Skip to content

chore: extract DataSource interface to package surface - #32

Draft
mattgle wants to merge 1 commit into
devfrom
chore/type-scan-provider
Draft

mattgle wants to merge 1 commit into
devfrom
chore/type-scan-provider

Conversation

@mattgle

@mattgle mattgle commented May 4, 2026

Copy link
Copy Markdown

Context

wallet-sdk's RailgunWalletSDK.scan() accepts a data source but currently types the parameter as any because the DataSource interface — defined inside this package at src/sources/data-source.ts — is not part of the public package surface. To let consumers type against it structurally instead of importing concrete provider classes for typing, this PR exposes it.

Changes

  • Re-export DataSource and SyncOptions from src/sources/index.ts and the package root src/index.ts.
  • SourceAggregator now declares implements DataSource<T> and gains head() and isLiveProvider. Both delegate to the last (highest-cost) source, which by the aggregator's existing convention is the live provider. This is consistent with how from() already treats the last source as the live tail.
  • No runtime behavior change. No public API renames.

Why now

Unblocks the wallet-sdk-side change that types scan()'s provider parameter as DataSource<EVMBlock>, removing two any casts and the need to import concrete provider classes purely for typing.

Re-exports DataSource and SyncOptions from the package barrel so consumers
(such as wallet-sdk) can type their data-source parameters structurally
instead of importing concrete provider classes. Adds the implements clause
to SourceAggregator and surfaces head() and isLiveProvider — both delegate
to the last (live) source — so the aggregator now satisfies the same
interface as the underlying providers.

No runtime behavior change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant