tvm

package
v0.0.0-...-a9c7d36 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 15 Imported by: 0

README

Go binding for C++ TVM library.

This library implements bindings for interacting with C++ tvm library.

TVM description you can find here:

Usage

Example

How to link or recompile shared library you can find in /lib directory depending on your OS.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetVerbosityLevel

func SetVerbosityLevel(level int) error

SetVerbosityLevel sets verbosity level of TVM emulator. This is a global setting that affects all emulators. verbosity level (0 - never, 1 - error, 2 - warning, 3 - info, 4 - debug)

Types

type Config

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

func CreateConfig

func CreateConfig(configRaw string) (*Config, error)

type Emulator

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

func NewEmulator

func NewEmulator(code, data, config *boc.Cell, opts ...Option) (*Emulator, error)

NewEmulator Verbosity level of VM log. 0 - log truncated to last 256 characters. 1 - unlimited length log. 2 - for each command prints its cell hash and offset. 3 - for each command log prints all stack values.

func NewEmulatorFromBOCsBase64

func NewEmulatorFromBOCsBase64(code, data, config string, opts ...Option) (*Emulator, error)

NewEmulatorFromBOCsBase64 Verbosity level of VM log. 0 - log truncated to last 256 characters. 1 - unlimited length log. 2 - for each command prints its cell hash and offset. 3 - for each command log prints all stack values.

func (*Emulator) RunSmcMethod

func (e *Emulator) RunSmcMethod(ctx context.Context, accountId ton.AccountID, method string, params tlb.VmStack) (uint32, tlb.VmStack, error)

func (*Emulator) RunSmcMethodByID

func (e *Emulator) RunSmcMethodByID(ctx context.Context, accountId ton.AccountID, methodID int, params tlb.VmStack) (uint32, tlb.VmStack, error)

func (*Emulator) SetBalance

func (e *Emulator) SetBalance(balance int64)

func (*Emulator) SetGasLimit

func (e *Emulator) SetGasLimit(gasLimit int64) error

func (*Emulator) SetLibs

func (e *Emulator) SetLibs(libs *boc.Cell) error

type Option

type Option func(o *Options)

func WithBalance

func WithBalance(balance int64) Option

func WithConfig

func WithConfig(config *Config) Option

func WithIgnoreLibraryCells

func WithIgnoreLibraryCells(ignore bool) Option

func WithLazyC7Optimization

func WithLazyC7Optimization() Option

WithLazyC7Optimization allows to make two attempts to execute a get method. At the first attempt an emulator invokes a get method without C7. This works for most get methods and significantly decreases the execution time. If the first attempt fails, an emulator invokes the same get method again but with configured C7.

func WithLibrariesBase64

func WithLibrariesBase64(libraries string) Option

WithLibrariesBase64 provides a list of available libraries as a base64 string. Take a look at LibrariesToBase64() to convert a map with libraries to such a string.

func WithLibraryResolver

func WithLibraryResolver(resolver libResolver) Option

func WithVerbosityLevel

func WithVerbosityLevel(level txemulator.VerbosityLevel) Option

WithVerbosityLevel sets verbosity level of a TVM emulator instance. TODO: find a way to expose logs to the caller.

type Options

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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