rpc

package
v0.36.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// TransactionReceipts returns transaction receipts for the given transaction hashes
	TransactionReceipts(ctx context.Context, txHashes []common.Hash) ([]TxReceiptResult, error)
	// HeaderByNumber returns the block header for the given block number
	HeaderByNumber(ctx context.Context, number *big.Int) (*Header, error)
	// LatestFinalizedBlockNumber returns the latest finalized block number
	LatestFinalizedBlockNumber(ctx context.Context, confirmations uint64) (*big.Int, error)
	// Close closes the client connection
	Close()
}

Client provides calls to EVM JSON-RPC endpoints

func NewClient

func NewClient(url string, override FinalityOverride) (Client, error)

NewClient returns an EVM JSON-RPC client

type Ethereum2Client added in v0.31.0

type Ethereum2Client struct {
	*EthereumClient
}

Ethereum2Client is a JSON-RPC client of Ethereum 2.0

func NewEthereum2Client added in v0.31.0

func NewEthereum2Client(ethereumClient *EthereumClient) (*Ethereum2Client, error)

NewEthereum2Client is the constructor

func (*Ethereum2Client) LatestFinalizedBlockNumber added in v0.33.1

func (c *Ethereum2Client) LatestFinalizedBlockNumber(ctx context.Context, _ uint64) (*big.Int, error)

LatestFinalizedBlockNumber returns the latest finalized block number

type EthereumClient added in v0.31.0

type EthereumClient struct {
	EthereumJSONRPCClient
	// contains filtered or unexported fields
}

EthereumClient is a JSON-RPC client of any Ethereum-compact chains

func NewEthereumClient added in v0.31.0

func NewEthereumClient(ethClient EthereumJSONRPCClient, rpc JSONRPCClient) (*EthereumClient, error)

NewEthereumClient is the constructor

func (*EthereumClient) HeaderByNumber added in v0.31.0

func (c *EthereumClient) HeaderByNumber(ctx context.Context, number *big.Int) (*Header, error)

HeaderByNumber returns the block header for the given block number

func (*EthereumClient) LatestFinalizedBlockNumber added in v0.33.1

func (c *EthereumClient) LatestFinalizedBlockNumber(ctx context.Context, confirmations uint64) (*big.Int, error)

LatestFinalizedBlockNumber returns the latest finalized block number

func (*EthereumClient) TransactionReceipts added in v0.34.0

func (c *EthereumClient) TransactionReceipts(ctx context.Context, txHashes []common.Hash) ([]TxReceiptResult, error)

type EthereumJSONRPCClient added in v0.31.0

type EthereumJSONRPCClient interface {
	BlockNumber(ctx context.Context) (uint64, error)
	CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
	Close()
}

EthereumJSONRPCClient represents the functionality of github.com/ethereum/go-ethereum/ethclient.Client

type FinalityOverride added in v0.33.1

type FinalityOverride int
const (
	NoOverride FinalityOverride = iota
	Confirmation
)

func ParseFinalityOverride added in v0.33.1

func ParseFinalityOverride(s string) (FinalityOverride, error)

func (FinalityOverride) String added in v0.33.1

func (i FinalityOverride) String() string
type Header struct {
	ParentHash    common.Hash    `json:"parentHash"       gencodec:"required"`
	Number        *hexutil.Big   `json:"number"           gencodec:"required"`
	Time          hexutil.Uint64 `json:"timestamp"        gencodec:"required"`
	Hash          common.Hash    `json:"hash"`
	Transactions  []common.Hash  `json:"transactions"     gencodec:"required"`
	L1BlockNumber *hexutil.Big   `json:"l1BlockNumber"`
}

Header represents a block header in any EVM blockchain

type JSONRPCClient added in v0.31.0

type JSONRPCClient interface {
	CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
	BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
}

JSONRPCClient represents the functionality of github.com/ethereum/go-ethereum/rpc.Client

type TxReceiptResult added in v0.36.0

type TxReceiptResult results.Result[types.Receipt]

TxReceiptResult is a custom type that allows moq to correctly generate the mock for results.TxReceiptResult with *types.Receipt.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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