Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertRlpBytesTo(input []byte, targetType string) interface{}
- func EventParsing(logs RecptLogs, abiBytesArr [][]byte, fn eventParsingFunc) []string
- func EventParsingV2(logs RecptLogs, events []*FuncDesc, fn eventParsingFuncV2) []string
- func EvmEventParsingPerLog(eLog *Log, abiBytes []byte) string
- func EvmEventParsingPerLogV2(eLog *Log, events []*FuncDesc) string
- func EvmStringToEncodeByte(abiFunc *FuncDesc, funcParams []string) ([]byte, []string, error)
- func GenFuncSig(input abi.ArgumentMarshaling) string
- func GenUnpackArgs(data []abi.ArgumentMarshaling) (arguments abi.Arguments)
- func IsWasmContract(codeBytes []byte) bool
- func RlpBytesToBool(b []byte) bool
- func RlpBytesToUint16(b []byte) uint16
- func RlpBytesToUint32(b []byte) uint32
- func RlpBytesToUint64(b []byte) uint64
- func UnpackError(res []byte) (string, error)
- func WasmEventParsingPerLog(eLog *Log, abiBytes []byte) string
- func WasmEventParsingPerLogV2(eLog *Log, events []*FuncDesc) string
- type ContractAbi
- type ContractDataGen
- func (dataGen *ContractDataGen) CombineData() (string, error)
- func (dataGen *ContractDataGen) GetContractDataDen() *ContractDataGen
- func (dataGen *ContractDataGen) GetIsWrite() bool
- func (dataGen *ContractDataGen) GetMethodAbi() *FuncDesc
- func (dataGen *ContractDataGen) ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{}
- func (dataGen *ContractDataGen) ReceiptParsing(receipt *Receipt) *ReceiptParsingReturn
- func (dataGen *ContractDataGen) SetInterpreter(vm, name string, txType uint64)
- type ContractReturn
- type DeployDataGen
- func (dataGen DeployDataGen) CombineData() (string, error)
- func (dataGen *DeployDataGen) GetContractDataDen() *ContractDataGen
- func (dataGen *DeployDataGen) GetIsWrite() bool
- func (dataGen *DeployDataGen) ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{}
- func (dataGen *DeployDataGen) ReceiptParsing(receipt *Receipt) *ReceiptParsingReturn
- func (dataGen *DeployDataGen) SetInterpreter(vm string, abiBytes, codeBytes []byte, consParams []interface{}, ...)
- type EvmContractInterpreter
- func (i EvmContractInterpreter) ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{}
- func (i EvmContractInterpreter) ReceiptParsing(receipt *Receipt, abiBytes []byte) *ReceiptParsingReturn
- func (i EvmContractInterpreter) ReceiptParsingV2(receipt *Receipt, conAbi ContractAbi) *ReceiptParsingReturn
- type EvmDeployInterpreter
- type FuncDesc
- type Log
- type MsgDataGen
- type RawData
- type Receipt
- type ReceiptParsingReturn
- type RecptLogs
- type TxParams
- type WasmContractInterpreter
- func (i WasmContractInterpreter) ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{}
- func (i WasmContractInterpreter) ReceiptParsing(receipt *Receipt, abiBytes []byte) *ReceiptParsingReturn
- func (i WasmContractInterpreter) ReceiptParsingV2(receipt *Receipt, conAbi ContractAbi) *ReceiptParsingReturn
- type WasmDeployInterpreter
Constants ¶
const ( TxReceiptSuccessMsg = "Operation Succeeded" TxReceiptFailureMsg = "Operation Failed" )
Variables ¶
var Bytes2X_CMD = map[string]interface{}{ "string": byteutil.BytesToString, "uint16": RlpBytesToUint16, "uint32": RlpBytesToUint32, "uint64": RlpBytesToUint64, "int16": RlpBytesToUint16, "int32": RlpBytesToUint32, "int64": RlpBytesToUint64, "bool": RlpBytesToBool, }
Functions ¶
func ConvertRlpBytesTo ¶
func EventParsing ¶
func EventParsingV2 ¶
func EvmEventParsingPerLog ¶
================================== EVM ========================
func EvmEventParsingPerLogV2 ¶
------------------------------ EVM --------------------------------------
func EvmStringToEncodeByte ¶
EvmStringToEncodeByte if the funcParams is nil, the return byte is nil
func GenFuncSig ¶
func GenFuncSig(input abi.ArgumentMarshaling) string
func GenUnpackArgs ¶
func GenUnpackArgs(data []abi.ArgumentMarshaling) (arguments abi.Arguments)
func IsWasmContract ¶
IsWasmContract judge whether the bytes satisfy the code format of wasm virtual machine
func RlpBytesToBool ¶
func RlpBytesToUint16 ¶
func RlpBytesToUint32 ¶
func RlpBytesToUint64 ¶
func UnpackError ¶
func WasmEventParsingPerLog ¶
func WasmEventParsingPerLogV2 ¶
--------------------------- WASM ------------------------------------
Types ¶
type ContractAbi ¶
type ContractAbi []*FuncDesc
func ParseAbiFromJson ¶
func ParseAbiFromJson(abiBytes []byte) (ContractAbi, error)
ParseAbiFromJson parses the application binary interface(abi) files to []FuncDesc object array
func (ContractAbi) GetConstructor ¶
func (funcs ContractAbi) GetConstructor() *FuncDesc
func (ContractAbi) GetEvents ¶
func (funcs ContractAbi) GetEvents() []*FuncDesc
func (ContractAbi) GetFuncFromAbi ¶
func (funcs ContractAbi) GetFuncFromAbi(name string) (*FuncDesc, error)
ParseFuncFromAbi searches the function (or event) names in the []FuncDesc object array
func (ContractAbi) ListAbiFuncName ¶
func (abiFuncs ContractAbi) ListAbiFuncName() string
type ContractDataGen ¶
type ContractDataGen struct { TxType uint64 /// name string Interp contractInter // contains filtered or unexported fields }
ContractDataGen is used for combining the data of contract execution
func NewContractDataGen ¶
func NewContractDataGen(data *RawData, conAbi ContractAbi, txType uint64) *ContractDataGen
func (*ContractDataGen) CombineData ¶
func (dataGen *ContractDataGen) CombineData() (string, error)
CombineData of Contractcall data struct is used for packeting the data of wasm or evm contracts execution Implement the MessageCallDemo interface
func (*ContractDataGen) GetContractDataDen ¶
func (dataGen *ContractDataGen) GetContractDataDen() *ContractDataGen
func (*ContractDataGen) GetIsWrite ¶
func (dataGen *ContractDataGen) GetIsWrite() bool
func (*ContractDataGen) GetMethodAbi ¶
func (dataGen *ContractDataGen) GetMethodAbi() *FuncDesc
func (*ContractDataGen) ParseNonConstantResponse ¶
func (dataGen *ContractDataGen) ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{}
func (*ContractDataGen) ReceiptParsing ¶
func (dataGen *ContractDataGen) ReceiptParsing(receipt *Receipt) *ReceiptParsingReturn
func (*ContractDataGen) SetInterpreter ¶
func (dataGen *ContractDataGen) SetInterpreter(vm, name string, txType uint64)
SetInterpreter set the interpreter of ContractDataGen object
type ContractReturn ¶
type ContractReturn struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
ContractReturn, system contract return object
func ParseSysContractResult ¶
func ParseSysContractResult(result []byte) (*ContractReturn, error)
ParseSysContractResult parsed the result to ContractReturn object
type DeployDataGen ¶
type DeployDataGen struct { /// codeBytes []byte /// abiBytes []byte /// ConstructorParams []string Interpreter deployInter // contains filtered or unexported fields }
DeployCall, used for combining the data of contract deployment
func NewDeployDataGen ¶
func NewDeployDataGen(conAbi ContractAbi) *DeployDataGen
NewDeployCall new a DeployCall object
func (DeployDataGen) CombineData ¶
func (dataGen DeployDataGen) CombineData() (string, error)
CombineData of DeployCall data struct is used for packeting the data of wasm or evm contracts deployment Implement the MessageCallDemo interface
func (*DeployDataGen) GetContractDataDen ¶
func (dataGen *DeployDataGen) GetContractDataDen() *ContractDataGen
func (*DeployDataGen) GetIsWrite ¶
func (dataGen *DeployDataGen) GetIsWrite() bool
func (*DeployDataGen) ParseNonConstantResponse ¶
func (dataGen *DeployDataGen) ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{}
func (*DeployDataGen) ReceiptParsing ¶
func (dataGen *DeployDataGen) ReceiptParsing(receipt *Receipt) *ReceiptParsingReturn
func (*DeployDataGen) SetInterpreter ¶
func (dataGen *DeployDataGen) SetInterpreter(vm string, abiBytes, codeBytes []byte, consParams []interface{}, methodAbi *FuncDesc)
SetInterpreter set the interpreter of DeployCall object
type EvmContractInterpreter ¶
type EvmContractInterpreter struct {
// contains filtered or unexported fields
}
func (EvmContractInterpreter) ParseNonConstantResponse ¶
func (i EvmContractInterpreter) ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{}
func (EvmContractInterpreter) ReceiptParsing ¶
func (i EvmContractInterpreter) ReceiptParsing(receipt *Receipt, abiBytes []byte) *ReceiptParsingReturn
func (EvmContractInterpreter) ReceiptParsingV2 ¶
func (i EvmContractInterpreter) ReceiptParsingV2(receipt *Receipt, conAbi ContractAbi) *ReceiptParsingReturn
type EvmDeployInterpreter ¶
type EvmDeployInterpreter struct {
// contains filtered or unexported fields
}
EvmInterpreter, packet data in the way defined by the evm virtual machine
func (EvmDeployInterpreter) ReceiptParsing ¶
func (i EvmDeployInterpreter) ReceiptParsing(receipt *Receipt, abiBytes []byte) *ReceiptParsingReturn
func (EvmDeployInterpreter) ReceiptParsingV2 ¶
func (i EvmDeployInterpreter) ReceiptParsingV2(receipt *Receipt, conAbi ContractAbi) *ReceiptParsingReturn
type FuncDesc ¶
type FuncDesc struct { Name string `json:"name"` Inputs []abi.ArgumentMarshaling `json:"inputs"` Outputs []abi.ArgumentMarshaling `json:"outputs"` Constant interface{} `json:"constant"` // ??? Type string `json:"type"` StateMutability string `json:"stateMutability,omitempty"` // tag for solidity ver > 0.6.0 }
================================ABI================================ todo: change FuncDesc to Method in abi/method.go FuncDesc, the object of the contract abi files
func (*FuncDesc) StringToArgs ¶
EvmStringToEncodeByte if the funcParams is nil, the return byte is nil
type MsgDataGen ¶
type MsgDataGen interface { // CombineData() (string, []abi.ArgumentMarshaling, bool, error) CombineData() (string, error) ReceiptParsing(receipt *Receipt) *ReceiptParsingReturn GetIsWrite() bool GetContractDataDen() *ContractDataGen }
MessageCallDemo, the interface for different types of data package methods
type Receipt ¶
type Receipt struct { BlockHash string `json:"blockHash"` // hash of the block BlockNumber string `json:"blockNumber"` // height of the block ContractAddress string `json:"contractAddress"` // contract address of the contract deployment. otherwise null CumulativeGasUsed string `json:"cumulativeGasUsed"` // From string `json:"from"` // the account address used to send the transaction GasUsed string `json:"gasUsed"` // gas used by executing the transaction Root string `json:"root"` To string `json:"to"` // the address the transaction is sent to TransactionHash string `json:"transactionHash"` // the hash of the transaction TransactionIndex string `json:"transactionIndex"` // the index of the transaction Logs RecptLogs `json:"logs"` Status string `json:"status"` // the execution status of the transaction, "0x1" for success }
Receipt, eth_getTransactionReceipt return data struct
func ParseTxReceipt ¶
ParseSysContractResult parsed the rpc response to Receipt object
func (*Receipt) Parsing ¶
func (receipt *Receipt) Parsing() *ReceiptParsingReturn
func (*Receipt) ParsingWrap ¶
func (receipt *Receipt) ParsingWrap(events []*FuncDesc, fn eventParsingFuncV2) *ReceiptParsingReturn
type ReceiptParsingReturn ¶
type ReceiptParsingReturn struct { Status string `json:"status"` ContractAddress string `json:"contractAddress,omitempty"` Logs []string `json:"logs,omitempty"` BlockNumber uint64 `json:"blockNumber"` GasUsed uint64 From string To string TxHash string Err string `json:"err,omitempty"` }
func (*ReceiptParsingReturn) String ¶
func (r *ReceiptParsingReturn) String() string
type TxParams ¶
type TxParams struct { From common.Address `json:"from"` // the address used to send the transaction To *common.Address `json:"to"` // the address receives the transactions Gas string `json:"gas"` GasPrice string `json:"gasPrice"` Value string `json:"value"` Data string `json:"data"` }
TxParamsDemo, the object of the eth_call, eth_sendTransaction
func NewTxParams ¶
func NewTxParams(from common.Address, to *common.Address, value, gas, gasPrice, data string) *TxParams
NewTxParams news a TxParams object
func (*TxParams) GetSignedTx ¶
GetSignedTx gets the signed transaction
type WasmContractInterpreter ¶
type WasmContractInterpreter struct {
// contains filtered or unexported fields
}
func (WasmContractInterpreter) ParseNonConstantResponse ¶
func (i WasmContractInterpreter) ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{}
func (WasmContractInterpreter) ReceiptParsing ¶
func (i WasmContractInterpreter) ReceiptParsing(receipt *Receipt, abiBytes []byte) *ReceiptParsingReturn
func (WasmContractInterpreter) ReceiptParsingV2 ¶
func (i WasmContractInterpreter) ReceiptParsingV2(receipt *Receipt, conAbi ContractAbi) *ReceiptParsingReturn
type WasmDeployInterpreter ¶
type WasmDeployInterpreter struct {
// contains filtered or unexported fields
}
WasmInterpreter, packet data in the way defined by the evm virtual machine
func (WasmDeployInterpreter) ReceiptParsing ¶
func (i WasmDeployInterpreter) ReceiptParsing(receipt *Receipt, abiBytes []byte) *ReceiptParsingReturn
func (WasmDeployInterpreter) ReceiptParsingV2 ¶
func (i WasmDeployInterpreter) ReceiptParsingV2(receipt *Receipt, conAbi ContractAbi) *ReceiptParsingReturn