common210

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGas = uint64(100000)

DefaultGas comment at next version

Variables

View Source
var (
	// ErrContractIdIsNil err msg
	ErrContractIdIsNil = errors.New("the contractId is empty")
	// ErrContractNotFound err msg
	ErrContractNotFound = errors.New("the contractName is not exist")
	// ErrTxTypeNotSupport err msg
	ErrTxTypeNotSupport = errors.New("the txType does not support")
	// ErrMethodNotFound err msg
	ErrMethodNotFound = errors.New("the method does not found")
	// ErrParamsEmpty err msg
	ErrParamsEmpty = errors.New("the params is empty")
	// ErrContractName err msg
	ErrContractName = errors.New("the contractName is error")
	// ErrOutOfRange err msg
	ErrOutOfRange = errors.New("out of range")
	// ErrParams err msg
	ErrParams = errors.New("params is error")
	// ErrSequence err msg
	ErrSequence = errors.New("sequence is error")
	// ErrUnmarshalFailed err msg
	ErrUnmarshalFailed = errors.New("unmarshal is error")
)

Functions

func GetGas

func GetGas(contractName, method string, defaultGas uint64) uint64

GetGas comment at next version

func ResultBytesAndError

func ResultBytesAndError(returnResult []byte, err error) *common.ContractResult

ResultBytesAndError comment at next version

func ResultError

func ResultError(err error) *common.ContractResult

ResultError comment at next version

func ResultErrorWithGasUsed

func ResultErrorWithGasUsed(err error, gas uint64) *common.ContractResult

ResultErrorWithGasUsed comment at next version

func ResultJson

func ResultJson(obj interface{}) (*common.ContractResult, error)

ResultJson comment at next version

func ResultSuccess

func ResultSuccess(result []byte, gas uint64) *common.ContractResult

ResultSuccess comment at next version

func WrapResultFunc

func WrapResultFunc(f func(txSimContext protocol.TxSimContext, parameters map[string][]byte) ([]byte, error)) func(
	txSimContext protocol.TxSimContext, parameters map[string][]byte) *common.ContractResult

WrapResultFunc 包装原有的返回[]byte的函数,改为返回ContractResult的函数

Types

type Contract

type Contract interface {
	GetMethod(methodName string) ContractFunc
}

Contract define native Contract interface

type ContractFunc

type ContractFunc func(context protocol.TxSimContext, params map[string][]byte) *common.ContractResult

ContractFunc comment at next version

Jump to

Keyboard shortcuts

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