diff --git a/external-wasms/cw721_metadata_onchain_v0.16.0.wasm b/external-wasms/cw721_metadata_onchain_v0.16.0.wasm new file mode 100644 index 0000000..5e87da2 Binary files /dev/null and b/external-wasms/cw721_metadata_onchain_v0.16.0.wasm differ diff --git a/ts-relayer-tests/src/cw721-utils.ts b/ts-relayer-tests/src/cw721-utils.ts index 5e329af..04e1d5a 100644 --- a/ts-relayer-tests/src/cw721-utils.ts +++ b/ts-relayer-tests/src/cw721-utils.ts @@ -10,7 +10,15 @@ export function mint( token_uri: string | undefined ) { const msg = { - mint: { token_id, owner, token_uri }, + mint: { + token_id, + owner, + token_uri, + extension: { + description: "This is a test NFT", + image: "https://ark.pass/image.png", + }, + }, }; return client.sign.execute( client.senderAddress, @@ -82,11 +90,29 @@ export function allTokens( return client.sign.queryContractSmart(cw721Contract, msg); } +/// valid for v16 - v19 export function nftInfo( client: CosmWasmSigner, cw721Contract: string, token_id: string -) { +): Promise<{ + token_uri: string | null; + extension: { + image: string | null; + image_data: string | null; + external_url: string | null; + description: string | null; + name: string | null; + attributes: null | Array<{ + trait_type: string; + value: string; + display_type: string | null; + }>; + background_color: string | null; + animation_url: string | null; + youtube_url: string | null; + }; +}> { const msg = { nft_info: { token_id, diff --git a/ts-relayer-tests/src/ics721.spec.ts b/ts-relayer-tests/src/ics721.spec.ts index 50ebc50..240aaf6 100644 --- a/ts-relayer-tests/src/ics721.spec.ts +++ b/ts-relayer-tests/src/ics721.spec.ts @@ -13,6 +13,7 @@ import { getCw721Minter_v16, getCw721MinterOwnership, mint, + nftInfo, ownerOf, sendNft, } from "./cw721-utils"; @@ -67,7 +68,7 @@ interface TestContext { const test = anyTest as TestFn; const WASM_FILE_CW721 = "./internal/cw721_metadata_onchain_v0.19.0.wasm"; -const WASM_FILE_CW721_v16 = "./internal/cw721_base_v0.16.0.wasm"; +const WASM_FILE_CW721_v16 = "./internal/cw721_metadata_onchain_v0.16.0.wasm"; const WASM_FILE_CW721_INCOMING_PROXY = "./internal/cw721_incoming_proxy.wasm"; const WASM_FILE_CW721_OUTGOING_PROXY = "./internal/cw721_outgoing_proxy_rate_limit.wasm"; @@ -375,7 +376,7 @@ const standardSetup = async (t: ExecutionContext) => { t.pass(); }; -test.skip("transfer NFT: wasmd -> osmo", async (t) => { +test.serial("transfer NFT: wasmd -> osmo", async (t) => { await standardSetup(t); const { @@ -470,6 +471,14 @@ test.skip("transfer NFT: wasmd -> osmo", async (t) => { const minterOwnerShip = await getCw721MinterOwnership(osmoClient, osmoCw721); t.is(osmoIcs721, minterOwnerShip.owner); + const wasmNftInfo = await nftInfo(wasmClient, wasmCw721, tokenId); + // assert extension is not null + t.truthy(wasmNftInfo.extension); + const osmoNftInfo = await nftInfo(osmoClient, osmoCw721, tokenId); + t.truthy(osmoNftInfo.extension); + // assert nft with extension is same + t.deepEqual(wasmNftInfo, osmoNftInfo); + // test back transfer NFT to wasm chain t.log(`transfering back to wasm chain via ${channel.channel.dest.channelId}`); transferResponse = await sendNft( @@ -925,9 +934,16 @@ test.serial("transfer NFT v16: wasm -> osmo", async (t) => { ); // assert minter is set to ics721 const minterOwnerShip = await getCw721Minter_v16(osmoClient, osmoCw721); - console.log(">>>>>", minterOwnerShip); t.is(osmoIcs721, minterOwnerShip.minter); + const wasmNftInfo = await nftInfo(wasmClient, wasmCw721_v16, tokenId); + // assert extension is not null + t.truthy(wasmNftInfo.extension); + const osmoNftInfo = await nftInfo(osmoClient, osmoCw721, tokenId); + t.truthy(osmoNftInfo.extension); + // assert nft with extension is same + t.deepEqual(wasmNftInfo, osmoNftInfo); + // test back transfer NFT to wasm chain t.log(`transfering back to wasm chain via ${channel.channel.dest.channelId}`); transferResponse = await sendNft( @@ -1296,7 +1312,7 @@ test.serial("transfer NFT v16: wasm -> osmo", async (t) => { t.is(wasmAddr, tokenOwner.owner); }); -test.skip("admin unescrow and burn NFT: wasmd -> osmo", async (t) => { +test.serial("admin unescrow and burn NFT: wasmd -> osmo", async (t) => { await standardSetup(t); const { @@ -1481,7 +1497,7 @@ test.skip("admin unescrow and burn NFT: wasmd -> osmo", async (t) => { ); }); -test.skip("malicious NFT", async (t) => { +test.serial("malicious NFT", async (t) => { await standardSetup(t); const { wasmClient,