Documentation
¶
Index ¶
- Constants
- Variables
- func BytesToString(b []byte) string
- func ConvertRlpBytesTo(input []byte, targetType string) interface{}
- func EventParsing(logs RecptLogs, abiBytesArr [][]byte, fn eventParsingFunc) []string
- func EvmEventParsingPerLog(eLog *Log, abiBytes []byte) 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 ListAbiFuncName(abiFuncs []FuncDesc) string
- func RlpBytesToBool(b []byte) bool
- func RlpBytesToUint16(b []byte) uint16
- func RlpBytesToUint32(b []byte) uint32
- func RlpBytesToUint64(b []byte) uint64
- func WasmEventParsingPerLog(eLog *Log, abiBytes []byte) string
- type Cns
- type ContractDataGen
- func (dataGen *ContractDataGen) CombineData() (string, []abi.ArgumentMarshaling, bool, error)
- func (dataGen *ContractDataGen) ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{}
- func (dataGen *ContractDataGen) ReceiptParsing(receipt *Receipt) *ReceiptParsingReturn
- func (dataGen *ContractDataGen) SetInterpreter(vm string)
- type ContractReturn
- type DeployDataGen
- func (dataGen DeployDataGen) CombineData() (string, []abi.ArgumentMarshaling, bool, error)
- func (dataGen *DeployDataGen) ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{}
- func (dataGen *DeployDataGen) ReceiptParsing(receipt *Receipt) *ReceiptParsingReturn
- func (dataGen *DeployDataGen) SetInterpreter(vm string) error
- type EvmContractInterpreter
- type EvmDeployInterpreter
- type FuncDesc
- type FuncIO
- type Log
- type MsgDataGen
- type RawData
- type Receipt
- type ReceiptParsingReturn
- type RecptLogs
- type TxParams
- type WasmContractInterpreter
- type WasmDeployInterpreter
Constants ¶
const ( TxReceiptSuccessMsg = "Operation Succeeded" TxReceiptFailureMsg = "Operation Failed" )
Variables ¶
var Bytes2X_CMD = map[string]interface{}{ "string": BytesToString, "uint16": RlpBytesToUint16, "uint32": RlpBytesToUint32, "uint64": RlpBytesToUint64, "int16": RlpBytesToUint16, "int32": RlpBytesToUint32, "int64": RlpBytesToUint64, "bool": RlpBytesToBool, }
Functions ¶
func BytesToString ¶
func ConvertRlpBytesTo ¶
func EventParsing ¶
func EvmEventParsingPerLog ¶
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 ListAbiFuncName ¶
func RlpBytesToBool ¶
func RlpBytesToUint16 ¶
func RlpBytesToUint32 ¶
func RlpBytesToUint64 ¶
func WasmEventParsingPerLog ¶
Types ¶
type Cns ¶
type ContractDataGen ¶
type ContractDataGen struct { Interp contractInter // contains filtered or unexported fields }
ContractDataGen is used for combining the data of contract execution
func NewContractDataGen ¶
func NewContractDataGen(data *RawData, name string) *ContractDataGen
func NewContractDataGenWrap ¶
func NewContractDataGenWrap(funcName string, funcParams []string, funcAbi []byte, cns Cns, vm string) *ContractDataGen
NewContractDataGen new a ContractDataGen object
func (*ContractDataGen) CombineData ¶
func (dataGen *ContractDataGen) CombineData() (string, []abi.ArgumentMarshaling, bool, error)
CombineData of Contractcall data struct is used for packeting the data of wasm or evm contracts execution Implement the MessageCallDemo interface
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 string)
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 { TxType uint64 ConstructorParams []string Interpreter deployInter // contains filtered or unexported fields }
DeployCall, used for combining the data of contract deployment
func NewDeployDataGen ¶
func NewDeployDataGen(codeBytes, abiBytes []byte, consParams []string, vm string, txType uint64) *DeployDataGen
NewDeployCall new a DeployCall object
func (DeployDataGen) CombineData ¶
func (dataGen DeployDataGen) CombineData() (string, []abi.ArgumentMarshaling, bool, error)
CombineData of DeployCall data struct is used for packeting the data of wasm or evm contracts deployment Implement the MessageCallDemo interface
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) error
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
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
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 ParseAbiFromJson ¶
ParseAbiFromJson parses the application binary interface(abi) files to []FuncDesc object array
type MsgDataGen ¶
type MsgDataGen interface { CombineData() (string, []abi.ArgumentMarshaling, bool, error) ReceiptParsing(receipt *Receipt) *ReceiptParsingReturn ParseNonConstantResponse(respStr string, outputType []abi.ArgumentMarshaling) []interface{} }
MessageCallDemo, the interface for different types of data package methods
type RawData ¶
type RawData struct {
// contains filtered or unexported fields
}
RawData, used to store function methods and abi
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
type ReceiptParsingReturn ¶
type ReceiptParsingReturn struct { Status string `json:"status"` ContractAddress string `json:"contractAddress,omitempty"` Logs []string `json:"logs,omitempty"` BlockNumber uint64 `json:"blockNumber"` 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
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