ethrpc

package
v1.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2024 License: LGPL-3.0, MIT Imports: 24 Imported by: 23

Documentation

Index

Examples

Constants

View Source
const ENSContractAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"

Variables

View Source
var (
	ErrNotFound                 = ethereum.NotFound
	ErrEmptyResponse            = errors.New("ethrpc: empty response")
	ErrUnsupportedMethodOnChain = errors.New("ethrpc: method is unsupported on this chain")
	ErrRequestFail              = errors.New("ethrpc: request fail")
)
View Source
var Networks = map[uint64]Network{
	1: {
		Name:                "mainnet",
		ChainID:             1,
		NumBlocksToFinality: 20,
	},
	3: {
		Name:                "ropsten",
		ChainID:             3,
		NumBlocksToFinality: 20,
	},
	4: {
		Name:                "rinkeby",
		ChainID:             4,
		NumBlocksToFinality: 20,
	},
	5: {
		Name:                "goerli",
		ChainID:             5,
		NumBlocksToFinality: 20,
	},
	42: {
		Name:                "kovan",
		ChainID:             42,
		NumBlocksToFinality: 20,
	},
	11155111: {
		Name:                "sepolia",
		ChainID:             11155111,
		NumBlocksToFinality: 50,
	},
	137: {
		Name:                "polygon",
		ChainID:             137,
		NumBlocksToFinality: 100,
	},
	80001: {
		Name:                "polygon-mumbai",
		ChainID:             80001,
		NumBlocksToFinality: 100,
	},
	56: {
		Name:                "bsc",
		ChainID:             56,
		NumBlocksToFinality: 50,
	},
	97: {
		Name:                "bsc-testnet",
		ChainID:             97,
		NumBlocksToFinality: 50,
	},
	10: {
		Name:                "optimism",
		ChainID:             10,
		NumBlocksToFinality: 50,
		OptimismChain:       true,
	},
	69: {
		Name:                "optimism-testnet",
		ChainID:             69,
		NumBlocksToFinality: 50,
		OptimismChain:       true,
	},
	42161: {
		Name:                "arbitrum",
		ChainID:             42161,
		NumBlocksToFinality: 50,
	},
	421613: {
		Name:                "arbitrum-testnet",
		ChainID:             421613,
		NumBlocksToFinality: 50,
	},
	42170: {
		Name:                "arbitrum-nova",
		ChainID:             42170,
		NumBlocksToFinality: 50,
	},
	43114: {
		Name:                "avalanche",
		ChainID:             43114,
		NumBlocksToFinality: 50,
	},
	43113: {
		Name:                "avalanche-testnet",
		ChainID:             43113,
		NumBlocksToFinality: 50,
	},
	250: {
		Name:                "fantom",
		ChainID:             250,
		NumBlocksToFinality: 100,
	},
	4002: {
		Name:                "fantom-testnet",
		ChainID:             4002,
		NumBlocksToFinality: 100,
	},
	100: {
		Name:                "gnosis",
		ChainID:             100,
		NumBlocksToFinality: 100,
	},
	1313161554: {
		Name:                "aurora",
		ChainID:             1313161554,
		NumBlocksToFinality: 50,
	},
	1313161556: {
		Name:                "aurora-testnet",
		ChainID:             1313161556,
		NumBlocksToFinality: 50,
	},
	8453: {
		Name:                "base",
		ChainID:             8453,
		NumBlocksToFinality: 50,
		OptimismChain:       true,
	},
	84531: {
		Name:                "base-goerli",
		ChainID:             84531,
		NumBlocksToFinality: 50,
		OptimismChain:       true,
	},
	19011: {
		Name:                "homeverse",
		ChainID:             19011,
		NumBlocksToFinality: 50,
		OptimismChain:       true,
	},
	40875: {
		Name:                "homeverse-testnet",
		ChainID:             40875,
		NumBlocksToFinality: 50,
		OptimismChain:       true,
	},
}
View Source
var Pending = big.NewInt(-1)

Functions

func IntoBlock added in v1.22.0

func IntoBlock(raw json.RawMessage, ret **types.Block) error

func IntoJSONRawMessage added in v1.22.0

func IntoJSONRawMessage(raw json.RawMessage, ret *json.RawMessage) error

func IntoTransaction added in v1.22.0

func IntoTransaction(raw json.RawMessage, tx **types.Transaction) error

func IntoTransactionWithPending added in v1.22.0

func IntoTransactionWithPending(raw json.RawMessage, tx **types.Transaction, pending *bool) error

func NameHash added in v1.17.8

func NameHash(name string) (hash [32]byte, err error)

NameHash generates a hash from a name that can be used to look up the name in ENS

func Normalize added in v1.17.8

func Normalize(input string) (output string, err error)

Normalize normalizes a name according to the ENS rules

func ResolveEnsAddress added in v1.17.8

func ResolveEnsAddress(ctx context.Context, ens string, provider *Provider) (common.Address, bool, error)

func WaitForTxnReceipt added in v1.3.6

func WaitForTxnReceipt(ctx context.Context, provider *Provider, txHash common.Hash) (*types.Receipt, error)

Types

type BatchCall added in v1.19.0

type BatchCall []*Call
Example
package main

import (
	"context"
	"fmt"
	"math/big"

	"github.com/0xsequence/ethkit/ethrpc"
	"github.com/0xsequence/ethkit/ethtest"
	"github.com/0xsequence/ethkit/go-ethereum/common"
	"github.com/0xsequence/ethkit/go-ethereum/core/types"
	"github.com/goware/logger"
)

var (
	testchain *ethtest.Testchain
	log       logger.Logger
)

func init() {
	var err error
	testchain, err = ethtest.NewTestchain()
	if err != nil {
		panic(err)
	}

	log = logger.NewLogger(logger.LogLevel_INFO)
}

func main() {
	p, err := ethrpc.NewProvider("https://nodes.sequence.app/polygon")
	if err != nil {
		panic(err)
	}

	var (
		chainID  *big.Int
		header   *types.Header
		errBlock *types.Block
	)
	_, err = p.Do(
		context.Background(),
		ethrpc.ChainID().Into(&chainID),
		ethrpc.HeaderByNumber(big.NewInt(38470000)).Into(&header),
		ethrpc.BlockByHash(common.BytesToHash([]byte("a1b2c3"))).Into(&errBlock),
	)
	fmt.Printf("polygon ID: %s\n", chainID.String())
	if err != nil {
		if batchErr, ok := err.(ethrpc.BatchError); ok {
			for i, err := range batchErr {
				fmt.Printf("error at %d: %s\n", i, err)
			}
		}
	}
}
Output:

polygon ID: 137
error at 2: not found

func (*BatchCall) ErrorOrNil added in v1.19.0

func (b *BatchCall) ErrorOrNil() error

func (*BatchCall) MarshalJSON added in v1.19.0

func (b *BatchCall) MarshalJSON() ([]byte, error)

func (*BatchCall) UnmarshalJSON added in v1.19.0

func (b *BatchCall) UnmarshalJSON(data []byte) error

type BatchError added in v1.19.0

type BatchError map[int]*Call

func (BatchError) Error added in v1.19.0

func (e BatchError) Error() string

func (BatchError) ErrorMap added in v1.19.0

func (e BatchError) ErrorMap() map[int]error

func (BatchError) Unwrap added in v1.19.0

func (e BatchError) Unwrap() error

type Call added in v1.19.0

type Call struct {
	// contains filtered or unexported fields
}

func NewCall added in v1.19.0

func NewCall(method string, params ...any) Call

func SendTransaction added in v1.19.0

func SendTransaction(tx *types.Transaction) Call

func (*Call) Error added in v1.19.0

func (c *Call) Error() string

func (*Call) Unwrap added in v1.19.0

func (c *Call) Unwrap() error

type CallBuilder added in v1.19.0

type CallBuilder[T any] struct {
	// contains filtered or unexported fields
}

func BalanceAt added in v1.19.0

func BalanceAt(account common.Address, blockNum *big.Int) CallBuilder[*big.Int]

func BlockByHash added in v1.19.0

func BlockByHash(hash common.Hash) CallBuilder[*types.Block]

func BlockByNumber added in v1.19.0

func BlockByNumber(blockNum *big.Int) CallBuilder[*types.Block]

func BlockNumber added in v1.19.0

func BlockNumber() CallBuilder[uint64]

func CallContract added in v1.19.0

func CallContract(msg ethereum.CallMsg, blockNum *big.Int) CallBuilder[[]byte]

func CallContractAtHash added in v1.19.0

func CallContractAtHash(msg ethereum.CallMsg, blockHash common.Hash) CallBuilder[[]byte]

func ChainID added in v1.19.0

func ChainID() CallBuilder[*big.Int]

func CodeAt added in v1.19.0

func CodeAt(account common.Address, blockNum *big.Int) CallBuilder[[]byte]

func ContractQuery added in v1.22.5

func ContractQuery(contractAddress common.Address, inputAbiExpr, outputAbiExpr string, args interface{}) (CallBuilder[[]string], error)

func EstimateGas added in v1.19.0

func EstimateGas(msg ethereum.CallMsg) CallBuilder[uint64]

func FeeHistory added in v1.19.0

func FeeHistory(blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) CallBuilder[*ethereum.FeeHistory]

func FilterLogs added in v1.19.0

func FilterLogs(q ethereum.FilterQuery) CallBuilder[[]types.Log]

func HeaderByHash added in v1.19.0

func HeaderByHash(hash common.Hash) CallBuilder[*types.Header]

func HeaderByNumber added in v1.19.0

func HeaderByNumber(blockNum *big.Int) CallBuilder[*types.Header]

func NetworkID added in v1.19.0

func NetworkID() CallBuilder[*big.Int]

func NewCallBuilder added in v1.19.0

func NewCallBuilder[T any](method string, intoFn IntoFn[T], params ...any) CallBuilder[T]

func NonceAt added in v1.19.0

func NonceAt(account common.Address, blockNum *big.Int) CallBuilder[uint64]

func PeerCount added in v1.19.0

func PeerCount() CallBuilder[uint64]

func PendingBalanceAt added in v1.19.0

func PendingBalanceAt(account common.Address) CallBuilder[*big.Int]

func PendingCallContract added in v1.19.0

func PendingCallContract(msg ethereum.CallMsg) CallBuilder[[]byte]

func PendingCodeAt added in v1.19.0

func PendingCodeAt(account common.Address) CallBuilder[[]byte]

func PendingNonceAt added in v1.19.0

func PendingNonceAt(account common.Address) CallBuilder[uint64]

func PendingStorageAt added in v1.19.0

func PendingStorageAt(account common.Address, key common.Hash) CallBuilder[[]byte]

func PendingTransactionCount added in v1.19.0

func PendingTransactionCount() CallBuilder[uint]

func RawBlockByHash added in v1.22.0

func RawBlockByHash(hash common.Hash) CallBuilder[json.RawMessage]

func RawBlockByNumber added in v1.22.0

func RawBlockByNumber(blockNum *big.Int) CallBuilder[json.RawMessage]

func RawFilterLogs added in v1.22.0

func RawFilterLogs(q ethereum.FilterQuery) CallBuilder[json.RawMessage]

func SendRawTransaction added in v1.19.0

func SendRawTransaction(signedTxHex string) CallBuilder[common.Hash]

func StorageAt added in v1.19.0

func StorageAt(account common.Address, key common.Hash, blockNum *big.Int) CallBuilder[[]byte]

func SuggestGasPrice added in v1.19.0

func SuggestGasPrice() CallBuilder[*big.Int]

func SuggestGasTipCap added in v1.19.0

func SuggestGasTipCap() CallBuilder[*big.Int]

func SyncProgress added in v1.19.0

func SyncProgress() CallBuilder[*ethereum.SyncProgress]

func TransactionCount added in v1.19.0

func TransactionCount(blockHash common.Hash) CallBuilder[uint]

func TransactionInBlock added in v1.19.0

func TransactionInBlock(blockHash common.Hash, index uint) CallBuilder[*types.Transaction]

func TransactionReceipt added in v1.19.0

func TransactionReceipt(txHash common.Hash) CallBuilder[*types.Receipt]

func TransactionSender added in v1.19.0

func TransactionSender(tx *types.Transaction, block common.Hash, index uint) CallBuilder[common.Address]

func (CallBuilder[T]) Into added in v1.19.0

func (b CallBuilder[T]) Into(ret *T) Call

type CallBuilder2 added in v1.19.0

type CallBuilder2[T1, T2 any] struct {
	// contains filtered or unexported fields
}

func TransactionByHash added in v1.19.0

func TransactionByHash(hash common.Hash) CallBuilder2[*types.Transaction, bool]

func (CallBuilder2[T1, T2]) Into added in v1.19.0

func (b CallBuilder2[T1, T2]) Into(ret1 *T1, ret2 *T2) Call

type Interface added in v1.19.0

type Interface interface {
	// ..
	Do(ctx context.Context, calls ...Call) ([]byte, error)

	// ChainID = eth_chainId
	ChainID(ctx context.Context) (*big.Int, error)

	// BlockByHash = eth_getBlockByHash (true)
	BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

	// BlockByNumber = eth_getBlockByNumber (true)
	BlockByNumber(ctx context.Context, blockNum *big.Int) (*types.Block, error)

	// BlockNumber = eth_blockNumber
	BlockNumber(ctx context.Context) (uint64, error)

	// PeerCount = net_peerCount
	PeerCount(ctx context.Context) (uint64, error)

	// HeaderByHash = eth_getBlockByHash (false)
	HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

	// HeaderByNumber = eth_getBlockByHash (true)
	HeaderByNumber(ctx context.Context, blockNum *big.Int) (*types.Header, error)

	// HeadersByNumbers = batch of eth_getHeaderByNumber
	HeadersByNumbers(ctx context.Context, blockNumbers []*big.Int) ([]*types.Header, error)

	// HeadersByNumberRange = batch of eth_getHeaderByNumber
	HeadersByNumberRange(ctx context.Context, fromBlockNumber, toBlockNumber *big.Int) ([]*types.Header, error)

	// TransactionByHash = eth_getTransactionByHash
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, pending bool, err error)

	// TransactionSender is a wrapper for eth_getTransactionByBlockHashAndIndex
	TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)

	// TransactionCount = eth_getBlockTransactionCountByHash
	TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)

	// TransactionInBlock = eth_getTransactionByBlockHashAndIndex
	TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)

	// TransactionReceipt = eth_getTransactionReceipt
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

	// SyncProgress = eth_syncing
	SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)

	// NetworkID = net_version
	NetworkID(ctx context.Context) (*big.Int, error)

	// BalanceAt = eth_getBalance
	BalanceAt(ctx context.Context, account common.Address, blockNum *big.Int) (*big.Int, error)

	// StorageAt = eth_getStorageAt
	StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNum *big.Int) ([]byte, error)

	// CodeAt = eth_getCode
	CodeAt(ctx context.Context, account common.Address, blockNum *big.Int) ([]byte, error)

	// NonceAt = eth_getTransactionCount
	NonceAt(ctx context.Context, account common.Address, blockNum *big.Int) (uint64, error)

	// FilterLogs = eth_getLogs
	FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)

	// PendingBalanceAt = eth_getBalance ("pending")
	PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)

	// PendingStorageAt = eth_getStorageAt ("pending")
	PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)

	// PendingCodeAt = eth_getCode ("pending")
	PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

	// PendingNonceAt = eth_getTransactionCount ("pending")
	PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

	// PendingTransactionCount = eth_getBlockTransactionCountByNumber ("pending")
	PendingTransactionCount(ctx context.Context) (uint, error)

	// CallContract = eth_call (blockNumber)
	CallContract(ctx context.Context, msg ethereum.CallMsg, blockNum *big.Int) ([]byte, error)

	// CallContractAtHash = eth_call (blockHash)
	CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)

	// PendingCallContract = eth_call ("pending")
	PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)

	// SuggestGasPrice = eth_gasPrice
	SuggestGasPrice(ctx context.Context) (*big.Int, error)

	// SuggestGasTipCap = eth_maxPriorityFeePerGas
	SuggestGasTipCap(ctx context.Context) (*big.Int, error)

	// FeeHistory = eth_feeHistory
	FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error)

	// EstimateGas = eth_estimateGas
	EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)

	// SendTransaction = eth_sendRawTransaction
	SendTransaction(ctx context.Context, tx *types.Transaction) error

	// SendRawTransaction = eth_sendRawTransaction
	SendRawTransaction(ctx context.Context, signedTxHex string) (common.Hash, error)

	// ..
	IsStreamingEnabled() bool

	// ..
	SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

	// ..
	SubscribeNewHeads(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
}

TODO: rename to either Provider, and rename the current Provider to Client

type IntoFn added in v1.19.0

type IntoFn[T any] func(raw json.RawMessage, ret *T) error

type Network added in v1.17.0

type Network struct {
	Name                string
	ChainID             uint64
	NumBlocksToFinality int
	OptimismChain       bool
}

type Option added in v1.19.0

type Option func(*Provider)

func WithBreaker added in v1.19.0

func WithBreaker(br breaker.Breaker) Option

func WithHTTPClient added in v1.19.0

func WithHTTPClient(c httpClient) Option

func WithJWTAuthorization added in v1.22.3

func WithJWTAuthorization(jwtToken string) Option

func WithLogger added in v1.19.0

func WithLogger(log logger.Logger) Option

func WithStreaming added in v1.24.0

func WithStreaming(nodeWebsocketURL string) Option

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(nodeURL string, options ...Option) (*Provider, error)

func (*Provider) BalanceAt added in v1.19.0

func (p *Provider) BalanceAt(ctx context.Context, account common.Address, blockNum *big.Int) (*big.Int, error)

func (*Provider) BlockByHash added in v1.1.7

func (p *Provider) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*Provider) BlockByNumber

func (p *Provider) BlockByNumber(ctx context.Context, blockNum *big.Int) (*types.Block, error)

func (*Provider) BlockNumber added in v1.19.0

func (p *Provider) BlockNumber(ctx context.Context) (uint64, error)

func (*Provider) CallContract added in v1.19.0

func (p *Provider) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNum *big.Int) ([]byte, error)

func (*Provider) CallContractAtHash added in v1.19.0

func (p *Provider) CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)

func (*Provider) ChainID

func (p *Provider) ChainID(ctx context.Context) (*big.Int, error)

func (*Provider) CodeAt added in v1.19.0

func (p *Provider) CodeAt(ctx context.Context, account common.Address, blockNum *big.Int) ([]byte, error)

func (*Provider) ContractQuery added in v1.19.0

func (p *Provider) ContractQuery(ctx context.Context, contractAddress string, inputAbiExpr, outputAbiExpr string, args interface{}) ([]string, error)

ie, ContractQuery(context.Background(), "0xabcdef..", "balanceOf(uint256)", "uint256", []string{"1"}) TODO: add common methods in helpers util, and also use generics to convert the return for us

func (*Provider) Do added in v1.19.0

func (p *Provider) Do(ctx context.Context, calls ...Call) ([]byte, error)

func (*Provider) EstimateGas added in v1.19.0

func (p *Provider) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)

func (*Provider) FeeHistory added in v1.19.0

func (p *Provider) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error)

func (*Provider) FilterLogs added in v1.19.0

func (p *Provider) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)

func (*Provider) HeaderByHash added in v1.19.0

func (p *Provider) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*Provider) HeaderByNumber added in v1.19.0

func (p *Provider) HeaderByNumber(ctx context.Context, blockNum *big.Int) (*types.Header, error)

func (*Provider) HeadersByNumberRange added in v1.25.0

func (p *Provider) HeadersByNumberRange(ctx context.Context, fromBlockNumber, toBlockNumber *big.Int) ([]*types.Header, error)

func (*Provider) HeadersByNumbers added in v1.25.0

func (p *Provider) HeadersByNumbers(ctx context.Context, blockNumbers []*big.Int) ([]*types.Header, error)

func (*Provider) IsStreamingEnabled added in v1.24.0

func (p *Provider) IsStreamingEnabled() bool

...

func (*Provider) NetworkID added in v1.19.0

func (p *Provider) NetworkID(ctx context.Context) (*big.Int, error)

func (*Provider) NonceAt added in v1.19.0

func (p *Provider) NonceAt(ctx context.Context, account common.Address, blockNum *big.Int) (uint64, error)

func (*Provider) PeerCount added in v1.19.0

func (p *Provider) PeerCount(ctx context.Context) (uint64, error)

func (*Provider) PendingBalanceAt added in v1.19.0

func (p *Provider) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)

func (*Provider) PendingCallContract added in v1.19.0

func (p *Provider) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)

func (*Provider) PendingCodeAt added in v1.19.0

func (p *Provider) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

func (*Provider) PendingNonceAt added in v1.19.0

func (p *Provider) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*Provider) PendingStorageAt added in v1.19.0

func (p *Provider) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)

func (*Provider) PendingTransactionCount added in v1.19.0

func (p *Provider) PendingTransactionCount(ctx context.Context) (uint, error)

func (*Provider) RawBlockByHash added in v1.22.0

func (p *Provider) RawBlockByHash(ctx context.Context, hash common.Hash) (json.RawMessage, error)

func (*Provider) RawBlockByNumber added in v1.22.0

func (p *Provider) RawBlockByNumber(ctx context.Context, blockNum *big.Int) (json.RawMessage, error)

func (*Provider) RawFilterLogs added in v1.22.0

func (p *Provider) RawFilterLogs(ctx context.Context, q ethereum.FilterQuery) (json.RawMessage, error)

func (*Provider) SendRawTransaction added in v1.3.6

func (s *Provider) SendRawTransaction(ctx context.Context, signedTxHex string) (common.Hash, error)

func (*Provider) SendTransaction added in v1.19.0

func (p *Provider) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*Provider) SetHTTPClient added in v1.19.0

func (s *Provider) SetHTTPClient(httpClient *http.Client)

func (*Provider) StorageAt added in v1.19.0

func (p *Provider) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNum *big.Int) ([]byte, error)

func (*Provider) SubscribeFilterLogs added in v1.19.0

func (p *Provider) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

SubscribeFilterLogs is stubbed below so we can adhere to the bind.ContractBackend interface.

func (*Provider) SubscribeNewHeads added in v1.24.0

func (p *Provider) SubscribeNewHeads(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

..

func (*Provider) SuggestGasPrice added in v1.19.0

func (p *Provider) SuggestGasPrice(ctx context.Context) (*big.Int, error)

func (*Provider) SuggestGasTipCap added in v1.19.0

func (p *Provider) SuggestGasTipCap(ctx context.Context) (*big.Int, error)

func (*Provider) SyncProgress added in v1.19.0

func (p *Provider) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)

func (*Provider) TransactionByHash added in v1.19.0

func (p *Provider) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, pending bool, err error)

func (*Provider) TransactionCount added in v1.19.0

func (p *Provider) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)

func (*Provider) TransactionInBlock added in v1.19.0

func (p *Provider) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)

func (*Provider) TransactionReceipt added in v1.19.0

func (p *Provider) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

func (*Provider) TransactionSender added in v1.19.0

func (p *Provider) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)

type RawInterface added in v1.22.0

type RawInterface interface {
	Interface
	RawBlockByHash(ctx context.Context, hash common.Hash) (json.RawMessage, error)
	RawBlockByNumber(ctx context.Context, blockNum *big.Int) (json.RawMessage, error)
	RawFilterLogs(ctx context.Context, q ethereum.FilterQuery) (json.RawMessage, error)
}

RawInterface also returns the bytes of the response body payload

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL