Skip to content

Commit

Permalink
add stargate queries to wasmOpts (#251)
Browse files Browse the repository at this point in the history
Co-authored-by: hard-nett <[email protected]>
  • Loading branch information
hard-nett and hard-nett authored Dec 19, 2024
1 parent e90d994 commit 57cd7be
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit 57cd7be

Please sign in to comment.