std

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 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_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)

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.
	Msg           sdk.Msg
	OrigCaller    crypto.Bech32Address
	OrigPkgAddr   crypto.Bech32Address
	OrigSend      std.Coins
	OrigSendSpent *std.Coins // mutable
	Banker        BankerInterface
	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"`
}

Jump to

Keyboard shortcuts

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