Skip to content

Show buy-in amount, fee, gas price, and total deduction in join-table preview - #483

Merged
Marvy247 merged 1 commit into
HitEmPoka:mainfrom
gboigwe:fix/161-buyin-confirmation-preview
Aug 31, 2026
Merged

Show buy-in amount, fee, gas price, and total deduction in join-table preview#483
Marvy247 merged 1 commit into
HitEmPoka:mainfrom
gboigwe:fix/161-buyin-confirmation-preview

Conversation

@gboigwe

@gboigwe gboigwe commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

TransactionSimulation already estimated the network fee via simulateTransaction, but the modal never showed the buy-in amount itself, an effective gas price, or the total amount that would actually leave the wallet (buy-in + fee) — exactly what this issue asks for.

  • TransactionSimulation.tsx accepts an optional buyInAmount (stroops) prop. When present, it renders a "Buy-in Summary" section above the existing generic simulation details: buy-in amount, network fee, gas price (derived from fee / instructions used, both already returned by the existing simulation), and total deduction.
  • useJoinTableSimulation now exposes its internal params (tableId, buyIn) so the render site can read the in-flight buy-in amount without new plumbing.
  • Table.tsx and page.tsx pass buyInAmount only to the join-table confirmation modal — the separate in-game action confirmation modal (raise/call/etc.) is untouched, since that's not a buy-in flow.

Issue

Closes #161

Notes on interpreting "current XLM/gas price"

Soroban doesn't have a separate market "gas price" the way some other chains do — fees are computed from simulated resource usage against the network's current fee rates, which simulateTransaction (already used here) reflects automatically. I interpreted "current gas price" as the effective rate the simulation implies (fee ÷ instructions used), shown so the user can see how the fee was derived, rather than adding a new external USD/XLM market-price dependency that nothing in the codebase currently has.

Test plan

  • npx vitest run — 123 passed, same 4 pre-existing failures as on main before this change (audio-controls.test.tsx, reconnect-state.test.ts — unrelated to this work, confirmed via git stash before/after comparison)
  • Added transaction-simulation-buyin.test.tsx — 4 new tests covering: summary shown/hidden based on buyInAmount presence, correct amount/fee/gas-price/total formatting, and no summary when the simulation itself failed
  • npx tsc --noEmit — fixed a real compile error my own change introduced (BigInt literal syntax isn't allowed at this project's ES2017 TS target; switched to BigInt(...) calls, matching the existing convention already used elsewhere in this codebase, e.g. page.tsx's STROOPS_PER_XLM). All remaining type errors are pre-existing and unrelated (confirmed present before this change too): token-selector.test.tsx, page.tsx:668 (tokenChoice typing), Table.tsx (replayEntry/setReplayEntry), reconnect-state.ts (ArrayBuffer typing) — not touched, since they aren't caused by this change.

…-table preview

TransactionSimulation already showed a fee estimate via
simulateTransaction, but not the buy-in amount, the effective gas
price, or the total wallet deduction the issue asked for.

- TransactionSimulation.tsx: accepts an optional buyInAmount (stroops)
  prop; when present, renders a Buy-in Summary section (buy-in
  amount, network fee, gas price derived from fee/instructions used,
  and total deduction = buy-in + fee) above the existing generic
  simulation details
- use-transaction-simulation.ts: useJoinTableSimulation now exposes
  its internal params (tableId, buyIn) so callers can read the
  in-flight buy-in amount
- Table.tsx / page.tsx: pass buyInAmount to the join-table
  confirmation modal only, not the in-game action confirmation modal

Closes HitEmPoka#161
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@gboigwe 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

@Marvy247
Marvy247 merged commit 8c9fff3 into HitEmPoka:main Aug 31, 2026
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.

Implement a buy-in confirmation preview with gas estimation

2 participants