Documentation ¶
Index ¶
- Constants
- Variables
- func GetGas(contractName, method string, defaultGas uint64) uint64
- func ResultBytesAndError(returnResult []byte, err error) *common.ContractResult
- func ResultError(err error) *common.ContractResult
- func ResultErrorWithGasUsed(err error, gas uint64) *common.ContractResult
- func ResultJson(obj interface{}) (*common.ContractResult, error)
- func ResultSuccess(result []byte, gas uint64) *common.ContractResult
- func WrapResultFunc(...) ...
- type Contract
- type ContractFunc
Constants ¶
View Source
const DefaultGas = uint64(100000)
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 ResultBytesAndError ¶ added in v2.2.0
func ResultBytesAndError(returnResult []byte, err error) *common.ContractResult
func ResultError ¶ added in v2.2.0
func ResultError(err error) *common.ContractResult
func ResultErrorWithGasUsed ¶ added in v2.2.0
func ResultErrorWithGasUsed(err error, gas uint64) *common.ContractResult
func ResultJson ¶ added in v2.2.0
func ResultJson(obj interface{}) (*common.ContractResult, error)
func ResultSuccess ¶ added in v2.2.0
func ResultSuccess(result []byte, gas uint64) *common.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
Click to show internal directories.
Click to hide internal directories.