Skip to content

Add multi-asset support with trustline management #27

Description

@MJ-RWA

Complexity: High — 200 pts

Summary

StellarFlow currently only supports XLM and USDC. This issue adds a "Manage Assets" page where users can discover and add trustlines for additional Stellar-issued assets (wBTC, yXLM, etc.), and dynamically updates the Send and Swap pages to support any asset the user holds.

Files to Create/Modify

  • Create: src/lib/assets.tsKNOWN_ASSETS registry (code, issuer, name, logo)
  • Create: src/pages/ManageAssetsPage.tsx
  • Modify: src/lib/stellar.ts — add buildChangeTrustTx
  • Modify: src/pages/SendPage.tsx — dynamic asset list from balances
  • Modify: src/pages/SwapPage.tsx — dynamic asset selectors
  • Modify: src/App.tsx — add /assets route
  • Modify: src/pages/DashboardPage.tsx — add "Manage Assets" link

Implementation Notes

assets.ts

Define a KNOWN_ASSETS: StellarAsset[] array with at least 4 assets beyond USDC (e.g. yXLM, AQUA) — each with code, issuer, name, logoSymbol.

buildChangeTrustTx in stellar.ts

export async function buildChangeTrustTx(sourceAddress, assetCode, assetIssuer, remove = false): Promise<string>

Uses Operation.changeTrust({ asset, limit: remove ? '0' : undefined }).

ManageAssetsPage

  • List KNOWN_ASSETS with an "Added" badge for assets already in balances
  • "Add" → build, sign, submit changeTrust tx
  • "Remove" → only enabled when balance is 0
  • Search bar filters by code or name

Dynamic selectors

Update SendPage and SwapPage to derive their asset dropdown options from the live balances array instead of a hardcoded XLM/USDC list.

Acceptance Criteria

  • Manage Assets page lists at least 4 known assets beyond XLM and USDC
  • Add button creates a changeTrust operation signed by Freighter
  • Remove button only enabled when asset balance is 0
  • New assets appear in Send and Swap selectors after trustline is added
  • Search bar filters the asset list
  • Works on Stellar mainnet

Screen Recording Requirements

  1. Open Manage Assets → list of known assets
  2. Click Add on yXLM → Freighter sign → trustline added
  3. Dashboard now shows yXLM with 0 balance
  4. Send page asset selector now includes yXLM
  5. Remove yXLM trustline (balance 0) → disappears from Dashboard

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions