Documentation
¶
Index ¶
- Constants
- Variables
- func MustGetABI(json string) abi.ABI
- func ReceiptIndicatesRunLogFulfillment(txr types.Receipt) bool
- type AddressArray
- type Backend
- type Block
- type Configs
- type Confirmations
- 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() chains.Head[common.Hash]
- func (h *Head) EarliestInChain() *Head
- func (h *Head) GetParent() chains.Head[common.Hash]
- func (h *Head) GetParentHash() common.Hash
- func (h *Head) GetTimestamp() time.Time
- func (h *Head) GetTotalDifficulty() *big.Int
- func (h *Head) GreaterThan(r *Head) bool
- func (h *Head) HasChainID() bool
- func (h *Head) HashAtHeight(blockNum int64) common.Hash
- func (h *Head) HeadAtHeight(blockNum int64) (chains.Head[common.Hash], error)
- func (h *Head) IsInChain(blockHash common.Hash) bool
- func (h *Head) IsValid() bool
- func (h *Head) LatestFinalizedHead() chains.Head[common.Hash]
- func (h *Head) MarshalJSON() ([]byte, error)
- func (h *Head) NextInt() *big.Int
- func (h *Head) SetFromHeader(header *types.Header)
- func (h *Head) String() string
- func (h *Head) ToChainAgnosticHead() *chainagnostictypes.Head
- 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) GetRevertReason() *string
- 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 ( Finalized = Confirmations(-1) Unconfirmed = Confirmations(0) )
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 Backend ¶
type Backend interface { Close() error Commit() common.Hash Rollback() Fork(parentHash common.Hash) error AdjustTime(adjustment time.Duration) error Client() simulated.Client }
Interface which is satisfied by simulated.Backend. Defined here so that default geth behavior can be overridden in tests, and injected into our SimulatedBackend wrapper. This can be used to simulate rpc servers with quirky behavior that differs from geth
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 Confirmations ¶
type Confirmations int
type EIP55Address ¶
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 ¶
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 ¶
func MustEIP55Address(s string) EIP55Address
func NewEIP55Address ¶
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 ¶
func (a EIP55Address) Address() common.Address
Address returns EIP55Address as a go-ethereum Address type
func (EIP55Address) Format ¶
func (a EIP55Address) Format(s fmt.State, c rune)
Format implements fmt.Formatter
func (EIP55Address) Hex ¶
func (a EIP55Address) Hex() string
Hex is identical to String but makes the API similar to common.Address
func (EIP55Address) IsZero ¶
func (a EIP55Address) IsZero() bool
IsZeroAddress determines whether the address is 0x0000... or not
func (*EIP55Address) Scan ¶
func (a *EIP55Address) Scan(value interface{}) error
Scan reads the database value and returns an instance.
func (EIP55Address) String ¶
func (a EIP55Address) String() string
String implements the stringer interface and is used also by the logger.
func (*EIP55Address) UnmarshalJSON ¶
func (a *EIP55Address) UnmarshalJSON(input []byte) error
UnmarshalJSON parses a hash from a JSON string
func (*EIP55Address) UnmarshalText ¶
func (a *EIP55Address) UnmarshalText(input []byte) error
UnmarshalText parses a hash from plain text
type EIP55AddressCollection ¶
type EIP55AddressCollection []EIP55Address
EIP55AddressCollection is an array of EIP55Addresses.
func (*EIP55AddressCollection) Scan ¶
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 atomic.Pointer[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 atomic.Bool }
Head represents a BlockNumber, BlockHash.
func NewHead ¶
func NewHead(number *big.Int, blockHash common.Hash, parentHash common.Hash, chainID *ubig.Big) Head
NewHead returns a Head instance.
func (*Head) AsSlice ¶
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 ¶
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 ¶
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 ¶
func (*Head) GetTimestamp ¶
func (*Head) GetTotalDifficulty ¶
func (*Head) GreaterThan ¶
GreaterThan compares BlockNumbers and returns true if the receiver BlockNumber is greater than the supplied BlockNumber
func (*Head) HasChainID ¶
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) HeadAtHeight ¶
func (*Head) IsInChain ¶
IsInChain returns true if the given hash matches the hash of a head in the chain
func (*Head) MarshalJSON ¶
func (*Head) NextInt ¶
NextInt returns the next BlockNumber as big.int, or nil if nil to represent latest.
func (*Head) SetFromHeader ¶
func (*Head) ToChainAgnosticHead ¶
func (h *Head) ToChainAgnosticHead() *chainagnostictypes.Head
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"` RevertReason []byte `json:"revertReason,omitempty"` // Only provided by Hedera }
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 ¶
func (*Receipt) GetBlockNumber ¶
func (*Receipt) GetFeeUsed ¶
func (*Receipt) GetRevertReason ¶
func (*Receipt) GetTransactionIndex ¶
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