rpc

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 9 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 {
	// TransactionReceipt returns the transaction receipt for the given transaction hash
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	// HeaderByNumber returns the block header for the given block number
	HeaderByNumber(ctx context.Context, number *big.Int) (*Header, error)
	// IsFinalized determines whether or not the given transaction receipt is finalized on the chain
	IsFinalized(ctx context.Context, conf uint64, txReceipt *types.Receipt) (bool, error)
	// Close closes the client connection
	Close()
}

Client provides calls to EVM JSON-RPC endpoints

func NewClient

func NewClient(url string) (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) IsFinalized added in v0.31.0

func (c *Ethereum2Client) IsFinalized(ctx context.Context, _ uint64, txReceipt *types.Receipt) (bool, error)

IsFinalized determines whether or not the given transaction receipt is finalized on the chain

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) IsFinalized added in v0.31.0

func (c *EthereumClient) IsFinalized(ctx context.Context, conf uint64, txReceipt *types.Receipt) (bool, error)

IsFinalized determines whether or not the given transaction receipt is finalized on the chain

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 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
}

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

type MoonbeamClient

type MoonbeamClient struct {
	*EthereumClient
}

MoonbeamClient is a JSON-RPC client of Moonbeam

func NewMoonbeamClient added in v0.31.0

func NewMoonbeamClient(ethereumClient *EthereumClient) (*MoonbeamClient, error)

NewMoonbeamClient is the constructor

func (*MoonbeamClient) IsFinalized added in v0.31.0

func (c *MoonbeamClient) IsFinalized(ctx context.Context, _ uint64, txReceipt *types.Receipt) (bool, error)

IsFinalized determines whether or not the given transaction receipt is finalized on the chain

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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