std

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Package = amino.RegisterPackage(amino.NewPackage(
	"github.com/gnolang/gno/gnovm/stdlibs/std",
	"tm",
	amino.GetCallersDirname(),
).
	WithDependencies(
		abci.Package,
	).
	WithTypes(
		GnoEventAttribute{},
		GnoEvent{},
	))

Functions

func AssertOriginCall

func AssertOriginCall(m *gno.Machine)

func CompactCoins

func CompactCoins(denoms []string, amounts []int64) std.Coins

func ExpandCoins

func ExpandCoins(c std.Coins) (denoms []string, amounts []int64)

func GetChainID

func GetChainID(m *gno.Machine) string

func GetHeight

func GetHeight(m *gno.Machine) int64

func IsOriginCall

func IsOriginCall(m *gno.Machine) bool

func X_assertCallerIsRealm

func X_assertCallerIsRealm(m *gno.Machine)

func X_bankerGetCoins

func X_bankerGetCoins(m *gno.Machine, bt uint8, addr string) (denoms []string, amounts []int64)

func X_bankerIssueCoin

func X_bankerIssueCoin(m *gno.Machine, bt uint8, addr string, denom string, amount int64)

func X_bankerRemoveCoin

func X_bankerRemoveCoin(m *gno.Machine, bt uint8, addr string, denom string, amount int64)

func X_bankerSendCoins

func X_bankerSendCoins(m *gno.Machine, bt uint8, fromS, toS string, denoms []string, amounts []int64)

func X_bankerTotalCoin

func X_bankerTotalCoin(m *gno.Machine, bt uint8, denom string) int64

func X_callerAt

func X_callerAt(m *gno.Machine, n int) string

func X_decodeBech32

func X_decodeBech32(addr string) (prefix string, bytes [20]byte, ok bool)

func X_derivePkgAddr

func X_derivePkgAddr(pkgPath string) string

func X_emit

func X_emit(m *gno.Machine, typ string, attrs []string)

func X_encodeBech32

func X_encodeBech32(prefix string, bytes [20]byte) string

func X_getRealm

func X_getRealm(m *gno.Machine, height int) (address, pkgPath string)

func X_origCaller

func X_origCaller(m *gno.Machine) string

func X_origPkgAddr

func X_origPkgAddr(m *gno.Machine) string

func X_origSend

func X_origSend(m *gno.Machine) (denoms []string, amounts []int64)

func X_setParamBool

func X_setParamBool(m *gno.Machine, key string, val bool)

func X_setParamBytes

func X_setParamBytes(m *gno.Machine, key string, val []byte)

func X_setParamInt64

func X_setParamInt64(m *gno.Machine, key string, val int64)

func X_setParamString

func X_setParamString(m *gno.Machine, key, val string)

func X_setParamUint64

func X_setParamUint64(m *gno.Machine, key string, val uint64)

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

BankerInterface is the interface through which Gno is capable of accessing the blockchain's banker.

The name is what it is to avoid a collision with Gno's Banker, when transpiling.

type ExecContext

type ExecContext struct {
	ChainID       string
	Height        int64
	Timestamp     int64 // seconds
	TimestampNano int64 // nanoseconds, only used for testing.
	OrigCaller    crypto.Bech32Address
	OrigPkgAddr   crypto.Bech32Address
	OrigSend      std.Coins
	OrigSendSpent *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 GnoEvent

type GnoEvent struct {
	Type       string              `json:"type"`
	Attributes []GnoEventAttribute `json:"attrs"`
	PkgPath    string              `json:"pkg_path"`
	Func       string              `json:"func"`
}

func (GnoEvent) AssertABCIEvent

func (e GnoEvent) AssertABCIEvent()

type GnoEventAttribute

type GnoEventAttribute struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

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

ParamsInterface is the interface through which Gno is capable of accessing the blockchain's params.

The name is what it is to avoid a collision with Gno's Params, when transpiling.

Jump to

Keyboard shortcuts

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