Documentation ¶
Overview ¶
Package types provides the definitions for various data structures used in the hypersync-client-go library.
Index ¶
- func BlockHeaderSchema(metadata *arrow.Metadata) *arrow.Schema
- func BlockSchemaFieldsAsString() []string
- func LogSchema(metadata *arrow.Metadata) *arrow.Schema
- func LogSchemaFieldsAsString() []string
- func TraceSchema(metadata *arrow.Metadata) *arrow.Schema
- func TraceSchemaFieldsAsString() []string
- func TransactionSchema(metadata *arrow.Metadata) *arrow.Schema
- func TransactionSchemaFieldsAsString() []string
- type AccessList
- type Address
- type Block
- type BlockNumber
- type BloomFilter
- type Data
- type DataResponse
- type DataType
- type Event
- type FieldSelection
- type Hash
- type JoinMode
- type Log
- type LogArgument
- type LogIndex
- type LogSelection
- type Nonce
- type Quantity
- type Query
- type QueryResponse
- func (qr *QueryResponse) AppendBlockData(data Block)
- func (qr *QueryResponse) AppendLogData(data Log)
- func (qr *QueryResponse) AppendTraceData(data Trace)
- func (qr *QueryResponse) AppendTransactionData(data Transaction)
- func (qr *QueryResponse) GetBlockByNumber(number *big.Int) *Block
- func (qr *QueryResponse) GetBlocks() []Block
- func (qr *QueryResponse) GetData() DataResponse
- func (qr *QueryResponse) GetLogs() []Log
- func (qr *QueryResponse) GetRollbackGuard() *RollbackGuard
- func (qr *QueryResponse) GetTraces() []Trace
- func (qr *QueryResponse) GetTransactions() []Transaction
- func (qr *QueryResponse) HasNextBlock() bool
- func (qr *QueryResponse) HasRollbackGuard() bool
- func (qr *QueryResponse) SetArchiveHeight(height *big.Int)
- func (qr *QueryResponse) SetNextBlock(block *big.Int)
- func (qr *QueryResponse) SetRollbackGuard(rg *RollbackGuard)
- func (qr *QueryResponse) SetTotalExecutionTime(tet uint64)
- type RollbackGuard
- type SigHash
- type Trace
- type TraceSelection
- type Transaction
- type TransactionIndex
- type TransactionSelection
- type TransactionStatus
- type TransactionType
- type Withdrawal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockSchemaFieldsAsString ¶
func BlockSchemaFieldsAsString() []string
func LogSchemaFieldsAsString ¶
func LogSchemaFieldsAsString() []string
func TraceSchemaFieldsAsString ¶
func TraceSchemaFieldsAsString() []string
func TransactionSchemaFieldsAsString ¶
func TransactionSchemaFieldsAsString() []string
Types ¶
type AccessList ¶
type AccessList struct { Address *Address `json:"address,omitempty"` StorageKeys *[]Hash `json:"storageKeys,omitempty"` }
AccessList represents an Evm access list object.
See ethereum rpc spec for the meaning of fields.
type Block ¶
type Block struct { // A scalar value equal to the number of ancestor blocks. The genesis block has a number of zero; formally Hi. Number *big.Int `json:"number,omitempty"` // The Keccak 256-bit hash of the block Hash *common.Hash `json:"hash,omitempty"` // The Keccak 256-bit hash of the parent block’s header, in its entirety; formally Hp. ParentHash *common.Hash `json:"parent_hash,omitempty"` // A 64-bit value which, combined with the mixhash, proves that a sufficient amount of computation has been carried out on this block; formally Hn. Nonce *types.BlockNonce `json:"nonce,omitempty"` // The Keccak 256-bit hash of the ommers/uncles list portion of this block; formally Ho. Sha3Uncles *common.Hash `json:"sha3_uncles,omitempty"` // The Bloom filter composed from indexable information (logger address and log topics) contained in each log entry from the receipt of each transaction in the transactions list; formally Hb. LogsBloom *types.Bloom `json:"logs_bloom,omitempty"` // The Keccak 256-bit hash of the root node of the trie structure populated with each transaction in the transactions list portion of the block; formally Ht. TransactionsRoot *common.Hash `json:"transactions_root,omitempty"` // The Keccak 256-bit hash of the root node of the state trie, after all transactions are executed and finalisations applied; formally Hr. StateRoot *common.Hash `json:"state_root,omitempty"` // The Keccak 256-bit hash of the root node of the trie structure populated with each transaction in the transactions list portion of the block; formally Ht. ReceiptsRoot *common.Hash `json:"receipts_root,omitempty"` // The 160-bit address to which all fees collected from the successful mining of this block be transferred; formally Hc. Miner *common.Address `json:"miner,omitempty"` // A scalar value corresponding to the difficulty level of this block. This can be calculated from the previous block’s difficulty level and the timestamp; formally Hd. Difficulty *big.Int `json:"difficulty,omitempty"` // The cumulative sum of the difficulty of all blocks that have been mined in the Ethereum network since the inception of the network. It measures the overall security and integrity of the Ethereum network. TotalDifficulty *big.Int `json:"total_difficulty,omitempty"` // An arbitrary byte array containing data relevant to this block. This must be 32 bytes or fewer; formally Hx. ExtraData *common.Hash `json:"extra_data,omitempty"` // The size of this block in bytes as an integer value, encoded as hexadecimal. Size *uint64 `json:"size,omitempty"` // A scalar value equal to the current limit of gas expenditure per block; formally Hl. GasLimit *uint64 `json:"gas_limit,omitempty"` // A scalar value equal to the total gas used in transactions in this block; formally Hg. GasUsed *uint64 `json:"gas_used,omitempty"` // A scalar value equal to the reasonable output of Unix’s time() at this block’s inception; formally Hs. Timestamp *time.Time `json:"timestamp,omitempty"` // Ommers/uncles header. Uncles *[]common.Hash `json:"uncles,omitempty"` // A scalar representing EIP1559 base fee which can move up or down each block according to a formula which is a function of gas used in parent block and gas target (block gas limit divided by elasticity multiplier) of parent block. The algorithm results in the base fee per gas increasing when blocks are above the gas target, and decreasing when blocks are below the gas target. The base fee per gas is burned. BaseFeePerGas *big.Int `json:"base_fee_per_gas,omitempty"` // The total amount of blob gas consumed by the transactions within the block, added in EIP-4844. BlobGasUsed *uint64 `json:"blob_gas_used,omitempty"` // A running total of blob gas consumed in excess of the target, prior to the block. Blocks with above-target blob gas consumption increase this value, blocks with below-target blob gas consumption decrease it (bounded at 0). This was added in EIP-4844. ExcessBlobGas *uint64 `json:"excess_blob_gas,omitempty"` // The hash of the parent beacon block's root is included in execution blocks, as proposed by EIP-4788. This enables trust-minimized access to consensus state, supporting staking pools, bridges, and more. The beacon roots contract handles root storage, enhancing Ethereum's functionalities. ParentBeaconBlockRoot *common.Hash `json:"parent_beacon_block_root,omitempty"` // The Keccak 256-bit hash of the withdrawals list portion of this block. See EIP-4895. WithdrawalsRoot *common.Hash `json:"withdrawals_root,omitempty"` // Withdrawal represents a validator withdrawal from the consensus layer. Withdrawals *[]Withdrawal `json:"withdrawals,omitempty"` // The L1 block number that would be used for block.number calls. L1BlockNumber *big.Int `json:"l1_block_number,omitempty"` // The number of L2 to L1 messages since Nitro genesis. SendCount *big.Int `json:"send_count,omitempty"` // The Merkle root of the outbox tree state. SendRoot *common.Hash `json:"send_root,omitempty"` // A 256-bit hash which, combined with the nonce, proves that a sufficient amount of computation has been carried out on this block; formally Hm. MixHash *common.Hash `json:"mix_hash,omitempty"` }
Block represents an Ethereum block object.
func NewBlockFromRecord ¶
func (*Block) ToCommonHeader ¶
type BlockNumber ¶
type BlockNumber uint64
type BloomFilter ¶
type BloomFilter string
type DataResponse ¶
type DataResponse struct { // Blocks contains the list of block data. Blocks []Block `json:"blocks,omitempty"` // Transactions contains the list of transaction data. Transactions []Transaction `json:"transactions,omitempty"` // Logs contains the list of log data. Logs []Log `json:"logs,omitempty"` // Traces contains the list of trace data. Traces []Trace `json:"traces,omitempty"` }
DataResponse represents the response containing various types of data such as blocks, transactions, logs, and traces.
type Event ¶
type Event struct { // An Ethereum event transaction object. Transaction *Transaction `json:"transaction,omitempty"` // An Ethereum event block object. Block *Block `json:"block,omitempty"` // An Ethereum event log object. Log Log `json:"log"` }
Event represents an Ethereum event object.
type FieldSelection ¶
type Log ¶
type Log struct { // The boolean value indicating if the event was removed from the blockchain due to a chain reorganization. True if the log was removed. False if it is a valid log. Removed *bool `json:"removed,omitempty"` // The integer identifying the index of the event within the block's list of events. LogIndex *uint64 `json:"log_index,omitempty"` // The integer index of the transaction within the block's list of transactions. TransactionIndex *uint64 `json:"transaction_index,omitempty"` // The hash of the transaction that triggered the event. TransactionHash *common.Hash `json:"transaction_hash,omitempty"` // The hash of the block in which the event was included. BlockHash *common.Hash `json:"block_hash,omitempty"` // The block number in which the event was included. BlockNumber *big.Int `json:"block_number,omitempty"` // The contract address from which the event originated. Address *common.Address `json:"address,omitempty"` // The non-indexed data that was emitted along with the event. Data *[]byte `json:"data,omitempty"` // Additional topics Topic0 *common.Hash `json:"topic0,omitempty"` Topic1 *common.Hash `json:"topic1,omitempty"` Topic2 *common.Hash `json:"topic2,omitempty"` Topic3 *common.Hash `json:"topic3,omitempty"` }
Log represents an Ethereum event log object.
func NewLogFromRecord ¶
type LogArgument ¶
type LogArgument string
type LogSelection ¶
type Query ¶
type Query struct { FromBlock *big.Int `json:"from_block,omitempty"` ToBlock *big.Int `json:"to_block,omitempty"` Logs []LogSelection `json:"logs,omitempty"` Transactions []TransactionSelection `json:"transactions,omitempty"` Traces []TraceSelection `json:"traces,omitempty"` IncludeAllBlocks bool `json:"include_all_blocks,omitempty"` FieldSelection FieldSelection `json:"field_selection,omitempty"` MaxNumBlocks *big.Int `json:"max_num_blocks,omitempty"` MaxNumTransactions *big.Int `json:"max_num_transactions,omitempty"` MaxNumLogs *big.Int `json:"max_num_logs,omitempty"` MaxNumTraces *big.Int `json:"max_num_traces,omitempty"` JoinMode JoinMode `json:"join_mode,omitempty"` }
type QueryResponse ¶
type QueryResponse struct { // Current height of the source hypersync instance ArchiveHeight *big.Int `json:"archive_height"` // Next block to query for, the responses are paginated so // the caller should continue the query from this block if they // didn't get responses up to the to_block they specified in the Query. NextBlock *big.Int `json:"next_block"` // Total time it took the hypersync instance to execute the query. TotalExecutionTime uint64 `json:"total_execution_time"` // Response data Data DataResponse `json:"data"` // Rollback guard RollbackGuard *RollbackGuard `json:"rollback_guard"` }
QueryResponse represents the query response from hypersync instance. Contain next_block field in case query didn't process all the block range
func (*QueryResponse) AppendBlockData ¶
func (qr *QueryResponse) AppendBlockData(data Block)
func (*QueryResponse) AppendLogData ¶
func (qr *QueryResponse) AppendLogData(data Log)
func (*QueryResponse) AppendTraceData ¶
func (qr *QueryResponse) AppendTraceData(data Trace)
func (*QueryResponse) AppendTransactionData ¶
func (qr *QueryResponse) AppendTransactionData(data Transaction)
func (*QueryResponse) GetBlockByNumber ¶
func (qr *QueryResponse) GetBlockByNumber(number *big.Int) *Block
func (*QueryResponse) GetBlocks ¶
func (qr *QueryResponse) GetBlocks() []Block
func (*QueryResponse) GetData ¶
func (qr *QueryResponse) GetData() DataResponse
func (*QueryResponse) GetLogs ¶
func (qr *QueryResponse) GetLogs() []Log
func (*QueryResponse) GetRollbackGuard ¶
func (qr *QueryResponse) GetRollbackGuard() *RollbackGuard
func (*QueryResponse) GetTraces ¶
func (qr *QueryResponse) GetTraces() []Trace
func (*QueryResponse) GetTransactions ¶
func (qr *QueryResponse) GetTransactions() []Transaction
func (*QueryResponse) HasNextBlock ¶
func (qr *QueryResponse) HasNextBlock() bool
func (*QueryResponse) HasRollbackGuard ¶
func (qr *QueryResponse) HasRollbackGuard() bool
func (*QueryResponse) SetArchiveHeight ¶
func (qr *QueryResponse) SetArchiveHeight(height *big.Int)
func (*QueryResponse) SetNextBlock ¶
func (qr *QueryResponse) SetNextBlock(block *big.Int)
func (*QueryResponse) SetRollbackGuard ¶
func (qr *QueryResponse) SetRollbackGuard(rg *RollbackGuard)
func (*QueryResponse) SetTotalExecutionTime ¶
func (qr *QueryResponse) SetTotalExecutionTime(tet uint64)
type RollbackGuard ¶
type SigHash ¶
type SigHash [4]byte
func NewSigHashFromHex ¶
func (SigHash) MarshalJSON ¶
func (*SigHash) UnmarshalJSON ¶
type Trace ¶
type Trace struct { // The address of the sender who initiated the transaction. From *common.Address `json:"from,omitempty"` // The address of the recipient of the transaction if it was a transaction to an address. For contract creation transactions, this field is None. To *common.Address `json:"to,omitempty"` // SigHash ... SigHash *common.Hash `json:"sig_hash,omitempty"` // The type of trace, `call` or `delegatecall`, two ways to invoke a function in a smart contract. `call` creates a new environment for the function to work in, so changes made in that function won't affect the environment where the function was called. `delegatecall` doesn't create a new environment. Instead, it runs the function within the environment of the caller, so changes made in that function will affect the caller's environment. CallType *string `json:"call_type,omitempty"` // The units of gas included in the transaction by the sender. Gas *uint64 `json:"gas,omitempty"` // The optional input data sent with the transaction, usually used to interact with smart contracts. Input *[]byte `json:"input,omitempty"` // The init code. Init *[]common.Hash `json:"init,omitempty"` // The value of the native token transferred along with the transaction, in Wei. Value *big.Int `json:"value,omitempty"` // The address of the receiver for reward transaction. Author *common.Address `json:"author,omitempty"` // Kind of reward. `Block` reward or `Uncle` reward. RewardType *string `json:"reward_type,omitempty"` // The hash of the block in which the transaction was included. BlockHash *common.Hash `json:"block_hash,omitempty"` // The number of the block in which the transaction was included. BlockNumber *big.Int `json:"block_number,omitempty"` // Destroyed address. AddressDestroyed *common.Address `json:"address,omitempty"` // Contract code. Code *common.Hash `json:"code,omitempty"` // The total used gas by the call, encoded as hexadecimal. GasUsed *uint64 `json:"gas_used,omitempty"` // The return value of the call, encoded as a hexadecimal string. Output *common.Hash `json:"output,omitempty"` // The number of sub-traces created during execution. When a transaction is executed on the EVM, it may trigger additional sub-executions, such as when a smart contract calls another smart contract or when an external account is accessed. Subtraces *uint64 `json:"subtraces,omitempty"` // An array that indicates the position of the transaction in the trace. TraceAddress *[]uint64 `json:"trace_address,omitempty"` // The hash of the transaction. TransactionHash *common.Hash `json:"transaction_hash,omitempty"` // The index of the transaction in the block. TransactionPosition *uint64 `json:"transaction_position,omitempty"` // The type of action taken by the transaction, `call`, `create`, `reward` and `suicide`. `call` is the most common type of trace and occurs when a smart contract invokes another contract's function. `create` represents the creation of a new smart contract. This type of trace occurs when a smart contract is deployed to the blockchain. Kind *string `json:"type,omitempty"` // A string that indicates whether the transaction was successful or not. None if successful, Reverted if not. Error *string `json:"error,omitempty"` }
Trace represents an Ethereum trace object.
type TraceSelection ¶
type TraceSelection struct { From []common.Address `json:"from,omitempty"` To []common.Address `json:"to,omitempty"` Address []common.Address `json:"address,omitempty"` CallType []string `json:"call_type,omitempty"` RewardType []string `json:"reward_type,omitempty"` Kind []string `json:"type,omitempty"` SigHash []common.Hash `json:"sighash,omitempty"` }
type Transaction ¶
type Transaction struct { // The Keccak 256-bit hash of the block BlockHash *common.Hash `json:"block_hash,omitempty"` // A scalar value equal to the number of ancestor blocks. The genesis block has a number of zero; formally Hi. BlockNumber *big.Int `json:"block_number,omitempty"` // SigHash ... SigHash *common.Hash `json:"sig_hash,omitempty"` // The 160-bit address of the message call’s sender From *common.Address `json:"from,omitempty"` // A scalar value equal to the maximum amount of gas that should be used in executing this transaction. This is paid up-front, before any computation is done and may not be increased later; formally Tg. Gas *uint64 `json:"gas,omitempty"` // A scalar value equal to the number of Wei to be paid per unit of gas for all computation costs incurred as a result of the execution of this transaction; formally Tp. GasPrice *big.Int `json:"gas_price,omitempty"` // A transaction hash is a keccak hash of an RLP encoded signed transaction. Hash *common.Hash `json:"hash,omitempty"` // Input has two uses depending if transaction is Create or Call (if `to` field is None or Some). pub init: An unlimited size byte array specifying the EVM-code for the account initialisation procedure CREATE, data: An unlimited size byte array specifying the input data of the message call, formally Td. Input *[]byte `json:"input,omitempty"` // A scalar value equal to the number of transactions sent by the sender; formally Tn. Nonce *uint64 `json:"nonce,omitempty"` // The 160-bit address of the message call’s recipient or, for a contract creation transaction, ∅, used here to denote the only member of B0 ; formally Tt. To *common.Address `json:"to,omitempty"` // Index of the transaction in the block TransactionIndex *uint64 `json:"transaction_index,omitempty"` // A scalar value equal to the number of Wei to be transferred to the message call’s recipient or, in the case of contract creation, as an endowment to the newly created account; formally Tv. Value *big.Int `json:"value,omitempty"` // Replay protection value based on chain_id. See EIP-155 for more info. V *big.Int `json:"v,omitempty"` // The R field of the signature; the point on the curve. R *big.Int `json:"r,omitempty"` // The S field of the signature; the point on the curve. S *big.Int `json:"s,omitempty"` // yParity: Signature Y parity; formally Ty YParity *big.Int `json:"y_parity,omitempty"` // Max Priority fee that transaction is paying As ethereum circulation is around 120mil eth as of 2022 that is around 120000000000000000000000000 wei we are safe to use u128 as its max number is: 340282366920938463463374607431768211455 This is also known as `GasTipCap` MaxPriorityFeePerGas *big.Int `json:"max_priority_fee_per_gas,omitempty"` // A scalar value equal to the maximum amount of gas that should be used in executing this transaction. This is paid up-front, before any computation is done and may not be increased later; formally Tg. As ethereum circulation is around 120mil eth as of 2022 that is around 120000000000000000000000000 wei we are safe to use u128 as its max number is: 340282366920938463463374607431768211455 This is also known as `GasFeeCap` MaxFeePerGas *big.Int `json:"max_fee_per_gas,omitempty"` // Added as EIP-155: Simple replay attack protection ChainID *big.Int `json:"chain_id,omitempty"` // The accessList specifies a list of addresses and storage keys; these addresses and storage keys are added into the `accessed_addresses` and `accessed_storage_keys` global sets (introduced in EIP-2929). A gas cost is charged, though at a discount relative to the cost of accessing outside the list. AccessList *[]types.AccessList `json:"access_list,omitempty"` // Max fee per data gas aka BlobFeeCap or blobGasFeeCap MaxFeePerBlobGas *big.Int `json:"max_fee_per_blob_gas,omitempty"` // It contains a vector of fixed size hash(32 bytes) BlobVersionedHashes *[]common.Hash `json:"blob_versioned_hashes,omitempty"` // The total amount of gas used in the block until this transaction was executed. CumulativeGasUsed *uint64 `json:"cumulative_gas_used,omitempty"` // The sum of the base fee and tip paid per unit of gas. EffectiveGasPrice *big.Int `json:"effective_gas_price,omitempty"` // Gas used by transaction GasUsed *uint64 `json:"gas_used,omitempty"` // Address of created contract if transaction was a contract creation ContractAddress *common.Address `json:"contract_address,omitempty"` // Bloom filter for logs produced by this transaction LogsBloom *BloomFilter `json:"logs_bloom,omitempty"` // Transaction type. For ethereum: Legacy, Eip2930, Eip1559, Eip4844 Kind *uint8 `json:"type,omitempty"` // The Keccak 256-bit hash of the root node of the trie structure populated with each transaction in the transactions list portion of the block; formally Ht. Root *common.Hash `json:"root,omitempty"` // If transaction is executed successfully. This is the `statusCode` Status *uint8 `json:"status,omitempty"` // The fee associated with a transaction on the Layer 1, it is calculated as l1GasPrice multiplied by l1GasUsed L1Fee *big.Int `json:"l1_fee,omitempty"` // The gas price for transactions on the Layer 1 L1GasPrice *big.Int `json:"l1_gas_price,omitempty"` // The amount of gas consumed by a transaction on the Layer 1 L1GasUsed *uint64 `json:"l1_gas_used,omitempty"` // A multiplier applied to the actual gas usage on Layer 1 to calculate the dynamic costs. If set to 1, it has no impact on the L1 gas usage L1FeeScalar *float64 `json:"l1_fee_scalar,omitempty"` // Amount of gas spent on L1 calldata in units of L2 gas. GasUsedForL1 *uint64 `json:"gas_used_for_l1,omitempty"` }
Transaction represents an Ethereum transaction object.
func (*Transaction) Data ¶
func (t *Transaction) Data() []byte
type TransactionIndex ¶
type TransactionIndex uint64
type TransactionSelection ¶
type TransactionSelection struct { From []common.Address `json:"from,omitempty"` To []common.Address `json:"to,omitempty"` SigHash []SigHash `json:"sighash,omitempty"` Status *uint8 `json:"status,omitempty"` Kind []uint8 `json:"type,omitempty"` ContractAddress []common.Address `json:"contract_address,omitempty"` }
type TransactionStatus ¶
type TransactionStatus string
type TransactionType ¶
type TransactionType string
type Withdrawal ¶
type Withdrawal struct{}