Skip to main content

Use NFT contract

First action that must be executed is create function in order for NFT to exist Second, creator must issue tokens and after new currency token is ready to be used in transfer

Create currency

 cline push action demonft create '["demonft","TST"]' -p demonft

output :

executed transaction: 0e9a93b62a0565d6c368a111e8957e528bfcb6982332e7074d8077320ce5f9b4  104 bytes  413 us
\# demonft <= demonft::create {"issuer":"demonft","symbol":"TST"}

This will create new NFT with TST as symbol

Issue token

 cline push action demonft issue '["receivernft","1 TST",[yourUriGoesHere],"demonft","this is demonfts transaction"]' -p demonft

output :

executed transaction: e77fbcc9af7583c228ab71a4a341ed27ce76521aaf0c4cf8bfe1967f58b16cd4  176 bytes  425 us
\# demonft <= demonft::issue {"to":"receivernft","quantity":"1 TST","uris":["yourUriGoesHere"],"name":"demonft","memo":"this is d...

Here, we issued a TST NFT with uri "yourUriGoesHere" and name "demonft" to receivernft account, it is in circulation and could be transfered between acounts.

Transfer

 cline push action demonft transfer '["demonft","receivernft","1 TST","this is memo for transfer transaction"]' -p demonft@active

output:

executed transaction: 4e074e0734b4d6d71b2fc9118918e4b8f1bd73f20a90dbd5c09a7f7fa58671ae  160 bytes  364 us
\# demonft <= demonft::transfer {"from":"demonft","to":"receivernft","quantity":"1 TST","memo":"this is memo for transfer transaction"}
\# receivernft <= demonft::transfer {"from":"demonft","to":"receivernft","quantity":"1 TST","memo":"this is memo for transfer transaction"}

TransferID

 cline push action demonft transferid '["receivernft","demonft","0","this is memo for transferid transaction"]' -p receivernft

output:

executed transaction: 4e074e0110b4d6d71b2fc9118918e4b8f1bd73f20a90dbd5c09a7f7fa58671ae  160 bytes  364 us
\# demonft <= demonft::transferid {"from":"receivernft","to":"demonft","id":0,"memo":"this is memo for transferid transaction"}
\# receivernft <= demonft::transferid {"from":"receivernft","to":"demonft","id":0,"memo":"this is memo for transferid transaction"}

Burn

Burn the NFT

 cline push action demonft burn '["demonft","0"]' -p demonft

output :

executed transaction: 447c9e323a04ff1a63e777d959e0feeb19bf993ea7cfaa9cdf1482cb9e8218ad  112 bytes  330 us
\# demonft <= demonft::burn {"owner":"demonft","token_id":0}

To display all issued token info

 cline get table demonft demonft token

output :

{
"rows": [{
"id": 0,
"uri": "yourUriGoesHere",
"owner": "receivernft",
"value": "1 TST",
"tokenName": "demonft"
},{
"id": 1,
"uri": "yourUriGoesHere",
"owner": "demonft",
"value": "1 TST",
"tokenName": "demonft"
}
],
"more": false,
"next_key": ""
}

To dislay token balance of receivernft

 cline get table demonft receivernft accounts

output :

{
"rows": [{
"balance": "1 TST"
}
],
"more": false,
"next_key": ""
}

or use

 cline get currency balance demonft receivernft

To display current supply of tokens with symbol "TST"

 cline get table demonft TST stat

output :

{
"rows": [{
"supply": "2 TST",
"issuer": "demonft"
}
],
"more": false,
"next_key": ""
}