Documentation
¶
Index ¶
- Constants
- Variables
- func NewRPCClient(ctx context.Context, cfg ethermanconfig.L2RPCClientConfig) (aggkittypes.EthClienter, error)
- func NewRPCClientModeOp(ctx context.Context, cfg ethermanconfig.L2RPCClientConfig) (aggkittypes.EthClienter, error)
- func RetrieveBlockHeaders(ctx context.Context, log aggkitcommon.Logger, ...) ([]*aggkittypes.BlockHeader, error)
- func RetrieveBlockHeadersBatch(ctx context.Context, log aggkitcommon.Logger, ...) ([]*aggkittypes.BlockHeader, error)
- func RetrieveBlockHeadersLegacy(ctx context.Context, log aggkitcommon.Logger, ...) ([]*aggkittypes.BlockHeader, error)
- func TryParseError(err error) (error, bool)
- type OpNodeClienter
- type RPCOpNodeDecorator
Constants ¶
const (
ExtraParamFieldName = "OpNodeURL"
)
Variables ¶
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") )
Functions ¶
func NewRPCClient ¶ added in v0.1.0
func NewRPCClient(ctx context.Context, cfg ethermanconfig.L2RPCClientConfig) (aggkittypes.EthClienter, error)
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
func NewRPCClientModeOp(ctx context.Context, cfg ethermanconfig.L2RPCClientConfig) (aggkittypes.EthClienter, error)
NewRPCClientModeOp creates a new RPC client that uses the OPNode client to get the finalized block
func RetrieveBlockHeaders ¶
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 ¶
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 ¶
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 ¶
Types ¶
type OpNodeClienter ¶ added in v0.1.0
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