Skip to content

feat(sdk-svelte): match React Stellar hooks#164

Open
Hallab7 wants to merge 1 commit into
wraith-protocol:developfrom
Hallab7:feat/sdk-svelte-hook-parity
Open

feat(sdk-svelte): match React Stellar hooks#164
Hallab7 wants to merge 1 commit into
wraith-protocol:developfrom
Hallab7:feat/sdk-svelte-hook-parity

Conversation

@Hallab7

@Hallab7 Hallab7 commented Jul 26, 2026

Copy link
Copy Markdown

sdk-svelte: parity with sdk-react hook set

Summary

Brings the Stellar API in @wraith-protocol/sdk-svelte to parity with the
current @wraith-protocol/sdk-react hook set using idiomatic Svelte stores and
actions.

This also adds a Svelte 5 receive example that derives a Stellar stealth
meta-address and scans recent on-chain announcements.

What changed

  • Added useStellarAnnouncementScan
    • Exposes announcements, scanning, and error readable stores
    • Provides a scan(options) action backed by the core SDK's streaming
      announcement API
  • Added useStellarSendStealthPayment
    • Exposes building and error readable stores
    • Provides a build(options) action
  • Added useStellarBalance
    • Loads and exposes the native XLM balance through balance and loading
      stores
  • Added useStellarName
    • Matches the React primitive's address, loading, and error shape
  • Updated useStellarStealthKeys
    • Added the React-compatible generate(signature) action while preserving the
      existing deriveKeys action
    • Updated announcement fetching to use fetchAnnouncementsStream
  • Exported all new primitives from the package entry point
  • Enabled declaration generation so package consumers receive the updated public
    types
  • Added @testing-library/svelte coverage with a rendered store subscriber to
    verify reactive updates
  • Added examples/stellar-svelte-receive

Public API parity

React hook Svelte primitive State
useStellarStealthKeys useStellarStealthKeys keys, generate
useStellarAnnouncementScan useStellarAnnouncementScan announcements, scanning, error, scan
useStellarSendStealthPayment useStellarSendStealthPayment building, error, build
useStellarBalance useStellarBalance balance, loading
useStellarName useStellarName address, loading, error

All state fields are exposed as readable Svelte stores. Calling an action updates
the associated stores and notifies subscribers.

Example

The new stellar-svelte-receive Vite app demonstrates:

  1. Parsing a 64-byte hexadecimal secret
  2. Deriving Stellar stealth keys
  3. Generating a shareable stealth meta-address
  4. Scanning the configured Stellar deployment for announcements
  5. Rendering scan progress, results, and errors reactively

Run it with:

pnpm --filter @wraith-protocol/sdk-svelte build
pnpm --filter @wraith-protocol/example-stellar-svelte-receive dev

Verification

  • @wraith-protocol/sdk-svelte tests pass: 10/10
  • Package typecheck passes
  • Package ESM and declaration builds pass
  • Example Svelte typecheck passes with no errors or warnings
  • Example production build passes
  • Vite dev server responds successfully and serves the compiled scan UI
  • Store writes notify rendered Svelte subscribers
  • Announcement scan state and results update reactively

Scope

Changes are limited to packages/sdk-svelte, the new
examples/stellar-svelte-receive app, and the required workspace lockfile
updates. No core SDK or unrelated package source was changed.

closes #129

@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@Hallab7 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sdk-svelte: parity with sdk-react hook set

1 participant