Documentation
¶
Index ¶
- Constants
- Variables
- func Account(address *EthCommon.Address) *RosettaTypes.AccountIdentifier
- func Amount(value *big.Int, currency *RosettaTypes.Currency) *RosettaTypes.Amount
- func BedrockContainsTopic(log *EthTypes.Log, topic string) bool
- func CallType(t string) bool
- func ChecksumAddress(address string) (string, bool)
- func ConvertEVMTopicHashToAddress(hash *EthCommon.Hash) *EthCommon.Address
- func CreateType(t string) bool
- func EffectiveGasPrice(tx InnerBedrockTransaction, baseFee *big.Int) (*big.Int, error)
- func Erc20Amount(bytes []byte, addr EthCommon.Address, currency RosettaTypes.Currency, ...) *RosettaTypes.Amount
- func Erc20Ops(transferLog *EthTypes.Log, currency *RosettaTypes.Currency, opsLen int64) []*RosettaTypes.Operation
- func ExtractL1Fee(rosettaTxReceipt *RosettaTxReceipt) *big.Int
- func ExtractStatus(rosettaTxReceipt *RosettaTxReceipt) (uint64, error)
- func FeeOps(tx *bedrockTransaction) ([]*RosettaTypes.Operation, error)
- func GenerateBootstrapFile(genesisFile string, outputFile string) error
- func GenerateOp(opIndex int64, relatedOps []*RosettaTypes.OperationIdentifier, opType string, ...) *RosettaTypes.Operation
- func LoadAndParseURL(url string, output interface{}) error
- func MarshalJSONMap(i interface{}) (map[string]interface{}, error)
- func MintOps(tx *bedrockTransaction, startIndex int) []*RosettaTypes.Operation
- func MustChecksum(address string) string
- func StartGeth(ctx context.Context, arguments string, g *errgroup.Group) error
- func TraceOps(calls []*FlatCall, startIndex int) []*RosettaTypes.Operation
- type BedrockRPCTransaction
- type BlockError
- type BlockParser
- type Call
- type Client
- func (ec *Client) Balance(ctx context.Context, account *RosettaTypes.AccountIdentifier, ...) (*RosettaTypes.AccountBalanceResponse, error)
- func (ec *Client) BaseFee(ctx context.Context) (*big.Int, error)
- func (ec *Client) Block(ctx context.Context, blockIdentifier *RosettaTypes.PartialBlockIdentifier) (*RosettaTypes.Block, error)
- func (ec *Client) Call(ctx context.Context, request *RosettaTypes.CallRequest) (*RosettaTypes.CallResponse, error)
- func (ec *Client) CallContract(ctx context.Context, call Eth.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (ec *Client) Close()
- func (ec *Client) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
- func (ec *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (ec *Client) FilterLogs(ctx context.Context, query Eth.FilterQuery) ([]EthTypes.Log, error)
- func (ec *Client) HeaderByNumber(ctx context.Context, number *big.Int) (*EthTypes.Header, error)
- func (c *Client) IsPreBedrock(b *big.Int) bool
- func (ec *Client) ParseOps(tx *bedrockTransaction) ([]*RosettaTypes.Operation, error)
- func (ec *Client) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (ec *Client) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (ec *Client) SendTransaction(ctx context.Context, tx *types2.Transaction) error
- func (ec *Client) Status(ctx context.Context) (*RosettaTypes.BlockIdentifier, int64, *RosettaTypes.SyncStatus, ...)
- func (ec *Client) SubscribeFilterLogs(ctx context.Context, query Eth.FilterQuery, ch chan<- EthTypes.Log) (Eth.Subscription, error)
- func (ec *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (ec *Client) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (ec *Client) TraceBlockByHash(ctx context.Context, blockHash EthCommon.Hash, txs []BedrockRPCTransaction) (map[string][]*FlatCall, error)
- func (ec *Client) TraceTransactions(ctx context.Context, blockHash EthCommon.Hash, txs []BedrockRPCTransaction) (map[string][]*FlatCall, error)
- type ClientOptions
- type CurrencyFetcher
- type ERC20CurrencyFetcher
- type FlatCall
- type GetBlockByNumberInput
- type GetCallInput
- type GetTransactionReceiptInput
- type GraphQL
- type GraphQLClient
- type InnerBedrockTransaction
- type JSONRPC
- type L2Receipt
- type RosettaTxReceipt
- type TraceCache
- type TxExtraInfo
Constants ¶
const ( // MintOpType is a [RosettaTypes.Operation] type for an Optimism Deposit or "mint" transaction. MintOpType = "MINT" // An erroneous STOP Type not defined in rosetta-geth-sdk StopOpType = "STOP" )
Op Types
const ( NumTopicsERC20Transfer = 3 UnknownERC20Symbol = "ERC20_UNKNOWN" UnknownERC20Decimals = 0 UnknownERC721Symbol = "ERC721_UNKNOWN" UnknownERC721Decimals = 0 )
ERC20 Log Consts
const ( // NodeVersion is the version of geth we are using. NodeVersion = "1.9.24" // Blockchain is Optimism. Blockchain string = "Optimism" // MainnetNetwork is the value of the network // in MainnetNetworkIdentifier. MainnetNetwork string = "Mainnet" // TestnetNetwork is the value of the network // in TestnetNetworkIdentifier. TestnetNetwork string = "Testnet" // SepoliaNetwork is the value of the sepolia network. SepoliaNetwork string = "Sepolia" // GoerliNetwork is the value of the network // in GoerliNetworkNetworkIdentifier. GoerliNetwork string = "Goerli" // Symbol is the symbol value // used in Currency. Symbol = "ETH" TokenSymbol = "OP" // Decimals is the decimals value // used in Currency. Decimals = 18 TokenDecimals = 18 // FeeOpType is used to represent fee operations. FeeOpType = "FEE" // PaymentOpType is used to represent token transfer operations PaymentOpType = "PAYMENT" // ERC20MintOpType is used to represent token mint operations ERC20MintOpType = "ERC20_MINT" // ERC20BurnOpType is used to represent token burn operations ERC20BurnOpType = "ERC20_BURN" // ERC20TransferOpType is used to represent token transfer operations ERC20TransferOpType = "ERC20_TRANSFER" // CallOpType is used to represent CALL trace operations. CallOpType = "CALL" // CreateOpType is used to represent CREATE trace operations. CreateOpType = "CREATE" // Create2OpType is used to represent CREATE2 trace operations. Create2OpType = "CREATE2" // SelfDestructOpType is used to represent SELFDESTRUCT trace operations. SelfDestructOpType = "SELFDESTRUCT" // CallCodeOpType is used to represent CALLCODE trace operations. CallCodeOpType = "CALLCODE" // DelegateCallOpType is used to represent DELEGATECALL trace operations. DelegateCallOpType = "DELEGATECALL" // StaticCallOpType is used to represent STATICCALL trace operations. StaticCallOpType = "STATICCALL" // DestructOpType is a synthetic operation used to represent the // deletion of suicided accounts that still have funds at the end // of a transaction. DestructOpType = "DESTRUCT" // DelegateVotesOpType is used to represent OZ ERC20Votes votes delegation DelegateVotesOpType = "DELEGATE_VOTES" // SuccessStatus is the status of any // Ethereum operation considered successful. SuccessStatus = "SUCCESS" // FailureStatus is the status of any // Ethereum operation considered unsuccessful. FailureStatus = "FAILURE" // HistoricalBalanceSupported is whether // historical balance is supported. HistoricalBalanceSupported = true // GenesisBlockIndex is the index of the // genesis block. GenesisBlockIndex = int64(0) // TransferGasLimit is the gas limit // of a transfer. TransferGasLimit = uint64(21000) //nolint:gomnd // MainnetGethArguments are the arguments to start a mainnet geth instance. MainnetGethArguments = `--config=/app/optimism/geth.toml --gcmode=archive --graphql` // IncludeMempoolCoins does not apply to rosetta-ethereum as it is not UTXO-based. IncludeMempoolCoins = false // ContractAddressKey is the key used to denote the contract address // for a token, provided via Currency metadata. ContractAddressKey string = "token_address" )
const ( // EthGetTransactionReceipt is the RPC method used to fetch a transaction receipt. EthGetTransactionReceipt = "eth_getTransactionReceipt" // EthGetBlockByNumber is the RPC method used to fetch a block by number. EthGetBlockByNumber = "eth_getBlockByNumber" // EthCall is the RPC method used to call a contract. EthCall = "eth_call" // EthEstimateGas is the RPC method used to estimate gas. EthEstimateGas = "eth_estimateGas" )
RPC Methods
const ImplementationContractFilter = "0xc0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3"
const L1ToL2DepositType = 126 // (126)
L1ToL2DepositType is the transaction type for L1ToL2 deposits.
const ProxyContractFilter = "0x420000000000000000000000000000000000"
const TopicsInErc20Transfer = 3
const ( // TransferEvent is emitted when an ERC20 token is transferred. // // TransferEvent is emitted in two bridging scenarios: // 1. When a native token is being sent to a non-native chain, from the sender to the bridge contract. // Think: Transferring USDC on Ethereum Mainnet to the Optimism bridge contract, // you will see a Transfer event from the sender (you) to the bridge contract. // 2. When a non-native token is being sent to a native chain, from the bridge to the sender contract. // Think: "Withdrawing" USDC from Optimism to Ethereum Mainnet. You will see a Transfer event // from the bridge contract to you (the sender) once the withdrawal is finalized on Mainnet. TransferEvent = "Transfer(address,address,uint256)" )
Event Topics
Variables ¶
var ( ErrBlockOrphaned = errors.New("block orphaned") ErrCallParametersInvalid = errors.New("call parameters invalid") ErrCallOutputMarshal = errors.New("call output marshal") ErrCallMethodInvalid = errors.New("call method invalid") )
Client errors
var ( // The BaseFeeVault predeploy receives the basefees on L2. // The basefee is not burnt on L2 like it is on L1. // Once the contract has received a certain amount of fees, // the ETH can be permissionlessly withdrawn to an immutable address on L1. BaseFeeVault = EthCommon.HexToAddress("0x4200000000000000000000000000000000000019") // The L1FeeVault predeploy receives the L1 portion of the transaction fees. // Once the contract has received a certain amount of fees, // the ETH can be permissionlessly withdrawn to an immutable address on L1. L1FeeVault = EthCommon.HexToAddress("0x420000000000000000000000000000000000001a") )
Optimism Predeploy Addresses (represented as 0x-prefixed hex string) See PredeployedContracts for more information.
var ( // TestnetGethArguments are the arguments to start a ropsten geth instance. TestnetGethArguments = fmt.Sprintf("%s --testnet", MainnetGethArguments) // RinkebyGethArguments are the arguments to start a rinkeby geth instance. RinkebyGethArguments = fmt.Sprintf("%s --rinkeby", MainnetGethArguments) // GoerliGethArguments are the arguments to start a ropsten geth instance. GoerliGethArguments = fmt.Sprintf("%s --goerli", MainnetGethArguments) // MainnetGenesisBlockIdentifier is the *types.BlockIdentifier // of the mainnet genesis block. MainnetGenesisBlockIdentifier = &types.BlockIdentifier{ Hash: "0x7ca38a1916c42007829c55e69d3e9a73265554b586a499015373241b8a3fa48b", Index: GenesisBlockIndex, } // TestnetGenesisBlockIdentifier is the *types.BlockIdentifier // of the testnet genesis block. TestnetGenesisBlockIdentifier = &types.BlockIdentifier{ Hash: "0x02adc9b449ff5f2467b8c674ece7ff9b21319d76c4ad62a67a70d552655927e5", Index: GenesisBlockIndex, } // GoerliGenesisBlockIdentifier is the *types.BlockIdentifier // of the Goerli genesis block. GoerliGenesisBlockIdentifier = &types.BlockIdentifier{ Hash: "0xb643d8aa991fb19f47b9178818886afb4eb54589eb500967beb444ea64f9761b", Index: GenesisBlockIndex, } SepoliaGenesisBlockIdentifier = &types.BlockIdentifier{ Hash: "0x102de6ffb001480cc9b8b548fd05c34cd4f46ae4aa91759393db90ea0409887d", Index: GenesisBlockIndex, } // Currency is the *types.Currency for all // Ethereum networks. Currency = &types.Currency{ Symbol: Symbol, Decimals: Decimals, } OPTokenCurrency = &types.Currency{ Symbol: TokenSymbol, Decimals: TokenDecimals, } // OperationTypes are all suppoorted operation types. OperationTypes = []string{ FeeOpType, PaymentOpType, ERC20MintOpType, ERC20BurnOpType, CallOpType, CreateOpType, Create2OpType, SelfDestructOpType, CallCodeOpType, DelegateCallOpType, StaticCallOpType, DestructOpType, DelegateVotesOpType, ERC20TransferOpType, } // OperationStatuses are all supported operation statuses. OperationStatuses = []*types.OperationStatus{ { Status: SuccessStatus, Successful: true, }, { Status: FailureStatus, Successful: false, }, } // CallMethods are all supported call methods. CallMethods = []string{ EthGetBlockByNumber, EthGetTransactionReceipt, EthCall, EthEstimateGas, } )
var ErrBadCurrency = errors.New("bad currency")
var ErrBlockFetch = fmt.Errorf("failed to fetch block")
var ErrBlockNotFound = fmt.Errorf("block not found")
var ErrBlockUnmarshal = fmt.Errorf("failed to unmarshal block")
var ErrClientBlockOrphaned = errors.New("block orphaned")
var ErrHeaderUnmarshal = fmt.Errorf("failed to unmarshal header")
Functions ¶
func Account ¶
func Account(address *EthCommon.Address) *RosettaTypes.AccountIdentifier
func Amount ¶
func Amount(value *big.Int, currency *RosettaTypes.Currency) *RosettaTypes.Amount
Amount returns a Rosetta Amount from a big.Int and currency.
func BedrockContainsTopic ¶
BedrockContainsTopic checks if a bedrock log contains a topic
func ChecksumAddress ¶
ChecksumAddress ensures an Ethereum hex address is in Checksum Format. If the address cannot be converted, it returns !ok.
func ConvertEVMTopicHashToAddress ¶
ConvertEVMTopicHashToAddress uses the last 20 bytes of a common.Hash to create a common.Address
func CreateType ¶
CreateType returns a boolean indicating if the provided trace type is a create type.
func EffectiveGasPrice ¶
EffectiveGasPrice returns the price of gas charged to this Transaction to be included in the block.
func Erc20Amount ¶
func Erc20Amount( bytes []byte, addr EthCommon.Address, currency RosettaTypes.Currency, sender bool, ) *RosettaTypes.Amount
func Erc20Ops ¶
func Erc20Ops( transferLog *EthTypes.Log, currency *RosettaTypes.Currency, opsLen int64, ) []*RosettaTypes.Operation
Erc20Ops returns a list of erc20 operations parsed from the log from a transaction receipt
func ExtractL1Fee ¶
func ExtractL1Fee(rosettaTxReceipt *RosettaTxReceipt) *big.Int
ExtractL1Fee attempts to unmarshal an [L1Fee] from the RawMessage field in a RosettaTxReceipt TODO: hoist this up to initial receipt unmarshalling in the bedrock block handler so we can error early
func ExtractStatus ¶
func ExtractStatus(rosettaTxReceipt *RosettaTxReceipt) (uint64, error)
ExtractStatus unmarshals a receipt status from a json marshalled raw message
func FeeOps ¶
func FeeOps(tx *bedrockTransaction) ([]*RosettaTypes.Operation, error)
FeeOps returns the fee operations for a given transaction.
func GenerateBootstrapFile ¶
GenerateBootstrapFile creates the bootstrap balances file for a particular genesis file.
func GenerateOp ¶
func GenerateOp(opIndex int64, relatedOps []*RosettaTypes.OperationIdentifier, opType string, opStatus string, address string, amount *RosettaTypes.Amount, metadata map[string]interface{}) *RosettaTypes.Operation
func LoadAndParseURL ¶
func MarshalJSONMap ¶
MarshalJSONMap converts an interface into a map[string]interface{}.
func MintOps ¶
func MintOps(tx *bedrockTransaction, startIndex int) []*RosettaTypes.Operation
MintOps constructs a list of [RosettaTypes.Operation]s for an Optimism Deposit or "mint" transaction.
func MustChecksum ¶
MustChecksum ensures an address can be converted into a valid checksum. If it does not, the program will exit.
Types ¶
type BedrockRPCTransaction ¶
type BedrockRPCTransaction struct { Tx InnerBedrockTransaction `json:"tx"` TxExtraInfo }
BedrockRPCTransaction is a post-bedrock transaction.
func (*BedrockRPCTransaction) LoadTransaction ¶
func (tx *BedrockRPCTransaction) LoadTransaction() *bedrockTransaction
LoadTransaction constructs a [bedrockTransaction] from a BedrockRPCTransaction.
func (*BedrockRPCTransaction) UnmarshalJSON ¶
func (tx *BedrockRPCTransaction) UnmarshalJSON(msg []byte) error
UnmarshalJSON unmarshals an BedrockRPCTransaction from bytes.
type BlockError ¶
func NewBlockError ¶
func NewBlockError(ty error, err error) *BlockError
func (*BlockError) IsBlockFetchError ¶
func (e *BlockError) IsBlockFetchError() bool
type BlockParser ¶
type BlockParser struct {
// contains filtered or unexported fields
}
func NewBlockParser ¶
func NewBlockParser(bedrockBlock *big.Int) *BlockParser
type Call ¶
type Call struct { Type string `json:"type"` From EthCommon.Address `json:"from"` To EthCommon.Address `json:"to"` Value *big.Int `json:"value"` GasUsed *big.Int `json:"gasUsed"` Input string `json:"input"` Revert bool ErrorMessage string `json:"error"` Calls []*Call `json:"calls"` }
Call is an Ethereum debug trace.
func (*Call) UnmarshalJSON ¶
UnmarshalJSON is a custom unmarshaler for Call.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client allows for querying a set of specific Ethereum endpoints in an idempotent manner. Client relies on the eth_*, debug_*, and admin_* methods and on the graphql endpoint.
Client borrows HEAVILY from https://github.com/ethereum/go-ethereum/tree/master/ethclient.
func NewClient ¶
func NewClient(url string, params *params.ChainConfig, opts ClientOptions) (*Client, error)
NewClient creates a Client that from the provided url and params.
func (*Client) Balance ¶
func (ec *Client) Balance( ctx context.Context, account *RosettaTypes.AccountIdentifier, block *RosettaTypes.PartialBlockIdentifier, currencies []*RosettaTypes.Currency, ) (*RosettaTypes.AccountBalanceResponse, error)
Balance returns the balance of a *RosettaTypes.AccountIdentifier at a *RosettaTypes.PartialBlockIdentifier. The OP Token and ETH balances will be returned if currencies is unspecified
func (*Client) Block ¶
func (ec *Client) Block( ctx context.Context, blockIdentifier *RosettaTypes.PartialBlockIdentifier, ) (*RosettaTypes.Block, error)
Block returns a populated block at the *RosettaTypes.PartialBlockIdentifier. If neither the hash or index is populated in the *RosettaTypes.PartialBlockIdentifier, the current (aka latest) block is returned.
func (*Client) Call ¶
func (ec *Client) Call( ctx context.Context, request *RosettaTypes.CallRequest, ) (*RosettaTypes.CallResponse, error)
Call handles calls to the /call endpoint.
func (*Client) CallContract ¶
func (*Client) CodeAt ¶
func (ec *Client) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
Dummy implementations to ensure we can leverage bind.ContractBackend interface for reusing the TCP connection Error out for now, and we can implement in the future if it's necessary
func (*Client) EstimateGas ¶
EstimateGas retrieves the currently gas limit
func (*Client) FilterLogs ¶
func (*Client) HeaderByNumber ¶
func (*Client) IsPreBedrock ¶
IsPreBedrock returns if the given block number is before the bedrock block.
func (*Client) ParseOps ¶
func (ec *Client) ParseOps( tx *bedrockTransaction, ) ([]*RosettaTypes.Operation, error)
ParseOps mimics the down-stream implementation of [rosetta-geth-sdk], exposing a hook for down-stream clients.
func (*Client) PendingCodeAt ¶
func (*Client) PendingNonceAt ¶
PendingNonceAt returns the account nonce of the given account in the pending state. This is the nonce that should be used for the next transaction.
func (*Client) SendTransaction ¶
SendTransaction injects a signed transaction into the pending pool for execution.
If the transaction was a contract creation use the TransactionReceipt method to get the contract address after the transaction has been mined.
func (*Client) Status ¶
func (ec *Client) Status(ctx context.Context) ( *RosettaTypes.BlockIdentifier, int64, *RosettaTypes.SyncStatus, []*RosettaTypes.Peer, error, )
Status returns geth status information for determining node healthiness.
func (*Client) SubscribeFilterLogs ¶
func (ec *Client) SubscribeFilterLogs(ctx context.Context, query Eth.FilterQuery, ch chan<- EthTypes.Log) (Eth.Subscription, error)
func (*Client) SuggestGasPrice ¶
SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.
func (*Client) SuggestGasTipCap ¶
SuggestGasPrice retrieves the currently suggested gas price
func (*Client) TraceBlockByHash ¶
func (ec *Client) TraceBlockByHash( ctx context.Context, blockHash EthCommon.Hash, txs []BedrockRPCTransaction, ) (map[string][]*FlatCall, error)
TraceBlockByHash returns the Transaction traces of all transactions in the block
func (*Client) TraceTransactions ¶
func (ec *Client) TraceTransactions( ctx context.Context, blockHash EthCommon.Hash, txs []BedrockRPCTransaction, ) (map[string][]*FlatCall, error)
TraceTransactions returns traces for each of the given transactions. TraceTransactions uses `debug_traceTransaction` under the hood.
type ClientOptions ¶
type ClientOptions struct { HTTPTimeout time.Duration MaxTraceConcurrency int64 EnableTraceCache bool EnableGethTracer bool FilterTokens bool SupportedTokens map[string]bool BedrockBlock *big.Int SuportsSyncing bool SkipAdminCalls bool SupportsPeering bool EnableCustomBedrockTracer bool TraceByBlock bool TraceCacheSize int }
type CurrencyFetcher ¶
type CurrencyFetcher interface {
FetchCurrency(ctx context.Context, blockNum uint64, contractAddress string) (*RosettaTypes.Currency, error)
}
CurrencyFetcher interface describes a struct that can fetch the details of an Ethereum-based token given its contract address.
type ERC20CurrencyFetcher ¶
type ERC20CurrencyFetcher struct {
// contains filtered or unexported fields
}
ERC20CurrencyFetcher type has a global currencyCache (lru) to cache results of fetching currency details, as well as a GraphQL client (required for getting currency details).
func (ERC20CurrencyFetcher) FetchCurrency ¶
func (ecf ERC20CurrencyFetcher) FetchCurrency( ctx context.Context, blockNum uint64, contractAddress string, ) (*RosettaTypes.Currency, error)
FetchCurrency is a helper function that takes in a contract address (ERC20) and returns a Currency object with details such as the symbol and # of decimal places. This method uses RPC calls to fetch such data. Because the contractAddress param is checksummed prior to invocation, we assume it is valid. We make use of an LRU cache to prevent repeatedly fetching currency details.
There are a few failure cases that this logic accounts for. If any contract call returns an empty value ("0x"), we fall back on default values. Additionally, in the specific case of the symbol, if an empty symbol is returned, we again fall back on the default symbol value.
Note: any returned data payload with the prefix `0x4e487b71` are the first four bytes of keccak256(Panic(uint256)) If we encounter a failure while fetching currency details, we return a default value.
type FlatCall ¶
type FlatCall struct { Type string `json:"type"` From EthCommon.Address `json:"from"` To EthCommon.Address `json:"to"` Value *big.Int `json:"value"` GasUsed *big.Int `json:"gasUsed"` Input string `json:"input"` Revert bool ErrorMessage string `json:"error"` }
FlatCall is a flattened Call object.
func FlattenTraces ¶
FlattenTraces recursively flattens all traces.
type GetBlockByNumberInput ¶
type GetBlockByNumberInput struct { Index *int64 `json:"index,omitempty"` ShowTxDetails bool `json:"show_transaction_details"` }
GetBlockByNumberInput is the input to the call method "eth_getBlockByNumber".
type GetCallInput ¶
type GetCallInput struct { BlockIndex int64 `json:"index,omitempty"` BlockHash string `json:"hash,omitempty"` From string `json:"from"` To string `json:"to"` Gas int64 `json:"gas"` GasPrice int64 `json:"gas_price"` Value int64 `json:"value"` Data string `json:"data"` }
GetCallInput is the input to the call method "eth_call", "eth_estimateGas".
type GetTransactionReceiptInput ¶
type GetTransactionReceiptInput struct {
TxHash string `json:"tx_hash"`
}
GetTransactionReceiptInput is the input to the call method "eth_getTransactionReceipt".
type GraphQLClient ¶
type GraphQLClient struct {
// contains filtered or unexported fields
}
GraphQLClient is a client used to make graphQL queries to geth's graphql endpoint.
type InnerBedrockTransaction ¶
type InnerBedrockTransaction interface { Hash() EthCommon.Hash To() *EthCommon.Address Gas() uint64 GasPrice() *big.Int GetType() uint64 GetValue() *big.Int EffectiveGasTip(*big.Int) (*big.Int, error) }
InnerBedrockTransaction is the JSON representation of a bedrock transaction.
type JSONRPC ¶
type JSONRPC interface { CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error BatchCallContext(ctx context.Context, b []rpc.BatchElem) error Close() }
JSONRPC is the interface for accessing go-ethereum's JSON RPC endpoint.
type L2Receipt ¶
type L2Receipt struct { // Consensus fields: These fields are defined by the Yellow Paper Type *hexutil.Uint64 `json:"type,omitempty"` PostState []byte `json:"root"` Status *hexutil.Uint64 `json:"status"` CumulativeGasUsed *hexutil.Uint64 `json:"cumulativeGasUsed"` Bloom ethTypes.Bloom `json:"logsBloom"` Logs []*ethTypes.Log `json:"logs"` // Implementation fields: These fields are added by geth when processing a transaction or retrieving a receipt. // gencodec annotated fields: these are stored in the chain database. TxHash common.Hash `json:"transactionHash"` ContractAddress *common.Address `json:"contractAddress"` GasUsed *hexutil.Uint64 `json:"gasUsed"` EffectiveGasPrice *hexutil.Uint64 `json:"effectiveGasPrice,omitempty"` // required, but tag omitted for backwards compatibility BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed,omitempty"` BlobGasPrice *hexutil.Uint64 `json:"blobGasPrice,omitempty"` // DepositNonce was introduced in Regolith to store the actual nonce used by deposit transactions // The state transition process ensures this is only set for Regolith deposit transactions. DepositNonce *hexutil.Uint64 `json:"depositNonce,omitempty"` // DepositReceiptVersion was introduced in Canyon to indicate an update to how receipt hashes // should be computed when set. The state transition process ensures this is only set for // post-Canyon deposit transactions. DepositReceiptVersion *hexutil.Uint64 `json:"depositReceiptVersion,omitempty"` // Inclusion information: These fields provide information about the inclusion of the // transaction corresponding to this receipt. BlockHash common.Hash `json:"blockHash,omitempty"` BlockNumber *hexutil.Uint64 `json:"blockNumber,omitempty"` TransactionIndex *hexutil.Uint64 `json:"transactionIndex"` // OVM legacy: extend receipts with their L1 price (if a rollup tx) L1GasPrice *hexutil.Uint64 `json:"l1GasPrice,omitempty"` L1GasUsed *hexutil.Uint64 `json:"l1GasUsed,omitempty"` L1Fee *hexutil.Uint64 `json:"l1Fee,omitempty"` FeeScalar *big.Float `json:"l1FeeScalar,omitempty"` // always nil after Ecotone hardfork }
L2Receipt represents the results of a transaction.
type RosettaTxReceipt ¶
type RosettaTxReceipt struct { Type uint8 `json:"type,omitempty"` GasPrice *big.Int GasUsed *big.Int TransactionFee *big.Int Logs []*EthTypes.Log RawMessage json.RawMessage }
RosettaTxReceipt is a Rosetta-compatible receipt type.
type TraceCache ¶
type TraceCache interface {
FetchTransaction(ctx context.Context, txhash common.Hash) (*Call, error)
}
func NewTraceCache ¶
Source Files
¶
- address.go
- blocks.go
- bootstrap.go
- client.go
- client_balance.go
- client_bedrock.go
- client_bedrock_receipts.go
- client_bedrock_tx.go
- client_blocks.go
- client_blocks_bedrock_handler.go
- client_blocks_bedrock_ops.go
- client_blocks_bedrock_tracers.go
- client_blocks_handler.go
- client_estimate_gas.go
- client_ops.go
- client_status.go
- currency_fetcher.go
- errors.go
- geth.go
- graphql_client.go
- suite_mocks.go
- tracer.go
- types.go
- types_block.go
- types_calls.go
- types_txs.go