package
0.0.0-20210705073534-e0ee87b6fbcc
Repository: https://github.com/eosspark/eos-go.git
Documentation: pkg.go.dev
# README
wasmgo
Fork from https://github.com/go-interpreter/wagon Fork from https://github.com/perlin-network/life
NOTE: wasmgo
requires Go >= 1.9.x
.
examples
package main
import (
"github.com/eosspark/eos-go/chain"
"github.com/eosspark/eos-go/chain/types"
"github.com/eosspark/eos-go/common"
"github.com/eosspark/eos-go/crypto"
"github.com/eosspark/eos-go/crypto/rlp"
"github.com/eosspark/eos-go/wasmgo"
"io/ioutil"
"log"
)
func main() {
name := "hello.wasm"
code, err := ioutil.ReadFile(name)
if err != nil {
log.Fatal(err)
}
wasmgo := wasmgo.NewWasmGo()
param, _ := rlp.EncodeToBytes(common.N("walker")) //[]byte{0x00, 0x00, 0x00, 0x00, 0x5c, 0x05, 0xa3, 0xe1}
applyContext := &chain.ApplyContext{
Receiver: common.N("hello"),
Act: &types.Action{
Account: common.N("hello"),
Name: common.N("hi"),
Data: param,
},
}
codeVersion := crypto.NewSha256Byte([]byte(code))
wasmgo.Apply(codeVersion, code, applyContext)
//"hello, walker"
//fmt.Println(applyContext.PendingConsoleOutput)
}
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewVirtualMachine instantiates a virtual machine for a given WebAssembly module, with specific execution options specified under a VMConfig, and a WebAssembly module import resolver.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
DefaultCallStackSize is the default call stack size.
DefaultPageSize is the linear memory page size.
JITCodeSizeThreshold is the lower-bound code size threshold for the JIT compiler.
nested calls.
bytes 20 * 1024 *1024.
bytes.
bytes.
bytes.
bytes.
elements.
elements.
bytes.
# Variables
LE is a simple alias to `binary.LittleEndian`.
# Structs
Frame represents a call frame.
NopResolver is a nil WebAssembly module import resolver.
Resolver defines imports for WebAssembly modules ran in Life.
VirtualMachine is a WebAssembly execution environment.
VMConfig denotes a set of options passed to a single VirtualMachine insta.ce.
No description provided by the author
# Interfaces
No description provided by the author
ImportResolver is an interface for allowing one to define imports to WebAssembly modules ran under a single VirtualMachine instance.
# Type aliases
FunctionImport represents the function import type.