Skip to content

feat: buy currencies with other currencies#499

Closed
raulriera wants to merge 3 commits into
mainfrom
buy-currencies-with-currencies-93fb9f
Closed

feat: buy currencies with other currencies#499
raulriera wants to merge 3 commits into
mainfrom
buy-currencies-with-currencies-93fb9f

Conversation

@raulriera

Copy link
Copy Markdown
Collaborator

Buying a currency now goes through a payment-currency step: enter an amount (capped at your highest spendable balance), pick what to pay with — USDF or any other currency you hold — and confirm. Paying with a currency routes through the launchpad-to-launchpad swap, showing the pool's 1% exchange fee up front; paying with USDF keeps the simple summary. If the amount plus fee doesn't fit the selected balance, Buy offers to switch to the maximum amount instead. The currency being bought is excluded from the payment list, and with nothing spendable the amount screen becomes an Add Money shortcut.

Along the way this fixes two latent bugs the new path exposed: the transaction compiler ordered lookup-table accounts globally instead of grouped by table (invisible until the first two-table transaction), and the funds gate compared amounts across two different exchange rates, which could crash on a pinned quote after a rate tick.

Since entry is now capped at spendable balances, the old enter-more-to-fund shortcut is gone; the funding regression tests enter Add Money from the wallet instead.

  • Buy with USDF end to end
  • Buy paying with another currency end to end
  • Enter more than the selected currency holds → insufficient sheet → Buy Maximum Amount
  • Buy a currency when it's your only holding → Add Money shortcut
  • Sell flow still shows the correct fee

Base automatically changed from sync-protos-6347ee to main July 17, 2026 16:08
Adds a payment-currency step to the buy flow: USDF or any launchpad
token can fund a buy via the launchpad-to-launchpad StatefulSwap.
Fixes multi-lookup-table account ordering in the transaction compiler
and the funds gate's cross-rate compare.
@raulriera
raulriera force-pushed the buy-currencies-with-currencies-93fb9f branch from dd1e6b6 to 33d7390 Compare July 17, 2026 16:09
@raulriera raulriera closed this Jul 17, 2026
@raulriera
raulriera deleted the buy-currencies-with-currencies-93fb9f branch July 17, 2026 16:17
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.

1 participant