feat: read the settled royalty ledger so consumers stop paging payouts by hand - #23
Merged
Conversation
…s by hand The Explorer client could read a collection's royalty configuration but not what the contract had actually paid, so a marketplace or a payout dashboard had to page the raw payout logs itself. The indexer already serves the settled ledger, its count, and per-account totals, one row per token symbol. This adds the three reads with typed rows, filters, and enums, and widens the three existing royalty interfaces with the row fields the indexer returns. The widening breaks only code that builds such a row by hand, which the release entry records.
robrigo
force-pushed
the
feat/royalty-payout-reads
branch
from
August 17, 2026 21:50
29f9605 to
12f6cbc
Compare
There was a problem hiding this comment.
Pull request overview
Adds a typed read surface for the AtomicMarket v2 settled royalty payout ledger so SDK consumers can query payouts, counts, and per-account token totals without paging raw on-chain logs.
Changes:
- Adds
getRoyaltyPayouts,countRoyaltyPayouts, andgetRoyaltyAccounttoAtomicMarketApi, with new filter param types for ledger paging and account aggregation. - Introduces royalty-ledger enums (
RoyaltyListingType,RoyaltyPayoutCategory,RoyaltyPayoutSort) and new row types (IRoyaltyPayout,IRoyaltyAccountTotal); widens existing royalty config/rule row interfaces to match indexer-returned fields. - Adds/updates tests and README documentation to pin enum vocabularies, URL/query construction, and row shapes (including nullable enum fields).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/types.test.ts | Adds type-level assertions for new royalty row types and pins served enum vocabularies. |
| test/royalties-api.test.ts | Adds endpoint/query-string tests for the three new royalty-ledger read methods and count parsing. |
| src/API/Explorer/Params.ts | Introduces RoyaltyPayoutApiParams and RoyaltyAccountApiParams filter types. |
| src/API/Explorer/Objects.ts | Adds IRoyaltyPayout / IRoyaltyAccountTotal and widens royalty config/rule interfaces to indexer shapes. |
| src/API/Explorer/index.ts | Implements getRoyaltyPayouts, countRoyaltyPayouts, and getRoyaltyAccount on AtomicMarketApi. |
| src/API/Explorer/Enums.ts | Adds royalty-ledger vocabulary enums for listing type, payout category, and sort. |
| README.md | Documents the settled royalty ledger read APIs, semantics (nullable fields), and 2.4.0 release notes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
robrigo
marked this pull request as ready for review
August 17, 2026 21:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Explorer client reads a collection's royalty configuration but not what the contract has actually paid, so a marketplace or a payout dashboard has to page the raw payout logs itself. The indexer serves the settled ledger, its count, and per-account totals, one row per token symbol. This adds
getRoyaltyPayouts,countRoyaltyPayouts, andgetRoyaltyAccountwith typed rows, filters, and enums, and widensIRoyaltyConfig,IRoyaltyTemplateRule, andIRoyaltyAttributeRulewith the row fields the indexer returns.Reading a response is unaffected by the widening. Code that builds one of those rows by hand, such as a test mock, must supply the added fields; the release entry records that under a breaking-changes heading, as the 2.0.1 entry did for
BuyofferState.IRoyaltyPayout.listing_typeandcategoryare nullable because the indexer's formatter emits null for a stored value outside the served vocabulary.Validation
yarn check-types,yarn lint, andyarn testpass at 141 tests (135 before). The six new tests pin the three URLs and their query strings against the fetch stub, the parse of the count string, the percent-encoding of a hostile account name, the enum members, and the row types against indexer-shaped rows with the nullable ids in both states.