wasm

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context represents the context of wasm

func NewContext

func NewContext(tx *pb.Transaction, data *pb.TransactionData, ledger ledger.Ledger, logger logrus.FieldLogger) *Context

NewContext creates a context of wasm instance

func (*Context) Callee

func (ctx *Context) Callee() string

Callee returns the tx callee address

func (*Context) Caller

func (ctx *Context) Caller() string

Caller returns the tx caller address

func (*Context) Logger

func (ctx *Context) Logger() logrus.FieldLogger

Logger returns the log instance

type Contract

type Contract struct {
	// contract byte
	Code []byte

	// contract hash
	Hash types.Hash
}

Contract represents the smart contract structure used in the wasm vm

type Wasm

type Wasm struct {

	// wasm instance
	Instance wasmer.Instance
	// contains filtered or unexported fields
}

Wasm represents the wasm vm in BitXHub

func New

func New(ctx *vm.Context) (*Wasm, error)

New creates a wasm vm instance

func (*Wasm) Run

func (w *Wasm) Run(input []byte) (ret []byte, err error)

Run let the wasm vm excute or deploy the smart contract which depends on whether the callee is empty

func (*Wasm) SetBytes

func (w *Wasm) SetBytes(b []byte) (int32, error)

SetBytes set bytes type arg for wasm

func (*Wasm) SetString

func (w *Wasm) SetString(str string) (int32, error)

SetString set the string type arg for wasm

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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