Skip to content

"feat(#428): enrich /txs response with resolved addresses - #436

Draft
HarunJr wants to merge 1 commit into
stagingfrom
428-resolve-input-addresses-in-txs
Draft

"feat(#428): enrich /txs response with resolved addresses#436
HarunJr wants to merge 1 commit into
stagingfrom
428-resolve-input-addresses-in-txs

Conversation

@HarunJr

@HarunJr HarunJr commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #428

The /txs endpoint previously returned raw CBORs as a flat string array. Wallet SDKs like Lace's MidgardChainHistoryProvider require input addresses (HydratedTxIn.address) to classify transactions as Sent or Received — without them, all transactions appear as Received regardless of direction.

Breaking Change

Response shape updated from:

{ "txs": ["<cbor_hex>"] }

to:

{
  "txs": [
    {
      "cbor": "<cbor_hex>",
      "resolvedInputs": [{ "txHash": "...", "index": 0, "address": "addr_test1..." }]
    }
  ]
}

Changes

  • address_history gains direction and outref columns to distinguish senders (input) from receivers (output) per UTxO
  • Input addresses are resolved at insert time by looking up spent outrefs in mempool_ledger before they are cleared no extra lookups needed at query time
  • ProcessedMempoolDB included in retrieve() so in-flight transactions remain visible during the block confirmation window
  • CML WASM objects explicitly freed after use to prevent heap leaks under sustained load
  • Effect.all concurrency capped at 20 to prevent DB connection pile-ups on large tx histories
  • Existing DBs handled via migrate() called in InitDB on startup no manual intervention needed
  • CORS middleware added to the HTTP server so browser-based wallet clients (e.g. Lace) can call the node endpoints cross-origin

Test plan

  • All 18 database tests pass (docker compose --profile test run --rm midgard-node-tests)
  • /txs?address=... returns resolvedInputs with sender address populated for L2 transfers
  • Self-transfers correctly show the wallet's own address in resolvedInputs
  • Deposits return resolvedInputs: [] (no L2 inputs)

@HarunJr HarunJr linked an issue Apr 6, 2026 that may be closed by this pull request
@HarunJr HarunJr changed the title git commit -m "feat(#428): enrich /txs response with resolved input a… "feat(#428): enrich /txs response with resolved addresses Apr 6, 2026
The /txs endpoint previously returned raw CBORs as a flat string array.
Wallet SDKs (e.g. Lace) require input addresses to classify transactions
as Sent or Received — without them, all txs appear as Received.

Breaking change: response shape updated from
  { txs: string[] }
to
  { txs: [{ cbor: string, resolvedInputs: [{ txHash, index, address }] }] }

- address_history gains direction + outref columns to track sender vs receiver
- Input addresses resolved at insert time from mempool_ledger before spent UTxOs are cleared — no extra lookups at query time
- ProcessedMempoolDB included in retrieve() so in-flight txs remain visible during block confirmation window
- CORS middleware added so browser-based wallet clients can call node endpoints cross-origin
- CML WASM objects explicitly freed after use to prevent heap leaks under load
- Effect.all concurrency capped at 20 to prevent DB connection pile-ups on large tx histories
- Existing DBs handled via migrate() called in InitDB on startup
@HarunJr
HarunJr force-pushed the 428-resolve-input-addresses-in-txs branch from 73e1464 to 52492d1 Compare April 7, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve input addresses in /txs to support wallet integration

1 participant