* Refactor CliContext as Context
* Fix lint issues
* Fix goimports
* Fix gov tests
* Resolved ci-lint issues
* Add changelog
* Rename cliCtx to clientCtx
* Fix mocks and routes
* Add changelog
* Update changelog
* Apply suggestions from code review
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
* merge client/rpc/ro{ot,utes}.go
* Update docs
* client/rpc: remove redundant client/rpc.RegisterRPCRoutes
* regenerate mocks
* Update ADRs
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
34 lines
890 B
Go
34 lines
890 B
Go
package utils
|
|
|
|
import (
|
|
"encoding/binary"
|
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
|
)
|
|
|
|
// QueryNextSequenceRecv queries the store to get the next receive sequence and
|
|
// a merkle proof.
|
|
func QueryNextSequenceRecv(
|
|
clientCtx client.Context, portID, channelID string, prove bool,
|
|
) (channeltypes.RecvResponse, error) {
|
|
req := abci.RequestQuery{
|
|
Path: "store/ibc/key",
|
|
Data: host.KeyNextSequenceRecv(portID, channelID),
|
|
Prove: prove,
|
|
}
|
|
|
|
res, err := clientCtx.QueryABCI(req)
|
|
if err != nil {
|
|
return channeltypes.RecvResponse{}, err
|
|
}
|
|
|
|
sequence := binary.BigEndian.Uint64(res.Value)
|
|
sequenceRes := channeltypes.NewRecvResponse(portID, channelID, sequence, res.Proof, res.Height)
|
|
|
|
return sequenceRes, nil
|
|
}
|