ERC721
Functionality available for contracts that implement the ERC721
extension.
balance
Get the NFT balance of the connected wallet (number of NFTs in this contract owned by the connected wallet).
balance = contract.erc721.balance()
Configuration
Return Value
Returns an int
representing the number of NFTs owned by the connected wallet.
balance_of
Get a wallet&rsquos NFT balance (number of NFTs in this contract owned by the wallet).
wallet_address = "{{wallet_address}}"
balance = contract.erc721.balance_of(wallet_address)
Configuration
get
Get the metadata for an NFT in this contract using it&rsquos token ID.
Metadata is fetched from the uri
property of the NFT.
If the metadata is hosted on IPFS, the metadata is fetched and made available as an object.
The object&rsquos image
property will be a URL that is available through the thirdweb IPFS gateway.
token_id = 0
nft = contract.erc721.get(token_id)
Configuration
is_approved
Get whether this wallet has approved transfers from the given operator.
This means that the operator can transfer NFTs on behalf of this wallet.
is_approved = contract.erc721.is_approved(
# Address of the wallet to check
"{{wallet_address}}",
# Address of the operator to check
"{{wallet_address}}",
)
Configuration
owner
The wallet address that owns the NFT.
Must be a string
.
is_approved = contract.erc721.is_approved(
"{{wallet_address}}",
"{{wallet_address}}",
)
operator
The wallet address of the operator to check (i.e. the wallet that does/does not have approval).
Must be a string
.
is_approved = contract.erc721.is_approved(
"{{wallet_address}}",
"{{wallet_address}}",
)
owner_of
Get the wallet address of the owner of an NFT.
owner = contract.erc721.owner_of("{{token_id}}")
Configuration
set_approval_for_token
Give another address approval (or remove approval) to transfer a specific one of your NFTs from this collection.
Proceed with caution. Only approve addresses you trust.
# Approve the wallet address
contract.erc721.set_approval_for_token(
"{{wallet_address}}", # The wallet address to approve
"{{token_id}}", # The token ID of the NFT to allow them to transfer
)
Configuration
set_approval_for_all
Give another address approval (or remove approval) to transfer any of your NFTs from this collection.
Proceed with caution. Only approve addresses you trust.
contract.erc721.set_approval_for_all(
"{{wallet_address}}", # The wallet address to approve
true, # Whether to approve (true) or remove approval (false)
)
Configuration
transfer
Transfer an NFT from the connected wallet to another wallet.
wallet_address = "{{wallet_address}}"
token_id = 0
contract.erc721.transfer(wallet_address, token_id)