Documentation
¶
Index ¶
- Constants
- Variables
- func MustParamInt64(key string, value any) int64
- func MustParamString(key string, value any) string
- func MustParamStrings(key string, value any) []string
- func NewHandler(params ParamsKeeper) paramsHandler
- type DummyKeeper
- type Param
- func (p Param) MarshalAmino() (string, error)
- func (goo Param) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)
- func (p *Param) Parse(entry string) error
- func (goo Param) SizeBinary2(cdc *amino.Codec) (int, error)
- func (p Param) String() string
- func (p *Param) UnmarshalAmino(rep string) error
- func (goo *Param) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error
- func (p Param) ValidateBasic() error
- type ParamfulKeeper
- type ParamsKeeper
- func (pk ParamsKeeper) ForModule(moduleName string) prefixParamsKeeper
- func (pk ParamsKeeper) GetAny(ctx sdk.Context, key string) any
- func (pk ParamsKeeper) GetBool(ctx sdk.Context, key string, ptr *bool) bool
- func (pk ParamsKeeper) GetBytes(ctx sdk.Context, key string, ptr *[]byte) bool
- func (pk ParamsKeeper) GetInt64(ctx sdk.Context, key string, ptr *int64) bool
- func (pk ParamsKeeper) GetRegisteredKeeper(moduleName string) (ParamfulKeeper, bool)
- func (pk ParamsKeeper) GetString(ctx sdk.Context, key string, ptr *string) bool
- func (pk ParamsKeeper) GetStrings(ctx sdk.Context, key string, ptr *[]string) bool
- func (pk ParamsKeeper) GetStruct(ctx sdk.Context, key string, strctPtr any)
- func (pk ParamsKeeper) GetUint64(ctx sdk.Context, key string, ptr *uint64) bool
- func (pk ParamsKeeper) Has(ctx sdk.Context, key string) bool
- func (pk ParamsKeeper) IsRegistered(moduleName string) bool
- func (pk ParamsKeeper) Logger(ctx sdk.Context) *slog.Logger
- func (pk ParamsKeeper) ModuleExists(moduleName string) bool
- func (pk ParamsKeeper) Register(moduleName string, pmk ParamfulKeeper)
- func (pk ParamsKeeper) SetAny(ctx sdk.Context, key string, value any)
- func (pk ParamsKeeper) SetBool(ctx sdk.Context, key string, value bool) int
- func (pk ParamsKeeper) SetBytes(ctx sdk.Context, key string, value []byte) int
- func (pk ParamsKeeper) SetInt64(ctx sdk.Context, key string, value int64) int
- func (pk ParamsKeeper) SetString(ctx sdk.Context, key, value string) int
- func (pk ParamsKeeper) SetStrings(ctx sdk.Context, key string, value []string) int
- func (pk ParamsKeeper) SetStruct(ctx sdk.Context, key string, strct any)
- func (pk ParamsKeeper) SetUint64(ctx sdk.Context, key string, value uint64) int
- type ParamsKeeperI
Constants ¶
View Source
const ( ModuleName = "params" // StoreKey = ModuleName StoreKeyPrefix = "/pv/" )
View Source
const ( ParamTypeString = "string" ParamTypeInt64 = "int64" ParamTypeUint64 = "uint64" ParamTypeBool = "bool" ParamTypeBytes = "bytes" ParamTypeStrings = "strings" )
Variables ¶
View Source
var Package = amino.RegisterPackage(amino.NewPackage( "github.com/gnolang/gno/tm2/pkg/sdk/params", "params", amino.GetCallersDirname(), ).WithDependencies().WithTypes( Param{}, "Param", ))
Functions ¶
func MustParamInt64 ¶
MustParamInt64 asserts value is an int64 and returns it. Panics with a descriptive message if the type assertion fails.
func MustParamString ¶
MustParamString asserts value is a string and returns it. Panics with a descriptive message if the type assertion fails.
func MustParamStrings ¶
MustParamStrings asserts value is a []string and returns it. Panics with a descriptive message if the type assertion fails.
func NewHandler ¶
func NewHandler(params ParamsKeeper) paramsHandler
Types ¶
type DummyKeeper ¶
type DummyKeeper struct {
// contains filtered or unexported fields
}
func NewDummyKeeper ¶
func NewDummyKeeper(prmk ParamsKeeperI) DummyKeeper
func (DummyKeeper) WillSetParam ¶
func (dk DummyKeeper) WillSetParam(ctx sdk.Context, key string, value any)
type Param ¶
type Param struct {
Key string `json:"key" yaml:"key"`
Type string `json:"type" yaml:"type"`
Value any `json:"value" yaml:"value"`
}
func (Param) MarshalAmino ¶
func (Param) MarshalBinary2 ¶
func (*Param) UnmarshalAmino ¶
func (*Param) UnmarshalBinary2 ¶
func (Param) ValidateBasic ¶
type ParamfulKeeper ¶
type ParamsKeeper ¶
type ParamsKeeper struct {
// contains filtered or unexported fields
}
global paramstore Keeper.
func NewParamsKeeper ¶
func NewParamsKeeper(key store.StoreKey) ParamsKeeper
NewParamsKeeper returns a new ParamsKeeper.
func (ParamsKeeper) ForModule ¶
func (pk ParamsKeeper) ForModule(moduleName string) prefixParamsKeeper
func (ParamsKeeper) GetRegisteredKeeper ¶
func (pk ParamsKeeper) GetRegisteredKeeper(moduleName string) (ParamfulKeeper, bool)
func (ParamsKeeper) GetStrings ¶
func (ParamsKeeper) GetStruct ¶
func (pk ParamsKeeper) GetStruct(ctx sdk.Context, key string, strctPtr any)
func (ParamsKeeper) IsRegistered ¶
func (pk ParamsKeeper) IsRegistered(moduleName string) bool
func (ParamsKeeper) Logger ¶
func (pk ParamsKeeper) Logger(ctx sdk.Context) *slog.Logger
XXX: why do we expose this?
func (ParamsKeeper) ModuleExists ¶
func (pk ParamsKeeper) ModuleExists(moduleName string) bool
func (ParamsKeeper) Register ¶
func (pk ParamsKeeper) Register(moduleName string, pmk ParamfulKeeper)
func (ParamsKeeper) SetString ¶
func (pk ParamsKeeper) SetString(ctx sdk.Context, key, value string) int
func (ParamsKeeper) SetStrings ¶
type ParamsKeeperI ¶
type ParamsKeeperI interface {
// GetXxx writes the stored value (if any) into *ptr and returns
// whether the key existed. A return of false leaves *ptr at its
// zero value, distinguishing "never set" from "set to zero" —
// which the in-memory backed types alone could not.
GetString(ctx sdk.Context, key string, ptr *string) bool
GetInt64(ctx sdk.Context, key string, ptr *int64) bool
GetUint64(ctx sdk.Context, key string, ptr *uint64) bool
GetBool(ctx sdk.Context, key string, ptr *bool) bool
GetBytes(ctx sdk.Context, key string, ptr *[]byte) bool
GetStrings(ctx sdk.Context, key string, ptr *[]string) bool
// SetXxx writes value under key and returns the byte delta
// (newSize - oldSize, with key bytes added on first-create or
// subtracted on delete). Callers that need the delta for storage-
// deposit accounting use the return value; callers that don't can
// ignore it (Go discards return values of expression statements).
// The internal Get to resolve oldSize is unmetered — its leaf-find
// is amortized into the Set's set-read-depth charge that fires at
// commit time. Saves ~ReadCostFlat × set-read-depth gas vs. callers
// that did `GetBytes; SetBytes` for the same intent.
SetString(ctx sdk.Context, key string, value string) int
SetInt64(ctx sdk.Context, key string, value int64) int
SetUint64(ctx sdk.Context, key string, value uint64) int
SetBool(ctx sdk.Context, key string, value bool) int
SetBytes(ctx sdk.Context, key string, value []byte) int
SetStrings(ctx sdk.Context, key string, value []string) int
Has(ctx sdk.Context, key string) bool
GetStruct(ctx sdk.Context, key string, strctPtr any)
SetStruct(ctx sdk.Context, key string, strct any)
// NOTE: GetAny and SetAny don't work on structs.
GetAny(ctx sdk.Context, key string) any
SetAny(ctx sdk.Context, key string, value any)
}
Click to show internal directories.
Click to hide internal directories.