feeder

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feeder

type Feeder struct {
	// contains filtered or unexported fields
}

func New

func New(client feeder.Reader) *Feeder

func (*Feeder) BlockByNumber

func (f *Feeder) BlockByNumber(ctx context.Context, blockNumber uint64) (*core.Block, error)

BlockByNumber gets the block for a given block number from the feeder, then adapts it to the core.Block type.

func (*Feeder) BlockHeaderLatest added in v0.15.22

func (f *Feeder) BlockHeaderLatest(ctx context.Context) (core.Header, error)

BlockHeaderLatest gets only the block hash and number for the latest block from the feeder, using the headerOnly=true parameter to minimise bandwidth.

func (*Feeder) BlockLatest added in v0.3.0

func (f *Feeder) BlockLatest(ctx context.Context) (*core.Block, error)

BlockLatest gets the latest block from the feeder, then adapts it to the core.Block type.

func (*Feeder) BlockPreLatest added in v0.16.0

func (f *Feeder) BlockPreLatest(ctx context.Context) (*core.Block, error)

BlockPreLatest gets the pre-latest (pending) block from the feeder, then adapts it to the core.Block type.

func (*Feeder) Class

func (f *Feeder) Class(ctx context.Context, classHash *felt.Felt) (core.ClassDefinition, error)

Class gets the class for a given class hash from the feeder, then adapts it to the core.Class type.

func (*Feeder) PreConfirmedBlockByNumber added in v0.15.0

func (f *Feeder) PreConfirmedBlockByNumber(
	ctx context.Context,
	blockNumber uint64,
	blockIdentifier string,
	knownTransactionCount uint64,
) (starknet.PreConfirmedUpdate, error)

PreConfirmedBlockByNumber fetches the pre_confirmed block at the given height and returns a delta-aware update. blockIdentifier and knownTransactionCount tell the server what the caller already has so the server can return a no-change marker, only the transactions appended since knownTransactionCount, or the full block when the round identifier no longer matches. Set both to zero values to get a full block.

func (*Feeder) StateUpdate

func (f *Feeder) StateUpdate(ctx context.Context, blockNumber uint64) (*core.StateUpdate, error)

StateUpdate gets the state update for a given block number from the feeder, then adapts it to the core.StateUpdate type.

func (*Feeder) StateUpdatePending added in v0.4.0

func (f *Feeder) StateUpdatePending(ctx context.Context) (*core.StateUpdate, error)

StateUpdatePending gets the state update for the pending block from the feeder, then adapts it to the core.StateUpdate type.

func (*Feeder) StateUpdatePendingWithBlock added in v0.6.1

func (f *Feeder) StateUpdatePendingWithBlock(
	ctx context.Context,
) (*core.StateUpdate, *core.Block, error)

StateUpdatePendingWithBlock gets both pending state update and pending block from the feeder, then adapts them to the core.StateUpdate and core.Block types respectively

func (*Feeder) StateUpdateWithBlock added in v0.6.1

func (f *Feeder) StateUpdateWithBlock(
	ctx context.Context,
	blockNumber uint64,
) (*core.StateUpdate, *core.Block, error)

StateUpdateWithBlock gets both state update and block for a given block number from the feeder, then adapts them to the core.StateUpdate and core.Block types respectively

func (*Feeder) Transaction deprecated

func (f *Feeder) Transaction(ctx context.Context, transactionHash *felt.Felt) (core.Transaction, error)

Deprecated: Transaction gets the transaction for a given transaction hash from the feeder, then adapts it to the appropriate core.Transaction types. Uses the old get_transaction endpoint; prefer get_transaction_status for status-only queries.

type FeederAdapter added in v0.16.1

type FeederAdapter struct {
	*Feeder
	// contains filtered or unexported fields
}

FeederAdapter wraps a Feeder and provides a transitional implementation of starknetdata.StarknetData for networks that have not yet upgraded to support the new "includeSignature=true" argument for the "get_state_update" endpoint.

A background verification loop ([Run]) periodically probes the new endpoint and atomically flips an internal flag once it becomes available, so the transition is automatic and requires no restart.

When the upstream feeder gateway does support the new argument, FeederAdapter delegates directly to the wrapped Feeder. Until then, it falls back to the old approach with two separate requests.

func NewFeederAdapter added in v0.16.1

func NewFeederAdapter(feeder *Feeder, logger log.StructuredLogger) *FeederAdapter

func (*FeederAdapter) PreConfirmedBlockByNumber added in v0.16.1

func (f *FeederAdapter) PreConfirmedBlockByNumber(
	ctx context.Context,
	blockNumber uint64,
	blockIdentifier string,
	knownTransactionCount uint64,
) (starknet.PreConfirmedUpdate, error)

PreConfirmedBlockByNumber returns the pre_confirmed block for the given block number. If the upstream feeder supports the new combined endpoint ("get_pre_confirmed" with the new "blockIdentifier" and "knownTransactionCount" arguments), it delegates to Feeder.PreConfirmedBlockByNumber. Otherwise, it falls back to the old approach: calling the client.DeprecatedPreConfirmedBlock endpoint with only the given block number.

func (*FeederAdapter) Run added in v0.16.1

func (f *FeederAdapter) Run(ctx context.Context) error

Complies with the Service interface

func (*FeederAdapter) StateUpdateWithBlock added in v0.16.1

func (f *FeederAdapter) StateUpdateWithBlock(
	ctx context.Context, blockNumber uint64,
) (*core.StateUpdate, *core.Block, error)

StateUpdateWithBlock returns the state update and block for the given block number. If the upstream feeder supports the new combined endpoint ("get_state_update" with the new "includeSignature=true" argument), it delegates to Feeder.StateUpdateWithBlock. Otherwise, it falls back to two separate requests (the "old" way): one for the state update with block and another for the block signature.

Jump to

Keyboard shortcuts

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