Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

redefine type in proto #10

Merged
merged 6 commits into from
Sep 18, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
112 changes: 65 additions & 47 deletions docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,24 @@

- [Msg](#ibc.applications.fee.v1.Msg)

- [ibc/applications/ibc_query/v1/crosschainquery.proto](#ibc/applications/ibc_query/v1/crosschainquery.proto)
- [CrossChainQuery](#ibc.applications.ibc_query.v1.CrossChainQuery)
- [CrossChainQueryResult](#ibc.applications.ibc_query.v1.CrossChainQueryResult)

- [QueryResult](#ibc.applications.ibc_query.v1.QueryResult)

- [ibc/applications/ibc_query/v1/event.proto](#ibc/applications/ibc_query/v1/event.proto)
- [EventQuerySubmitted](#ibc.applications.ibc_query.v1.EventQuerySubmitted)

- [ibc/applications/ibc_query/v1/genesis.proto](#ibc/applications/ibc_query/v1/genesis.proto)
- [CrossChainQuery](#ibc.applications.ibc_query.v1.CrossChainQuery)
- [CrossChainQueryResult](#ibc.applications.ibc_query.v1.CrossChainQueryResult)
- [GenesisState](#ibc.applications.ibc_query.v1.GenesisState)

- [QueryResult](#ibc.applications.ibc_query.v1.QueryResult)

- [ibc/applications/ibc_query/v1/packet.proto](#ibc/applications/ibc_query/v1/packet.proto)
- [IBCQueryPacketData](#ibc.applications.ibc_query.v1.IBCQueryPacketData)

- [ibc/applications/ibc_query/v1/query.proto](#ibc/applications/ibc_query/v1/query.proto)
- [QueryCrossChainQuery](#ibc.applications.ibc_query.v1.QueryCrossChainQuery)
- [QueryCrossChainQueryResponse](#ibc.applications.ibc_query.v1.QueryCrossChainQueryResponse)
- [QueryCrossChainQueryResult](#ibc.applications.ibc_query.v1.QueryCrossChainQueryResult)
- [QueryCrossChainQueryResultResponse](#ibc.applications.ibc_query.v1.QueryCrossChainQueryResultResponse)

- [Query](#ibc.applications.ibc_query.v1.Query)

Expand Down Expand Up @@ -1446,33 +1448,65 @@ Msg defines the ICS29 Msg service.



<a name="ibc/applications/ibc_query/v1/event.proto"></a>
<a name="ibc/applications/ibc_query/v1/crosschainquery.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## ibc/applications/ibc_query/v1/event.proto
## ibc/applications/ibc_query/v1/crosschainquery.proto



<a name="ibc.applications.ibc_query.v1.EventQuerySubmitted"></a>
<a name="ibc.applications.ibc_query.v1.CrossChainQuery"></a>

### EventQuerySubmitted
EventQuerySubmitted emitted when process MsgSubmitCrossChainQuery tx
### CrossChainQuery
CrossChainQuery


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `id` | [string](#string) | | |
| `path` | [string](#string) | | |
| `local_timeout_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | |
| `local_timeout_stamp` | [uint64](#uint64) | | |
| `local_timeout_timestamp` | [uint64](#uint64) | | |
| `query_height` | [uint64](#uint64) | | |
| `client_id` | [string](#string) | | |






<a name="ibc.applications.ibc_query.v1.CrossChainQueryResult"></a>

### CrossChainQueryResult
CrossChainQueryResult


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `id` | [string](#string) | | |
| `result` | [QueryResult](#ibc.applications.ibc_query.v1.QueryResult) | | |
| `data` | [bytes](#bytes) | | |





<!-- end messages -->


<a name="ibc.applications.ibc_query.v1.QueryResult"></a>

### QueryResult
QueryResult

| Name | Number | Description |
| ---- | ------ | ----------- |
| QUERY_RESULT_UNSPECIFIED | 0 | UNSPECIFIED |
| QUERY_RESULT_SUCCESS | 1 | SUCCESS |
| QUERY_RESULT_FAILURE | 2 | FAILURE |
| QUERY_RESULT_TIMEOUT | 3 | TIMEOUT |


<!-- end enums -->

<!-- end HasExtensions -->
Expand All @@ -1481,47 +1515,45 @@ EventQuerySubmitted emitted when process MsgSubmitCrossChainQuery tx



<a name="ibc/applications/ibc_query/v1/genesis.proto"></a>
<a name="ibc/applications/ibc_query/v1/event.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## ibc/applications/ibc_query/v1/genesis.proto
## ibc/applications/ibc_query/v1/event.proto



<a name="ibc.applications.ibc_query.v1.CrossChainQuery"></a>
<a name="ibc.applications.ibc_query.v1.EventQuerySubmitted"></a>

### CrossChainQuery
CrossChainQuery
### EventQuerySubmitted
EventQuerySubmitted emitted when process MsgSubmitCrossChainQuery tx


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `id` | [string](#string) | | |
| `path` | [string](#string) | | |
| `local_timeout_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | |
| `local_timeout_timestamp` | [uint64](#uint64) | | |
| `local_timeout_stamp` | [uint64](#uint64) | | |
| `query_height` | [uint64](#uint64) | | |
| `client_id` | [string](#string) | | |





<!-- end messages -->

<a name="ibc.applications.ibc_query.v1.CrossChainQueryResult"></a>
<!-- end enums -->

### CrossChainQueryResult
CrossChainQueryResult
<!-- end HasExtensions -->

<!-- end services -->

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `id` | [string](#string) | | |
| `result` | [QueryResult](#ibc.applications.ibc_query.v1.QueryResult) | | |
| `data` | [bytes](#bytes) | | |


<a name="ibc/applications/ibc_query/v1/genesis.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## ibc/applications/ibc_query/v1/genesis.proto



Expand All @@ -1543,20 +1575,6 @@ GenesisState defines the ICS31 ibc-query genesis state

<!-- end messages -->


<a name="ibc.applications.ibc_query.v1.QueryResult"></a>

### QueryResult
QueryResult

| Name | Number | Description |
| ---- | ------ | ----------- |
| QUERY_RESULT_UNSPECIFIED | 0 | UNSPECIFIED |
| QUERY_RESULT_SUCCESS | 1 | SUCCESS |
| QUERY_RESULT_FAILURE | 2 | FAILURE |
| QUERY_RESULT_TIMEOUT | 3 | TIMEOUT |


<!-- end enums -->

<!-- end HasExtensions -->
Expand All @@ -1583,6 +1601,7 @@ IBCQueryPacketData defines a struct for the packet payload
| `id` | [string](#string) | | |
| `path` | [string](#string) | | |
| `query_height` | [uint64](#uint64) | | |
| `proof_specs` | [ics23.ProofSpec](#ics23.ProofSpec) | repeated | TODO: Proof specifications used in verifying counterparty state |



Expand All @@ -1605,9 +1624,9 @@ IBCQueryPacketData defines a struct for the packet payload



<a name="ibc.applications.ibc_query.v1.QueryCrossChainQuery"></a>
<a name="ibc.applications.ibc_query.v1.QueryCrossChainQueryResult"></a>

### QueryCrossChainQuery
### QueryCrossChainQueryResult
QueryCrossChainQuery


Expand All @@ -1620,9 +1639,9 @@ QueryCrossChainQuery



<a name="ibc.applications.ibc_query.v1.QueryCrossChainQueryResponse"></a>
<a name="ibc.applications.ibc_query.v1.QueryCrossChainQueryResultResponse"></a>

### QueryCrossChainQueryResponse
### QueryCrossChainQueryResultResponse
QueryCrossChainQueryResponse


Expand All @@ -1631,7 +1650,6 @@ QueryCrossChainQueryResponse
| `id` | [string](#string) | | |
| `result` | [QueryResult](#ibc.applications.ibc_query.v1.QueryResult) | | |
| `data` | [bytes](#bytes) | | |
| `proof_specs` | [ics23.ProofSpec](#ics23.ProofSpec) | repeated | TODO Proof specifications used in verifying counterparty state |



Expand All @@ -1651,7 +1669,7 @@ Query

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `CrossChainQuery` | [QueryCrossChainQuery](#ibc.applications.ibc_query.v1.QueryCrossChainQuery) | [QueryCrossChainQueryResponse](#ibc.applications.ibc_query.v1.QueryCrossChainQueryResponse) | query CrossChainQuery | GET|/ibc/apps/ibc-query/v1/{id}|
| `CrossChainQueryResult` | [QueryCrossChainQueryResult](#ibc.applications.ibc_query.v1.QueryCrossChainQueryResult) | [QueryCrossChainQueryResultResponse](#ibc.applications.ibc_query.v1.QueryCrossChainQueryResultResponse) | query CrossChainQueryResult | GET|/ibc/apps/ibc-query/v1/{id}|

<!-- end services -->

Expand Down
4 changes: 2 additions & 2 deletions modules/apps/31-ibc-query/client/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func GetQueryCmd() *cobra.Command {
}

queryCmd.AddCommand(

GetCmdQueryCrossChainQueryResult(),
)

return queryCmd
Expand All @@ -25,7 +25,7 @@ func GetQueryCmd() *cobra.Command {
func NewTxCmd() *cobra.Command {
txCmd := &cobra.Command{
Use: "ibc-query",
Short: "IBC query command",
Short: "Query cross chain query result",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
Expand Down
43 changes: 43 additions & 0 deletions modules/apps/31-ibc-query/client/cli/query.go
Original file line number Diff line number Diff line change
@@ -1 +1,44 @@
package cli

import (
"fmt"
"github.com/cosmos/cosmos-sdk/version"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

"github.com/cosmos/ibc-go/v4/modules/apps/31-ibc-query/types"
)

// GetCmdQueryCrossChainQueryResult defines the command to query CrossChainQueryResult from store
func GetCmdQueryCrossChainQueryResult() *cobra.Command {
cmd := &cobra.Command{
Use: "query-ibc-query-result [query id]",
Short: "query cross chain query result with query id",
Long: "query cross chain query result with query id",
Example: fmt.Sprintf("%s query ibc-query query-ibc-query-result 3", version.AppName),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

req := &types.QueryCrossChainQueryResult{
Id: args[0],
}

res, err := queryClient.CrossChainQueryResult(cmd.Context(), req)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)
return cmd
}
4 changes: 2 additions & 2 deletions modules/apps/31-ibc-query/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

var _ types.QueryServer = Keeper{}

// CrossChainQuery implements the Query/CrossChainQuery gRPC method
func (k Keeper) CrossChainQuery(context context.Context, query *types.QueryCrossChainQuery) (*types.QueryCrossChainQueryResponse, error) {
// CrossChainQueryResult implements the Query/CrossChainQueryResult gRPC method
func (k Keeper) CrossChainQueryResult(context context.Context, query *types.QueryCrossChainQueryResult) (*types.QueryCrossChainQueryResultResponse, error) {
// TODO
// get queryResult from private store
return nil, nil
Expand Down
5 changes: 3 additions & 2 deletions modules/apps/31-ibc-query/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/cosmos/ibc-go/v4/modules/apps/31-ibc-query/client/cli"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -67,12 +68,12 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *r

// GetTxCmd implements AppModuleBasic interface
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return nil
return cli.NewTxCmd()
}

// GetQueryCmd implements AppModuleBasic interface
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return nil
return cli.GetQueryCmd()
}

type AppModule struct {
Expand Down
Loading