Skip to content

Add the AtomicMarket v2 royalty endpoints and the remaining v2 response fields - #12

Open
robrigo wants to merge 5 commits into
wharfkit:masterfrom
robrigo:feat/atomicmarket-v2-royalties
Open

Add the AtomicMarket v2 royalty endpoints and the remaining v2 response fields#12
robrigo wants to merge 5 commits into
wharfkit:masterfrom
robrigo:feat/atomicmarket-v2-royalties

Conversation

@robrigo

@robrigo robrigo commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Why

The v1.3.1 bindings cover the AtomicAssets v2 and AtomicMarket v2 contracts, but the API layer stops short of what the indexer now serves. This adds the six /atomicmarket/v1/royalties/* reads (config, template rules, attribute rules, the settled payout ledger, its count, and per-account totals) with their response structs, declares current_collection_fee on auctions, buyoffers, and template buyoffers as it already is on sales, declares the types descriptors the schema endpoints return, and adds the /atomicmarket/v1/stats/markets endpoint that was missing. Every v2-only field is optional, so a v1 indexer's response still decodes.

Two existing doc comments were wrong against the indexer and are corrected: current_collection_fee is the collection's live market_fee, with collection.market_fee being the listing-time snapshot, and format[].mediatype and format[].info are merged with a heuristic, so only types reports what setschematyp stored.

A collection with no royalty configuration answers HTTP 416, which propagates as APIError like every other non-2xx here; the doc comment and the README name it as the "not configured" case.

Tests

make check and make test pass at 252 tests (234 before), and each commit passes on its own. The royalty endpoints only return data on an AtomicMarket v2 chain, so their eight fixtures were recorded against the WAX testnet indexer through a second client in test/royalties-api.ts (V2_BASE_URL in test/config.ts); fixture names hash the full URL, so they cannot collide with the existing ones, and CI still replays offline. Struct decoding of the new shapes, including the nullable payout ids and a v1 response with the fields absent, is covered without fixtures in test/v2-api.ts.

The new methods interpolate NameType segments into the path the way the existing endpoints do. If you would rather percent-encode path segments, that is best done across all endpoint files in one change; happy to follow up.

@robrigo

robrigo commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

CI is red at the install step on all three Node versions: yarn install --frozen-lockfile refuses smob@1.6.1 (engines node >=20) under the 14/16/18 matrix. master has failed the same way since the yarn.lock update in March, including the #11 merge and the v1.3.1 push, so it is not this diff. Locally make check and make test pass on every commit of this branch (252 tests). Happy to add a commit that moves the matrix to 18/20/22, or to leave that to you.

@robrigo

robrigo commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Follow-ups now open: #13 moves the CI matrix to Node 20/22/24 (its own run shows the suite green there), and #14, stacked on this branch, percent-encodes every caller-supplied path segment and refuses dot segments across all 52 endpoint sites.

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.

1 participant