Random Number Generator (RNG)
Other Documentation
NFT
Non Fungible Tokens

Operations

Create NFT Meta

1
p.nft_metadata_create(
2
owner_account_id_or_name, # owner of nft meta
3
name, # nft meta name
4
symbol, # nft symbol
5
base_uri, # nft uri
6
is_transferable=True,
7
is_sellable=True,
8
)
Copied!
For example
1
p.nft_metadata_create("1.2.7", self.nameMetadata, self.nameMetadata, self.nameMetadata, revenue_partner="1.2.8", revenue_split=300, is_sellable=False, is_transferable=False)
Copied!

Update NFT Meta

1
p.nft_metadata_update(
2
owner_account_id_or_name,
3
nft_metadata_id,
4
name,
5
symbol,
6
base_uri,
7
is_transferable=True,
8
is_sellable=True,
9
)
Copied!
For example
1
p.nft_metadata_update("1.2.7", "1.30.11", self.nameMetadata + "m", self.nameMetadata + "m", self.nameMetadata + "m", "1.2.9", 400, True, True)
Copied!

Mint NFT

1
p.nft_mint(
2
metadata_owner_account_id_or_name,
3
metadata_id,
4
owner_account_id_or_name,
5
approved_account_id_or_name,
6
approved_operators, # list of operators
7
token_uri,
8
)
Copied!
For example
1
p.nft_mint("1.2.7", "1.30.11", "1.2.7", "1.2.7", "1.2.7", self.nameNft)
Copied!

Transfer NFT

1
p.nft_safe_transfer_from(
2
operator_, # operator account name or id
3
from_,
4
to_,
5
token_id,
6
data, # notes as string
7
)
Copied!
For example
1
p.nft_safe_transfer_from("1.2.7", "1.2.7", "1.2.9", "1.31.5", "whatever")
Copied!

Approve Control over NFT

1
def nft_approve(
2
operator_,
3
approved, # approved account id or name
4
token_id,
5
)
Copied!
For example
1
p.nft_approve("1.2.9", "1.2.8", "1.31.5")
Copied!

Approve for all the tokens owned

1
def nft_set_approval_for_all(
2
owner,
3
operator_,
4
approved,
5
)
Copied!
For example
1
p.nft_set_approval_for_all("1.2.7", "1.2.10", True)
Copied!

Info calls

p.rpc.nft_get_balance(owner)
p.rpc.nft_owner_of(token_id)
p.rpc.nft_get_approved(token_id)
p.rpc.nft_is_approved_for_all(owner, operator)
p.rpc.nft_get_name(nft_metadata_id)
p.rpc.nft_get_symbol(nft_metadata_id)
p.rpc.nft_get_token_uri(token_id)
p.rpc.nft_get_total_supply(nft_metadata_id)
p.rpc.nft_token_by_index(nft_metadata_id, token_idx)
p.rpc.nft_token_of_owner_by_index(nft_metadata_id, owner, token_idx)
p.rpc.nft_get_all_tokens()
p.rpc.nft_get_tokens_by_owner(owner)

Additional Info

For examples, refer to tests/test_nft.py
Export as PDF
Copy link
Contents
Operations