Documentation ¶
Index ¶
- Constants
- Variables
- type AccessList
- type AccessTuple
- type Address
- func AddressFromBytes(b []byte) (Address, error)
- func AddressFromBytesPtr(b []byte) *Address
- func AddressFromHex(h string) (a Address, err error)
- func AddressFromHexPtr(h string) *Address
- func MustAddressFromBytes(b []byte) Address
- func MustAddressFromBytesPtr(b []byte) *Address
- func MustAddressFromHex(h string) Address
- func MustAddressFromHexPtr(h string) *Address
- func (t Address) Bytes() []byte
- func (t Address) Checksum(h HashFunc) string
- func (t *Address) DecodeRLP(data []byte) (int, error)
- func (t Address) EncodeRLP() ([]byte, error)
- func (t Address) IsZero() bool
- func (t Address) MarshalJSON() ([]byte, error)
- func (t Address) MarshalText() ([]byte, error)
- func (t Address) String() string
- func (t *Address) UnmarshalJSON(input []byte) error
- func (t *Address) UnmarshalText(input []byte) error
- type Block
- type BlockNumber
- func BlockNumberFromBigInt(x *big.Int) BlockNumber
- func BlockNumberFromBigIntPtr(x *big.Int) *BlockNumber
- func BlockNumberFromHex(h string) (BlockNumber, error)
- func BlockNumberFromHexPtr(h string) *BlockNumber
- func BlockNumberFromUint64(x uint64) BlockNumber
- func BlockNumberFromUint64Ptr(x uint64) *BlockNumber
- func MustBlockNumberFromHex(h string) BlockNumber
- func MustBlockNumberFromHexPtr(h string) *BlockNumber
- func (t *BlockNumber) Big() *big.Int
- func (t *BlockNumber) IsEarliest() bool
- func (t *BlockNumber) IsFinalized() bool
- func (t *BlockNumber) IsLatest() bool
- func (t *BlockNumber) IsPending() bool
- func (t *BlockNumber) IsSafe() bool
- func (t *BlockNumber) IsTag() bool
- func (t BlockNumber) MarshalJSON() ([]byte, error)
- func (t BlockNumber) MarshalText() ([]byte, error)
- func (t *BlockNumber) String() string
- func (t *BlockNumber) UnmarshalJSON(input []byte) error
- func (t *BlockNumber) UnmarshalText(input []byte) error
- type Bytes
- func (b *Bytes) Bytes() []byte
- func (b Bytes) MarshalJSON() ([]byte, error)
- func (b Bytes) MarshalText() ([]byte, error)
- func (b Bytes) PadLeft(n int) Bytes
- func (b Bytes) PadRight(n int) Bytes
- func (b *Bytes) String() string
- func (b *Bytes) UnmarshalJSON(input []byte) error
- func (b *Bytes) UnmarshalText(input []byte) error
- type Call
- func (c Call) Copy() *Call
- func (c Call) MarshalJSON() ([]byte, error)
- func (c *Call) SetAccessList(accessList AccessList) *Call
- func (c *Call) SetFrom(from Address) *Call
- func (c *Call) SetGasLimit(gasLimit uint64) *Call
- func (c *Call) SetGasPrice(gasPrice *big.Int) *Call
- func (c *Call) SetInput(input []byte) *Call
- func (c *Call) SetMaxFeePerGas(maxFeePerGas *big.Int) *Call
- func (c *Call) SetMaxPriorityFeePerGas(maxPriorityFeePerGas *big.Int) *Call
- func (c *Call) SetTo(to Address) *Call
- func (c *Call) SetValue(value *big.Int) *Call
- func (c *Call) UnmarshalJSON(data []byte) error
- type FeeHistory
- type FilterLogsQuery
- func (q *FilterLogsQuery) AddAddresses(addresses ...Address) *FilterLogsQuery
- func (q *FilterLogsQuery) AddTopics(topics ...[]Hash) *FilterLogsQuery
- func (q FilterLogsQuery) MarshalJSON() ([]byte, error)
- func (q *FilterLogsQuery) SetAddresses(addresses ...Address) *FilterLogsQuery
- func (q *FilterLogsQuery) SetBlockHash(blockHash *Hash) *FilterLogsQuery
- func (q *FilterLogsQuery) SetFromBlock(fromBlock *BlockNumber) *FilterLogsQuery
- func (q *FilterLogsQuery) SetToBlock(toBlock *BlockNumber) *FilterLogsQuery
- func (q *FilterLogsQuery) SetTopics(topics ...[]Hash) *FilterLogsQuery
- func (q *FilterLogsQuery) UnmarshalJSON(input []byte) error
- type Hash
- func HashFromBigInt(i *big.Int) (Hash, error)
- func HashFromBigIntPtr(i *big.Int) *Hash
- func HashFromBytes(b []byte, pad Pad) (Hash, error)
- func HashFromBytesPtr(b []byte, pad Pad) *Hash
- func HashFromHex(h string, pad Pad) (Hash, error)
- func HashFromHexPtr(h string, pad Pad) *Hash
- func MustHashFromBigInt(i *big.Int) Hash
- func MustHashFromBigIntPtr(i *big.Int) *Hash
- func MustHashFromBytes(b []byte, pad Pad) Hash
- func MustHashFromBytesPtr(b []byte, pad Pad) *Hash
- func MustHashFromHex(h string, pad Pad) Hash
- func MustHashFromHexPtr(h string, pad Pad) *Hash
- func (t Hash) Bytes() []byte
- func (t *Hash) DecodeRLP(data []byte) (int, error)
- func (t Hash) EncodeRLP() ([]byte, error)
- func (t Hash) IsZero() bool
- func (t Hash) MarshalJSON() ([]byte, error)
- func (t Hash) MarshalText() ([]byte, error)
- func (t Hash) String() string
- func (t *Hash) UnmarshalJSON(input []byte) error
- func (t *Hash) UnmarshalText(input []byte) error
- type HashFunc
- type Log
- type Number
- func MustNumberFromHex(h string) Number
- func MustNumberFromHexPtr(h string) *Number
- func NumberFromBigInt(x *big.Int) Number
- func NumberFromBigIntPtr(x *big.Int) *Number
- func NumberFromBytes(b []byte) Number
- func NumberFromBytesPtr(b []byte) *Number
- func NumberFromHex(h string) (Number, error)
- func NumberFromHexPtr(h string) *Number
- func NumberFromUint64(x uint64) Number
- func NumberFromUint64Ptr(x uint64) *Number
- type OnChainTransaction
- type Pad
- type Signature
- func MustSignatureFromBytes(b []byte) Signature
- func MustSignatureFromBytesPtr(b []byte) *Signature
- func MustSignatureFromHex(h string) Signature
- func MustSignatureFromHexPtr(h string) *Signature
- func SignatureFromBytes(b []byte) (Signature, error)
- func SignatureFromBytesPtr(b []byte) *Signature
- func SignatureFromHex(h string) (Signature, error)
- func SignatureFromHexPtr(h string) *Signature
- func SignatureFromVRS(v, r, s *big.Int) Signature
- func SignatureFromVRSPtr(v, r, s *big.Int) *Signature
- func (s Signature) Bytes() []byte
- func (s Signature) Copy() *Signature
- func (s Signature) Equal(c Signature) bool
- func (s Signature) IsZero() bool
- func (s Signature) MarshalJSON() ([]byte, error)
- func (s Signature) MarshalText() ([]byte, error)
- func (s Signature) String() string
- func (s *Signature) UnmarshalJSON(input []byte) error
- func (s *Signature) UnmarshalText(input []byte) error
- type SyncStatus
- type Transaction
- func (t *Transaction) Copy() *Transaction
- func (t *Transaction) DecodeRLP(data []byte) (int, error)
- func (t Transaction) EncodeRLP() ([]byte, error)
- func (t Transaction) Hash(h HashFunc) (Hash, error)
- func (t Transaction) MarshalJSON() ([]byte, error)
- func (t Transaction) Raw() ([]byte, error)
- func (t *Transaction) SetAccessList(accessList AccessList) *Transaction
- func (t *Transaction) SetChainID(chainID uint64) *Transaction
- func (t *Transaction) SetFrom(from Address) *Transaction
- func (t *Transaction) SetGasLimit(gasLimit uint64) *Transaction
- func (t *Transaction) SetGasPrice(gasPrice *big.Int) *Transaction
- func (t *Transaction) SetInput(input []byte) *Transaction
- func (t *Transaction) SetMaxFeePerGas(maxFeePerGas *big.Int) *Transaction
- func (t *Transaction) SetMaxPriorityFeePerGas(maxPriorityFeePerGas *big.Int) *Transaction
- func (t *Transaction) SetNonce(nonce uint64) *Transaction
- func (t *Transaction) SetSignature(signature Signature) *Transaction
- func (t *Transaction) SetTo(to Address) *Transaction
- func (t *Transaction) SetType(transactionType TransactionType) *Transaction
- func (t *Transaction) SetValue(value *big.Int) *Transaction
- func (t *Transaction) UnmarshalJSON(data []byte) error
- type TransactionReceipt
- type TransactionType
Constants ¶
const AddressLength = 20
AddressLength is the length of an Ethereum address in bytes.
const HashLength = 32
Variables ¶
var ( EarliestBlockNumber = BlockNumber{/* contains filtered or unexported fields */} LatestBlockNumber = BlockNumber{/* contains filtered or unexported fields */} PendingBlockNumber = BlockNumber{/* contains filtered or unexported fields */} SafeBlockNumber = BlockNumber{/* contains filtered or unexported fields */} FinalizedBlockNumber = BlockNumber{/* contains filtered or unexported fields */} )
var ZeroAddress = Address{}
ZeroAddress is an address with all zeros.
var ZeroHash = Hash{}
ZeroHash is a hash with all zeros.
Functions ¶
This section is empty.
Types ¶
type AccessList ¶
type AccessList []AccessTuple
AccessList is an EIP-2930 access list.
func (*AccessList) Copy ¶ added in v0.4.0
func (a *AccessList) Copy() AccessList
func (AccessList) EncodeRLP ¶
func (a AccessList) EncodeRLP() ([]byte, error)
type AccessTuple ¶
type AccessTuple struct { Address Address `json:"address"` StorageKeys []Hash `json:"storageKeys"` }
AccessTuple is the element type of access list.
func (*AccessTuple) Copy ¶ added in v0.4.0
func (a *AccessTuple) Copy() AccessTuple
func (AccessTuple) EncodeRLP ¶
func (a AccessTuple) EncodeRLP() ([]byte, error)
type Address ¶
type Address [AddressLength]byte
Address represents an Ethereum address encoded as a 20 byte array.
func AddressFromBytes ¶
AddressFromBytes converts a byte slice to an Address type.
func AddressFromBytesPtr ¶
AddressFromBytesPtr converts a byte slice to an *Address type. It returns nil if the address is invalid.
func AddressFromHex ¶
AddressFromHex parses an address in hex format and returns an Address type.
func AddressFromHexPtr ¶
AddressFromHexPtr parses an address in hex format and returns an *Address type. It returns nil if the address is invalid.
func MustAddressFromBytes ¶
MustAddressFromBytes converts a byte slice to an Address type. It panics if the address is invalid.
func MustAddressFromBytesPtr ¶
MustAddressFromBytesPtr converts a byte slice to an *Address type. It panics if the address is invalid.
func MustAddressFromHex ¶
MustAddressFromHex parses an address in hex format and returns an Address type. It panics if the address is invalid.
func MustAddressFromHexPtr ¶
MustAddressFromHexPtr parses an address in hex format and returns an *Address type. It panics if the address is invalid.
func (Address) Checksum ¶
Checksum returns the address with the checksum calculated according to EIP-55.
HashFunc is the hash function used to calculate the checksum, most likely crypto.Keccak256.
func (Address) MarshalJSON ¶
func (Address) MarshalText ¶
func (*Address) UnmarshalJSON ¶
func (*Address) UnmarshalText ¶
type Block ¶
type Block struct { Number *big.Int // Block is the block number. Hash Hash // Hash is the hash of the block. ParentHash Hash // ParentHash is the hash of the parent block. StateRoot Hash // StateRoot is the root hash of the state trie. ReceiptsRoot Hash // ReceiptsRoot is the root hash of the receipts trie. TransactionsRoot Hash // TransactionsRoot is the root hash of the transactions trie. MixHash Hash // MixHash is the hash of the seed used for the DAG. Sha3Uncles Hash // Sha3Uncles is the SHA3 hash of the uncles data in the block. Nonce *big.Int // Nonce is the block's nonce. Miner Address // Miner is the address of the beneficiary to whom the mining rewards were given. LogsBloom []byte // LogsBloom is the bloom filter for the logs of the block. Difficulty *big.Int // Difficulty is the difficulty for this block. TotalDifficulty *big.Int // TotalDifficulty is the total difficulty of the chain until this block. Size uint64 // Size is the size of the block in bytes. GasLimit uint64 // GasLimit is the maximum gas allowed in this block. GasUsed uint64 // GasUsed is the total used gas by all transactions in this block. Timestamp time.Time // Timestamp is the time at which the block was collated. Uncles []Hash // Uncles is the list of uncle hashes. Transactions []OnChainTransaction // Transactions is the list of transactions in the block. TransactionHashes []Hash // TransactionHashes is the list of transaction hashes in the block. ExtraData []byte // ExtraData is the "extra data" field of this block. }
func (Block) MarshalJSON ¶
func (*Block) UnmarshalJSON ¶
type BlockNumber ¶
type BlockNumber struct {
// contains filtered or unexported fields
}
BlockNumber is a type that can hold a block number or a tag.
func BlockNumberFromBigInt ¶
func BlockNumberFromBigInt(x *big.Int) BlockNumber
BlockNumberFromBigInt converts a big.Int to a BlockNumber type.
func BlockNumberFromBigIntPtr ¶
func BlockNumberFromBigIntPtr(x *big.Int) *BlockNumber
BlockNumberFromBigIntPtr converts a big.Int to a *BlockNumber type.
func BlockNumberFromHex ¶
func BlockNumberFromHex(h string) (BlockNumber, error)
BlockNumberFromHex converts a string to a BlockNumber type. The string can be a hex number or one of the following strings: "earliest", "latest", "safe", "finalized", "pending". If the string is not a valid block number, it returns an error.
func BlockNumberFromHexPtr ¶
func BlockNumberFromHexPtr(h string) *BlockNumber
BlockNumberFromHexPtr converts a string to a *BlockNumber type. The string can be a hex number or one of the following strings: "earliest", "latest", "safe", "finalized", "pending". If the string is not a valid block number, it returns nil.
func BlockNumberFromUint64 ¶
func BlockNumberFromUint64(x uint64) BlockNumber
BlockNumberFromUint64 converts an uint64 to a BlockNumber type.
func BlockNumberFromUint64Ptr ¶
func BlockNumberFromUint64Ptr(x uint64) *BlockNumber
BlockNumberFromUint64Ptr converts an uint64 to a *BlockNumber type.
func MustBlockNumberFromHex ¶
func MustBlockNumberFromHex(h string) BlockNumber
MustBlockNumberFromHex converts a string to a BlockNumber type. The string can be a hex number or one of the following strings: "earliest", "latest", "safe", "finalized", "pending". It panics if the string is not a valid block number.
func MustBlockNumberFromHexPtr ¶
func MustBlockNumberFromHexPtr(h string) *BlockNumber
MustBlockNumberFromHexPtr converts a string to a *BlockNumber type. The string can be a hex number or one of the following strings: "earliest", "latest", "safe", "finalized", "pending". It panics if the string is not a valid block number.
func (*BlockNumber) Big ¶
func (t *BlockNumber) Big() *big.Int
Big returns the big.Int representation of the block number.
func (*BlockNumber) IsEarliest ¶
func (t *BlockNumber) IsEarliest() bool
IsEarliest returns true if the block tag is "earliest".
func (*BlockNumber) IsFinalized ¶ added in v0.6.1
func (t *BlockNumber) IsFinalized() bool
IsFinalized returns true if the block tag is "finalized".
func (*BlockNumber) IsLatest ¶
func (t *BlockNumber) IsLatest() bool
IsLatest returns true if the block tag is "latest".
func (*BlockNumber) IsPending ¶
func (t *BlockNumber) IsPending() bool
IsPending returns true if the block tag is "pending".
func (*BlockNumber) IsSafe ¶ added in v0.6.1
func (t *BlockNumber) IsSafe() bool
IsSafe returns true if the block tag is "safe".
func (*BlockNumber) IsTag ¶
func (t *BlockNumber) IsTag() bool
IsTag returns true if the block tag is used.
func (BlockNumber) MarshalJSON ¶
func (t BlockNumber) MarshalJSON() ([]byte, error)
func (BlockNumber) MarshalText ¶
func (t BlockNumber) MarshalText() ([]byte, error)
func (*BlockNumber) String ¶
func (t *BlockNumber) String() string
String returns the string representation of the block number.
func (*BlockNumber) UnmarshalJSON ¶
func (t *BlockNumber) UnmarshalJSON(input []byte) error
func (*BlockNumber) UnmarshalText ¶
func (t *BlockNumber) UnmarshalText(input []byte) error
type Bytes ¶
type Bytes []byte
Bytes represents a hex-encoded byte slice. This type is used for marshaling and unmarshalling JSON numbers. When possible, use byte slices instead.
func BytesFromHex ¶
BytesFromHex converts a hex string to a Bytes type.
func BytesFromHexPtr ¶
BytesFromHexPtr converts a hex string to a *Bytes type. If the input is not a valid hex string, it returns nil.
func BytesFromString ¶
BytesFromString converts a string to a Bytes type.
func BytesFromStringPtr ¶
BytesFromStringPtr converts a string to a *Bytes type.
func MustBytesFromHex ¶
MustBytesFromHex converts a hex string to a Bytes type. It panics if the input is not a valid hex string.
func MustBytesFromHexPtr ¶
MustBytesFromHexPtr converts a hex string to a *Bytes type. It panics if the input is not a valid hex string.
func (Bytes) MarshalJSON ¶
func (Bytes) MarshalText ¶
func (Bytes) PadLeft ¶
PadLeft returns a new byte slice padded with zeros to the given length. If the byte slice is longer than the given length, it is truncated leaving the rightmost bytes.
func (Bytes) PadRight ¶
PadRight returns a new byte slice padded with zeros to the given length. If the byte slice is longer than the given length, it is truncated leaving the leftmost bytes.
func (*Bytes) UnmarshalJSON ¶
func (*Bytes) UnmarshalText ¶
type Call ¶
type Call struct { From *Address // From is the sender address. To *Address // To is the recipient address. nil means contract creation. GasLimit *uint64 // GasLimit is the gas limit, if 0, there is no limit. GasPrice *big.Int // GasPrice is the gas price in wei per gas unit. Value *big.Int // Value is the amount of wei to send. Input []byte // Input is the input data. // EIP-2930 fields: AccessList AccessList // AccessList is the list of addresses and storage keys that the transaction can access. // EIP-1559 fields: MaxPriorityFeePerGas *big.Int // MaxPriorityFeePerGas is the maximum priority fee per gas the sender is willing to pay. MaxFeePerGas *big.Int // MaxFeePerGas is the maximum fee per gas the sender is willing to pay. }
Call represents a call to a contract or a contract creation if To is nil.
func (Call) MarshalJSON ¶
func (*Call) SetAccessList ¶
func (c *Call) SetAccessList(accessList AccessList) *Call
func (*Call) SetGasLimit ¶
func (*Call) SetMaxPriorityFeePerGas ¶
func (*Call) UnmarshalJSON ¶
type FeeHistory ¶
type FeeHistory struct { OldestBlock uint64 // OldestBlock is the oldest block number for which the base fee and gas used are returned. Reward [][]*big.Int // Reward is the reward for each block in the range [OldestBlock, LatestBlock]. BaseFeePerGas []*big.Int // BaseFeePerGas is the base fee per gas for each block in the range [OldestBlock, LatestBlock]. GasUsedRatio []float64 // GasUsedRatio is the gas used ratio for each block in the range [OldestBlock, LatestBlock]. }
FeeHistory represents the result of the feeHistory Client call.
func (FeeHistory) MarshalJSON ¶
func (f FeeHistory) MarshalJSON() ([]byte, error)
func (*FeeHistory) UnmarshalJSON ¶
func (f *FeeHistory) UnmarshalJSON(input []byte) error
type FilterLogsQuery ¶
type FilterLogsQuery struct { Address []Address FromBlock *BlockNumber ToBlock *BlockNumber Topics [][]Hash BlockHash *Hash }
FilterLogsQuery represents a query to filter logs.
func NewFilterLogsQuery ¶ added in v0.5.0
func NewFilterLogsQuery() *FilterLogsQuery
func (*FilterLogsQuery) AddAddresses ¶
func (q *FilterLogsQuery) AddAddresses(addresses ...Address) *FilterLogsQuery
func (*FilterLogsQuery) AddTopics ¶
func (q *FilterLogsQuery) AddTopics(topics ...[]Hash) *FilterLogsQuery
func (FilterLogsQuery) MarshalJSON ¶
func (q FilterLogsQuery) MarshalJSON() ([]byte, error)
func (*FilterLogsQuery) SetAddresses ¶
func (q *FilterLogsQuery) SetAddresses(addresses ...Address) *FilterLogsQuery
func (*FilterLogsQuery) SetBlockHash ¶
func (q *FilterLogsQuery) SetBlockHash(blockHash *Hash) *FilterLogsQuery
func (*FilterLogsQuery) SetFromBlock ¶
func (q *FilterLogsQuery) SetFromBlock(fromBlock *BlockNumber) *FilterLogsQuery
func (*FilterLogsQuery) SetToBlock ¶
func (q *FilterLogsQuery) SetToBlock(toBlock *BlockNumber) *FilterLogsQuery
func (*FilterLogsQuery) SetTopics ¶
func (q *FilterLogsQuery) SetTopics(topics ...[]Hash) *FilterLogsQuery
func (*FilterLogsQuery) UnmarshalJSON ¶
func (q *FilterLogsQuery) UnmarshalJSON(input []byte) error
type Hash ¶
type Hash [HashLength]byte
Hash represents the 32 byte Keccak256 hash of arbitrary data.
func HashFromBigInt ¶
HashFromBigInt converts a big.Int to a Hash type. Negative numbers are represented as two's complement.
func HashFromBigIntPtr ¶
HashFromBigIntPtr converts a big.Int to a *Hash type. Negative numbers are represented as two's complement. It returns nil if the hash is invalid.
func HashFromBytes ¶
HashFromBytes converts a byte slice to a Hash type. If bytes is longer than 32 bytes, it returns an error.
func HashFromBytesPtr ¶
HashFromBytesPtr converts a byte slice to a *Hash type. If bytes is longer than 32 bytes, it returns an error. It returns nil if the hash is invalid.
func HashFromHex ¶
HashFromHex parses a hash in hex format and returns a Hash type. If hash is longer than 32 bytes, it returns an error.
func HashFromHexPtr ¶
HashFromHexPtr parses a hash in hex format and returns a *Hash type. If hash is longer than 32 bytes, it returns an error. It returns nil if the hash is invalid.
func MustHashFromBigInt ¶
MustHashFromBigInt converts a big.Int to a Hash type. Negative numbers are represented as two's complement. It panics if the hash is invalid.
func MustHashFromBigIntPtr ¶
MustHashFromBigIntPtr converts a big.Int to a *Hash type. Negative numbers are represented as two's complement. It panics if the hash is invalid.
func MustHashFromBytes ¶
MustHashFromBytes converts a byte slice to a Hash type. If bytes is longer than 32 bytes, it returns an error. It panics if the hash is invalid.
func MustHashFromBytesPtr ¶
MustHashFromBytesPtr converts a byte slice to a *Hash type. If bytes is longer than 32 bytes, it returns an error. It panics if the hash is invalid.
func MustHashFromHex ¶
MustHashFromHex parses a hash in hex format and returns a Hash type. If hash is longer than 32 bytes, it returns an error. It panics if the hash is invalid.
func MustHashFromHexPtr ¶
MustHashFromHexPtr parses a hash in hex format and returns a *Hash type. If hash is longer than 32 bytes, it returns an error. It panics if the hash is invalid.
func (Hash) MarshalJSON ¶
func (Hash) MarshalText ¶
func (*Hash) UnmarshalJSON ¶
func (*Hash) UnmarshalText ¶
type Log ¶
type Log struct { Address Address // Address of the contract that generated the event Topics []Hash // Topics provide information about the event type. Data []byte // Data contains the non-indexed arguments of the event. BlockHash *Hash // BlockHash is the hash of the block where this log was in. Nil when pending. BlockNumber *big.Int // BlockNumber is the block number where this log was in. Nil when pending. TransactionHash *Hash // TransactionHash is the hash of the transaction that generated this log. Nil when pending. TransactionIndex *uint64 // TransactionIndex is the index of the transaction in the block. Nil when pending. LogIndex *uint64 // LogIndex is the index of the log in the block. Nil when pending. Removed bool // Removed is true if the log was reverted due to a chain reorganization. False if unknown. }
Log represents a contract log event.
func (Log) MarshalJSON ¶
func (*Log) UnmarshalJSON ¶
type Number ¶
type Number struct {
// contains filtered or unexported fields
}
Number represents a hex-encoded number. This type is used for marshaling and unmarshalling JSON numbers. When possible, use big.Int or regular integers instead.
func MustNumberFromHex ¶
MustNumberFromHex converts a hex string to a Number type. It panics if the conversion fails.
func MustNumberFromHexPtr ¶
MustNumberFromHexPtr converts a hex string to a *Number type. It panics if the conversion fails.
func NumberFromBigInt ¶
NumberFromBigInt converts a big.Int to a Number type.
func NumberFromBigIntPtr ¶
NumberFromBigIntPtr converts a big.Int to a *Number type.
func NumberFromBytes ¶
NumberFromBytes converts a byte slice to a Number type.
func NumberFromBytesPtr ¶
NumberFromBytesPtr converts a byte slice to a *Number type.
func NumberFromHex ¶
NumberFromHex converts a hex string to a Number type.
func NumberFromHexPtr ¶
NumberFromHexPtr converts a hex string to a *Number type.
func NumberFromUint64 ¶
NumberFromUint64 converts an uint64 to a Number type.
func NumberFromUint64Ptr ¶
NumberFromUint64Ptr converts an uint64 to a *Number type.
func (Number) MarshalJSON ¶
func (Number) MarshalText ¶
func (*Number) UnmarshalJSON ¶
func (*Number) UnmarshalText ¶
type OnChainTransaction ¶
type OnChainTransaction struct { Transaction // On-chain fields, only available when the transaction is included in a block: Hash *Hash // Hash of the transaction. BlockHash *Hash // BlockHash is the hash of the block where this transaction was in. BlockNumber *big.Int // BlockNumber is the block number where this transaction was in. TransactionIndex *uint64 // TransactionIndex is the index of the transaction in the block. }
OnChainTransaction represents a transaction that is included in a block.
func (OnChainTransaction) MarshalJSON ¶
func (t OnChainTransaction) MarshalJSON() ([]byte, error)
func (*OnChainTransaction) UnmarshalJSON ¶
func (t *OnChainTransaction) UnmarshalJSON(data []byte) error
type Signature ¶
Signature represents the transaction signature.
func MustSignatureFromBytes ¶
MustSignatureFromBytes returns Signature from bytes. Byte representation of the signature is [R || S || V]. It panics if the length of the bytes is not 65.
func MustSignatureFromBytesPtr ¶
MustSignatureFromBytesPtr returns *Signature from bytes. Byte representation of the signature is [R || S || V]. It panics if the length of the bytes is not 65.
func MustSignatureFromHex ¶
MustSignatureFromHex parses a hex string into a Signature. Hex representation of the signature is hex([R || S || V]). It panics if the string is not a valid signature.
func MustSignatureFromHexPtr ¶
MustSignatureFromHexPtr parses a hex string into a *Signature. Hex representation of the signature is hex([R || S || V]). It panics if the string is not a valid signature.
func SignatureFromBytes ¶
SignatureFromBytes returns Signature from bytes. Byte representation of the signature is [R || S || V].
func SignatureFromBytesPtr ¶
SignatureFromBytesPtr returns *Signature from bytes. Byte representation of the signature is [R || S || V]. It returns nil if the length of the bytes is not 65.
func SignatureFromHex ¶
SignatureFromHex parses a hex string into a Signature. Hex representation of the signature is hex([R || S || V]).
func SignatureFromHexPtr ¶
SignatureFromHexPtr parses a hex string into a *Signature. Hex representation of the signature is hex([R || S || V]). It returns nil if the string is not a valid signature.
func SignatureFromVRS ¶
SignatureFromVRS returns Signature from V, R, S values.
func SignatureFromVRSPtr ¶
SignatureFromVRSPtr returns *Signature from V, R, S values.
func (Signature) Bytes ¶
Bytes returns the byte representation of the signature. The byte representation is [R || S || V].
func (Signature) Equal ¶ added in v0.6.1
Equal returns true if the signature is equal to the given signature.
Nil values are considered as zero.
func (Signature) MarshalJSON ¶
func (Signature) MarshalText ¶
func (Signature) String ¶
String returns the hex representation of the signature. The hex representation is hex([R || S || V]).
func (*Signature) UnmarshalJSON ¶
func (*Signature) UnmarshalText ¶
type SyncStatus ¶ added in v0.6.1
type SyncStatus struct { StartingBlock BlockNumber `json:"startingBlock"` CurrentBlock BlockNumber `json:"currentBlock"` HighestBlock BlockNumber `json:"highestBlock"` }
SyncStatus represents the sync status of a node.
type Transaction ¶
type Transaction struct { Call // Transaction data: Type TransactionType // Type is the transaction type. Nonce *uint64 // Nonce is the number of transactions made by the sender prior to this one. Signature *Signature // Signature of the transaction. // EIP-2930 fields: ChainID *uint64 // ChainID is the chain ID of the transaction. }
Transaction represents a transaction.
func NewTransaction ¶ added in v0.5.0
func NewTransaction() *Transaction
func (*Transaction) Copy ¶ added in v0.4.0
func (t *Transaction) Copy() *Transaction
func (Transaction) EncodeRLP ¶
func (t Transaction) EncodeRLP() ([]byte, error)
func (Transaction) Hash ¶
func (t Transaction) Hash(h HashFunc) (Hash, error)
Hash returns the hash of the transaction (transaction ID).
func (Transaction) MarshalJSON ¶
func (t Transaction) MarshalJSON() ([]byte, error)
func (Transaction) Raw ¶
func (t Transaction) Raw() ([]byte, error)
Raw returns the raw transaction data that could be sent to the network.
func (*Transaction) SetAccessList ¶
func (t *Transaction) SetAccessList(accessList AccessList) *Transaction
func (*Transaction) SetChainID ¶
func (t *Transaction) SetChainID(chainID uint64) *Transaction
func (*Transaction) SetFrom ¶
func (t *Transaction) SetFrom(from Address) *Transaction
func (*Transaction) SetGasLimit ¶
func (t *Transaction) SetGasLimit(gasLimit uint64) *Transaction
func (*Transaction) SetGasPrice ¶
func (t *Transaction) SetGasPrice(gasPrice *big.Int) *Transaction
func (*Transaction) SetInput ¶
func (t *Transaction) SetInput(input []byte) *Transaction
func (*Transaction) SetMaxFeePerGas ¶
func (t *Transaction) SetMaxFeePerGas(maxFeePerGas *big.Int) *Transaction
func (*Transaction) SetMaxPriorityFeePerGas ¶
func (t *Transaction) SetMaxPriorityFeePerGas(maxPriorityFeePerGas *big.Int) *Transaction
func (*Transaction) SetNonce ¶
func (t *Transaction) SetNonce(nonce uint64) *Transaction
func (*Transaction) SetSignature ¶
func (t *Transaction) SetSignature(signature Signature) *Transaction
func (*Transaction) SetTo ¶
func (t *Transaction) SetTo(to Address) *Transaction
func (*Transaction) SetType ¶
func (t *Transaction) SetType(transactionType TransactionType) *Transaction
func (*Transaction) SetValue ¶
func (t *Transaction) SetValue(value *big.Int) *Transaction
func (*Transaction) UnmarshalJSON ¶
func (t *Transaction) UnmarshalJSON(data []byte) error
type TransactionReceipt ¶
type TransactionReceipt struct { TransactionHash Hash // TransactionHash is the hash of the transaction. TransactionIndex uint64 // TransactionIndex is the index of the transaction in the block. BlockHash Hash // BlockHash is the hash of the block. BlockNumber *big.Int // BlockNumber is the number of the block. From Address // From is the sender of the transaction. To Address // To is the recipient of the transaction. CumulativeGasUsed uint64 // CumulativeGasUsed is the total amount of gas used when this transaction was executed in the block. EffectiveGasPrice *big.Int // EffectiveGasPrice is the effective gas price of the transaction. GasUsed uint64 // GasUsed is the amount of gas used by this specific transaction alone. ContractAddress *Address // ContractAddress is the contract address created, if the transaction was a contract creation, otherwise nil. Logs []Log // Logs is the list of logs generated by the transaction. LogsBloom []byte // LogsBloom is the bloom filter for the logs of the transaction. Root *Hash // Root is the root of the state trie after the transaction. Status *uint64 // Status is the status of the transaction. }
TransactionReceipt represents transaction receipt.
func (TransactionReceipt) MarshalJSON ¶
func (t TransactionReceipt) MarshalJSON() ([]byte, error)
func (*TransactionReceipt) UnmarshalJSON ¶
func (t *TransactionReceipt) UnmarshalJSON(data []byte) error
type TransactionType ¶
type TransactionType uint64
TransactionType is the type of transaction.
const ( LegacyTxType TransactionType = iota AccessListTxType DynamicFeeTxType )
Transaction types.