Skip to content

feat: read the settled royalty ledger so consumers stop paging payouts by hand - #23

Merged
robrigo merged 1 commit into
mainfrom
feat/royalty-payout-reads
Aug 17, 2026
Merged

feat: read the settled royalty ledger so consumers stop paging payouts by hand#23
robrigo merged 1 commit into
mainfrom
feat/royalty-payout-reads

Conversation

@robrigo

@robrigo robrigo commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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, and getRoyaltyAccount with typed rows, filters, and enums, and widens IRoyaltyConfig, IRoyaltyTemplateRule, and IRoyaltyAttributeRule with 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_type and category are nullable because the indexer's formatter emits null for a stored value outside the served vocabulary.

Validation

yarn check-types, yarn lint, and yarn test pass 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.

…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
robrigo force-pushed the feat/royalty-payout-reads branch from 29f9605 to 12f6cbc Compare August 17, 2026 21:50
@robrigo
robrigo requested a lite review from Copilot August 17, 2026 21:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and getRoyaltyAccount to AtomicMarketApi, 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
robrigo marked this pull request as ready for review August 17, 2026 21:55
@robrigo
robrigo merged commit 62c6663 into main Aug 17, 2026
7 checks passed
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.

2 participants