Add AtomicAssets v2 and AtomicMarket v2 support - #11
Merged
Conversation
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.
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 |
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
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:
atomicassetsgoes from 35 actions and 8 tables to 47 and 11,atomicmarketfrom 39 and 9 to 51 and 12,atomictoolsxis 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.tsandsrc/contracts/atomicmarket.tsare regenerated, not hand-edited. They come fromwharfkit generateon@wharfkit/cli2.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 foratomicassetsv2.0.0-rc5 andatomicmarketv2.0.0-rc2, which I verified match what is deployed on both testnets.atomicassetsgains mutable templates, template deletion and supply reduction, schema media types, collection author succession, RAM payer control, and three tables (templates2,schematypes,authorswaps).atomicmarketgains the royalty configuration surface, its settlement logs, and three tables (royaltyconf,royaltytemp,royaltyattr).src/endpoints/types.tscatches the REST types up with what the indexer returns. Templates gainedmutable_data,data,deleted_at_blockanddeleted_at_time; collections gainednew_author_nameandnew_author_date; sales gainedcurrent_collection_fee. All are optional, so v1 responses decode exactly as before.Schema formats needed more than a field.
SchemaObject.formatreused the contract'sFORMATstruct, which is{name, type}, but the v2 API also reports themediatypeandinforecorded bysetschematyp. Widening the contract struct would let those fields leak intocreateschemaaction data, so this adds a separateSchemaFormatFieldfor 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_marketplacecan be nullWhile testing against live data I hit a decode failure unrelated to v2:
maker_marketplaceis declared non-optional onSaleObject,AuctionObject,BuyofferObjectandTemplateBuyofferObject, 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:
collections,config,tokenconfigs,schemasandtemplatesrows, andatomicmarketconfigandmarketplacesrows, decode to output identical to@wharfkit/atomicassets@1.2.4.atomicassetsactions and all 6 newatomicmarketroyalty actions encode byte-identically through the new binding and through the deployed ABI directly.templates2,schematypesandauthorswapsread live on WAX Testnet and decode through the binding.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() == 1onannouncesale,announceauctandcreatebuyo. Multi-asset bundles are retired, so code that builds bundled listings still type-checks but fails on chain.settempldataandsetschematypare whole-array replaces. Omitting a field erases it.Reading
templates2,schematypesorauthorswapsagainst 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.