diff --git a/e2e/testsuite/grpc_query.go b/e2e/testsuite/grpc_query.go new file mode 100644 index 00000000000..302403c3fbe --- /dev/null +++ b/e2e/testsuite/grpc_query.go @@ -0,0 +1,23 @@ +package testsuite + +import ( + "context" + + "github.com/strangelove-ventures/ibctest/ibc" + + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" +) + +// QueryPacketCommitment queries the packet commitment on the given chain for the provided channel and sequence. +func (s *E2ETestSuite) QueryPacketCommitment(ctx context.Context, chain ibc.Chain, portID, channelID string, sequence uint64) ([]byte, error) { + queryClient := s.GetChainGRCPClients(chain).ChannelQueryClient + res, err := queryClient.PacketCommitment(ctx, &channeltypes.QueryPacketCommitmentRequest{ + PortId: portID, + ChannelId: channelID, + Sequence: sequence, + }) + if err != nil { + return nil, err + } + return res.Commitment, nil +} diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index 10d58ef735a..502dac842df 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -21,7 +21,7 @@ import ( "github.com/cosmos/ibc-go/e2e/testconfig" feetypes "github.com/cosmos/ibc-go/v5/modules/apps/29-fee/types" - clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" ) const ( @@ -47,7 +47,8 @@ type E2ETestSuite struct { // These should typically be used for query clients only. If we need to make changes, we should // use E2ETestSuite.BroadcastMessages to broadcast transactions instead. type GRPCClients struct { - FeeQueryClient feetypes.QueryClient + ChannelQueryClient channeltypes.QueryClient + FeeQueryClient feetypes.QueryClient } // path is a pairing of two chains which will be used in a test. @@ -275,7 +276,8 @@ func (s *E2ETestSuite) initGRPCClients(chain *cosmos.CosmosChain) { } s.grpcClients[chain.Config().ChainID] = GRPCClients{ - FeeQueryClient: feetypes.NewQueryClient(grpcConn), + ChannelQueryClient: channeltypes.NewQueryClient(grpcConn), + FeeQueryClient: feetypes.NewQueryClient(grpcConn), } }