Documentation ¶
Index ¶
Constants ¶
const ( // Optimism // https://github.com/Inphi/optimism-rosetta/blob/d3c37e359fa4262a2a53014c424a8ae53efaf3d0/optimism/client_bedrock.go#L138 TransactionTypeOptimismDeposit = 0x7E // Arbitrum // https://github.com/OffchainLabs/go-ethereum/blob/08bf9b119ff9c47ad51d507969997ff9cd8c5328/core/types/transaction.go#L45-L59 TransactionTypeArbitrumDeposit = 0x64 TransactionTypeArbitrumUnsigned = 0x65 TransactionTypeArbitrumContract = 0x66 TransactionTypeArbitrumRetry = 0x68 TransactionTypeArbitrumSubmitRetryable = 0x69 TransactionTypeArbitrumInternal = 0x6A TransactionTypeArbitrumLegacy = 0x78 )
Variables ¶
var ( AddressGenesis = common.HexToAddress("0x0000000000000000000000000000000000000000") HashGenesis = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000") )
Functions ¶
func IsBurnAddress ¶
IsBurnAddress will return whether the current address is a black hole address, most of which are provided by https://etherscan.io/accounts/label/burn.
Types ¶
type Block ¶
type Block struct { Hash common.Hash `json:"hash"` ParentHash common.Hash `json:"parentHash"` UncleHash common.Hash `json:"sha3Uncles"` Coinbase common.Address `json:"miner"` Number *big.Int `json:"number"` GasLimit uint64 `json:"gasLimit"` GasUsed uint64 `json:"gasUsed"` Timestamp uint64 `json:"timestamp"` BaseFee *big.Int `json:"baseFeePerGas"` Transactions []*Transaction `json:"transactions"` }
func (Block) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Block) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type Client ¶
type Client interface { // ContractCaller is used for compatibility with abigen generated contract callers. bind.ContractCaller ChainID(ctx context.Context) (*big.Int, error) BlockNumber(ctx context.Context) (*big.Int, error) HeaderByHash(ctx context.Context, hash common.Hash) (*Header, error) HeaderByNumber(ctx context.Context, number *big.Int) (*Header, error) BlockByHash(ctx context.Context, hash common.Hash) (*Block, error) BlockByNumber(ctx context.Context, number *big.Int) (*Block, error) BatchBlockByNumbers(ctx context.Context, numbers []*big.Int) ([]*Block, error) BlockReceipts(ctx context.Context, number *big.Int) ([]*Receipt, error) BatchBlockReceipts(ctx context.Context, numbers []*big.Int) ([][]*Receipt, error) TransactionByHash(ctx context.Context, hash common.Hash) (*Transaction, error) TransactionReceipt(ctx context.Context, hash common.Hash) (*Receipt, error) BatchTransactionReceipt(ctx context.Context, hashes []common.Hash) ([]*Receipt, error) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error) FilterLogs(ctx context.Context, filter Filter) ([]*Log, error) }
Client provides basic RPC methods.
type Header ¶
type Header struct { Hash common.Hash `json:"hash"` ParentHash common.Hash `json:"parentHash"` UncleHash common.Hash `json:"sha3Uncles"` Coinbase common.Address `json:"miner"` Number *big.Int `json:"number"` GasLimit uint64 `json:"gasLimit"` GasUsed uint64 `json:"gasUsed"` Timestamp uint64 `json:"timestamp"` BaseFee *big.Int `json:"baseFeePerGas"` Transactions []common.Hash `json:"transactions"` }
func (Header) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Header) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type Log ¶
type Log struct { Address common.Address `json:"address"` Topics []common.Hash `json:"topics"` Data []byte `json:"data"` BlockNumber *big.Int `json:"blockNumber"` TransactionHash common.Hash `json:"transactionHash"` TransactionIndex uint `json:"transactionIndex"` BlockHash common.Hash `json:"blockHash"` Index uint `json:"logIndex"` Removed bool `json:"removed"` }
func (*Log) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type Option ¶ added in v0.4.20
Option used to configure the client with additional options.
func WithHTTP2Disabled ¶ added in v0.4.21
func WithHTTP2Disabled() Option
WithHTTP2Disabled sets the HTTP2 client to be disabled.
func WithHTTPHeader ¶ added in v0.4.20
WithHTTPHeader sets the HTTP header for the client. The header can be used to set the authorization token and other headers.
type Receipt ¶
type Receipt struct { BlockHash common.Hash `json:"blockHash"` BlockNumber *big.Int `json:"blockNumber"` ContractAddress *common.Address `json:"contractAddress"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed"` EffectiveGasPrice *big.Int `json:"effectiveGasPrice"` GasUsed uint64 `json:"gasUsed"` // Optimism L1GasPrice *big.Int `json:"l1GasPrice,omitempty"` L1GasUsed *big.Int `json:"l1GasUsed,omitempty"` L1Fee *big.Int `json:"l1Fee,omitempty"` FeeScalar *big.Float `json:"l1FeeScalar,omitempty"` Logs []*Log `json:"logs"` Status uint64 `json:"status"` TransactionHash common.Hash `json:"transactionHash"` TransactionIndex uint `json:"transactionIndex"` }
func (Receipt) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Receipt) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type Transaction ¶
type Transaction struct { BlockHash common.Hash `json:"blockHash"` BlockNumber *big.Int `json:"blockNumber"` From common.Address `json:"from"` Gas uint64 `json:"gas"` GasPrice *big.Int `json:"gasPrice"` GasTipCap *big.Int `json:"maxPriorityFeePerGas"` Hash common.Hash `json:"hash"` Input []byte `json:"input"` To *common.Address `json:"to"` Index uint `json:"index"` Value *big.Int `json:"value"` Type uint64 `json:"type"` ChainID *big.Int `json:"chainId"` }
func (Transaction) MarshalJSON ¶
func (t Transaction) MarshalJSON() ([]byte, error)
MarshalJSON marshals as JSON.
func (*Transaction) UnmarshalJSON ¶
func (t *Transaction) UnmarshalJSON(input []byte) error
UnmarshalJSON unmarshals from JSON.
type TransactionCall ¶
type TransactionCall struct { From common.Address `json:"from"` To *common.Address `json:"to,omitempty"` Gas uint64 `json:"gas,omitempty"` GasPrice *big.Int `json:"gasPrice,omitempty"` Value *big.Int `json:"value,omitempty"` Data []byte `json:"data,omitempty"` }
func (TransactionCall) MarshalJSON ¶
func (t TransactionCall) MarshalJSON() ([]byte, error)
MarshalJSON marshals as JSON.
func (*TransactionCall) UnmarshalJSON ¶
func (t *TransactionCall) UnmarshalJSON(input []byte) error
UnmarshalJSON unmarshals from JSON.