types

package
v0.7.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 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

type BaseEthereumClienter interface {
	ethereum.BlockNumberReader
	ethereum.ChainIDReader
	ethereum.ChainReader
	ethereum.ChainStateReader
	ethereum.LogFilterer
	ethereum.TransactionReader
	bind.ContractBackend
}

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) String added in v0.7.0

func (b BlockNumber) String() 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) IsEmpty

func (b BlockNumberFinality) IsEmpty() bool

IsEmpty returns true if b is empty

func (BlockNumberFinality) IsFinalized

func (b BlockNumberFinality) IsFinalized() bool

IsFinalized returns true if b is finalized

func (BlockNumberFinality) IsLatest added in v0.7.0

func (b BlockNumberFinality) IsLatest() bool

IsLatest returns true if b is latest with non-negative offset

func (BlockNumberFinality) IsSafe

func (b BlockNumberFinality) IsSafe() bool

IsSafe returns true if b is safe

func (BlockNumberFinality) JSONSchema

func (BlockNumberFinality) JSONSchema() *jsonschema.Schema

JSONSchema returns the JSON schema for BlockNumberFinality

func (*BlockNumberFinality) LessFinalThan added in v0.7.0

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

LessFinalThan returns true if b is less strict commitment level than other. In case commitment level keywords are the same, it compares the offsets. finalized ≤ safe ≤ latest ≤ pending

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