Documentation ¶
Index ¶
- Constants
- Variables
- func MustGetABI(json string) abi.ABI
- func ReceiptIndicatesRunLogFulfillment(txr types.Receipt) bool
- type AddressArray
- type Block
- type Configs
- 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) BlockDifficulty() *utils.Big
- 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) 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) 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.6/ChainlinkClient.sol
var ErrMissingBlock = errors.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 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 null.Int64 ParentHash common.Hash Parent *Head EVMChainID *utils.Big Timestamp time.Time CreatedAt time.Time BaseFeePerGas *assets.Wei ReceiptsRoot common.Hash TransactionsRoot common.Hash StateRoot common.Hash Difficulty *utils.Big TotalDifficulty *utils.Big }
Head represents a BlockNumber, BlockHash.
func NewHead ¶
func NewHead(number *big.Int, blockHash common.Hash, parentHash common.Hash, timestamp uint64, chainID *utils.Big) Head
NewHead returns a Head instance.
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) 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) 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 Nonce ¶ added in v2.1.0
type Nonce int64
Nonce wraps an EVM nonce into a stringable type
func GenerateNextNonce ¶ added in v2.7.0
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