types

package
v1.68.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssembleChain33Tx added in v1.67.4

func AssembleChain33Tx(etx *etypes.Transaction, sig, pubkey []byte, cfg *ctypes.Chain33Config) *ctypes.Transaction

AssembleChain33Tx 通过eth tx 组装chain33 tx 全部走evm 通道

func CaculateRealV added in v1.67.4

func CaculateRealV(v *big.Int, chainID uint64, txTyppe uint8) (byte, error)

CaculateRealV return v

func CreateBloom added in v1.67.4

func CreateBloom(receipts []*Receipt) etypes.Bloom

CreateBloom creates a bloom filter out of the give Receipts (+Logs)

func TxDetailsToEthReceipts added in v1.67.4

func TxDetailsToEthReceipts(txDetails *ctypes.TransactionDetails, blockHash common.Hash, cfg *ctypes.Chain33Config) (txs Transactions, receipts []*Receipt, err error)

TxDetailsToEthReceipts chain33 txdetails transfer to eth tx receipts

func TxsToEthTxs

func TxsToEthTxs(blockHash common.Hash, blockNum int64, ctxs []*ctypes.Transaction, cfg *ctypes.Chain33Config, full bool) (txs []interface{}, fee int64, err error)

TxsToEthTxs chain33 txs format transfer to eth txs format

Types

type Block

type Block struct {
	*Header
	Uncles       []*Header   `json:"uncles"`
	Transactions interface{} `json:"transactions"`
	Hash         string      `json:"hash"`
}

Block ETH 交易结构体

func BlockDetailToEthBlock

func BlockDetailToEthBlock(details *types.BlockDetails, cfg *types.Chain33Config, full bool) (*Block, error)

BlockDetailToEthBlock chain33 blockdetails transfer to eth block format

type CallMsg

type CallMsg struct {
	From     string          `json:"from"`
	To       string          `json:"to"`
	Gas      *hexutil.Uint64 `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Nonce    *hexutil.Uint64 `json:"nonce"`
	// We accept "data" and "input" for backwards-compatibility reasons. "input" is the
	// newer name and should be preferred by clients.
	Data *hexutil.Bytes `json:"data"`
}

CallMsg eth api param

type EthProto

type EthProto struct {
	Difficulty uint32 `json:"difficulty,omitempty"`
	Head       string `json:"head,omitempty"`
	Version    string `json:"version,omitempty"`
	NetworkID  int    `json:"network,omitempty"`
}

EthProto eth proto

type EvmLog

type EvmLog struct {
	Address     common.Address `json:"address"`
	Topics      []common.Hash  `json:"topics"`
	Data        hexutil.Bytes  `json:"data"`
	BlockNumber hexutil.Uint64 `json:"blockNumber"`
	TxHash      common.Hash    `json:"transactionHash"`
	TxIndex     hexutil.Uint   `json:"transactionIndex"`
	BlockHash   common.Hash    `json:"blockHash"`
	Index       hexutil.Uint   `json:"logIndex"`
	Removed     bool           `json:"removed"`
}

EvmLog evm log

type Filter added in v1.67.5

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

Filter 过滤器

func NewFilter added in v1.67.5

func NewFilter(gcli ctypes.Chain33Client, cfg *ctypes.Chain33Config, option *FilterQuery) (*Filter, error)

NewFilter 创建filter 对象

func (*Filter) FilterBlockDetail added in v1.67.5

func (f *Filter) FilterBlockDetail(blockHashes [][]byte) ([]*EvmLog, error)

FilterBlockDetail 根据blockhash 过滤evmlog

func (*Filter) FilterEvmTxLogs added in v1.67.5

func (f *Filter) FilterEvmTxLogs(logs *ctypes.EVMTxLogPerBlk) (evmlogs []*EvmLog)

FilterEvmTxLogs 过滤EVMTxLogPerBlk

type FilterQuery added in v1.67.5

type FilterQuery struct {
	Address   interface{}   `json:"address,omitempty"`
	Topics    []interface{} `json:"topics,omitempty"`
	BlockHash *common.Hash  // used by eth_getLogs, return logs only from block with this hash
	FromBlock string        `json:"fromBlock,omitempty"` // beginning of the queried range, nil means genesis block
	ToBlock   string        `json:"toBlock,omitempty"`
}

FilterQuery ... logs Subscription

type Header struct {
	ParentHash  common.Hash      `json:"parentHash"       gencodec:"required"`
	UncleHash   common.Hash      `json:"sha3Uncles"   gencodec:"required"`
	Coinbase    common.Address   `json:"miner"            gencodec:"required"`
	Root        common.Hash      `json:"stateRoot"        gencodec:"required"`
	TxHash      common.Hash      `json:"transactionsRoot" gencodec:"required"`
	ReceiptHash common.Hash      `json:"receiptsRoot"     gencodec:"required"`
	Bloom       types.Bloom      `json:"logsBloom"        gencodec:"required"`
	Difficulty  *hexutil.Big     `json:"difficulty"       gencodec:"required"`
	Number      *hexutil.Big     `json:"number"           gencodec:"required"`
	GasLimit    hexutil.Uint64   `json:"gasLimit"         gencodec:"required"`
	GasUsed     hexutil.Uint64   `json:"gasUsed"          gencodec:"required"`
	Time        hexutil.Uint64   `json:"timestamp"        gencodec:"required"`
	Extra       hexutil.Bytes    `json:"extraData"        gencodec:"required"`
	MixDigest   common.Hash      `json:"mixHash"`
	Nonce       types.BlockNonce `json:"nonce"`
	//BaseFee     *hexutil.Big     `json:"baseFeePerGas" rlp:"optional"`
	Hash common.Hash `json:"hash"`
}

Header block header

func BlockHeaderToEthHeader

func BlockHeaderToEthHeader(cHeader *types.Header) (*Header, error)

BlockHeaderToEthHeader transfer chain33 header to eth header

type Network

type Network struct {
	LocalAddress  string `json:"localAddress,omitempty"`
	RemoteAddress string `json:"remoteAddress,omitempty"`
}

Network network info

type Peer

type Peer struct {
	ID         string     `json:"id,omitempty"`
	Name       string     `json:"name,omitempty"`
	NetWork    *Network   `json:"netWork,omitempty"`
	Protocols  *Protocols `json:"protocols,omitempty"`
	Self       bool       `json:"self,omitempty"`
	Ports      *Ports     `json:"ports,omitempty"`
	Encode     string     `json:"encode,omitempty"`
	ListenAddr string     `json:"listenAddr,omitempty"`
}

Peer peer info

type Ports

type Ports struct {
	Discovery int32 `json:"discovery,omitempty"`
	Listener  int32 `json:"listener,omitempty"`
}

Ports ...

type Protocols

type Protocols struct {
	EthProto *EthProto `json:"eth,omitempty"`
}

Protocols peer protocols

type Receipt

type Receipt struct {
	Type              hexutil.Uint64  `json:"type"`
	Status            hexutil.Uint64  `json:"status"`
	CumulativeGasUsed hexutil.Uint64  `json:"cumulativeGasUsed" gencodec:"required"`
	Bloom             types.Bloom     `json:"logsBloom"         gencodec:"required"`
	Logs              []*EvmLog       `json:"logs"              gencodec:"required"`
	TxHash            common.Hash     `json:"transactionHash" gencodec:"required"`
	ContractAddress   *common.Address `json:"contractAddress"`
	GasUsed           hexutil.Uint64  `json:"gasUsed" gencodec:"required"`
	BlockHash         common.Hash     `json:"blockHash,omitempty"`
	BlockNumber       *hexutil.Big    `json:"blockNumber,omitempty"`
	TransactionIndex  hexutil.Uint    `json:"transactionIndex"`
	From              *common.Address `json:"from"`
}

Receipt tx Receipt

type Transaction

type Transaction struct {
	BlockHash        *common.Hash      `json:"blockHash"`
	BlockNumber      *hexutil.Big      `json:"blockNumber"`
	From             common.Address    `json:"from"`
	Gas              hexutil.Uint64    `json:"gas"`
	GasPrice         *hexutil.Big      `json:"gasPrice"`
	GasFeeCap        *hexutil.Big      `json:"maxFeePerGas,omitempty"`
	GasTipCap        *hexutil.Big      `json:"maxPriorityFeePerGas,omitempty"`
	Hash             common.Hash       `json:"hash"`
	Input            hexutil.Bytes     `json:"input"`
	Nonce            hexutil.Uint64    `json:"nonce"`
	To               *common.Address   `json:"to"`
	TransactionIndex *hexutil.Uint64   `json:"transactionIndex"`
	Value            *hexutil.Big      `json:"value"`
	Type             hexutil.Uint64    `json:"type"`
	Accesses         *types.AccessList `json:"accessList,omitempty"`
	ChainID          *hexutil.Big      `json:"chainId,omitempty"`
	V                *hexutil.Big      `json:"v"`
	R                *hexutil.Big      `json:"r"`
	S                *hexutil.Big      `json:"s"`
}

Transaction represents a transaction that will serialize to the RPC representation of a transaction

type Transactions

type Transactions []*Transaction

Transactions txs types

Jump to

Keyboard shortcuts

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