Skip to content

Commit

Permalink
add decode for client state in core/04-channel
Browse files Browse the repository at this point in the history
  • Loading branch information
vuong177 committed Jul 24, 2023
1 parent 3e77ff0 commit 2b77d4a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/core/02-client/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cli
import (
"errors"
"fmt"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/version"
Expand Down
2 changes: 2 additions & 0 deletions modules/core/03-connection/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/cosmos/ibc-go/v7/modules/core/02-client/client/utils"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
Expand Down Expand Up @@ -133,6 +134,7 @@ func (q Keeper) ConnectionClientState(c context.Context, req *types.QueryConnect
}

identifiedClientState := clienttypes.NewIdentifiedClientState(connection.ClientId, clientState)
utils.MaybeDecodeWasmData(q.cdc, identifiedClientState.ClientState)

height := clienttypes.GetSelfHeight(ctx)
return types.NewQueryConnectionClientStateResponse(identifiedClientState, nil, height), nil
Expand Down
2 changes: 2 additions & 0 deletions modules/core/04-channel/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/cosmos/ibc-go/v7/modules/core/02-client/client/utils"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
"github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
Expand Down Expand Up @@ -148,6 +149,7 @@ func (q Keeper) ChannelClientState(c context.Context, req *types.QueryChannelCli
}

identifiedClientState := clienttypes.NewIdentifiedClientState(clientID, clientState)
utils.MaybeDecodeWasmData(q.cdc, identifiedClientState.ClientState)

selfHeight := clienttypes.GetSelfHeight(ctx)
return types.NewQueryChannelClientStateResponse(identifiedClientState, nil, selfHeight), nil
Expand Down

0 comments on commit 2b77d4a

Please sign in to comment.