Documentation ¶
Index ¶
- Constants
- Variables
- func MustGetABI(json string) abi.ABI
- func ReceiptIndicatesRunLogFulfillment(txr types.Receipt) bool
- type AddressArray
- type Block
- type Configs
- type EIP55Address
- func (a EIP55Address) Address() common.Address
- func (a EIP55Address) Big() *big.Int
- func (a EIP55Address) Bytes() []byte
- func (a EIP55Address) Format(s fmt.State, c rune)
- func (a EIP55Address) Hash() common.Hash
- func (a EIP55Address) Hex() string
- func (a EIP55Address) IsZero() bool
- func (a *EIP55Address) Scan(value interface{}) error
- func (a EIP55Address) String() string
- func (a *EIP55Address) UnmarshalJSON(input []byte) error
- func (a *EIP55Address) UnmarshalText(input []byte) error
- func (a EIP55Address) Value() (driver.Value, error)
- type EIP55AddressCollection
- type FunctionSelector
- func (f FunctionSelector) Bytes() []byte
- func (f FunctionSelector) MarshalJSON() ([]byte, error)
- func (f *FunctionSelector) Scan(value interface{}) error
- func (f *FunctionSelector) SetBytes(b []byte)
- func (f FunctionSelector) String() string
- func (f *FunctionSelector) UnmarshalJSON(input []byte) error
- func (f FunctionSelector) Value() (driver.Value, error)
- type HashArray
- type Head
- func (h *Head) AsSlice(k int) (heads []*Head)
- func (h *Head) BlockDifficulty() *big.Int
- func (h *Head) BlockHash() common.Hash
- func (h *Head) BlockNumber() int64
- func (h *Head) ChainHashes() []common.Hash
- func (h *Head) ChainID() *big.Int
- func (h *Head) ChainLength() uint32
- func (h *Head) ChainString() string
- func (h *Head) EarliestHeadInChain() commontypes.Head[common.Hash]
- func (h *Head) EarliestInChain() *Head
- func (h *Head) GetParent() commontypes.Head[common.Hash]
- func (h *Head) GetParentHash() common.Hash
- func (h *Head) GetTimestamp() time.Time
- func (h *Head) GreaterThan(r *Head) bool
- func (h *Head) HasChainID() bool
- func (h *Head) HashAtHeight(blockNum int64) common.Hash
- func (h *Head) IsInChain(blockHash common.Hash) bool
- func (h *Head) IsValid() bool
- func (h *Head) LatestFinalizedHead() commontypes.Head[common.Hash]
- func (h *Head) MarshalJSON() ([]byte, error)
- func (h *Head) NextInt() *big.Int
- func (h *Head) String() string
- func (h *Head) ToInt() *big.Int
- func (h *Head) UnmarshalJSON(bs []byte) error
- type Log
- type Node
- type Nonce
- type Receipt
- func (r *Receipt) GetBlockHash() common.Hash
- func (r *Receipt) GetBlockNumber() *big.Int
- func (r *Receipt) GetFeeUsed() uint64
- func (r *Receipt) GetStatus() uint64
- func (r *Receipt) GetTransactionIndex() uint
- func (r *Receipt) GetTxHash() common.Hash
- func (r *Receipt) IsUnmined() bool
- func (r *Receipt) IsZero() bool
- func (r Receipt) MarshalJSON() ([]byte, error)
- func (r *Receipt) Scan(value interface{}) error
- func (r *Receipt) UnmarshalJSON(input []byte) error
- func (r *Receipt) Value() (driver.Value, error)
- type Transaction
- type TxType
- type UntrustedBytes
Constants ¶
const FunctionSelectorLength = 4
FunctionSelectorLength should always be a length of 4 as a byte.
const LegacyTxType = blocks.TxType(0x0)
Variables ¶
var ChainlinkFulfilledTopic = utils.MustHash("ChainlinkFulfilled(bytes32)")
ChainlinkFulfilledTopic is the signature for the event emitted after calling ChainlinkClient.validateChainlinkCallback(requestId). See ../../contracts/src/v0.8/ChainlinkClient.sol
var ErrMissingBlock = pkgerrors.New("missing block")
WeiPerEth is amount of Wei currency units in one Eth.
Functions ¶
func MustGetABI ¶
func ReceiptIndicatesRunLogFulfillment ¶
ReceiptIndicatesRunLogFulfillment returns true if this tx receipt is the result of a fulfilled run log.
Types ¶
type AddressArray ¶
func (*AddressArray) Scan ¶
func (a *AddressArray) Scan(src interface{}) error
type Block ¶
type Block struct { Number int64 Hash common.Hash ParentHash common.Hash BaseFeePerGas *assets.Wei Timestamp time.Time Transactions []Transaction }
Block represents an ethereum block This type is only used for the block history estimator, and can be expensive to unmarshal. Don't add unnecessary fields here.
func (Block) MarshalJSON ¶
MarshalJSON implements json marshalling for Block
func (*Block) UnmarshalJSON ¶
UnmarshalJSON unmarshals to a Block
type EIP55Address ¶ added in v2.11.0
type EIP55Address string
EIP55Address is a new type for string which persists an ethereum address in its original string representation which includes a leading 0x, and EIP55 checksum which is represented by the case of digits A-F.
func EIP55AddressFromAddress ¶ added in v2.11.0
func EIP55AddressFromAddress(a common.Address) EIP55Address
EIP55AddressFromAddress forces an address into EIP55Address format It is safe to panic on error since address.Hex() should ALWAYS generate EIP55Address-compatible hex strings
func MustEIP55Address ¶ added in v2.11.0
func MustEIP55Address(s string) EIP55Address
func NewEIP55Address ¶ added in v2.11.0
func NewEIP55Address(s string) (EIP55Address, error)
NewEIP55Address creates an EIP55Address from a string, an error is returned if:
1) There is no leading 0x 2) The length is wrong 3) There are any non hexadecimal characters 4) The checksum fails
func (EIP55Address) Address ¶ added in v2.11.0
func (a EIP55Address) Address() common.Address
Address returns EIP55Address as a go-ethereum Address type
func (EIP55Address) Big ¶ added in v2.11.0
func (a EIP55Address) Big() *big.Int
Big returns a big.Int representation
func (EIP55Address) Bytes ¶ added in v2.11.0
func (a EIP55Address) Bytes() []byte
Bytes returns the raw bytes
func (EIP55Address) Format ¶ added in v2.11.0
func (a EIP55Address) Format(s fmt.State, c rune)
Format implements fmt.Formatter
func (EIP55Address) Hash ¶ added in v2.11.0
func (a EIP55Address) Hash() common.Hash
Hash returns the Hash
func (EIP55Address) Hex ¶ added in v2.11.0
func (a EIP55Address) Hex() string
Hex is identical to String but makes the API similar to common.Address
func (EIP55Address) IsZero ¶ added in v2.11.0
func (a EIP55Address) IsZero() bool
IsZeroAddress determines whether the address is 0x0000... or not
func (*EIP55Address) Scan ¶ added in v2.11.0
func (a *EIP55Address) Scan(value interface{}) error
Scan reads the database value and returns an instance.
func (EIP55Address) String ¶ added in v2.11.0
func (a EIP55Address) String() string
String implements the stringer interface and is used also by the logger.
func (*EIP55Address) UnmarshalJSON ¶ added in v2.11.0
func (a *EIP55Address) UnmarshalJSON(input []byte) error
UnmarshalJSON parses a hash from a JSON string
func (*EIP55Address) UnmarshalText ¶ added in v2.11.0
func (a *EIP55Address) UnmarshalText(input []byte) error
UnmarshalText parses a hash from plain text
type EIP55AddressCollection ¶ added in v2.11.0
type EIP55AddressCollection []EIP55Address
EIP55AddressCollection is an array of EIP55Addresses.
func (*EIP55AddressCollection) Scan ¶ added in v2.11.0
func (c *EIP55AddressCollection) Scan(value interface{}) error
Scan reads the database value and returns an instance.
type FunctionSelector ¶
type FunctionSelector [FunctionSelectorLength]byte
FunctionSelector is the first four bytes of the call data for a function call and specifies the function to be called.
func BytesToFunctionSelector ¶
func BytesToFunctionSelector(b []byte) FunctionSelector
BytesToFunctionSelector converts the given bytes to a FunctionSelector.
func HexToFunctionSelector ¶
func HexToFunctionSelector(s string) FunctionSelector
HexToFunctionSelector converts the given string to a FunctionSelector.
func (FunctionSelector) Bytes ¶
func (f FunctionSelector) Bytes() []byte
Bytes returns the FunctionSelector as a byte slice
func (FunctionSelector) MarshalJSON ¶
func (f FunctionSelector) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of f
func (*FunctionSelector) Scan ¶
func (f *FunctionSelector) Scan(value interface{}) error
Scan returns the selector from its serialization in the database
func (*FunctionSelector) SetBytes ¶
func (f *FunctionSelector) SetBytes(b []byte)
SetBytes sets the FunctionSelector to that of the given bytes (will trim).
func (FunctionSelector) String ¶
func (f FunctionSelector) String() string
String returns the FunctionSelector as a string type.
func (*FunctionSelector) UnmarshalJSON ¶
func (f *FunctionSelector) UnmarshalJSON(input []byte) error
UnmarshalJSON parses the raw FunctionSelector and sets the FunctionSelector type to the given input.
type Head ¶
type Head struct { ID uint64 Hash common.Hash Number int64 L1BlockNumber sql.NullInt64 ParentHash common.Hash Parent *Head EVMChainID *ubig.Big Timestamp time.Time CreatedAt time.Time BaseFeePerGas *assets.Wei ReceiptsRoot common.Hash TransactionsRoot common.Hash StateRoot common.Hash Difficulty *big.Int TotalDifficulty *big.Int IsFinalized bool }
Head represents a BlockNumber, BlockHash.
func NewHead ¶
func NewHead(number *big.Int, blockHash common.Hash, parentHash common.Hash, timestamp uint64, chainID *ubig.Big) Head
NewHead returns a Head instance.
func (*Head) AsSlice ¶ added in v2.8.0
AsSlice returns a slice of heads up to length k len(heads) may be less than k if the available chain is not long enough
func (*Head) BlockDifficulty ¶ added in v2.8.0
func (*Head) BlockNumber ¶
func (*Head) ChainHashes ¶
ChainHashes returns an array of block hashes by recursively looking up parents
func (*Head) ChainLength ¶
ChainLength returns the length of the chain followed by recursively looking up parents
func (*Head) ChainString ¶
func (*Head) EarliestHeadInChain ¶
func (h *Head) EarliestHeadInChain() commontypes.Head[common.Hash]
EarliestHeadInChain recurses through parents until it finds the earliest one
func (*Head) EarliestInChain ¶
EarliestInChain recurses through parents until it finds the earliest one
func (*Head) GetParentHash ¶ added in v2.3.0
func (*Head) GetTimestamp ¶ added in v2.8.0
func (*Head) GreaterThan ¶
GreaterThan compares BlockNumbers and returns true if the receiver BlockNumber is greater than the supplied BlockNumber
func (*Head) HasChainID ¶ added in v2.3.0
func (*Head) HashAtHeight ¶
HashAtHeight returns the hash of the block at the given height, if it is in the chain. If not in chain, returns the zero hash
func (*Head) IsInChain ¶
IsInChain returns true if the given hash matches the hash of a head in the chain
func (*Head) LatestFinalizedHead ¶ added in v2.11.0
func (h *Head) LatestFinalizedHead() commontypes.Head[common.Hash]
func (*Head) MarshalJSON ¶
func (*Head) NextInt ¶
NextInt returns the next BlockNumber as big.int, or nil if nil to represent latest.
func (*Head) UnmarshalJSON ¶
type Log ¶
type Log struct { Address common.Address `json:"address"` Topics []common.Hash `json:"topics"` Data []byte `json:"data"` BlockNumber uint64 `json:"blockNumber"` TxHash common.Hash `json:"transactionHash"` TxIndex uint `json:"transactionIndex"` BlockHash common.Hash `json:"blockHash"` Index uint `json:"logIndex"` Removed bool `json:"removed"` }
Log represents a contract log event.
Copied from go-ethereum: https://github.com/ethereum/go-ethereum/blob/ce9a289fa48e0d2593c4aaa7e207c8a5dd3eaa8a/core/types/log.go
We use our own version because Geth's version specifies various gencodec:"required" fields which cause unhelpful errors when unmarshalling from an empty JSON object which can happen in the batch fetcher.
func FromGethLog ¶
FromGethLog converts a gethTypes.Log to a Log
func (*Log) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type Receipt ¶
type Receipt struct { PostState []byte `json:"root"` Status uint64 `json:"status"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed"` Bloom gethTypes.Bloom `json:"logsBloom"` Logs []*Log `json:"logs"` TxHash common.Hash `json:"transactionHash"` ContractAddress common.Address `json:"contractAddress"` GasUsed uint64 `json:"gasUsed"` BlockHash common.Hash `json:"blockHash,omitempty"` BlockNumber *big.Int `json:"blockNumber,omitempty"` TransactionIndex uint `json:"transactionIndex"` }
Receipt represents an ethereum receipt.
Copied from go-ethereum: https://github.com/ethereum/go-ethereum/blob/ce9a289fa48e0d2593c4aaa7e207c8a5dd3eaa8a/core/types/receipt.go#L50
We use our own version because Geth's version specifies various gencodec:"required" fields which cause unhelpful errors when unmarshalling from an empty JSON object which can happen in the batch fetcher.
func FromGethReceipt ¶
FromGethReceipt converts a gethTypes.Receipt to a Receipt
func (*Receipt) GetBlockHash ¶ added in v2.2.0
func (*Receipt) GetBlockNumber ¶ added in v2.2.0
func (*Receipt) GetFeeUsed ¶ added in v2.2.0
func (*Receipt) GetTransactionIndex ¶ added in v2.2.0
func (*Receipt) IsUnmined ¶
IsUnmined returns true if the receipt is for a TX that has not been mined yet. Supposedly according to the spec this should never happen, but Parity does it anyway.
func (*Receipt) IsZero ¶
IsZero returns true if receipt is the zero receipt Batch calls to the RPC will return a pointer to an empty Receipt struct Easiest way to check if the receipt was missing is to see if the hash is 0x0 Real receipts will always have the TxHash set
func (Receipt) MarshalJSON ¶
MarshalJSON marshals Receipt as JSON. Copied from: https://github.com/ethereum/go-ethereum/blob/ce9a289fa48e0d2593c4aaa7e207c8a5dd3eaa8a/core/types/gen_receipt_json.go
func (*Receipt) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type Transaction ¶
type Transaction struct { GasPrice *assets.Wei `json:"gasPrice"` GasLimit uint32 `json:"gasLimit"` MaxFeePerGas *assets.Wei `json:"maxFeePerGas"` MaxPriorityFeePerGas *assets.Wei `json:"maxPriorityFeePerGas"` Type TxType `json:"type"` Hash common.Hash `json:"hash"` }
Transaction represents an ethereum transaction Use our own type because geth's type has validation failures on e.g. zero gas used, which can occur on other chains. This type is only used for the block history estimator, and can be expensive to unmarshal. Don't add unnecessary fields here.
func (*Transaction) MarshalJSON ¶
func (t *Transaction) MarshalJSON() ([]byte, error)
func (*Transaction) UnmarshalJSON ¶
func (t *Transaction) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a Transaction
type TxType ¶
type TxType uint8
thin public wrapper for internal type of the same name and which has to be internal for JSON un/marshal'ing code gen consistency
type UntrustedBytes ¶
type UntrustedBytes []byte
This data can contain anything and is submitted by user on-chain, so we must be extra careful how we interact with it
func (UntrustedBytes) SafeByteSlice ¶
func (ary UntrustedBytes) SafeByteSlice(start int, end int) ([]byte, error)
SafeByteSlice returns an error on out of bounds access to a byte array, where a normal slice would panic instead