For Kylin we'll setup the collection and schema then mint an asset to the test contract. If you have a pre existing NFT, you can send it to the Kylin test account.
If you get errors such as Transaction exceeded the current network usage limit imposed on the transaction, see the Kylin account setup guides to get more tokens and to stake for more resources.
Mint test tokens
We will mint some test NFT tokens to our test account.
Be sure to update the account name, the new asset owner, the collection name and the actor signing the transaction.
export AUTHORIZED_MINTER=$KYLIN_TEST_ACCOUNTexport COLLECTION_NAME=$COLLECTION_NAMEexport SCHEMA_NAME=$SCHEMA_NAMEexport TEMPLATE_ID=-1export NEW_ASSET_OWNER=$KYLIN_TEST_ACCOUNTexport IMMUTABLE_DATA=[ { "key": "name", "value": [ "string", "The New Silk Road" ] }, { "key": "img", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1.png" ] }, { "key": "backimg", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1_back.jpg" ] }, { "key": "series", "value": [ "string", "Through the Looking Glass" ] }, { "key": "moment", "value": [ "string", "6 - The Silk Road" ] }, { "key": "rarity", "value": [ "string", "genesis" ] }, { "key": "description", "value": [ "string", "Named after an ancient Chinese trade route, the digital silk road is a virtual pathway for the delivery of merchandise." ] } ]
export MUTABLE_DATA=[]export TOKENS_TO_BACK=[]cleos-u $KYLIN_ENDPOINT pushtransaction'{ "delay_sec": 0, "max_cpu_usage_ms": 0, "actions": [ { "account": "bridgeassets", "name": "mintasset", "data": { "authorized_minter": "natdeveloper", "collection_name": "nftauthcoll2", "schema_name": "nftauthschem", "template_id": -1, "new_asset_owner": "natdeveloper", "immutable_data": [ { "key": "name", "value": [ "string", "The New Silk Road" ] }, { "key": "img", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1.png" ] }, { "key": "backimg", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1_back.jpg" ] }, { "key": "series", "value": [ "string", "Through the Looking Glass" ] }, { "key": "moment", "value": [ "string", "6 - The Silk Road" ] }, { "key": "rarity", "value": [ "string", "genesis" ] }, { "key": "description", "value": [ "string", "Named after an ancient Chinese trade route, the digital silk road is a virtual pathway for the delivery of merchandise." ] } ],
"mutable_data": [], "tokens_to_back": [] }, "authorization": [ { "actor": "natdeveloper", "permission": "active" } ] } ]}'
Register mapping
The collection author for an NFT must register that NFT with the bridge before users can transfer.
Be sure to update the address to the atomicnft contract address
cleos-u $KYLIN_ENDPOINT pushtransaction'{ "delay_sec": 0, "max_cpu_usage_ms": 0, "actions": [ { "account": "maticnftbrdg", "name": "regmapping", "data": { "template_id": -1, "schema_name": "nftauthschem", "collection_name": "nftauthcoll2", "address": "0xc68c97B2c24A79F096D4b6503D9a1C6Eef7ce292", "immutable_data": [ { "key": "name", "value": [ "string", "The New Silk Road" ] }, { "key": "img", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1.png" ] }, { "key": "backimg", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1_back.jpg" ] }, { "key": "series", "value": [ "string", "Through the Looking Glass" ] }, { "key": "moment", "value": [ "string", "6 - The Silk Road" ] }, { "key": "rarity", "value": [ "string", "genesis" ] }, { "key": "description", "value": [ "string", "Named after an ancient Chinese trade route, the digital silk road is a virtual pathway for the delivery of merchandise." ] } ],
}, "authorization": [ { "actor": "natdeveloper", "permission": "active" } ] } ]}'
Go to your NFT contract and scroll to #11. Set operator to atomictokenpeg contract account, and approved to 1.
Click on the contract tab, go to Write Contract, and connect using your user's account.
Then go to the atomictokenpeg contract and scroll to #4. Type in the tokenId from the transaction that was sent to your user account.
To determine the destination address we're going to use a helper function on our bridge contract.
cleos-u $EOS_ENDPOINT pushaction $KYLIN_BRIDGE_ACCOUNT getdest'["YOUR EOSIO USER ACCOUNT HERE"]'-p $KYLIN_BRIDGE_ACCOUNT@active
The assertion error will relay the uint64_t for the account specified, and you said EOSIO assertion messages weren't good for anything, pish posh, we move on!
Destination EOSIO Account Name Value: 11075078730411234672
The token contract is the atomicnft token contract.