Repository navigation
feat: wallet state machine, WalletConnect, account activation and connect-in-place - #168
Merged
Marvell69 merged 2 commits intoOct 18, 2026
Conversation
…nect-in-place - Pure wallet state machine with an interpreter and kit adapter (OracleDesk#32) - openModal stays on the current page; returnTo is validated; no sign-in on connect; withSession (OracleDesk#33) - WalletConnect module behind NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID (OracleDesk#31) - XLM balance, account activation state, Friendbot link and write guard for unfunded accounts (OracleDesk#34)
|
@QueenGiba is attempting to deploy a commit to the Marvel's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@QueenGiba 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR reworks the wallet flow in four connected parts, since they all touch
WalletProvider:lib/stellar/wallet-machine.ts) with named states, typed events and effects as data. A small interpreter (lib/stellar/wallet-interpreter.ts) runs the effects against aWalletKitAdapterinterface, so the races are testable without an extension or DOM. Late results after a disconnect or account change are dropped by an epoch counter. ConcurrentensureSession()calls share one sign-in.WalletContextValuekeeps its shape.openModal()no longer redirects to/markets.openModal({ returnTo })navigates only to a same-origin path (lib/navigation.ts). Connecting never triggers the SEP-10 signature;withSession(fn, why)signs in right before a protected call.RequireWalletreplaces the admin connect gates, the admin "Switch wallet" button disconnects before reopening the picker, and premium keeps the chosen tier when the wallet connects.NEXT_PUBLIC_WALLETCONNECT_PROJECT_IDis set, through a dynamic import, so the default bundle is unchanged.APP_URLand the chain (stellar:testnet/stellar:pubnet) come from config. A missing WalletConnect session maps to "Connect your mobile wallet again".account-not-founderror before building a transaction.describeErrormaps "Account not found" and similar errors to that kind. Account polling is faster while unfunded.Closes
Closes #31
Closes #32
Closes #33
Closes #34
Not in this PR
scripts/measure-bundle.mjs) and numbers.canSignMessage, etc.) and the "approve in your wallet app" waiting UI.RequireSessioncomponent and session-expiry handling beyond the reconnect message.UserFacingErrors; only the guard anddescribeErrormapping are covered.Testing
Unit tests added:
lib/stellar/__tests__/wallet-machine.test.ts(transitions, races, and a no-navigate-without-connect property over event sequences),lib/__tests__/navigation.test.ts, and new cases inlib/stellar/__tests__/errors.test.ts.Not run in this PR:
npm run typecheck,npm run lint,npm testandnpm run build. The lockfile ondevelopdoes not matchpackage.json, sonpm cifails before any check runs. Manual steps are indocs/manual-test.md(steps 3, 5 and 5a).