Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add stargate query support for staking related queries #249

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,29 @@ func NewAppKeeper(
// MoveKeeper Configuration //
//////////////////////////////

*appKeepers.MoveKeeper = *movekeeper.NewKeeper(
queryWhitelist := movetypes.DefaultVMQueryWhiteList(ac)
queryWhitelist.Stargate["/initia.mstaking.v1.Query/UnbondingDelegation"] = movetypes.ProtoSet{
Request: &stakingtypes.QueryUnbondingDelegationRequest{},
Response: &stakingtypes.QueryUnbondingDelegationResponse{},
}
queryWhitelist.Stargate["/initia.mstaking.v1.Query/Pool"] = movetypes.ProtoSet{
Request: &stakingtypes.QueryPoolRequest{},
Response: &stakingtypes.QueryPoolResponse{},
}
queryWhitelist.Stargate["/initia.mstaking.v1.Query/DelegatorDelegations"] = movetypes.ProtoSet{
Request: &stakingtypes.QueryDelegatorDelegationsRequest{},
Response: &stakingtypes.QueryDelegatorDelegationsResponse{},
}
queryWhitelist.Stargate["/initia.mstaking.v1.Query/Delegation"] = movetypes.ProtoSet{
Request: &stakingtypes.QueryDelegationRequest{},
Response: &stakingtypes.QueryDelegationResponse{},
}
queryWhitelist.Stargate["/initia.mstaking.v1.Query/Redelegations"] = movetypes.ProtoSet{
Request: &stakingtypes.QueryRedelegationsRequest{},
Response: &stakingtypes.QueryRedelegationsResponse{},
}

*appKeepers.MoveKeeper = movekeeper.NewKeeper(
appCodec,
runtime.NewKVStoreService(appKeepers.keys[movetypes.StoreKey]),
appKeepers.AccountKeeper,
Expand All @@ -636,7 +658,7 @@ func NewAppKeeper(
authtypes.FeeCollectorName,
authorityAddr,
ac, vc,
)
).WithVMQueryWhitelist(queryWhitelist)

// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
Expand Down
Loading