params

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2026 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

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

func MustParamInt64(key string, value any) int64

MustParamInt64 asserts value is an int64 and returns it. Panics with a descriptive message if the type assertion fails.

func MustParamString

func MustParamString(key string, value any) string

MustParamString asserts value is a string and returns it. Panics with a descriptive message if the type assertion fails.

func MustParamStrings

func MustParamStrings(key string, value any) []string

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 NewParam

func NewParam(key string, value any) Param

NOTE: do not support structs here.

func (Param) MarshalAmino

func (p Param) MarshalAmino() (string, error)

func (Param) MarshalBinary2

func (goo Param) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (*Param) Parse

func (p *Param) Parse(entry string) error

As would appear in genesis.json.

func (Param) SizeBinary2

func (goo Param) SizeBinary2(cdc *amino.Codec) (int, error)

func (Param) String

func (p Param) String() string

func (*Param) UnmarshalAmino

func (p *Param) UnmarshalAmino(rep string) error

func (*Param) UnmarshalBinary2

func (goo *Param) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

func (Param) ValidateBasic

func (p Param) ValidateBasic() error

type ParamfulKeeper

type ParamfulKeeper interface {
	WillSetParam(ctx sdk.Context, key string, value any)
}

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) GetAny

func (pk ParamsKeeper) GetAny(ctx sdk.Context, key string) any

func (ParamsKeeper) GetBool

func (pk ParamsKeeper) GetBool(ctx sdk.Context, key string, ptr *bool) bool

func (ParamsKeeper) GetBytes

func (pk ParamsKeeper) GetBytes(ctx sdk.Context, key string, ptr *[]byte) bool

func (ParamsKeeper) GetInt64

func (pk ParamsKeeper) GetInt64(ctx sdk.Context, key string, ptr *int64) bool

func (ParamsKeeper) GetRegisteredKeeper

func (pk ParamsKeeper) GetRegisteredKeeper(moduleName string) (ParamfulKeeper, bool)

func (ParamsKeeper) GetString

func (pk ParamsKeeper) GetString(ctx sdk.Context, key string, ptr *string) bool

func (ParamsKeeper) GetStrings

func (pk ParamsKeeper) GetStrings(ctx sdk.Context, key string, ptr *[]string) bool

func (ParamsKeeper) GetStruct

func (pk ParamsKeeper) GetStruct(ctx sdk.Context, key string, strctPtr any)

func (ParamsKeeper) GetUint64

func (pk ParamsKeeper) GetUint64(ctx sdk.Context, key string, ptr *uint64) bool

func (ParamsKeeper) Has

func (pk ParamsKeeper) Has(ctx sdk.Context, key string) bool

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) SetAny

func (pk ParamsKeeper) SetAny(ctx sdk.Context, key string, value any)

func (ParamsKeeper) SetBool

func (pk ParamsKeeper) SetBool(ctx sdk.Context, key string, value bool)

func (ParamsKeeper) SetBytes

func (pk ParamsKeeper) SetBytes(ctx sdk.Context, key string, value []byte)

func (ParamsKeeper) SetInt64

func (pk ParamsKeeper) SetInt64(ctx sdk.Context, key string, value int64)

func (ParamsKeeper) SetString

func (pk ParamsKeeper) SetString(ctx sdk.Context, key, value string)

func (ParamsKeeper) SetStrings

func (pk ParamsKeeper) SetStrings(ctx sdk.Context, key string, value []string)

func (ParamsKeeper) SetStruct

func (pk ParamsKeeper) SetStruct(ctx sdk.Context, key string, strct any)

func (ParamsKeeper) SetUint64

func (pk ParamsKeeper) SetUint64(ctx sdk.Context, key string, value uint64)

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

	SetString(ctx sdk.Context, key string, value string)
	SetInt64(ctx sdk.Context, key string, value int64)
	SetUint64(ctx sdk.Context, key string, value uint64)
	SetBool(ctx sdk.Context, key string, value bool)
	SetBytes(ctx sdk.Context, key string, value []byte)
	SetStrings(ctx sdk.Context, key string, value []string)

	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)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL