Skip to content

Add AtomicAssets v2 and AtomicMarket v2 support - #11

Merged
aaroncox merged 3 commits into
wharfkit:masterfrom
robrigo:feat/atomicassets-v2
Aug 1, 2026
Merged

Add AtomicAssets v2 and AtomicMarket v2 support#11
aaroncox merged 3 commits into
wharfkit:masterfrom
robrigo:feat/atomicassets-v2

Conversation

@robrigo

@robrigo robrigo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Why

AtomicAssets v2 and AtomicMarket v2 are deployed on WAX Testnet and Jungle4. This package still binds the v1 surface, so anything built on Wharf can neither construct a v2 action nor read a v2 table.

Regeneration also picks up four template-buyoffer actions (createtbuyo, canceltbuyo, fulfilltbuyo, lognewtbuyo) that are already live on WAX Mainnet and absent from the current binding, so this closes a mainnet gap independently of v2.

The v2 ABI adds to v1 and removes nothing on all three bound contracts: atomicassets goes from 35 actions and 8 tables to 47 and 11, atomicmarket from 39 and 9 to 51 and 12, atomictoolsx is untouched, and every struct shared between the versions is field-identical. One binding therefore works against both v1 and v2 chains, so there is no ABI-version switch and nothing to change at the type level. The on-chain behavior changes below are a separate matter.

What changed

src/contracts/atomicassets.ts and src/contracts/atomicmarket.ts are regenerated, not hand-edited. They come from wharfkit generate on @wharfkit/cli 2.5.1, which is the version that reproduces the files on master byte for byte, so the diff is the ABI delta and nothing else. The input ABIs are the SHA-256-pinned release artifacts for atomicassets v2.0.0-rc5 and atomicmarket v2.0.0-rc2, which I verified match what is deployed on both testnets.

atomicassets gains mutable templates, template deletion and supply reduction, schema media types, collection author succession, RAM payer control, and three tables (templates2, schematypes, authorswaps). atomicmarket gains the royalty configuration surface, its settlement logs, and three tables (royaltyconf, royaltytemp, royaltyattr).

src/endpoints/types.ts catches the REST types up with what the indexer returns. Templates gained mutable_data, data, deleted_at_block and deleted_at_time; collections gained new_author_name and new_author_date; sales gained current_collection_fee. All are optional, so v1 responses decode exactly as before.

Schema formats needed more than a field. SchemaObject.format reused the contract's FORMAT struct, which is {name, type}, but the v2 API also reports the mediatype and info recorded by setschematyp. Widening the contract struct would let those fields leak into createschema action data, so this adds a separate SchemaFormatField for the API shape and leaves the contract struct narrow. A test asserts that a format field carrying a mediatype still serializes to the two-field contract shape.

maker_marketplace can be null

While testing against live data I hit a decode failure unrelated to v2: maker_marketplace is declared non-optional on SaleObject, AuctionObject, BuyofferObject and TemplateBuyofferObject, but the API returns null for any listing created without a referring marketplace. On WAX Mainnet that is 44 of the first 100 sales and 100 of the first 100 auctions. It reproduces on 1.2.4, so it rides here as its own commit and can move to a separate PR if you prefer.

Validation

228 tests pass, up from 210 on master, with ESLint clean. Beyond the suite:

  • WAX Mainnet collections, config, tokenconfigs, schemas and templates rows, and atomicmarket config and marketplaces rows, decode to output identical to @wharfkit/atomicassets@1.2.4.
  • All 12 new atomicassets actions and all 6 new atomicmarket royalty actions encode byte-identically through the new binding and through the deployed ABI directly.
  • templates2, schematypes and authorswaps read live on WAX Testnet and decode through the binding.
  • Templates, collections, schemas and sales from both a v1 and a v2 indexer decode against the updated types, 100 rows per endpoint.

Behavior the ABI diff does not show

Three things here will surprise consumers and none of them appear in an ABI diff.

AtomicMarket v2 asserts asset_ids.size() == 1 on announcesale, announceauct and createbuyo. Multi-asset bundles are retired, so code that builds bundled listings still type-checks but fails on chain.

settempldata and setschematyp are whole-array replaces. Omitting a field erases it.

Reading templates2, schematypes or authorswaps against a v1 chain fails at the node with a contract table query exception, observed against WAX Mainnet. The table does not exist there, so the node rejects the query outright and consumers should expect an exception rather than an empty result. That is node behavior and not something the binding can smooth over.

robrigo added 3 commits July 28, 2026 14:27
AtomicAssets v2 and AtomicMarket v2 are deployed on WAX Testnet and Jungle4,
and this package still bound the v1 surface, so Wharf consumers could neither
construct a v2 action nor read a v2 table.

Both files are codegen output, regenerated with the CLI version that reproduces
their previous content byte for byte, from the SHA-256-pinned release ABIs. The
v2 ABI adds to v1 and removes nothing, so a single binding covers both chain
generations and existing consumers need no migration.

Regeneration also picks up four template-buyoffer actions that are already live
on WAX Mainnet and were absent from the binding.
Templates carry mutable data and deletion markers, collections carry a pending
author succession, and sales carry the collection fee resolved at listing time.
All are optional, so v1 responses decode unchanged.

Schema formats needed a type rather than a field. The API shape reused the
contract's FORMAT struct, which createschema serializes and which must stay at
name and type; the API additionally reports the media type and info recorded by
setschematyp. Splitting the two keeps a media type from ever reaching action
data.
maker_marketplace was declared non-optional on sales, auctions, buyoffers and
template buyoffers, but the API returns null whenever a listing was created
without a referrer. That is 44 of the first 100 sales and every one of the first
100 auctions on WAX Mainnet, all of which fail to decode.

The accessors keep returning a Name: null in the API is the default marketplace,
which is the empty name on chain, so no information is lost and the public
signature is unchanged.
@robrigo

robrigo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

The workflow run on this PR is waiting on maintainer approval, which is expected for a first contribution from a fork.

One thing worth knowing before you read the result: the most recent run on master (23774915096) also fails, at the Install dependencies step on all three Node versions, so a red run here may not be from this change. Its logs have aged out, and I could not reproduce it locally, where yarn install --frozen-lockfile and the full suite pass. Happy to look into it separately if useful, but I have left it out of this PR to keep the diff to the ABI work.

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