types

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: LGPL-3.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

View Source
const (
	LegacyTxType = iota
	AccessListTxType
	DynamicFeeTxType
)

Transaction types.

Variables

This section is empty.

Functions

func InitEIP155Signer

func InitEIP155Signer(chainId *big.Int)

func PrefixedRlpHash

func PrefixedRlpHash(prefix byte, x interface{}) *common.Hash

PrefixedRlpHash writes the prefix into the hasher before rlp-encoding x. It's used for typed transactions.

func RecoverPlain

func RecoverPlain(hash []byte, R, S, Vb *big.Int, homestead bool) ([]byte, error)

func RlpHash

func RlpHash(x interface{}) *common.Hash

RlpHash encodes x and hashes the encoded bytes.

Types

type AccessListTx

type AccessListTx struct {
	ChainID    *big.Int         // destination chain ID
	Nonce      uint64           // nonce of sender account
	GasPrice   *big.Int         // wei per gas
	Gas        uint64           // gas limit
	To         *common.Address  `rlp:"nil"` // nil means contract creation
	Value      *big.Int         // wei amount
	Data       []byte           // contract invocation input data
	AccessList types.AccessList // EIP-2930 access list
	V, R, S    *big.Int         // signature values
}

AccessListTx is the data of EIP-2930 access list transactions.

func (*AccessListTx) GetAccessList

func (tx *AccessListTx) GetAccessList() types.AccessList

func (*AccessListTx) GetChainID

func (tx *AccessListTx) GetChainID() *big.Int

func (*AccessListTx) GetData

func (tx *AccessListTx) GetData() []byte

func (*AccessListTx) GetGas

func (tx *AccessListTx) GetGas() uint64

func (*AccessListTx) GetGasFeeCap

func (tx *AccessListTx) GetGasFeeCap() *big.Int

func (*AccessListTx) GetGasPrice

func (tx *AccessListTx) GetGasPrice() *big.Int

func (*AccessListTx) GetGasTipCap

func (tx *AccessListTx) GetGasTipCap() *big.Int

func (*AccessListTx) GetNonce

func (tx *AccessListTx) GetNonce() uint64

func (*AccessListTx) GetTo

func (tx *AccessListTx) GetTo() *common.Address

func (*AccessListTx) GetValue

func (tx *AccessListTx) GetValue() *big.Int

func (*AccessListTx) RawSignatureValues

func (tx *AccessListTx) RawSignatureValues() (v, r, s *big.Int)

func (*AccessListTx) TxType

func (tx *AccessListTx) TxType() byte

type CallArgs

type CallArgs struct {
	From                 *common.Address   `json:"from"`
	To                   *common.Address   `json:"to"`
	Gas                  *hexutil.Uint64   `json:"gas"`
	GasPrice             *hexutil.Big      `json:"gasPrice"`
	MaxFeePerGas         *hexutil.Big      `json:"maxFeePerGas"`
	MaxPriorityFeePerGas *hexutil.Big      `json:"maxPriorityFeePerGas"`
	Value                *hexutil.Big      `json:"value"`
	Nonce                *hexutil.Uint64   `json:"nonce"`
	Data                 *hexutil.Bytes    `json:"data"`
	Input                *hexutil.Bytes    `json:"input"`
	AccessList           *types.AccessList `json:"accessList"`
	ChainID              *hexutil.Big      `json:"chainId,omitempty"`
}

CallArgs represents the arguments for a call.

type DynamicFeeTx

type DynamicFeeTx struct {
	ChainID    *big.Int
	Nonce      uint64
	GasTipCap  *big.Int
	GasFeeCap  *big.Int
	Gas        uint64
	To         *common.Address `rlp:"nil"` // nil means contract creation
	Value      *big.Int
	Data       []byte
	AccessList types.AccessList

	// Signature values
	V *big.Int `json:"v" gencodec:"required"`
	R *big.Int `json:"r" gencodec:"required"`
	S *big.Int `json:"s" gencodec:"required"`
}

func (*DynamicFeeTx) GetAccessList

func (tx *DynamicFeeTx) GetAccessList() types.AccessList

func (*DynamicFeeTx) GetChainID

func (tx *DynamicFeeTx) GetChainID() *big.Int

func (*DynamicFeeTx) GetData

func (tx *DynamicFeeTx) GetData() []byte

func (*DynamicFeeTx) GetGas

func (tx *DynamicFeeTx) GetGas() uint64

func (*DynamicFeeTx) GetGasFeeCap

func (tx *DynamicFeeTx) GetGasFeeCap() *big.Int

func (*DynamicFeeTx) GetGasPrice

func (tx *DynamicFeeTx) GetGasPrice() *big.Int

func (*DynamicFeeTx) GetGasTipCap

func (tx *DynamicFeeTx) GetGasTipCap() *big.Int

func (*DynamicFeeTx) GetNonce

func (tx *DynamicFeeTx) GetNonce() uint64

func (*DynamicFeeTx) GetTo

func (tx *DynamicFeeTx) GetTo() *common.Address

func (*DynamicFeeTx) GetValue

func (tx *DynamicFeeTx) GetValue() *big.Int

func (*DynamicFeeTx) RawSignatureValues

func (tx *DynamicFeeTx) RawSignatureValues() (v, r, s *big.Int)

func (*DynamicFeeTx) TxType

func (tx *DynamicFeeTx) TxType() byte

accessors for innerTx.

type EIP155Signer

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

type EthTransaction

type EthTransaction struct {
	Inner TxData    // Consensus contents of a transaction
	Time  time.Time // Time first seen locally (spam avoidance)
	// contains filtered or unexported fields
}

Transaction is an Ethereum transaction.

func (*EthTransaction) DecodeRLP

func (tx *EthTransaction) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder

func (*EthTransaction) EncodeRLP

func (tx *EthTransaction) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder

func (*EthTransaction) FromCallArgs

func (e *EthTransaction) FromCallArgs(callArgs CallArgs)

func (*EthTransaction) GetChainID

func (e *EthTransaction) GetChainID() *big.Int

func (*EthTransaction) GetExtra

func (e *EthTransaction) GetExtra() []byte

func (*EthTransaction) GetFrom

func (e *EthTransaction) GetFrom() *types.Address

func (*EthTransaction) GetGas

func (e *EthTransaction) GetGas() uint64

func (*EthTransaction) GetGasFeeCap

func (e *EthTransaction) GetGasFeeCap() *big.Int

func (*EthTransaction) GetGasPrice

func (e *EthTransaction) GetGasPrice() *big.Int

func (*EthTransaction) GetGasTipCap

func (e *EthTransaction) GetGasTipCap() *big.Int

func (*EthTransaction) GetHash

func (e *EthTransaction) GetHash() *types.Hash

func (*EthTransaction) GetIBTP

func (e *EthTransaction) GetIBTP() *pb.IBTP

func (*EthTransaction) GetInner

func (e *EthTransaction) GetInner() TxData

func (*EthTransaction) GetNonce

func (e *EthTransaction) GetNonce() uint64

func (*EthTransaction) GetPayload

func (e *EthTransaction) GetPayload() []byte

func (*EthTransaction) GetRawSignature

func (e *EthTransaction) GetRawSignature() (v, r, s *big.Int)

RawSignatureValues returns the V, R, S signature values of the transaction. The return values should not be modified by the caller.

func (*EthTransaction) GetSignHash

func (e *EthTransaction) GetSignHash() *types.Hash

func (*EthTransaction) GetSignature

func (e *EthTransaction) GetSignature() []byte

func (*EthTransaction) GetTimeStamp

func (e *EthTransaction) GetTimeStamp() int64

func (*EthTransaction) GetTo

func (e *EthTransaction) GetTo() *types.Address

func (*EthTransaction) GetType

func (e *EthTransaction) GetType() byte

Type returns the transaction type.

func (*EthTransaction) GetValue

func (e *EthTransaction) GetValue() *big.Int

func (*EthTransaction) GetVersion

func (e *EthTransaction) GetVersion() []byte

func (*EthTransaction) IsIBTP

func (e *EthTransaction) IsIBTP() bool

func (*EthTransaction) MarshalBinary

func (tx *EthTransaction) MarshalBinary() ([]byte, error)

MarshalBinary returns the canonical encoding of the transaction. For legacy transactions, it returns the RLP encoding. For EIP-2718 typed transactions, it returns the type and payload.

func (*EthTransaction) MarshalJSON

func (tx *EthTransaction) MarshalJSON() ([]byte, error)

func (*EthTransaction) MarshalTo

func (e *EthTransaction) MarshalTo(buf []byte) (int, error)

func (*EthTransaction) MarshalWithFlag

func (e *EthTransaction) MarshalWithFlag() ([]byte, error)

func (*EthTransaction) Protected

func (e *EthTransaction) Protected() bool

Protected says whether the transaction is replay-protected.

func (*EthTransaction) Size

func (e *EthTransaction) Size() int

func (*EthTransaction) SizeWithFlag

func (e *EthTransaction) SizeWithFlag() int

func (*EthTransaction) ToMessage

func (tx *EthTransaction) ToMessage() etherTypes.Message

func (*EthTransaction) Unmarshal

func (e *EthTransaction) Unmarshal(buf []byte) error

func (*EthTransaction) UnmarshalBinary

func (tx *EthTransaction) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes the canonical encoding of transactions. It supports legacy RLP transactions and EIP2718 typed transactions.

func (*EthTransaction) VerifySignature

func (e *EthTransaction) VerifySignature() error

type LegacyTx

type LegacyTx struct {
	Nonce    uint64          // nonce of sender account
	GasPrice *big.Int        // wei per gas
	Gas      uint64          // gas limit
	To       *common.Address `rlp:"nil"` // nil means contract creation
	Value    *big.Int        // wei amount
	Data     []byte          // contract invocation input data
	V, R, S  *big.Int        // signature values
}

LegacyTx is the transaction data of regular Ethereum transactions.

func (*LegacyTx) GetAccessList

func (tx *LegacyTx) GetAccessList() types.AccessList

func (*LegacyTx) GetChainID

func (tx *LegacyTx) GetChainID() *big.Int

func (*LegacyTx) GetData

func (tx *LegacyTx) GetData() []byte

func (*LegacyTx) GetGas

func (tx *LegacyTx) GetGas() uint64

func (*LegacyTx) GetGasFeeCap

func (tx *LegacyTx) GetGasFeeCap() *big.Int

func (*LegacyTx) GetGasPrice

func (tx *LegacyTx) GetGasPrice() *big.Int

func (*LegacyTx) GetGasTipCap

func (tx *LegacyTx) GetGasTipCap() *big.Int

func (*LegacyTx) GetNonce

func (tx *LegacyTx) GetNonce() uint64

func (*LegacyTx) GetTo

func (tx *LegacyTx) GetTo() *common.Address

func (*LegacyTx) GetValue

func (tx *LegacyTx) GetValue() *big.Int

func (*LegacyTx) RawSignatureValues

func (tx *LegacyTx) RawSignatureValues() (v, r, s *big.Int)

func (*LegacyTx) TxType

func (tx *LegacyTx) TxType() byte

type TxData

type TxData interface {
	TxType() byte // returns the type ID

	GetChainID() *big.Int
	GetAccessList() types.AccessList
	GetData() []byte
	GetGas() uint64
	GetGasPrice() *big.Int
	GetGasTipCap() *big.Int
	GetGasFeeCap() *big.Int
	GetValue() *big.Int
	GetNonce() uint64
	GetTo() *common.Address

	RawSignatureValues() (v, r, s *big.Int)
	// contains filtered or unexported methods
}

TxData is the underlying data of a transaction.

This is implemented by DynamicFeeTx, LegacyTx and AccessListTx.

Jump to

Keyboard shortcuts

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