2023-04-04 00:08:45 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
package cosmos.nft.v1beta1;
|
|
|
|
|
|
|
|
import "cosmos/base/query/v1beta1/pagination.proto";
|
|
|
|
import "google/api/annotations.proto";
|
|
|
|
import "cosmos/nft/v1beta1/nft.proto";
|
|
|
|
|
|
|
|
option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
|
|
|
|
|
|
|
|
// Query defines the gRPC querier service.
|
|
|
|
service Query {
|
|
|
|
// Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721
|
|
|
|
rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) {
|
|
|
|
option (google.api.http).get = "/cosmos/nft/v1beta1/balance/{owner}/{class_id}";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721
|
|
|
|
rpc Owner(QueryOwnerRequest) returns (QueryOwnerResponse) {
|
|
|
|
option (google.api.http).get = "/cosmos/nft/v1beta1/owner/{class_id}/{id}";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Supply queries the number of NFTs from the given class, same as totalSupply of ERC721.
|
|
|
|
rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) {
|
|
|
|
option (google.api.http).get = "/cosmos/nft/v1beta1/supply/{class_id}";
|
|
|
|
}
|
|
|
|
|
|
|
|
// NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in
|
|
|
|
// ERC721Enumerable
|
|
|
|
rpc NFTs(QueryNFTsRequest) returns (QueryNFTsResponse) {
|
|
|
|
option (google.api.http).get = "/cosmos/nft/v1beta1/nfts";
|
|
|
|
}
|
|
|
|
|
|
|
|
// NFT queries an NFT based on its class and id.
|
|
|
|
rpc NFT(QueryNFTRequest) returns (QueryNFTResponse) {
|
|
|
|
option (google.api.http).get = "/cosmos/nft/v1beta1/nfts/{class_id}/{id}";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Class queries an NFT class based on its id
|
|
|
|
rpc Class(QueryClassRequest) returns (QueryClassResponse) {
|
|
|
|
option (google.api.http).get = "/cosmos/nft/v1beta1/classes/{class_id}";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Classes queries all NFT classes
|
|
|
|
rpc Classes(QueryClassesRequest) returns (QueryClassesResponse) {
|
|
|
|
option (google.api.http).get = "/cosmos/nft/v1beta1/classes";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// QueryBalanceRequest is the request type for the Query/Balance RPC method
|
|
|
|
message QueryBalanceRequest {
|
2024-02-06 22:54:10 +00:00
|
|
|
// class_id associated with the nft
|
2023-04-04 00:08:45 +00:00
|
|
|
string class_id = 1;
|
2024-02-06 22:54:10 +00:00
|
|
|
|
|
|
|
// owner is the owner address of the nft
|
|
|
|
string owner = 2;
|
2023-04-04 00:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// QueryBalanceResponse is the response type for the Query/Balance RPC method
|
|
|
|
message QueryBalanceResponse {
|
2024-02-06 22:54:10 +00:00
|
|
|
// amount is the number of all NFTs of a given class owned by the owner
|
2023-04-04 00:08:45 +00:00
|
|
|
uint64 amount = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// QueryOwnerRequest is the request type for the Query/Owner RPC method
|
|
|
|
message QueryOwnerRequest {
|
2024-02-06 22:54:10 +00:00
|
|
|
// class_id associated with the nft
|
2023-04-04 00:08:45 +00:00
|
|
|
string class_id = 1;
|
2024-02-06 22:54:10 +00:00
|
|
|
|
|
|
|
// id is a unique identifier of the NFT
|
|
|
|
string id = 2;
|
2023-04-04 00:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// QueryOwnerResponse is the response type for the Query/Owner RPC method
|
|
|
|
message QueryOwnerResponse {
|
2024-02-06 22:54:10 +00:00
|
|
|
// owner is the owner address of the nft
|
2023-04-04 00:08:45 +00:00
|
|
|
string owner = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// QuerySupplyRequest is the request type for the Query/Supply RPC method
|
|
|
|
message QuerySupplyRequest {
|
2024-02-06 22:54:10 +00:00
|
|
|
// class_id associated with the nft
|
2023-04-04 00:08:45 +00:00
|
|
|
string class_id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// QuerySupplyResponse is the response type for the Query/Supply RPC method
|
|
|
|
message QuerySupplyResponse {
|
2024-02-06 22:54:10 +00:00
|
|
|
// amount is the number of all NFTs from the given class
|
2023-04-04 00:08:45 +00:00
|
|
|
uint64 amount = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// QueryNFTstRequest is the request type for the Query/NFTs RPC method
|
|
|
|
message QueryNFTsRequest {
|
2024-02-06 22:54:10 +00:00
|
|
|
// class_id associated with the nft
|
|
|
|
string class_id = 1;
|
|
|
|
|
|
|
|
// owner is the owner address of the nft
|
|
|
|
string owner = 2;
|
|
|
|
|
|
|
|
// pagination defines an optional pagination for the request.
|
2023-04-04 00:08:45 +00:00
|
|
|
cosmos.base.query.v1beta1.PageRequest pagination = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// QueryNFTsResponse is the response type for the Query/NFTs RPC methods
|
|
|
|
message QueryNFTsResponse {
|
2024-02-06 22:54:10 +00:00
|
|
|
// NFT defines the NFT
|
|
|
|
repeated cosmos.nft.v1beta1.NFT nfts = 1;
|
|
|
|
|
|
|
|
// pagination defines the pagination in the response.
|
2023-04-04 00:08:45 +00:00
|
|
|
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// QueryNFTRequest is the request type for the Query/NFT RPC method
|
|
|
|
message QueryNFTRequest {
|
2024-02-06 22:54:10 +00:00
|
|
|
// class_id associated with the nft
|
2023-04-04 00:08:45 +00:00
|
|
|
string class_id = 1;
|
2024-02-06 22:54:10 +00:00
|
|
|
|
|
|
|
// id is a unique identifier of the NFT
|
|
|
|
string id = 2;
|
2023-04-04 00:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// QueryNFTResponse is the response type for the Query/NFT RPC method
|
|
|
|
message QueryNFTResponse {
|
2024-02-06 22:54:10 +00:00
|
|
|
// owner is the owner address of the nft
|
2023-04-04 00:08:45 +00:00
|
|
|
cosmos.nft.v1beta1.NFT nft = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// QueryClassRequest is the request type for the Query/Class RPC method
|
|
|
|
message QueryClassRequest {
|
2024-02-06 22:54:10 +00:00
|
|
|
// class_id associated with the nft
|
2023-04-04 00:08:45 +00:00
|
|
|
string class_id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// QueryClassResponse is the response type for the Query/Class RPC method
|
|
|
|
message QueryClassResponse {
|
2024-02-06 22:54:10 +00:00
|
|
|
// class defines the class of the nft type.
|
2023-04-04 00:08:45 +00:00
|
|
|
cosmos.nft.v1beta1.Class class = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// QueryClassesRequest is the request type for the Query/Classes RPC method
|
|
|
|
message QueryClassesRequest {
|
|
|
|
// pagination defines an optional pagination for the request.
|
|
|
|
cosmos.base.query.v1beta1.PageRequest pagination = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// QueryClassesResponse is the response type for the Query/Classes RPC method
|
|
|
|
message QueryClassesResponse {
|
2024-02-06 22:54:10 +00:00
|
|
|
// class defines the class of the nft type.
|
|
|
|
repeated cosmos.nft.v1beta1.Class classes = 1;
|
|
|
|
|
|
|
|
// pagination defines the pagination in the response.
|
2023-04-04 00:08:45 +00:00
|
|
|
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
|
|
|
}
|