Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: modify wasm grpc query api path. #453

Merged
merged 2 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Improvements

### Bug Fixes
* (x/wasm) [\#453](https://github.com/line/lbm-sdk/pull/453) modify wasm grpc query api path

### Breaking Changes

Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,8 @@ proto-all: proto-format proto-lint proto-gen

proto-gen:
@echo "Generating Protobuf files"
@$(DOCKER) run --rm -v $(CURDIR):/workspace \
--workdir /workspace tendermintdev/docker-build-proto \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
@if $(DOCKER) ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then $(DOCKER) start -a $(containerProtoGen); else $(DOCKER) run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
sh ./scripts/protocgen.sh; fi

# This generates the SDK's custom wrapper for google.protobuf.Any. It should only be run manually when needed
proto-gen-any:
Expand Down
8 changes: 3 additions & 5 deletions client/docs/statik/statik.go

Large diffs are not rendered by default.

212 changes: 106 additions & 106 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31049,7 +31049,7 @@ paths:
format: byte
tags:
- Query
/line/wasm/v1/code:
/lbm/wasm/v1/code:
get:
summary: Codes gets the metadata for all stored wasm codes
operationId: Codes
Expand Down Expand Up @@ -31354,7 +31354,7 @@ paths:
format: boolean
tags:
- Query
'/line/wasm/v1/code/{code_id}':
'/lbm/wasm/v1/code/{code_id}':
get:
summary: Code gets the binary code and metadata for a singe wasm code
operationId: Code
Expand Down Expand Up @@ -31600,7 +31600,7 @@ paths:
format: uint64
tags:
- Query
'/line/wasm/v1/code/{code_id}/contracts':
'/lbm/wasm/v1/code/{code_id}/contracts':
get:
summary: ContractsByCode lists all smart contracts for a code id
operationId: ContractsByCode
Expand Down Expand Up @@ -31880,7 +31880,7 @@ paths:
format: boolean
tags:
- Query
'/line/wasm/v1/contract/{address}':
'/lbm/wasm/v1/contract/{address}':
get:
summary: ContractInfo gets the contract meta data
operationId: ContractInfo
Expand Down Expand Up @@ -32328,7 +32328,7 @@ paths:
type: string
tags:
- Query
'/line/wasm/v1/contract/{address}/history':
'/lbm/wasm/v1/contract/{address}/history':
get:
summary: ContractHistory gets the contract code history
operationId: ContractHistory
Expand Down Expand Up @@ -32650,51 +32650,23 @@ paths:
format: boolean
tags:
- Query
'/line/wasm/v1/contract/{address}/state':
'/lbm/wasm/v1/contract/{address}/raw/{query_data}':
get:
summary: AllContractState gets all raw store data for a single contract
operationId: AllContractState
summary: RawContractState gets single key from the raw store data of a contract
operationId: RawContractState
responses:
'200':
description: A successful response.
schema:
type: object
properties:
models:
type: array
items:
type: object
properties:
key:
type: string
format: byte
title: hex-encode key to read it better (this is often ascii)
value:
type: string
format: byte
title: base64-encode raw value
title: Model is a struct that holds a KV pair
pagination:
description: pagination defines the pagination in the response.
type: object
properties:
next_key:
type: string
format: byte
title: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
data:
type: string
format: byte
title: Data contains the raw store data
title: |-
QueryAllContractStateResponse is the response type for the
Query/AllContractState RPC method
QueryRawContractStateResponse is the response type for the
Query/RawContractState RPC method
default:
description: An unexpected error response
schema:
Expand Down Expand Up @@ -32890,59 +32862,17 @@ paths:
in: path
required: true
type: string
- name: pagination.key
description: |-
key is a value returned in PageResponse.next_key to begin
querying the next page most efficiently. Only one of offset or key
should be set.
in: query
required: false
- name: query_data
in: path
required: true
type: string
format: byte
- name: pagination.offset
description: >-
offset is a numeric offset that can be used when key is unavailable.

It is less efficient than using key. Only one of offset or key
should

be set.
in: query
required: false
type: string
format: uint64
- name: pagination.limit
description: >-
limit is the total number of results to be returned in the result
page.

If left empty it will default to a value to be set by each app.
in: query
required: false
type: string
format: uint64
- name: pagination.count_total
description: >-
count_total is set to true to indicate that the result set should
include

a count of the total number of items available for pagination in
UIs.

count_total is only respected when offset is used. It is ignored
when key

is set.
in: query
required: false
type: boolean
format: boolean
tags:
- Query
'/wasm/v1/contract/{address}/raw/{query_data}':
'/lbm/wasm/v1/contract/{address}/smart/{query_data}':
get:
summary: RawContractState gets single key from the raw store data of a contract
operationId: RawContractState
summary: SmartContractState get smart query result from the contract
operationId: SmartContractState
responses:
'200':
description: A successful response.
Expand All @@ -32952,10 +32882,10 @@ paths:
data:
type: string
format: byte
title: Data contains the raw store data
title: Data contains the json data returned from the smart contract
title: |-
QueryRawContractStateResponse is the response type for the
Query/RawContractState RPC method
QuerySmartContractStateResponse is the response type for the
Query/SmartContractState RPC method
default:
description: An unexpected error response
schema:
Expand Down Expand Up @@ -33152,29 +33082,58 @@ paths:
required: true
type: string
- name: query_data
description: QueryData contains the query data passed to the contract
in: path
required: true
type: string
format: byte
tags:
- Query
'/wasm/v1/contract/{address}/smart/{query_data}':
'/lbm/wasm/v1/contract/{address}/state':
get:
summary: SmartContractState get smart query result from the contract
operationId: SmartContractState
summary: AllContractState gets all raw store data for a single contract
operationId: AllContractState
responses:
'200':
description: A successful response.
schema:
type: object
properties:
data:
type: string
format: byte
title: Data contains the json data returned from the smart contract
models:
type: array
items:
type: object
properties:
key:
type: string
format: byte
title: hex-encode key to read it better (this is often ascii)
value:
type: string
format: byte
title: base64-encode raw value
title: Model is a struct that holds a KV pair
pagination:
description: pagination defines the pagination in the response.
type: object
properties:
next_key:
type: string
format: byte
title: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
title: |-
QuerySmartContractStateResponse is the response type for the
Query/SmartContractState RPC method
QueryAllContractStateResponse is the response type for the
Query/AllContractState RPC method
default:
description: An unexpected error response
schema:
Expand Down Expand Up @@ -33370,12 +33329,53 @@ paths:
in: path
required: true
type: string
- name: query_data
description: QueryData contains the query data passed to the contract
in: path
required: true
- name: pagination.key
description: |-
key is a value returned in PageResponse.next_key to begin
querying the next page most efficiently. Only one of offset or key
should be set.
in: query
required: false
type: string
format: byte
- name: pagination.offset
description: >-
offset is a numeric offset that can be used when key is unavailable.

It is less efficient than using key. Only one of offset or key
should

Copy link
Contributor

@shiki-tak shiki-tak Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Unnecessary line breaks in a sentence?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swagger.yaml file is generated by make proto-swagger-gen.
So, we don't need to modify swagger file.

be set.
in: query
required: false
type: string
format: uint64
- name: pagination.limit
description: >-
limit is the total number of results to be returned in the result
page.

If left empty it will default to a value to be set by each app.
in: query
required: false
type: string
format: uint64
- name: pagination.count_total
description: >-
count_total is set to true to indicate that the result set should
include

Copy link
Contributor

@shiki-tak shiki-tak Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

a count of the total number of items available for pagination in
UIs.

count_total is only respected when offset is used. It is ignored
when key

Copy link
Contributor

@shiki-tak shiki-tak Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

is set.
in: query
required: false
type: boolean
format: boolean
tags:
- Query
/lbm/consortium/v1/params:
Expand Down
16 changes: 8 additions & 8 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -13003,14 +13003,14 @@ Query provides defines the gRPC querier service

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `ContractInfo` | [QueryContractInfoRequest](#lbm.wasm.v1.QueryContractInfoRequest) | [QueryContractInfoResponse](#lbm.wasm.v1.QueryContractInfoResponse) | ContractInfo gets the contract meta data | GET|/line/wasm/v1/contract/{address}|
| `ContractHistory` | [QueryContractHistoryRequest](#lbm.wasm.v1.QueryContractHistoryRequest) | [QueryContractHistoryResponse](#lbm.wasm.v1.QueryContractHistoryResponse) | ContractHistory gets the contract code history | GET|/line/wasm/v1/contract/{address}/history|
| `ContractsByCode` | [QueryContractsByCodeRequest](#lbm.wasm.v1.QueryContractsByCodeRequest) | [QueryContractsByCodeResponse](#lbm.wasm.v1.QueryContractsByCodeResponse) | ContractsByCode lists all smart contracts for a code id | GET|/line/wasm/v1/code/{code_id}/contracts|
| `AllContractState` | [QueryAllContractStateRequest](#lbm.wasm.v1.QueryAllContractStateRequest) | [QueryAllContractStateResponse](#lbm.wasm.v1.QueryAllContractStateResponse) | AllContractState gets all raw store data for a single contract | GET|/line/wasm/v1/contract/{address}/state|
| `RawContractState` | [QueryRawContractStateRequest](#lbm.wasm.v1.QueryRawContractStateRequest) | [QueryRawContractStateResponse](#lbm.wasm.v1.QueryRawContractStateResponse) | RawContractState gets single key from the raw store data of a contract | GET|/wasm/v1/contract/{address}/raw/{query_data}|
| `SmartContractState` | [QuerySmartContractStateRequest](#lbm.wasm.v1.QuerySmartContractStateRequest) | [QuerySmartContractStateResponse](#lbm.wasm.v1.QuerySmartContractStateResponse) | SmartContractState get smart query result from the contract | GET|/wasm/v1/contract/{address}/smart/{query_data}|
| `Code` | [QueryCodeRequest](#lbm.wasm.v1.QueryCodeRequest) | [QueryCodeResponse](#lbm.wasm.v1.QueryCodeResponse) | Code gets the binary code and metadata for a singe wasm code | GET|/line/wasm/v1/code/{code_id}|
| `Codes` | [QueryCodesRequest](#lbm.wasm.v1.QueryCodesRequest) | [QueryCodesResponse](#lbm.wasm.v1.QueryCodesResponse) | Codes gets the metadata for all stored wasm codes | GET|/line/wasm/v1/code|
| `ContractInfo` | [QueryContractInfoRequest](#lbm.wasm.v1.QueryContractInfoRequest) | [QueryContractInfoResponse](#lbm.wasm.v1.QueryContractInfoResponse) | ContractInfo gets the contract meta data | GET|/lbm/wasm/v1/contract/{address}|
| `ContractHistory` | [QueryContractHistoryRequest](#lbm.wasm.v1.QueryContractHistoryRequest) | [QueryContractHistoryResponse](#lbm.wasm.v1.QueryContractHistoryResponse) | ContractHistory gets the contract code history | GET|/lbm/wasm/v1/contract/{address}/history|
| `ContractsByCode` | [QueryContractsByCodeRequest](#lbm.wasm.v1.QueryContractsByCodeRequest) | [QueryContractsByCodeResponse](#lbm.wasm.v1.QueryContractsByCodeResponse) | ContractsByCode lists all smart contracts for a code id | GET|/lbm/wasm/v1/code/{code_id}/contracts|
| `AllContractState` | [QueryAllContractStateRequest](#lbm.wasm.v1.QueryAllContractStateRequest) | [QueryAllContractStateResponse](#lbm.wasm.v1.QueryAllContractStateResponse) | AllContractState gets all raw store data for a single contract | GET|/lbm/wasm/v1/contract/{address}/state|
| `RawContractState` | [QueryRawContractStateRequest](#lbm.wasm.v1.QueryRawContractStateRequest) | [QueryRawContractStateResponse](#lbm.wasm.v1.QueryRawContractStateResponse) | RawContractState gets single key from the raw store data of a contract | GET|/lbm/wasm/v1/contract/{address}/raw/{query_data}|
| `SmartContractState` | [QuerySmartContractStateRequest](#lbm.wasm.v1.QuerySmartContractStateRequest) | [QuerySmartContractStateResponse](#lbm.wasm.v1.QuerySmartContractStateResponse) | SmartContractState get smart query result from the contract | GET|/lbm/wasm/v1/contract/{address}/smart/{query_data}|
| `Code` | [QueryCodeRequest](#lbm.wasm.v1.QueryCodeRequest) | [QueryCodeResponse](#lbm.wasm.v1.QueryCodeResponse) | Code gets the binary code and metadata for a singe wasm code | GET|/lbm/wasm/v1/code/{code_id}|
| `Codes` | [QueryCodesRequest](#lbm.wasm.v1.QueryCodesRequest) | [QueryCodesResponse](#lbm.wasm.v1.QueryCodesResponse) | Codes gets the metadata for all stored wasm codes | GET|/lbm/wasm/v1/code|

<!-- end services -->

Expand Down
16 changes: 8 additions & 8 deletions proto/lbm/wasm/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,35 @@ option (gogoproto.equal_all) = false;
service Query {
// ContractInfo gets the contract meta data
rpc ContractInfo(QueryContractInfoRequest) returns (QueryContractInfoResponse) {
option (google.api.http).get = "/line/wasm/v1/contract/{address}";
option (google.api.http).get = "/lbm/wasm/v1/contract/{address}";
}
// ContractHistory gets the contract code history
rpc ContractHistory(QueryContractHistoryRequest) returns (QueryContractHistoryResponse) {
option (google.api.http).get = "/line/wasm/v1/contract/{address}/history";
option (google.api.http).get = "/lbm/wasm/v1/contract/{address}/history";
}
// ContractsByCode lists all smart contracts for a code id
rpc ContractsByCode(QueryContractsByCodeRequest) returns (QueryContractsByCodeResponse) {
option (google.api.http).get = "/line/wasm/v1/code/{code_id}/contracts";
option (google.api.http).get = "/lbm/wasm/v1/code/{code_id}/contracts";
}
// AllContractState gets all raw store data for a single contract
rpc AllContractState(QueryAllContractStateRequest) returns (QueryAllContractStateResponse) {
option (google.api.http).get = "/line/wasm/v1/contract/{address}/state";
option (google.api.http).get = "/lbm/wasm/v1/contract/{address}/state";
}
// RawContractState gets single key from the raw store data of a contract
rpc RawContractState(QueryRawContractStateRequest) returns (QueryRawContractStateResponse) {
option (google.api.http).get = "/wasm/v1/contract/{address}/raw/{query_data}";
option (google.api.http).get = "/lbm/wasm/v1/contract/{address}/raw/{query_data}";
}
// SmartContractState get smart query result from the contract
rpc SmartContractState(QuerySmartContractStateRequest) returns (QuerySmartContractStateResponse) {
option (google.api.http).get = "/wasm/v1/contract/{address}/smart/{query_data}";
option (google.api.http).get = "/lbm/wasm/v1/contract/{address}/smart/{query_data}";
}
// Code gets the binary code and metadata for a singe wasm code
rpc Code(QueryCodeRequest) returns (QueryCodeResponse) {
option (google.api.http).get = "/line/wasm/v1/code/{code_id}";
option (google.api.http).get = "/lbm/wasm/v1/code/{code_id}";
}
// Codes gets the metadata for all stored wasm codes
rpc Codes(QueryCodesRequest) returns (QueryCodesResponse) {
option (google.api.http).get = "/line/wasm/v1/code";
option (google.api.http).get = "/lbm/wasm/v1/code";
}
}

Expand Down
Loading