NFT functions

Change methods

NFT transfer

1
pub fn nft_transfer(
2
&mut self,
3
receiver_id: ValidAccountId,
4
token_id: TokenId,
5
approval_id: Option<u64>,
6
memo: Option<String>,
7
)
Copied!
1
$ near call --accountId gnaor.testnet paras-token-v2.testnet nft_transfer '{"token_id":"3:2","receiver_id":"projectp.testnet"}' --depositYocto 1
2
Scheduling a call: paras-token-v2.testnet.nft_transfer({"token_id":"3:2","receiver_id":"projectp.testnet"}) with attached 0.000000000000000000000001 NEAR
3
Doing account.functionCall()
4
Receipt: C4VX4zUEZQhwFMzgAiuFU4iEhgzB8adbqVe3Sc3yA4F1
5
Log [paras-token-v2.testnet]: Transfer 3:2 from gnaor.testnet to projectp.testnet
6
Log [paras-token-v2.testnet]: {"type":"nft_transfer","params":{"token_id":"3:2","sender_id":"gnaor.testnet","receiver_id":"projectp.testnet"}}
7
Transaction Id 4Pe7ymVjFKXAft9fLScvCWxXtz2AptwTejXSJR31H6fU
8
To see the transaction in the transaction explorer, please open this url in your browser
9
https://explorer.testnet.near.org/transactions/4Pe7ymVjFKXAft9fLScvCWxXtz2AptwTejXSJR31H6fU
10
''
Copied!

NFT burn

1
pub fn nft_burn(
2
&mut self,
3
token_id: TokenId
4
)
Copied!
1
$ near call --accountId projectp.testnet paras-token-v2.testnet nft_burn '{"token_id":"3:2"}' --depositYocto 1
2
Scheduling a call: paras-token-v2.testnet.nft_burn({"token_id":"3:2"}) with attached 0.000000000000000000000001 NEAR
3
Doing account.functionCall()
4
Receipt: 3im6sEQ2fjUgid46w86HFEmUsFmAeX8HJn5j6B18K3mc
5
Log [paras-token-v2.testnet]: {"type":"nft_transfer","params":{"token_id":"3:2","sender_id":"projectp.testnet","receiver_id":""}}
6
Transaction Id 7ZXfiiYoSmhstdUh29rrTU2WLso1SLq3UUVPcEPwzktf
7
To see the transaction in the transaction explorer, please open this url in your browser
8
https://explorer.testnet.near.org/transactions/7ZXfiiYoSmhstdUh29rrTU2WLso1SLq3UUVPcEPwzktf
9
''
Copied!

View methods

NFT information

1
pub fn nft_token(
2
&self,
3
token_id: TokenId
4
) -> Option<Token>
Copied!
1
$ near view paras-token-v2.testnet nft_token '{"token_id":"3:1"}'
2
View call: paras-token-v2.testnet.nft_token({"token_id":"3:1"})
3
{
4
token_id: '3:1',
5
owner_id: 'projectp.testnet',
6
metadata: {
7
title: 'Dark #1',
8
description: null,
9
media: 'bafybeifdbvb6yzajogbe4dbn3bgxoli3sp7ol7upfmu2givpvbwufydthu',
10
media_hash: null,
11
copies: 90,
12
issued_at: '1637976923487702140',
13
expires_at: null,
14
starts_at: null,
15
updated_at: null,
16
extra: null,
17
reference: 'bafybeifvzitvju4ftwnkf7w7yakz7i5colcey223uk2ui4t5z3ss7l2od4',
18
reference_hash: null
19
},
20
approved_account_ids: {}
21
}
Copied!