Skip to content

fix: address #1268, #1269, #1270, #1271 - #1319

Merged
Ehonrie merged 5 commits into
Netwalls:mainfrom
kodaodife-dev:drips/1268-1269-1270-1271
Sep 28, 2026
Merged

Ehonrie merged 5 commits into
Netwalls:mainfrom
kodaodife-dev:drips/1268-1269-1270-1271

Conversation

@kodaodife-dev

Copy link
Copy Markdown
Contributor

Summary

fix: address #1268, #1269, #1270, #1271

What was solved

#1268 — F-50: Persist wallet connection across reloads

Persist the Freighter wallet connection across page reloads by silently restoring wallet state on mount in frontend/hooks/useWallet.ts, and clearing the persisted flag on disconnect, without triggering a Freighter popup on load.

Addressed:

  • Changed: frontend/hooks/useWallet.ts
  • On mount, silently call isConnected/getAddress to restore wallet state
  • disconnect must clear the persisted connection flag
  • No Freighter popup should appear on page load

#1269 — F-51: Share wallet state via a WalletProvider context

Introduce a WalletProvider React context that owns wallet state and the single polling interval, mount it in the root layout, and refactor useWallet to consume that context so Navbar, BetForm, and Portfolio share consistent state.

Addressed:

  • Changed: frontend/hooks/useWallet.ts, frontend/app/layout.tsx
  • Create a WalletProvider component that owns wallet state (address, connection status, balance, etc.) and runs a single poll interval
  • Mount WalletProvider in frontend/app/layout.tsx so it wraps the app tree
  • Refactor frontend/hooks/useWallet.ts to read state from the context instead of maintaining its own state and poll interval

#1270 — F-52: Map contract error codes to user-facing messages

Add a frontend error-mapping layer that decodes numeric Soroban ContractError codes returned by contract simulations/submissions into friendly user-facing copy, and wire it into submitTransaction/simulate error paths so toasts display the mapped messages.

Addressed:

  • Changed: frontend/lib/errors.ts, frontend/lib/stellar.ts, frontend/lib/errors.ts
  • Create frontend/lib/errors.ts with a table mapping every ContractError variant to friendly user-facing copy
  • Decode and map errors from submitTransaction and simulation failures in frontend/lib/stellar.ts
  • Ensure toasts surface the mapped message rather than raw host errors

#1271 — F-53: Wait for transaction confirmation with timeout

Implement bounded transaction confirmation polling in the frontend: submitTransaction in frontend/lib/stellar.ts should poll getTransaction with backoff up to 30s, distinguishing pending/success/failed/timeout states, and components/TransactionStatusModal.tsx should surface those states and link to stellar.expert for the tx hash.

Addressed:

  • Changed: frontend/lib/stellar.ts, components/TransactionStatusModal.tsx
  • Poll getTransaction with backoff until SUCCESS/FAILED, bounded to a 30s timeout
  • Distinguish and report pending, success, failed, and timeout states
  • Report status to TransactionStatusModal

Changes

  • frontend/hooks/useWallet.ts (modify)
  • frontend/app/layout.tsx (modify)
  • frontend/lib/errors.ts (create)
  • frontend/lib/stellar.ts (modify)
  • components/TransactionStatusModal.tsx (create)

Approach

  1. F-50: Persist wallet connection across reloads #1268 — F-50: Persist wallet connection across reloads (Changed: frontend/hooks/useWallet.ts)
  2. F-51: Share wallet state via a WalletProvider context #1269 — F-51: Share wallet state via a WalletProvider context (Changed: frontend/hooks/useWallet.ts, frontend/app/layout.tsx)
  3. F-52: Map contract error codes to user-facing messages #1270 — F-52: Map contract error codes to user-facing messages (Changed: frontend/lib/errors.ts, frontend/lib/stellar.ts, frontend/lib/errors.ts)
  4. F-53: Wait for transaction confirmation with timeout #1271 — F-53: Wait for transaction confirmation with timeout (Changed: frontend/lib/stellar.ts, components/TransactionStatusModal.tsx)

Issues

Closes #1268
Closes #1269
Closes #1270
Closes #1271

@Ehonrie
Ehonrie merged commit 41ec777 into Netwalls:main Sep 28, 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

2 participants