Documentation
¶
Index ¶
- type RPCClient
- type ReaderConfig
- type SourceReader
- func (s *SourceReader) FetchMessageSentEvents(ctx context.Context, fromBlock, toBlock *big.Int) ([]protocol.MessageSentEvent, error)
- func (s *SourceReader) GetBlocksHeaders(ctx context.Context, ledgerNumber []*big.Int) (map[uint64]protocol.BlockHeader, error)
- func (s *SourceReader) GetRMNCursedSubjects(ctx context.Context) ([]protocol.Bytes16, error)
- func (s *SourceReader) LatestAndFinalizedBlock(ctx context.Context) (latest, finalized *protocol.BlockHeader, err error)
- func (s *SourceReader) LatestSafeBlock(_ context.Context) (*protocol.BlockHeader, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RPCClient ¶
type RPCClient interface {
// GetLatestLedger returns the latest ledger information.
GetLatestLedger(ctx context.Context) (protocolrpc.GetLatestLedgerResponse, error)
// GetLedgers returns ledger data for a range of ledgers.
GetLedgers(ctx context.Context, req protocolrpc.GetLedgersRequest) (protocolrpc.GetLedgersResponse, error)
// GetEvents returns contract events matching the specified filters.
GetEvents(ctx context.Context, req protocolrpc.GetEventsRequest) (protocolrpc.GetEventsResponse, error)
}
RPCClient defines the interface for Stellar RPC client methods used by SourceReader. This interface allows for mocking in unit tests.
type ReaderConfig ¶
type ReaderConfig struct {
// NetworkPassphrase is the Stellar network passphrase (e.g., "Standalone Network ; February 2017").
NetworkPassphrase string `toml:"network_passphrase"`
// OnRampContractID is the contract ID of the Stellar OnRamp contract.
OnRampContractID string `toml:"onramp_contract_id"`
// RMNRemoteContractID is the contract ID of the RMN Remote contract.
RMNRemoteContractID string `toml:"rmn_remote_contract_id"`
// SorobanRPCURL is the URL of the Soroban RPC endpoint.
SorobanRPCURL string `toml:"soroban_rpc_url"`
}
ReaderConfig is the configuration required to create a Stellar source reader.
type SourceReader ¶
type SourceReader struct {
// contains filtered or unexported fields
}
SourceReader is the Stellar implementation of chainaccess.SourceReader.
func NewSourceReaderWithClient ¶
func NewSourceReaderWithClient( client RPCClient, invoker bindings.Invoker, ccipOnrampAddress string, ccipMessageSentTopic string, rmnRemoteAddress string, lggr *zerolog.Logger, ) (*SourceReader, error)
NewSourceReaderWithClient constructs a Stellar source reader with a RPC client.
func (*SourceReader) FetchMessageSentEvents ¶
func (s *SourceReader) FetchMessageSentEvents(ctx context.Context, fromBlock, toBlock *big.Int) ([]protocol.MessageSentEvent, error)
FetchMessageSentEvents fetches CCIP MessageSent events from the Stellar OnRamp contract.
func (*SourceReader) GetBlocksHeaders ¶
func (s *SourceReader) GetBlocksHeaders(ctx context.Context, ledgerNumber []*big.Int) (map[uint64]protocol.BlockHeader, error)
GetBlocksHeaders returns the block headers for the requested ledger sequence numbers.
func (*SourceReader) GetRMNCursedSubjects ¶
GetRMNCursedSubjects gets the cursed subjects from the RMN Remote contract.
func (*SourceReader) LatestAndFinalizedBlock ¶
func (s *SourceReader) LatestAndFinalizedBlock(ctx context.Context) (latest, finalized *protocol.BlockHeader, err error)
LatestAndFinalizedBlock returns the latest and finalized ledger headers. Stellar does not have re-orgs, so the latest and finalized ledger headers are the same.
func (*SourceReader) LatestSafeBlock ¶
func (s *SourceReader) LatestSafeBlock(_ context.Context) (*protocol.BlockHeader, error)
LatestSafeBlock returns nil because Stellar has no "safe" head concept — all closed ledgers are immediately final.