Skip to content

feat(streams): add USDC testnet SAC as stream token with trustline validation (fixes #1) - #27

Open
NePreby wants to merge 11 commits into
Flow-Pulse:mainfrom
NePreby:feat/usdc-stream-token-support
Open

NePreby wants to merge 11 commits into
Flow-Pulse:mainfrom
NePreby:feat/usdc-stream-token-support

Conversation

@NePreby

@NePreby NePreby commented Nov 6, 2026

Copy link
Copy Markdown

Overview

Resolves #1 by adding full support for testnet USDC (Stellar Asset Contract) alongside native XLM for per-second micro-streams, complete with token selector, trustline pre-flight validation, and multi-token Earnings/Streams filtering.

Changes

  1. Token Metadata & Registration (frontend/src/lib/config.ts):

    • Registered Circle Testnet USDC SAC (CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA issued by GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5) with 7 decimals.
    • Defined SUPPORTED_TOKENS with TokenInfo types for both XLM and USDC.
    • Fallback tokenMeta safely handles arbitrary unregistered SAC addresses.
  2. Trustline & Horizon Balances (frontend/src/lib/wallet.ts):

    • Added hasTrustline(address, assetCode, issuer) to detect whether the recipient account can receive USDC transfers.
    • Added tokenBalance(address, tokenAddress) to query balances across both native XLM and classic credit assets on Horizon.
  3. NewStreamModal Token Selector & Warning (frontend/src/components/NewStreamModal.tsx):

    • Added token selection cards for XLM and USDC with dynamic symbols, names, and check indicators.
    • Real-time recipient trustline verification: displays warning banner if recipient has not established a USDC trustline.
    • Dispatches create_stream with the chosen SAC contract ID.
  4. Multi-Token Streams & Earnings Pages (frontend/src/pages/Streams.tsx, frontend/src/pages/Earnings.tsx):

    • Updated TopUpSheet to accept arbitrary token addresses and format amounts according to token metadata.
    • Removed single-token XLM lock from EarningsPage, adding All / XLM / USDC token filter tabs.
  5. Unit Tests & Verification (frontend/src/lib/__tests__/tokens.test.ts):

    • 6 new unit tests verifying XLM/USDC metadata resolution, trustline detection, and token balance queries.
    • 85/85 vitest tests pass, tsc -b clean, and production Vite build succeeds.

Closes #1.


Bounty Payout Wallet (TRC20 USDT / TRX):
TMqmJjRgVS21NL2eFtfyHciTxvE4BqGmEv

This branch has not been deployed

No deployments
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.

Add USDC (testnet SAC) as a stream token

1 participant