CW721
Introduction
The CW721 ADO is a smart contract to allow users to launch their own custom NFT projects. In addition to the standard CW721 messages, we have added some custom logic to further extend the utility and function of the contract.
The CW721 ADO is one of the base ADOs meaning it can interact with a large number of other ADOs such as the marketplace, crowdfund, auction, CW721 timelock and many more.
The contract has implemented a custom TransferAgreement
message to allow the buying/selling of tokens between two parties throught the CW721 ADO itself.
Ado_type: cw721
Version: 2.0.3-beta.1
InstantiateMsg
name
String
The name of the NFT collection.
symbol
String
The symbol of the NFT collection.
minter
The address allowed to mint NFTs.
kernel_address
String
owner
Option<String>
Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified.
ExecuteMsg
Mint
Mints a new NFT.
Only available to the defined minter
in the InstantiateMsg.
token_id
String
Unique Id of the NFT.
owner
String
The address of the NFT owner.
token_uri
Option<String>
extension
TokenExtension
TokenExtension
Extension that can be added to an NFT when minting.
publisher
String
The entity to assign as the publisher of the NFT e.g. "Andromeda" or "Bob". (Immutable).
BatchMint
Mint several NFTs at once.
tokens
Vector of MintMsg. Similar to minting one token, but allows minting of many tokens in one go.
TransferAgreement
Assigns a TransferAgreement
for a token. If the agreement
field is not set, the message will remove any previously set agreements on the token (Instead of making a new RemoveAgreement message).
Only available to the token owner.
token_id
String
The token Id of the NFT we want to add an agreement for.
agreement
The agreement for the token containing the selling price and the address allowed to purchase the token. If not specified then any previously set agreement is removed from the token.
TransferAgreement
The purchaser
may use the TransferNft
message for this token as long as funds are provided equaling the amount
defined in the agreement.
If the purchaser
is set to "*"
then anyone can complete the TransferAgreement
(Anyone can buy the NFT).
amount
The amount required for the purchaser to transfer ownership of the token.
purchaser
String
The address of the purchaser that is allowed to purchase the token.
TransferNft
A CW721 compliant transfer method. Transfers ownership of a minted token.
Archived tokens cannot be transferred.
Only available to the contract owner, an approved operator, or a purchaser in a TransferAgreement
for the given token.
recipient
The address to receive the NFT.
token_id
String
The token Id of the token to be transferred.
SendNft
A CW721 compliant send method. Sends ownership of a minted token to an external contract.
Only available to the token owner/operator/approved address.
contract
The address of the receiving contract.
token_id
String
The Id of the token to be sent.
msg
Binary
A message to be sent to the receiving contract.
Burn
Destroys any token data related to an token Id. The Id of the token is still reserved.
Cannot be undone.
Only available to the token owner.
token_id
String
The Id of the token to burn.
Archive
Archives an token, making it immutable in any respect. Once an token is archived it cannot be edited, transferred or burnt.
Cannot be undone.
Only available to the token owner.
token_id
String
The Id of the token to archive.
Approve
A CW721 compliant approve method. Approves a given address as an operator for the token, allowing them to transfer, burn or archive the token.
Only available to the token owner/operator.
spender
String
The address to be authorised as an operator.
token_id
String
The id of the token for which to assign the spender
as an operator.
expires
An optional expiration for the approval. Defaults to never.
Revoke
A CW721 compliant revoke method. Revokes operator privileges for a given address.
Only available to the token owner/operator.
spender
String
The address of the operator for which to revoke privileges.
token_id
String
The Id of the token for which to revoke operator privileges.
ApproveAll
A CW721 compliant approve all method. Approves a given address as an operator for all tokens owned by the sender.
Will overwrite any approval currently assigned to the operator's address.
operator
String
The address to be authorised as an operator.
expires
An optional expiration for the approval. Defaults to never.
RevokeAll
A CW721 compliant revoke all method. Revokes an operator's privileges for any tokens owned by the sender.
operator
String
The address of the operator for which to revoke privileges.
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
Minter
Queries the current minter of the contract.
MinterResponse
OwnerOf
A CW721 compliant "owner of" query. Queries the current owner of a given token Id.
token_id
String
The Id of the token to query.
include_expired
bool
Whether to include any expired owners.
OwnerOfResponse
owner
String
The owner of the queried token.
approvals
An array of all approvals for the token.
Approval
spender
String
The address that is approved.
expires
The expiration for the approval.
Operator
Returns the approval of a given operator for all tokens of an owner. Errors if no approvals are set.
owner
String
The address of the NFTs owner.
operator
String
The address of the operator that has approvals over the specified owner
NFTs.
include_expired
Option<bool>
Whether to include any expired approvals.
OperatorResponse
Returns an Approval struct.
AllOperators
List all operators that can access all of the owner's tokens.
owner
String
The address of the owner for which to query operators.
include_expired
Option<bool>
Whether to include any expired approvals.
limit
Option<u32>
An optional limit on how many approvals are returned. The default limit is 10 and the maximum limit allowed is 100.
start_after
Option<String>
An optional address for which to start after, used for pagination.
OperatorsResponse
approvals
An array of all approvals for the given owner address.
NumTokens
A CW721 compliant "num tokens" query. Queries the amount of tokens minted by the contract.
NumTokensResponse
count
u64
The amount of tokens minted by the contract.
NftInfo
A CW721 compliant "nft info" query. Queries the stored info of a token.
token_id
String
The id of the token.
NftInfoResponse
token_uri
String
Universal resource identifier for this token.
extension
T (Generic type)
Any extension being used by the contract to add custom metadata to the tokens.
AllNftInfo
A CW721 compliant "all nft info" query. Queries all stored info of an token.
token_id
String
The token id of the NFT.
include_expired
Option<bool>
Whether to include any expired approvals.
AllNftInfoResponse
access
The address that can transfer the token.
info
Data on the token itself.
IsArchived
Checks if the token with the specified token_id
is archived.
token_id
String
The token_id
of the NFT we want to check.
Returns a bool value.
TransferAgreement
Checks if the token has a TransferAgreement .
token_id
String
The token_id of the nft we want to check.
Returns None if no TransferAgreement is found, and the TransferAgreement struct otherwise.
Tokens
Queries all the tokens of a particular owner.
owner
String
The address that we want to check the tokens of
start_after
Option<String>
An optional address for which to start after, used for pagination.
limit
Option<u32>
Optional limit to the number of tokens queried. It is set by default as 10 and can be set up to 30.
TokensResponse
Contains all token_ids in lexicographical ordering. If there are more than limit
, use start_from
in future queries to achieve pagination.
AllTokens
Queries the tokens minted by the contract.
start_after
Option<String>
An optional address for which to start after, used for pagination.
limit
Option<u32>
Optional limit to the number of tokens queried. It is set by default as 10 and can be set up to 30.
TokensResponse
Contains all token_ids in lexicographical ordering. If there are more than limit
, use start_from
in future queries to achieve pagination.
ContractInfo
Queries the name and symbol of the token collection.
ContractInfoResponse
name
String
The name of the contract.
symbol
String
The assigned symbol of the contract.
Approval
Queries the spender's approval to check for the expiration.
token_id
String
The token Id of the NFT to check.
spender
String
The address to check the approvals.
include_expired
Option<bool>
Optional flag to include the expired approvals. Defaults to false.
ApprovalResponse
approval
Approval
The approved spender and the expiration for the approval.
spender
String
Account that can transfer/send the token
expires
When the Approval expires. Might be Expiration::never.
Approvals
Returns all the approvals a token has.
token_id
String
The token Id of the NFT to get approvals for.
include_expired
Option<bool>
Optional flag to include the expired approvals. Defaults to false.
ApprovalsResponse
Return a vector of Approval.
Base Queries
The rest of the query messages can be found in the ADO Base section.