From 57cd7be08ccd099e134f90731d61da5435f5f3a8 Mon Sep 17 00:00:00 2001 From: Hard-Nett <123711748+hard-nett@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:40:00 +0000 Subject: [PATCH] add stargate queries to wasmOpts (#251) Co-authored-by: hard-nett --- app/keepers/keepers.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 501a537c..9a24d0f5 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -62,6 +62,7 @@ import ( ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" ) @@ -315,6 +316,36 @@ func NewAppKeepers( panic("error while reading wasm config: " + err.Error()) } + // Stargate Queries + accepted := wasmkeeper.AcceptedStargateQueries{ + // ibc + "/ibc.core.client.v1.Query/ClientState": &ibcclienttypes.QueryClientStateResponse{}, + "/ibc.core.client.v1.Query/ConsensusState": &ibcclienttypes.QueryConsensusStateResponse{}, + "/ibc.core.connection.v1.Query/Connection": &ibcconnectiontypes.QueryConnectionResponse{}, + + // distribution + "/cosmos.distribution.v1beta1.Query/DelegationRewards": &distrtypes.QueryDelegationRewardsResponse{}, + + // staking + "/cosmos.staking.v1beta1.Query/Delegation": &stakingtypes.QueryDelegationResponse{}, + "/cosmos.staking.v1beta1.Query/Redelegations": &stakingtypes.QueryRedelegationsResponse{}, + "/cosmos.staking.v1beta1.Query/UnbondingDelegation": &stakingtypes.QueryUnbondingDelegationResponse{}, + "/cosmos.staking.v1beta1.Query/Validator": &stakingtypes.QueryValidatorResponse{}, + "/cosmos.staking.v1beta1.Query/Params": &stakingtypes.QueryParamsResponse{}, + "/cosmos.staking.v1beta1.Query/Pool": &stakingtypes.QueryPoolResponse{}, + + // fantoken + "/bitsong.fantoken.v1beta1.Query/Params": &fantokentypes.QueryParamsResponse{}, + "/bitsong.fantoken.v1beta1.Query/FanToken": &fantokentypes.QueryFanTokenResponse{}, + "/bitsong.fantoken.v1beta1.Query/FanTokens": &fantokentypes.QueryFanTokensResponse{}, + } + + querierOpts := wasmkeeper.WithQueryPlugins( + &wasmkeeper.QueryPlugins{ + Stargate: wasmkeeper.AcceptListStargateQuerier(accepted, bApp.GRPCQueryRouter(), appCodec), + }) + wasmOpts = append(wasmOpts, querierOpts) + appKeepers.WasmKeeper = wasmkeeper.NewKeeper( appCodec, keys[wasmtypes.StoreKey],