execctx

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentRealm

func CurrentRealm(m *gno.Machine) (address, pkgPath string)

CurrentRealm retrieves the current realm's address and pkgPath. It's not a native binding; but is used as a helper function here and elsewhere to clarify usage.

func GetRealm

func GetRealm(m *gno.Machine, height int) (addr, pkgPath string)

Types

type BankerInterface

type BankerInterface interface {
	GetCoins(addr crypto.Bech32Address) (dst std.Coins)
	SendCoins(from, to crypto.Bech32Address, amt std.Coins)
	TotalCoin(denom string) int64
	IssueCoin(addr crypto.Bech32Address, denom string, amount int64)
	RemoveCoin(addr crypto.Bech32Address, denom string, amount int64)
}

type ExecContext

type ExecContext struct {
	ChainID         string
	ChainDomain     string
	Height          int64
	Timestamp       int64 // seconds
	TimestampNano   int64 // nanoseconds, only used for testing.
	OriginCaller    crypto.Bech32Address
	OriginSend      std.Coins
	OriginSendSpent *std.Coins // mutable
	Banker          BankerInterface
	Params          ParamsInterface
	EventLogger     *sdk.EventLogger
}

func GetContext

func GetContext(m *gno.Machine) ExecContext

GetContext returns the context from the Gno machine.

func (ExecContext) GetExecContext

func (e ExecContext) GetExecContext() ExecContext

GetContext returns the execution context. This is used to allow extending the exec context using interfaces, for instance when testing.

type ExecContexter

type ExecContexter interface {
	GetExecContext() ExecContext
}

ExecContexter is a type capable of returning the parent ExecContext. When using these standard libraries, m.Context should always implement this interface. This can be obtained by embedding ExecContext.

type ParamsInterface

type ParamsInterface interface {
	SetString(key, val string)
	SetBool(key string, val bool)
	SetInt64(key string, val int64)
	SetUint64(key string, val uint64)
	SetBytes(key string, val []byte)
	SetStrings(key string, val []string)
	UpdateStrings(key string, val []string, add bool)
}

Jump to

Keyboard shortcuts

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