Skip to content

feat(mobile): wire SDK and port WalletProvider with secure session persistence - #594

Open
Big-Rahm wants to merge 1 commit into
Miracle656:mainfrom
Big-Rahm:fix/443-wire-sdk-port-walletprovider
Open

feat(mobile): wire SDK and port WalletProvider with secure session persistence#594
Big-Rahm wants to merge 1 commit into
Miracle656:mainfrom
Big-Rahm:fix/443-wire-sdk-port-walletprovider

Conversation

@Big-Rahm

Copy link
Copy Markdown

Overview

This PR wires the @veil/sdk (useInvisibleWallet) into the mobile app and ports the WalletProvider from the web wallet, adapted for React Native.

Unlike the web wallet (which keeps the signer keypair in React state only), the mobile provider persists the session in expo-secure-store so it survives the app being backgrounded or killed by the OS. The SDK credentials (key ID, public key, address) are persisted via AsyncStorage (configured as the SDK's StorageAdapter).

Related Issue

Closes #443

Changes

Mobile WalletProvider

  • [ADD] frontend/mobile/components/WalletProvider.tsx

    • Wraps useInvisibleWallet(walletConfig) with AsyncStorage as the storage adapter
    • Exposes session, setSession, wallet, clearSession via React context
    • Hydrates session from expo-secure-store on mount (reads wallet_address + signer_secret)
    • Persists/clears session (fee-payer signer keypair) in OS keychain via expo-secure-store
    • Blocks render until hydration is complete so children always see a consistent session state
    • Exports useWallet() hook matching the web interface
  • [MODIFY] frontend/mobile/app/_layout.tsx

    • Imported and mounted <WalletProvider> wrapping the navigation Stack and WalletConnectApprovalModal

SDK / Network Wiring

  • [MODIFY] frontend/mobile/lib/network.ts

    • Added factoryContractId to VeilNetwork type and both network definitions (testnet/mainnet)
    • Added walletConfig export (mirrors frontend/wallet/lib/network.ts)
  • [MODIFY] frontend/mobile/lib/walletStore.ts

    • Added setSignerSecret(secret) for persisting the fee-payer secret to expo-secure-store
    • Removed duplicate getWalletAddress() declaration

Dependencies

  • [MODIFY] frontend/mobile/package.json

    • Added invisible-wallet-sdk: file:../../sdk dependency
  • [MODIFY] frontend/mobile/tsconfig.json

    • Added path aliases for @veil/sdk and other @veil/* modules pointing to SDK source

Verification Results

npm install  - success
npx tsc --noEmit - success (no errors in changed files)
Acceptance Criteria Status
useWallet() returns a live useInvisibleWallet(walletConfig) from any screen Yes
WalletProvider exposes session, setSession, wallet, clearSession Yes
Session persists in expo-secure-store across app restart Yes
Portal/port structure matches web WalletProvider.tsx Yes

…rsistence

- Create WalletProvider component using @veil/sdk useInvisibleWallet with AsyncStorage adapter
- Persist session (signer keypair) in expo-secure-store for OS background/kill survival
- Add walletConfig export to network.ts with factoryContractId
- Add setSignerSecret to walletStore.ts
- Mount WalletProvider in app/_layout.tsx wrapping the navigation stack
- Add invisible-wallet-sdk dependency and tsconfig path aliases

Closes Miracle656#443
@Big-Rahm
Big-Rahm requested a review from Miracle656 as a code owner July 30, 2026 02:40
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the miracle656's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Big-Rahm 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

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.

15. Wire SDK + port WalletProvider

1 participant