Skip to content

Commit

Permalink
fixed query names
Browse files Browse the repository at this point in the history
  • Loading branch information
miladz68 committed Oct 16, 2023
1 parent 1a78f0a commit 33ae24d
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 209 deletions.
70 changes: 35 additions & 35 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@
- [QueryBurntNFTsInClassResponse](#coreum.asset.nft.v1.QueryBurntNFTsInClassResponse)
- [QueryClassRequest](#coreum.asset.nft.v1.QueryClassRequest)
- [QueryClassResponse](#coreum.asset.nft.v1.QueryClassResponse)
- [QueryClassWhitelistedAccountsRequest](#coreum.asset.nft.v1.QueryClassWhitelistedAccountsRequest)
- [QueryClassWhitelistedAccountsResponse](#coreum.asset.nft.v1.QueryClassWhitelistedAccountsResponse)
- [QueryClassesRequest](#coreum.asset.nft.v1.QueryClassesRequest)
- [QueryClassesResponse](#coreum.asset.nft.v1.QueryClassesResponse)
- [QueryFrozenRequest](#coreum.asset.nft.v1.QueryFrozenRequest)
- [QueryFrozenResponse](#coreum.asset.nft.v1.QueryFrozenResponse)
- [QueryParamsRequest](#coreum.asset.nft.v1.QueryParamsRequest)
- [QueryParamsResponse](#coreum.asset.nft.v1.QueryParamsResponse)
- [QueryWhitelistedAccountsForClassRequest](#coreum.asset.nft.v1.QueryWhitelistedAccountsForClassRequest)
- [QueryWhitelistedAccountsForClassResponse](#coreum.asset.nft.v1.QueryWhitelistedAccountsForClassResponse)
- [QueryWhitelistedAccountsForNFTRequest](#coreum.asset.nft.v1.QueryWhitelistedAccountsForNFTRequest)
- [QueryWhitelistedAccountsForNFTResponse](#coreum.asset.nft.v1.QueryWhitelistedAccountsForNFTResponse)
- [QueryWhitelistedRequest](#coreum.asset.nft.v1.QueryWhitelistedRequest)
Expand Down Expand Up @@ -1667,6 +1667,38 @@ QueryClassResponse is response type for the Query/Class RPC method.



<a name="coreum.asset.nft.v1.QueryClassWhitelistedAccountsRequest"></a>

### QueryClassWhitelistedAccountsRequest



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. |
| `class_id` | [string](#string) | | |






<a name="coreum.asset.nft.v1.QueryClassWhitelistedAccountsResponse"></a>

### QueryClassWhitelistedAccountsResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. |
| `accounts` | [string](#string) | repeated | |






<a name="coreum.asset.nft.v1.QueryClassesRequest"></a>

### QueryClassesRequest
Expand Down Expand Up @@ -1755,38 +1787,6 @@ QueryParamsResponse defines the response type for querying x/asset/nft parameter



<a name="coreum.asset.nft.v1.QueryWhitelistedAccountsForClassRequest"></a>

### QueryWhitelistedAccountsForClassRequest



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. |
| `class_id` | [string](#string) | | |






<a name="coreum.asset.nft.v1.QueryWhitelistedAccountsForClassResponse"></a>

### QueryWhitelistedAccountsForClassResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. |
| `accounts` | [string](#string) | repeated | |






<a name="coreum.asset.nft.v1.QueryWhitelistedAccountsForNFTRequest"></a>

### QueryWhitelistedAccountsForNFTRequest
Expand Down Expand Up @@ -1871,7 +1871,7 @@ Query defines the gRPC querier service.
| `Frozen` | [QueryFrozenRequest](#coreum.asset.nft.v1.QueryFrozenRequest) | [QueryFrozenResponse](#coreum.asset.nft.v1.QueryFrozenResponse) | Frozen queries to check if an NFT is frozen or not. | GET|/coreum/asset/nft/v1/classes/{class_id}/nfts/{id}/frozen|
| `Whitelisted` | [QueryWhitelistedRequest](#coreum.asset.nft.v1.QueryWhitelistedRequest) | [QueryWhitelistedResponse](#coreum.asset.nft.v1.QueryWhitelistedResponse) | Whitelisted queries to check if an account is whitelited to hold an NFT or not. | GET|/coreum/asset/nft/v1/classes/{class_id}/nfts/{id}/whitelisted/{account}|
| `WhitelistedAccountsForNFT` | [QueryWhitelistedAccountsForNFTRequest](#coreum.asset.nft.v1.QueryWhitelistedAccountsForNFTRequest) | [QueryWhitelistedAccountsForNFTResponse](#coreum.asset.nft.v1.QueryWhitelistedAccountsForNFTResponse) | WhitelistedAccountsForNFT returns the list of accounts which are whitelisted to hold this NFT. | GET|/coreum/asset/nft/v1/classes/{class_id}/nfts/{id}/whitelisted|
| `WhitelistedAccountsForClass` | [QueryWhitelistedAccountsForClassRequest](#coreum.asset.nft.v1.QueryWhitelistedAccountsForClassRequest) | [QueryWhitelistedAccountsForClassResponse](#coreum.asset.nft.v1.QueryWhitelistedAccountsForClassResponse) | WhitelistedAccountsForClass returns the list of accounts which are whitelisted to hold NFTs in this class. | GET|/coreum/asset/nft/v1/classes/{class_id}/whitelisted|
| `ClassWhitelistedAccounts` | [QueryClassWhitelistedAccountsRequest](#coreum.asset.nft.v1.QueryClassWhitelistedAccountsRequest) | [QueryClassWhitelistedAccountsResponse](#coreum.asset.nft.v1.QueryClassWhitelistedAccountsResponse) | ClassWhitelistedAccounts returns the list of accounts which are whitelisted to hold NFTs in this class. | GET|/coreum/asset/nft/v1/classes/{class_id}/whitelisted|
| `BurntNFT` | [QueryBurntNFTRequest](#coreum.asset.nft.v1.QueryBurntNFTRequest) | [QueryBurntNFTResponse](#coreum.asset.nft.v1.QueryBurntNFTResponse) | BurntNFTsInClass checks if an nft if is in burnt NFTs list. | GET|/coreum/asset/nft/v1/classes/{class_id}/burnt/{nft_id}|
| `BurntNFTsInClass` | [QueryBurntNFTsInClassRequest](#coreum.asset.nft.v1.QueryBurntNFTsInClassRequest) | [QueryBurntNFTsInClassResponse](#coreum.asset.nft.v1.QueryBurntNFTsInClassResponse) | BurntNFTsInClass returns the list of burnt nfts in a class. | GET|/coreum/asset/nft/v1/classes/{class_id}/burnt|

Expand Down
36 changes: 18 additions & 18 deletions docs/static/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@
},
"/coreum/asset/nft/v1/classes/{class_id}/whitelisted": {
"get": {
"operationId": "GithubComCoreumFoundationCoreumV3XAssetNftTypesWhitelistedAccountsForClass",
"operationId": "GithubComCoreumFoundationCoreumV3XAssetNftTypesClassWhitelistedAccounts",
"parameters": [
{
"name": "class_id",
Expand Down Expand Up @@ -805,7 +805,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/coreum.asset.nft.v1.QueryWhitelistedAccountsForClassResponse"
"$ref": "#/definitions/coreum.asset.nft.v1.QueryClassWhitelistedAccountsResponse"
}
},
"default": {
Expand All @@ -815,7 +815,7 @@
}
}
},
"summary": "WhitelistedAccountsForClass returns the list of accounts which are whitelisted to hold NFTs in this class.",
"summary": "ClassWhitelistedAccounts returns the list of accounts which are whitelisted to hold NFTs in this class.",
"tags": [
"Query"
]
Expand Down Expand Up @@ -7221,6 +7221,21 @@
},
"description": "QueryClassResponse is response type for the Query/Class RPC method."
},
"coreum.asset.nft.v1.QueryClassWhitelistedAccountsResponse": {
"type": "object",
"properties": {
"pagination": {
"$ref": "#/definitions/cosmos.base.query.v1beta1.PageResponse",
"description": "pagination defines the pagination in the response."
},
"accounts": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"coreum.asset.nft.v1.QueryClassesResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -7255,21 +7270,6 @@
},
"description": "QueryParamsResponse defines the response type for querying x/asset/nft parameters."
},
"coreum.asset.nft.v1.QueryWhitelistedAccountsForClassResponse": {
"type": "object",
"properties": {
"pagination": {
"$ref": "#/definitions/cosmos.base.query.v1beta1.PageResponse",
"description": "pagination defines the pagination in the response."
},
"accounts": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"coreum.asset.nft.v1.QueryWhitelistedAccountsForNFTResponse": {
"type": "object",
"properties": {
Expand Down
8 changes: 4 additions & 4 deletions proto/coreum/asset/nft/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ service Query {
option (google.api.http).get = "/coreum/asset/nft/v1/classes/{class_id}/nfts/{id}/whitelisted";
}

// WhitelistedAccountsForClass returns the list of accounts which are whitelisted to hold NFTs in this class.
rpc WhitelistedAccountsForClass (QueryWhitelistedAccountsForClassRequest) returns (QueryWhitelistedAccountsForClassResponse) {
// ClassWhitelistedAccounts returns the list of accounts which are whitelisted to hold NFTs in this class.
rpc ClassWhitelistedAccounts (QueryClassWhitelistedAccountsRequest) returns (QueryClassWhitelistedAccountsResponse) {
option (google.api.http).get = "/coreum/asset/nft/v1/classes/{class_id}/whitelisted";
}

Expand Down Expand Up @@ -122,13 +122,13 @@ message QueryWhitelistedAccountsForNFTResponse {
repeated string accounts = 2;
}

message QueryWhitelistedAccountsForClassRequest {
message QueryClassWhitelistedAccountsRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
string class_id = 2;
}

message QueryWhitelistedAccountsForClassResponse {
message QueryClassWhitelistedAccountsResponse {
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 1;
repeated string accounts = 2;
Expand Down
4 changes: 2 additions & 2 deletions x/asset/nft/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func CmdQueryClassWhitelistedAccounts() *cobra.Command {
cmd := &cobra.Command{
Use: "class-whitelisted-accounts [class-id]",
Args: cobra.ExactArgs(1),
Short: "Query for the list whitelisted accounts for a class of non-fungible tokens",
Short: "Query for whitelisted accounts for a class of non-fungible tokens",
Long: strings.TrimSpace(
fmt.Sprintf(`Query for whitelisted accounts for a class of non-fungible tokens.
Expand All @@ -277,7 +277,7 @@ $ %s query %s class-whitelisted-accounts [class-id]
return err
}

res, err := queryClient.WhitelistedAccountsForClass(cmd.Context(), &types.QueryWhitelistedAccountsForClassRequest{
res, err := queryClient.ClassWhitelistedAccounts(cmd.Context(), &types.QueryClassWhitelistedAccountsRequest{
Pagination: pageReq,
ClassId: classID,
})
Expand Down
6 changes: 3 additions & 3 deletions x/asset/nft/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ func (qs QueryService) WhitelistedAccountsForNFT(ctx context.Context, req *types
}, err
}

// WhitelistedAccountsForClass returns the list of accounts which are whitelited to hold this NFTs in this class.
func (qs QueryService) WhitelistedAccountsForClass(ctx context.Context, req *types.QueryWhitelistedAccountsForClassRequest) (*types.QueryWhitelistedAccountsForClassResponse, error) {
// ClassWhitelistedAccounts returns the list of accounts which are whitelited to hold this NFTs in this class.
func (qs QueryService) ClassWhitelistedAccounts(ctx context.Context, req *types.QueryClassWhitelistedAccountsRequest) (*types.QueryClassWhitelistedAccountsResponse, error) {
accounts, pageRes, err := qs.keeper.GetWhitelistedAccountsForClass(sdk.UnwrapSDKContext(ctx), req.ClassId, req.Pagination)
return &types.QueryWhitelistedAccountsForClassResponse{
return &types.QueryClassWhitelistedAccountsResponse{
Pagination: pageRes,
Accounts: accounts,
}, err
Expand Down
Loading

0 comments on commit 33ae24d

Please sign in to comment.