diff --git a/web/backend/src/m2_market_web/ledger.py b/web/backend/src/m2_market_web/ledger.py index d0ca314..3c54908 100644 --- a/web/backend/src/m2_market_web/ledger.py +++ b/web/backend/src/m2_market_web/ledger.py @@ -21,8 +21,8 @@ def _headers() -> dict[str, str]: def _tx_dto(tx: dict[str, Any]) -> dict[str, Any]: return { "ts": tx.get("ts"), - "from": tx.get("from"), - "to": tx.get("to"), + "from": tx.get("from_id", tx.get("from")), + "to": tx.get("to_id", tx.get("to")), "amount": tx.get("amount"), "reason": tx.get("reason"), "ref": tx.get("ref"), @@ -91,7 +91,7 @@ async def economy() -> dict[str, Any] | JSONResponse: { party for tx in transactions - for party in (tx.get("from"), tx.get("to")) + for party in (tx.get("from_id", tx.get("from")), tx.get("to_id", tx.get("to"))) if party and party != "mint" } ) diff --git a/web/backend/tests/test_backend.py b/web/backend/tests/test_backend.py index 89de7c4..c057753 100644 --- a/web/backend/tests/test_backend.py +++ b/web/backend/tests/test_backend.py @@ -101,7 +101,7 @@ def _ok_transport(request: httpx.Request) -> httpx.Response: "transactions": [ { "ts": "2026-07-02T09:00:00Z", - "from": "mint", + "from_id": "mint", "to": "m2bd", "amount": 50, "reason": "grant", @@ -116,8 +116,8 @@ def _ok_transport(request: httpx.Request) -> httpx.Response: 200, json={ "transactions": [ - {"from": "mint", "to": "m2bd", "amount": 50}, - {"from": "m2bd", "to": "platform", "amount": 8}, + {"from_id": "mint", "to_id": "m2bd", "amount": 50}, + {"from_id": "m2bd", "to_id": "platform", "amount": 8}, ] }, ) @@ -187,7 +187,7 @@ def test_catalog_wallet_economy_governance_happy_paths( assert wallet.json()["balance"] == 42 assert wallet.json()["transactions"][0] == { "ts": "2026-07-02T09:00:00Z", - "from": "mint", + "from_id": "mint", "to": "m2bd", "amount": 50, "reason": "grant",