nft
The nft
module is responsible for creating NFT classifications, creating NFTs, transferring NFTs, updating NFTs, and supporting various queries. It is fully compatible with the ERC721 specification.
For more information, visit https://docs.cosmos.network/main/modules/nft/
Message Types
Msg
defines the nft Msg service.
_4 // Send defines a method to send a nft from one account to another account.
_4 rpc Send(MsgSend) returns (MsgSendResponse);
MsgSend
MsgSend
represents a message to send a nft from one account to another account.
_15 option (cosmos.msg.v1.signer) = "sender";
_15 // class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721
_15 // id defines the unique identification of nft
_15 // sender is the address of the owner of nft
_15 // receiver is the receiver address of nft
MsgSendResponse
MsgSendResponse
defines the Msg/Send
response type.
_1message MsgSendResponse {}
Queries
Query
defines the gRPC querier service.
_37 // Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721
_37 rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) {
_37 option (google.api.http).get = "/cosmos/nft/v1beta1/balance/{owner}/{class_id}";
_37 // Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721
_37 rpc Owner(QueryOwnerRequest) returns (QueryOwnerResponse) {
_37 option (google.api.http).get = "/cosmos/nft/v1beta1/owner/{class_id}/{id}";
_37 // Supply queries the number of NFTs from the given class, same as totalSupply of ERC721.
_37 rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) {
_37 option (google.api.http).get = "/cosmos/nft/v1beta1/supply/{class_id}";
_37 // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in
_37 rpc NFTs(QueryNFTsRequest) returns (QueryNFTsResponse) {
_37 option (google.api.http).get = "/cosmos/nft/v1beta1/nfts";
_37 // NFT queries an NFT based on its class and id.
_37 rpc NFT(QueryNFTRequest) returns (QueryNFTResponse) {
_37 option (google.api.http).get = "/cosmos/nft/v1beta1/nfts/{class_id}/{id}";
_37 // Class queries an NFT class based on its id
_37 rpc Class(QueryClassRequest) returns (QueryClassResponse) {
_37 option (google.api.http).get = "/cosmos/nft/v1beta1/classes/{class_id}";
_37 // Classes queries all NFT classes
_37 rpc Classes(QueryClassesRequest) returns (QueryClassesResponse) {
_37 option (google.api.http).get = "/cosmos/nft/v1beta1/classes";
QueryBalanceRequest
QueryBalanceRequest
is the request type for the Query/Balance
RPC method
_4message QueryBalanceRequest {
QueryBalanceResponse
QueryBalanceResponse
is the response type for the Query/Balance
RPC method
_3message QueryBalanceResponse {
QueryOwnerRequest
QueryOwnerRequest
is the request type for the Query/Owner
RPC method
_4message QueryOwnerRequest {
QueryOwnerResponse
QueryOwnerResponse
is the response type for the Query/Owner
RPC method
_3message QueryOwnerResponse {
QuerySupplyRequest
QuerySupplyRequest
is the request type for the Query/Supply
RPC method
_3message QuerySupplyRequest {
QuerySupplyResponse
QuerySupplyResponse
is the response type for the Query/Supply
RPC method
_3message QuerySupplyResponse {
QueryNFTstRequest
QueryNFTstRequest
is the request type for the Query/NFTs
RPC method
_5message QueryNFTsRequest {
_5 cosmos.base.query.v1beta1.PageRequest pagination = 3;
QueryNFTsResponse
QueryNFTsResponse
is the response type for the Query/NFTs
RPC methods
_4message QueryNFTsResponse {
_4 repeated cosmos.nft.v1beta1.NFT nfts = 1;
_4 cosmos.base.query.v1beta1.PageResponse pagination = 2;
QueryNFTRequest
QueryNFTRequest
is the request type for the Query/NFT
RPC method.
_4message QueryNFTRequest {
QueryNFTResponse
QueryNFTResponse
is the response type for the Query/NFT
RPC method.
_3message QueryNFTResponse {
_3 cosmos.nft.v1beta1.NFT nft = 1;
QueryClassRequest
QueryClassRequest
is the request type for the Query/Class
RPC method.
_3message QueryClassRequest {
QueryClassResponse
QueryClassResponse
is the response type for the Query/Class
RPC method.
_3message QueryClassResponse {
_3 cosmos.nft.v1beta1.Class class = 1;
QueryClassesRequest
QueryClassesRequest
is the request type for the Query/Classes
RPC method.
_4message QueryClassesRequest {
_4 // pagination defines an optional pagination for the request.
_4 cosmos.base.query.v1beta1.PageRequest pagination = 1;
QueryClassesResponse
QueryClassesResponse
is the response type for the Query/Classes
RPC method.
_4message QueryClassesResponse {
_4 repeated cosmos.nft.v1beta1.Class classes = 1;
_4 cosmos.base.query.v1beta1.PageResponse pagination = 2;