Labels: Stellar Wave, stellar, feature, drips, help-wanted
Tier: M (2–4 days)
Type: feature
Context
fetchAnnouncements('stellar') today returns announcements across a probed ledger range starting max - 5000 if no cursor is provided. There's no way to say "only give me announcements from the last hour" or "everything since I last scanned." Every consumer ends up paginating from scratch.
Spectre's background scanner re-fetches the same window every 5 minutes. The Soroban RPC is expensive. We need incremental scan support.
Scope
Extend fetchAnnouncements (and fetchAnnouncementsStream from #09 if it lands) to accept:
type FetchOpts = {
fromLedger?: number // earliest ledger to include (inclusive)
toLedger?: number // latest ledger (exclusive); defaults to latest
fromTimestamp?: Date // convenience: convert to ledger using Horizon
toTimestamp?: Date
cursor?: string // resume from a previous run
}
Behavior:
cursor takes precedence over fromLedger if both supplied.
fromTimestamp and fromLedger are mutually exclusive; error if both set.
- Returned result includes a
nextCursor field consumers can pass to the next call.
- If the Soroban RPC's retention window has elapsed past
fromLedger, throw a typed error RetentionExceededError with the actual oldest available ledger.
Acceptance criteria
Why this matters
This single change cuts Spectre's Stellar RPC usage by ~50×. Five-minute scans of the last five minutes only, not the last five hours.
Resources
Labels:
Stellar Wave,stellar,feature,drips,help-wantedTier: M (2–4 days)
Type: feature
Context
fetchAnnouncements('stellar')today returns announcements across a probed ledger range startingmax - 5000if no cursor is provided. There's no way to say "only give me announcements from the last hour" or "everything since I last scanned." Every consumer ends up paginating from scratch.Spectre's background scanner re-fetches the same window every 5 minutes. The Soroban RPC is expensive. We need incremental scan support.
Scope
Extend
fetchAnnouncements(andfetchAnnouncementsStreamfrom #09 if it lands) to accept:Behavior:
cursortakes precedence overfromLedgerif both supplied.fromTimestampandfromLedgerare mutually exclusive; error if both set.nextCursorfield consumers can pass to the next call.fromLedger, throw a typed errorRetentionExceededErrorwith the actual oldest available ledger.Acceptance criteria
sdk/src/chains/stellar/announcements.ts.Why this matters
This single change cuts Spectre's Stellar RPC usage by ~50×. Five-minute scans of the last five minutes only, not the last five hours.
Resources
getEventscursor: https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents