Skip to content

Commit

Permalink
chore: add ParamsQuerier interface
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Dec 12, 2024
1 parent 4632c74 commit 9535023
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/client/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,18 @@ type HistoricalQueryCache[T any] interface {
// SetAtHeight adds or updates a value at a specific height
SetAtHeight(key string, value T, height int64) error
}

// ParamsQuerier represents a generic querier for module parameters.
// This interface should be implemented by any module-specific querier
// that needs to access and cache on-chain parameters.
//
// DEV_NOTE: Can't use cosmostypes.Msg instead of any because M
// would be a pointer but Keeper#GetParams() returns a value. 🙄
type ParamsQuerier[P any] interface {
// GetParams queries the chain for the current module parameters, where
// P is the params type of a given module (e.g. sharedtypes.Params).
GetParams(ctx context.Context) (P, error)
// GetParamsAtHeight returns the parameters as they were at the specified
// height, where M is the params type of a given module (e.g. sharedtypes.Params).
GetParamsAtHeight(ctx context.Context, height int64) (P, error)
}

0 comments on commit 9535023

Please sign in to comment.