types

package
v0.7.0-beta4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SafeBlockName      = "SafeBlock"
	FinalizedBlockName = "FinalizedBlock"
	LatestBlockName    = "LatestBlock"
	PendingBlockName   = "PendingBlock"
	EmptyBlockName     = ""
)

Variables

View Source
var (
	FinalizedBlock = BlockNumberFinality{Block: Finalized}
	LatestBlock    = BlockNumberFinality{Block: Latest}
	SafeBlock      = BlockNumberFinality{Block: Safe}
	PendingBlock   = BlockNumberFinality{Block: Pending}
)

Functions

This section is empty.

Types

type BaseEthereumClienter

BaseEthereumClienter defines the methods required to interact with an Ethereum client.

type BlockNumber

type BlockNumber int64

func NewBlockNumber added in v0.7.0

func NewBlockNumber(s string) (BlockNumber, error)

func (BlockNumber) ApplyOffset added in v0.7.0

func (b BlockNumber) ApplyOffset(blockNumber uint64, offset int64) uint64

func (BlockNumber) ToString

func (b BlockNumber) ToString() string

type BlockNumberFinality

type BlockNumberFinality struct {
	Block  BlockNumber
	Offset int64
}

BlockNumberFinality represents a block finality with an optional offset

func NewBlockNumberFinality

func NewBlockNumberFinality(s string) (BlockNumberFinality, error)

NewBlockNumberFinality creates a new BlockNumberFinality from a string format: <blockName>[/<offset>] e.g: "SafeBlock", "FinalizedBlock/-5", "LatestBlock/+10"

func (*BlockNumberFinality) BlockNumber added in v0.7.0

func (b *BlockNumberFinality) BlockNumber(ctx context.Context, requester ethereum.ChainReader) (uint64, error)

BlockNumber gets the safe block number from RPC

func (*BlockNumberFinality) GreaterThan

func (b *BlockNumberFinality) GreaterThan(other *BlockNumberFinality) bool

IsGreaterThan returns true if v is greater than other earliest ≤ finalized ≤ safe ≤ latest ≤ pending

func (BlockNumberFinality) IsEmpty

func (b BlockNumberFinality) IsEmpty() bool

IsEmpty returns true if v is empty

func (BlockNumberFinality) IsFinalized

func (b BlockNumberFinality) IsFinalized() bool

IsLessThan returns true if v is less than other

func (BlockNumberFinality) IsLatest added in v0.7.0

func (b BlockNumberFinality) IsLatest() bool

func (BlockNumberFinality) IsSafe

func (b BlockNumberFinality) IsSafe() bool

func (BlockNumberFinality) JSONSchema

func (BlockNumberFinality) JSONSchema() *jsonschema.Schema

JSONSchema returns the JSON schema for BlockNumberFinality

func (*BlockNumberFinality) String

func (b *BlockNumberFinality) String() string

String returns the string representation of the BlockNumberFinality

func (*BlockNumberFinality) UnmarshalText

func (b *BlockNumberFinality) UnmarshalText(data []byte) error

UnmarshalText unmarshalls BlockNumberFinality from text.

type DefaultEthClient

type DefaultEthClient struct {
	BaseEthereumClienter
	RPCClienter
}

DefaultEthClient is the default implementation of EthClienter.

func NewDefaultEthClient

func NewDefaultEthClient(baseClient BaseEthereumClienter, rpcClient RPCClienter) *DefaultEthClient

NewDefaultEthClient creates a new DefaultEthClient.

type EthClienter

type EthClienter interface {
	BaseEthereumClienter
	RPCClienter
}

EthClienter defines the methods for an Ethereum RPC client.

func DialWithRetry added in v0.7.0

func DialWithRetry(ctx context.Context, url string, retryHandler commontypes.RetryHandler) (EthClienter, error)

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.

type NoopRPCClient

type NoopRPCClient struct{}

NoopRPCClient is no operation implementation for the RPCClienter interface

func (*NoopRPCClient) Call

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

type RPCClienter

type RPCClienter interface {
	Call(result any, method string, args ...any) error
}

RPCClienter defines an interface for making generic RPC calls.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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