-
Notifications
You must be signed in to change notification settings - Fork 572
/
query.go
70 lines (61 loc) · 2.67 KB
/
query.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package types
import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v2/modules/core/exported"
)
var (
_ codectypes.UnpackInterfacesMessage = QueryConnectionClientStateResponse{}
_ codectypes.UnpackInterfacesMessage = QueryConnectionConsensusStateResponse{}
)
// NewQueryConnectionResponse creates a new QueryConnectionResponse instance
func NewQueryConnectionResponse(
connection ConnectionEnd, proof []byte, height clienttypes.Height,
) *QueryConnectionResponse {
return &QueryConnectionResponse{
Connection: &connection,
Proof: proof,
ProofHeight: height,
}
}
// NewQueryClientConnectionsResponse creates a new ConnectionPaths instance
func NewQueryClientConnectionsResponse(
connectionPaths []string, proof []byte, height clienttypes.Height,
) *QueryClientConnectionsResponse {
return &QueryClientConnectionsResponse{
ConnectionPaths: connectionPaths,
Proof: proof,
ProofHeight: height,
}
}
// NewQueryClientConnectionsRequest creates a new QueryClientConnectionsRequest instance
func NewQueryClientConnectionsRequest(clientID string) *QueryClientConnectionsRequest {
return &QueryClientConnectionsRequest{
ClientId: clientID,
}
}
// NewQueryConnectionClientStateResponse creates a newQueryConnectionClientStateResponse instance
func NewQueryConnectionClientStateResponse(identifiedClientState clienttypes.IdentifiedClientState, proof []byte, height clienttypes.Height) *QueryConnectionClientStateResponse {
return &QueryConnectionClientStateResponse{
IdentifiedClientState: &identifiedClientState,
Proof: proof,
ProofHeight: height,
}
}
// UnpackInterfaces implements UnpackInterfacesMesssage.UnpackInterfaces
func (qccsr QueryConnectionClientStateResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return qccsr.IdentifiedClientState.UnpackInterfaces(unpacker)
}
// NewQueryConnectionConsensusStateResponse creates a newQueryConnectionConsensusStateResponse instance
func NewQueryConnectionConsensusStateResponse(clientID string, anyConsensusState *codectypes.Any, consensusStateHeight exported.Height, proof []byte, height clienttypes.Height) *QueryConnectionConsensusStateResponse {
return &QueryConnectionConsensusStateResponse{
ConsensusState: anyConsensusState,
ClientId: clientID,
Proof: proof,
ProofHeight: height,
}
}
// UnpackInterfaces implements UnpackInterfacesMesssage.UnpackInterfaces
func (qccsr QueryConnectionConsensusStateResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return unpacker.UnpackAny(qccsr.ConsensusState, new(exported.ConsensusState))
}