Skip to content

feat(minibf): add /accounts/{stake_address}/addresses/assets endpoint#1126

Draft
slowbackspace wants to merge 1 commit into
mainfrom
feat/minibf-account-addresses-assets
Draft

feat(minibf): add /accounts/{stake_address}/addresses/assets endpoint#1126
slowbackspace wants to merge 1 commit into
mainfrom
feat/minibf-account-addresses-assets

Conversation

@slowbackspace

@slowbackspace slowbackspace commented Jul 24, 2026

Copy link
Copy Markdown

Summary

Closes #1067 by adding the Blockfrost-compatible GET /accounts/{stake_address}/addresses/assets endpoint.

  • Aggregates native assets across the account’s current UTxOs, excluding lovelace
  • Supports count, page, and order
  • Returns 404 for unknown accounts and existing MiniBF errors for invalid requests and storage failures
  • Shares one query facade across block-metadata lookups to respect the blocking-task limit
  • Updates MiniBF documentation

Ordering semantics

Because the directions use different keys, desc is not necessarily the reverse of asc.

  • asc: each asset’s oldest current UTxO
  • desc: each asset’s newest current UTxO
  • ties: asset unit ascending

This reproduces the reference implementation (blockfrost-backend-ryo, accounts_stake_address_addresses_assets.sql: MIN(txo.id) ASC / MAX(txo.id) DESC, tie-break (policy, name) ASC), with the tuple (slot, tx_index, output_index) standing in for db-sync's monotone txo.id. The route test accounts_by_stake_addresses_assets_uses_directional_ordering pins the exact asc and desc sequences, including the non-reversal and the tie-break cases.

Testing

  • Route-level coverage: aggregation across UTxOs, direction-dependent ordering with position ties and unit tie-breaking (custom fixture state injected via the new TestApp::new_with_cfg_and_setup), pagination including past-the-end pages, invalid stake addresses, unknown accounts, storage failures
  • Verified against live Blockfrost preview: the full 116-unit asset list of the blockfrost-tests fixture account is byte-identical in both asc and desc, as are pagination windows and the 400/404 error responses.

Known deviations

  • Collateral-return UTxOs of failed txs are included. The reference blockfrost-backend-ryo query predates collateral-return outputs so Blockfrost misses assets held via unspent collateral returns. Dolos aggregates from the ledger-true UTxO set, so these appear naturally. Practically unobservable outside that rare case; same ledger-truth stance as fix(minibf): return affected addresses from /blocks/{hash_or_number}/addresses #1124
  • Invalid stake addresses return a bare 400 (no JSON error body) — pre-existing behavior shared by all account endpoints, deliberately left untouched here

Aggregates native assets over the account's unspent UTxOs from the
utxos_by_stake index, ordered by the chain position of the oldest (asc)
or newest (desc) UTxO holding each asset with unit tie-breaks, matching
the Blockfrost reference implementation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cde83262-c5ed-430c-ab6f-0ac437a95699

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/minibf-account-addresses-assets

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

minibf: add /accounts/<account>/addresses/assets

1 participant