Documentation ¶
Index ¶
- Constants
- Variables
- func ErrInvalidExpr(msg string) error
- func ErrInvalidPkgPath(msg string) error
- func ErrInvalidStmt(msg string) error
- func ErrPkgAlreadyExists(msg string) error
- func ErrTypeCheck(err error) error
- func ErrUnauthorizedUser(msg string) error
- func NewHandler(vm *VMKeeper) vmHandler
- func RegisterInvariants(ir sdk.InvariantRegistry, vmk VMKeeper)
- type FunctionSignature
- type FunctionSignatures
- type InvalidExprError
- type InvalidPkgPathError
- type InvalidStmtError
- type MsgAddPackage
- type MsgCall
- type MsgRun
- type NamedType
- type PkgExistError
- type SDKBanker
- func (bnk *SDKBanker) GetCoins(b32addr crypto.Bech32Address) (dst std.Coins)
- func (bnk *SDKBanker) IssueCoin(b32addr crypto.Bech32Address, denom string, amount int64)
- func (bnk *SDKBanker) RemoveCoin(b32addr crypto.Bech32Address, denom string, amount int64)
- func (bnk *SDKBanker) SendCoins(b32from, b32to crypto.Bech32Address, amt std.Coins)
- func (bnk *SDKBanker) TotalCoin(denom string) int64
- type SDKParams
- type TypeCheckError
- type UnauthorizedUserError
- type VMKeeper
- func (vm *VMKeeper) AddPackage(ctx sdk.Context, msg MsgAddPackage) (err error)
- func (vm *VMKeeper) Call(ctx sdk.Context, msg MsgCall) (res string, err error)
- func (vm *VMKeeper) CommitGnoTransactionStore(ctx sdk.Context)
- func (vm *VMKeeper) Initialize(logger *slog.Logger, ms store.MultiStore)
- func (vm *VMKeeper) LoadStdlib(ctx sdk.Context, stdlibDir string)
- func (vm *VMKeeper) LoadStdlibCached(ctx sdk.Context, stdlibDir string)
- func (vm *VMKeeper) MakeGnoTransactionStore(ctx sdk.Context) sdk.Context
- func (vm *VMKeeper) QueryEval(ctx sdk.Context, pkgPath string, expr string) (res string, err error)
- func (vm *VMKeeper) QueryEvalString(ctx sdk.Context, pkgPath string, expr string) (res string, err error)
- func (vm *VMKeeper) QueryFile(ctx sdk.Context, filepath string) (res string, err error)
- func (vm *VMKeeper) QueryFuncs(ctx sdk.Context, pkgPath string) (fsigs FunctionSignatures, err error)
- func (vm *VMKeeper) Run(ctx sdk.Context, msg MsgRun) (res string, err error)
- type VMKeeperI
Constants ¶
const ( ModuleName = "vm" RouterKey = ModuleName )
const ( QueryPackage = "package" QueryStore = "store" QueryRender = "qrender" QueryFuncs = "qfuncs" QueryEval = "qeval" QueryFile = "qfile" )
query paths
Variables ¶
var Package = amino.RegisterPackage(amino.NewPackage( "github.com/gnolang/gno/gno.land/pkg/sdk/vm", "vm", amino.GetCallersDirname(), ).WithDependencies( std.Package, gnovm.Package, ).WithTypes( MsgCall{}, "m_call", MsgRun{}, "m_run", MsgAddPackage{}, "m_addpkg", InvalidPkgPathError{}, "InvalidPkgPathError", PkgExistError{}, "PkgExistError", InvalidStmtError{}, "InvalidStmtError", InvalidExprError{}, "InvalidExprError", TypeCheckError{}, "TypeCheckError", UnauthorizedUserError{}, "UnauthorizedUserError", ))
Functions ¶
func ErrInvalidExpr ¶
func ErrInvalidPkgPath ¶
func ErrInvalidStmt ¶
func ErrPkgAlreadyExists ¶
func ErrTypeCheck ¶
func ErrUnauthorizedUser ¶
func NewHandler ¶
func NewHandler(vm *VMKeeper) vmHandler
NewHandler returns a handler for "vm" type messages.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, vmk VMKeeper)
RegisterInvariants registers the vm module invariants
Types ¶
type FunctionSignature ¶
Public facing function signatures. See convertArgToGno() for supported types.
type FunctionSignatures ¶
type FunctionSignatures []FunctionSignature
func (FunctionSignatures) JSON ¶
func (fsigs FunctionSignatures) JSON() string
type InvalidExprError ¶
type InvalidExprError struct {
// contains filtered or unexported fields
}
declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.
func (InvalidExprError) AssertABCIError ¶
func (InvalidExprError) AssertABCIError()
func (InvalidExprError) Error ¶
func (e InvalidExprError) Error() string
type InvalidPkgPathError ¶
type InvalidPkgPathError struct {
// contains filtered or unexported fields
}
declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.
func (InvalidPkgPathError) AssertABCIError ¶
func (InvalidPkgPathError) AssertABCIError()
func (InvalidPkgPathError) Error ¶
func (e InvalidPkgPathError) Error() string
type InvalidStmtError ¶
type InvalidStmtError struct {
// contains filtered or unexported fields
}
declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.
func (InvalidStmtError) AssertABCIError ¶
func (InvalidStmtError) AssertABCIError()
func (InvalidStmtError) Error ¶
func (e InvalidStmtError) Error() string
type MsgAddPackage ¶
type MsgAddPackage struct { Creator crypto.Address `json:"creator" yaml:"creator"` Package *gnovm.MemPackage `json:"package" yaml:"package"` Deposit std.Coins `json:"deposit" yaml:"deposit"` }
MsgAddPackage - create and initialize new package
func NewMsgAddPackage ¶
NewMsgAddPackage - upload a package with files.
func (MsgAddPackage) GetReceived ¶
func (msg MsgAddPackage) GetReceived() std.Coins
Implements ReceiveMsg.
func (MsgAddPackage) GetSigners ¶
func (msg MsgAddPackage) GetSigners() []crypto.Address
Implements Msg.
type MsgCall ¶
type MsgCall struct { Caller crypto.Address `json:"caller" yaml:"caller"` Send std.Coins `json:"send" yaml:"send"` PkgPath string `json:"pkg_path" yaml:"pkg_path"` Func string `json:"func" yaml:"func"` Args []string `json:"args" yaml:"args"` }
MsgCall - executes a Gno statement.
func NewMsgCall ¶
type MsgRun ¶
type MsgRun struct { Caller crypto.Address `json:"caller" yaml:"caller"` Send std.Coins `json:"send" yaml:"send"` Package *gnovm.MemPackage `json:"package" yaml:"package"` }
MsgRun - executes arbitrary Gno code.
type PkgExistError ¶
type PkgExistError struct {
// contains filtered or unexported fields
}
declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.
func (PkgExistError) AssertABCIError ¶
func (PkgExistError) AssertABCIError()
func (PkgExistError) Error ¶
func (e PkgExistError) Error() string
type SDKBanker ¶
type SDKBanker struct {
// contains filtered or unexported fields
}
func (*SDKBanker) GetCoins ¶
func (bnk *SDKBanker) GetCoins(b32addr crypto.Bech32Address) (dst std.Coins)
func (*SDKBanker) IssueCoin ¶
func (bnk *SDKBanker) IssueCoin(b32addr crypto.Bech32Address, denom string, amount int64)
func (*SDKBanker) RemoveCoin ¶
func (bnk *SDKBanker) RemoveCoin(b32addr crypto.Bech32Address, denom string, amount int64)
type TypeCheckError ¶
type TypeCheckError struct { Errors []string `json:"errors"` // contains filtered or unexported fields }
declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.
func (TypeCheckError) AssertABCIError ¶
func (TypeCheckError) AssertABCIError()
func (TypeCheckError) Error ¶
func (e TypeCheckError) Error() string
type UnauthorizedUserError ¶
type UnauthorizedUserError struct {
// contains filtered or unexported fields
}
declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.
func (UnauthorizedUserError) AssertABCIError ¶
func (UnauthorizedUserError) AssertABCIError()
func (UnauthorizedUserError) Error ¶
func (e UnauthorizedUserError) Error() string
type VMKeeper ¶
type VMKeeper struct {
// contains filtered or unexported fields
}
VMKeeper holds all package code and store state.
func NewVMKeeper ¶
func NewVMKeeper( baseKey store.StoreKey, iavlKey store.StoreKey, acck auth.AccountKeeper, bank bank.BankKeeper, prmk params.ParamsKeeper, ) *VMKeeper
NewVMKeeper returns a new VMKeeper.
func (*VMKeeper) AddPackage ¶
func (vm *VMKeeper) AddPackage(ctx sdk.Context, msg MsgAddPackage) (err error)
AddPackage adds a package with given fileset.
func (*VMKeeper) CommitGnoTransactionStore ¶
func (*VMKeeper) Initialize ¶
func (vm *VMKeeper) Initialize( logger *slog.Logger, ms store.MultiStore, )
func (*VMKeeper) LoadStdlib ¶
LoadStdlib loads the Gno standard library into the given store.
func (*VMKeeper) LoadStdlibCached ¶
LoadStdlib loads the Gno standard library into the given store.
func (*VMKeeper) MakeGnoTransactionStore ¶
func (*VMKeeper) QueryEval ¶
QueryEval evaluates a gno expression (readonly, for ABCI queries). TODO: modify query protocol to allow MsgEval. TODO: then, rename to "Eval".
func (*VMKeeper) QueryEvalString ¶
func (vm *VMKeeper) QueryEvalString(ctx sdk.Context, pkgPath string, expr string) (res string, err error)
QueryEvalString evaluates a gno expression (readonly, for ABCI queries). The result is expected to be a single string (not a tuple). TODO: modify query protocol to allow MsgEval. TODO: then, rename to "EvalString".
func (*VMKeeper) QueryFuncs ¶
func (vm *VMKeeper) QueryFuncs(ctx sdk.Context, pkgPath string) (fsigs FunctionSignatures, err error)
QueryFuncs returns public facing function signatures.
type VMKeeperI ¶
type VMKeeperI interface { AddPackage(ctx sdk.Context, msg MsgAddPackage) error Call(ctx sdk.Context, msg MsgCall) (res string, err error) QueryEval(ctx sdk.Context, pkgPath string, expr string) (res string, err error) Run(ctx sdk.Context, msg MsgRun) (res string, err error) LoadStdlib(ctx sdk.Context, stdlibDir string) LoadStdlibCached(ctx sdk.Context, stdlibDir string) MakeGnoTransactionStore(ctx sdk.Context) sdk.Context CommitGnoTransactionStore(ctx sdk.Context) }
vm.VMKeeperI defines a module interface that supports Gno smart contracts programming (scripting).