Get Contracts by Creator Address (#1021)

* add query to query.proto

* add ContractsByCreatorPrefix in keys.go

* add ContractCreatorThirdIndex to keeper.go

* add querier

* cli

* fix test

* linting

* add key test

* no need to change creator when migrate

* add query test

* minor

* add migrate logic

* add more test

* register migration

* minor

* Update x/wasm/client/cli/query.go

Co-authored-by: Alexander Peters <alpe@users.noreply.github.com>

* nits

* remove IterateAllContract

* Update x/wasm/keeper/genesis_test.go

Co-authored-by: Alexander Peters <alpe@users.noreply.github.com>

* nit

* nit: func name

* change key

* improve TestIteratorContractByCreator

* fix test

* use IterateContractInfo in migrate2to3

* minor

* move key

* improve test case

* add pagReq in ContractsByCreator query

* ordering query

* add migrate test

* Make ContractsByCreator plural; formatting and minor updates

* Comment why AbsoluteTxPositionLen makes sense

* Migrate 1 to 2

* Set module version

Co-authored-by: Alexander Peters <alpe@users.noreply.github.com>
Co-authored-by: khanh-notional <50263489+catShaark@users.noreply.github.com>
This commit is contained in:
vuong
2022-10-21 00:04:41 +07:00
committed by GitHub
parent 2abf812a90
commit 6d67d5b4f7
17 changed files with 1221 additions and 84 deletions

View File

@@ -73,6 +73,8 @@
- [QueryContractInfoResponse](#cosmwasm.wasm.v1.QueryContractInfoResponse)
- [QueryContractsByCodeRequest](#cosmwasm.wasm.v1.QueryContractsByCodeRequest)
- [QueryContractsByCodeResponse](#cosmwasm.wasm.v1.QueryContractsByCodeResponse)
- [QueryContractsByCreatorRequest](#cosmwasm.wasm.v1.QueryContractsByCreatorRequest)
- [QueryContractsByCreatorResponse](#cosmwasm.wasm.v1.QueryContractsByCreatorResponse)
- [QueryParamsRequest](#cosmwasm.wasm.v1.QueryParamsRequest)
- [QueryParamsResponse](#cosmwasm.wasm.v1.QueryParamsResponse)
- [QueryPinnedCodesRequest](#cosmwasm.wasm.v1.QueryPinnedCodesRequest)
@@ -1131,6 +1133,40 @@ Query/ContractsByCode RPC method
<a name="cosmwasm.wasm.v1.QueryContractsByCreatorRequest"></a>
### QueryContractsByCreatorRequest
QueryContractsByCreatorRequest is the request type for the
Query/ContractsByCreator RPC method.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `creator_address` | [string](#string) | | CreatorAddress is the address of contract creator |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | Pagination defines an optional pagination for the request. |
<a name="cosmwasm.wasm.v1.QueryContractsByCreatorResponse"></a>
### QueryContractsByCreatorResponse
QueryContractsByCreatorResponse is the response type for the
Query/ContractsByCreator RPC method.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `contract_addresses` | [string](#string) | repeated | ContractAddresses result set |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | Pagination defines the pagination in the response. |
<a name="cosmwasm.wasm.v1.QueryParamsRequest"></a>
### QueryParamsRequest
@@ -1278,6 +1314,7 @@ Query provides defines the gRPC querier service
| `Codes` | [QueryCodesRequest](#cosmwasm.wasm.v1.QueryCodesRequest) | [QueryCodesResponse](#cosmwasm.wasm.v1.QueryCodesResponse) | Codes gets the metadata for all stored wasm codes | GET|/cosmwasm/wasm/v1/code|
| `PinnedCodes` | [QueryPinnedCodesRequest](#cosmwasm.wasm.v1.QueryPinnedCodesRequest) | [QueryPinnedCodesResponse](#cosmwasm.wasm.v1.QueryPinnedCodesResponse) | PinnedCodes gets the pinned code ids | GET|/cosmwasm/wasm/v1/codes/pinned|
| `Params` | [QueryParamsRequest](#cosmwasm.wasm.v1.QueryParamsRequest) | [QueryParamsResponse](#cosmwasm.wasm.v1.QueryParamsResponse) | Params gets the module params | GET|/cosmwasm/wasm/v1/codes/params|
| `ContractsByCreator` | [QueryContractsByCreatorRequest](#cosmwasm.wasm.v1.QueryContractsByCreatorRequest) | [QueryContractsByCreatorResponse](#cosmwasm.wasm.v1.QueryContractsByCreatorResponse) | ContractsByCreator gets the contracts by creator | GET|/cosmwasm/wasm/v1/contracts/creator/{creator_address}|
<!-- end services -->