Skip to content

feat(transaction-panel): send assetIssuer and show a balance hint - #624

Open
16navigabraham wants to merge 1 commit into
Sorokit:mainfrom
16navigabraham:feat/multi-asset-transaction-support
Open

feat(transaction-panel): send assetIssuer and show a balance hint#624
16navigabraham wants to merge 1 commit into
Sorokit:mainfrom
16navigabraham:feat/multi-asset-transaction-support

Conversation

@16navigabraham

Copy link
Copy Markdown

Summary

Closes #565. Closes #566 (duplicate of #565 — same title/problem, filed separately).

TransactionPanel's asset selector already let a user pick a non-native asset from their balances (added in a prior PR), but the actual submission never sent enough information for the backend to know which issuer's asset to pay with, and the amount input gave no feedback on how much of the selected asset was actually available.

Problem

  • TransactionParams (src/lib/client.ts) has no assetIssuer field, and TransactionPanel's submitTransaction() only ever sent asset: selectedAsset (an asset code like "USDC") — never the issuer account. Two different tokens can share the same code with different issuers, so this payload is ambiguous for anything other than native XLM.
  • The Amount input showed the selected asset's balance only as part of an error message once you'd already typed an amount that exceeded it — there was no passive hint showing what's available before you type.

What changed

  • src/lib/client.ts — added assetIssuer?: string to TransactionParams.
  • src/components/TransactionPanel.tsx
    • submitTransaction() now passes assetIssuer: selectedAssetBalance?.assetIssuer in the transaction.submit(...) call — undefined for native XLM (which has no issuer), and the balance's assetIssuer for anything else.
    • The Amount input now shows Balance: {balance} {asset} via the existing Input component's hint prop, which is automatically suppressed whenever a validation error is showing (no double messaging).
  • src/components/TransactionPanel.test.tsx — 3 new tests: assetIssuer is included for a non-native asset and correctly matches the selected balance's issuer, assetIssuer is undefined for XLM, and the balance hint updates when the asset selection changes.

Acceptance criteria

  • A dropdown shows all assets from the connected wallet's balance list (already implemented before this PR)
  • The selected asset code is reflected in the amount input label (already implemented before this PR)
  • The transaction payload includes the correct assetCode and assetIssuer
  • XLM (native) is the default selected asset (already implemented before this PR)
  • The balance for the selected asset is shown as a hint near the amount input
  • Existing amount validation and the Send button disabled state still work (unchanged, verified via the existing test suite)

Testing

  • npx vitest run src/components/TransactionPanel.test.tsx → same 25/36 pass as main plus the 3 new tests (28 total passing here); the 11 failures are pre-existing and unrelated — see note below.
  • npm run typecheck → clean.

Note for maintainers

While working on this I found main already has 11 pre-existing, unrelated failures in TransactionPanel.test.tsx (confirmed via git stash against a clean checkout) — every test that completes a submission through the confirmation modal fails with "Wallet not connected", because the shared useSorokit() mock at the top of the file was never updated to include a client field after the "context client" refactor (client now comes from useSorokit(), not a direct getClient() call). My 3 new tests work around it locally (client: getClient() in their own mock), but I left the shared, already-broken tests alone since fixing them isn't in scope for this issue. Flagging in case it's worth a follow-up.

TransactionPanel's asset selector already let users pick a non-native
asset from their balances, but TransactionParams had no assetIssuer
field and the payload never included one, so a payment in USDC (or
any other issued asset) would submit with only the asset code and no
way for the API to disambiguate which issuer's USDC to pay with.

- lib/client.ts: add an optional assetIssuer field to
  TransactionParams.
- TransactionPanel.tsx: pass the selected balance's assetIssuer
  through to transaction.submit (undefined for native XLM), and show
  the selected asset's balance as a hint under the Amount input via
  the existing Input hint prop.

Closes Sorokit#565
Closes Sorokit#566
Copilot AI lite review requested due to automatic review settings August 29, 2026 11:18
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@16navigabraham 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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

TransactionPanel hardcodes XLM no multi-asset support TransactionPanel hardcodes XLM with no multi-asset support for token payments

2 participants