rpc

package
v0.26.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 8 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 {
	BlockNumber(ctx context.Context) (uint64, error)
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	Close()
}

Client provides calls to EVM JSON-RPC endpoints

func NewClient

func NewClient(url string) (Client, error)

NewClient returns an EVM rpc client

type Eth2Client

type Eth2Client interface {
	Client

	FinalizedHeader(ctx context.Context) (*types.Header, error)
}

Eth2Client provides calls to Ethereum JSON-RPC endpoints post the merge

type Eth2ClientImpl

type Eth2ClientImpl struct {
	*evmClient.Client
	// contains filtered or unexported fields
}

Eth2ClientImpl implements Eth2Client

func (Eth2ClientImpl) FinalizedHeader

func (c Eth2ClientImpl) FinalizedHeader(ctx context.Context) (*types.Header, error)

FinalizedHeader returns the header of the most recent finalized block

type MoonbeamClient

type MoonbeamClient interface {
	Client

	ChainGetFinalizedHead(ctx context.Context) (common.Hash, error)
	ChainGetHeader(ctx context.Context, hash common.Hash) (*MoonbeamHeader, error)
}

MoonbeamClient provides calls to Moonbeam JSON-RPC endpoints

type MoonbeamClientImpl

type MoonbeamClientImpl struct {
	*evmClient.Client
	// contains filtered or unexported fields
}

MoonbeamClientImpl implements MoonbeamClient

func (MoonbeamClientImpl) ChainGetFinalizedHead

func (c MoonbeamClientImpl) ChainGetFinalizedHead(ctx context.Context) (common.Hash, error)

ChainGetFinalizedHead returns the hash of the latest finalized block

func (MoonbeamClientImpl) ChainGetHeader

func (c MoonbeamClientImpl) ChainGetHeader(ctx context.Context, hash common.Hash) (*MoonbeamHeader, error)

ChainGetHeader returns the moonbeam block header of the given hash

type MoonbeamHeader

type MoonbeamHeader struct {
	ParentHash     common.Hash  `json:"parentHash"       gencodec:"required"`
	ExtrinsicsRoot common.Hash  `json:"extrinsicsRoot"   gencodec:"required"`
	StateRoot      common.Hash  `json:"stateRoot"        gencodec:"required"`
	Number         *hexutil.Big `json:"number"           gencodec:"required"`
}

MoonbeamHeader represents a block header in the Moonbeam blockchain

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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