etherman

package
v0.9.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExtraParamFieldName = "OpNodeURL"
)

Variables

View Source
var (
	// ErrGasRequiredExceedsAllowance gas required exceeds the allowance
	ErrGasRequiredExceedsAllowance = errors.New("gas required exceeds allowance")
	// ErrContentLengthTooLarge content length is too large
	ErrContentLengthTooLarge = errors.New("content length too large")
	// ErrTimestampMustBeInsideRange Timestamp must be inside range
	ErrTimestampMustBeInsideRange = errors.New("timestamp must be inside range")
	// ErrInsufficientAllowance insufficient allowance
	ErrInsufficientAllowance = errors.New("insufficient allowance")
	// ErrBothGasPriceAndMaxFeeGasAreSpecified both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified
	ErrBothGasPriceAndMaxFeeGasAreSpecified = errors.New(
		"both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified",
	)
	// ErrMaxFeeGasAreSpecifiedButLondonNotActive maxFeePerGas or maxPriorityFeePerGas
	// specified but london fork is not active yet
	ErrMaxFeeGasAreSpecifiedButLondonNotActive = errors.New(
		"maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet",
	)
	// ErrNoSigner no signer to authorize the transaction with
	ErrNoSigner = errors.New("no signer to authorize the transaction with")
	// ErrMissingTrieNode means that a node is missing on the trie
	ErrMissingTrieNode = errors.New("missing trie node")
	// ErrNotFound is used when the object is not found
	ErrNotFound = errors.New("not found")
	// ErrPrivateKeyNotFound used when the provided sender does not have a private key registered to be used
	ErrPrivateKeyNotFound = errors.New("can't find sender private key to sign tx")
)
View Source
var (
	ErrNotImplemented = errors.New("not implemented")
)

Functions

func DialWithRetry

DialWithRetry attempts to connect to an Ethereum client with retries and exponential backoff. It returns an EthClienter on success or an error if all attempts fail.

func NewRPCClient added in v0.1.0

NewRPCClient creates a new RPC client based on the provided configuration. It supports both basic RPC mode and OPNode mode. In basic mode, it simply creates a client with the given URL. In OPNode mode, it creates a client that uses the OPNode client to get the finalized block.

func NewRPCClientModeOp added in v0.1.0

NewRPCClientModeOp creates a new RPC client that uses the OPNode client to get the finalized block

func RetrieveBlockHeaders added in v0.8.0

func RetrieveBlockHeaders(ctx context.Context,
	log aggkitcommon.Logger,
	ethClient aggkittypes.BaseEthereumClienter,
	rpcClient aggkittypes.RPCClienter,
	blockNumbers []uint64,
	maxConcurrency int) ([]*aggkittypes.BlockHeader, error)

RetrieveBlockHeaders retrieves block headers for the given block numbers using batch requests if rpcClient is provided

func RetrieveBlockHeadersBatch added in v0.8.0

func RetrieveBlockHeadersBatch(ctx context.Context,
	log aggkitcommon.Logger,
	rpcClient aggkittypes.RPCClienter,
	blockNumbers []uint64,
	maxConcurrency int) ([]*aggkittypes.BlockHeader, error)

RetrieveBlockHeaders retrieves block headers for the given block numbers using batch requests with concurrency control

func RetrieveBlockHeadersLegacy added in v0.8.0

func RetrieveBlockHeadersLegacy(ctx context.Context,
	log aggkitcommon.Logger,
	ethClient aggkittypes.BaseEthereumClienter,
	blockNumbers []uint64,
	maxConcurrency int) ([]*aggkittypes.BlockHeader, error)

RetrieveBlockHeadersLegacy retrieves block headers for the given block numbers using individual requests this is used in simulated environments where batch requests are not supported

func TryParseError

func TryParseError(err error) (error, bool)

Types

type DefaultEthClient

type DefaultEthClient struct {
	aggkittypes.EthereumClienter
	aggkittypes.RPCClienter

	// If true, the block Hash is getted from JSON RPC
	// if false, the block Hash is getted from go-ethereum RLP hashing of header
	HashFromJSON bool
	// contains filtered or unexported fields
}

func NewDefaultEthClient

This function is for legacy code that doesn't use logger

func (*DefaultEthClient) BatchCallContext

func (c *DefaultEthClient) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error

func (*DefaultEthClient) Call

func (c *DefaultEthClient) Call(result any, method string, args ...any) error

func (*DefaultEthClient) CallContext

func (c *DefaultEthClient) CallContext(ctx context.Context,
	result interface{}, method string, args ...interface{}) error

func (*DefaultEthClient) CustomBlockNumber

func (c *DefaultEthClient) CustomBlockNumber(ctx context.Context, number aggkittypes.BlockName) (uint64, error)

func (*DefaultEthClient) CustomHeaderByNumber

func (c *DefaultEthClient) CustomHeaderByNumber(ctx context.Context,
	number *aggkittypes.BlockNumberFinality) (*aggkittypes.BlockHeader, error)

type OpNodeClienter added in v0.1.0

type OpNodeClienter interface {
	FinalizedL2Block() (*opnode.BlockInfo, error)
}

type RPCOpNodeDecorator added in v0.1.0

type RPCOpNodeDecorator struct {
	aggkittypes.EthClienter
	OpNodeClient OpNodeClienter
}

RPCOpNodeDecorator is a decorator for the ethclient.Client that intercepts calls to the HeaderByNumber method and if the block number is the FinalizedBlockNumber, it will ask the OpNodeClient for the finalized block instead of asking the ethclient.Client

func NewRPCOpNodeDecorator added in v0.1.0

func NewRPCOpNodeDecorator(client aggkittypes.EthClienter, opNodeClient OpNodeClienter) *RPCOpNodeDecorator

func (*RPCOpNodeDecorator) HeaderByNumber added in v0.1.0

func (f *RPCOpNodeDecorator) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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