Implements the first on-chain write action from the Hypha mobile app: casting a governance vote.
Comes out of #2239 (analysis + direction decision): Path A confirmed — Flutter app sends its Privy JWT to the backend, which uses the Privy Server SDK to sign and submit the transaction in Privy's TEE. No private keys on the mobile device.
Scope
Backend (hypha-web / apps/api):
POST /api/v1/wallet/provision — provision a Privy smart wallet for a user on first governance interaction (verify Flutter JWT via Privy Server SDK, create/retrieve smart wallet, store userId → smartWalletAddress mapping)
POST /api/v1/vote (or /api/v1/proposals/:id/vote) — verify JWT to identify user + wallet, encode the vote function call, submit transaction via Privy Server SDK, return txHash
Mobile (hypha-mobile / Flutter):
- Call provisioning endpoint on first governance interaction
- Wire the vote button (currently
onPressed: () {}) to the vote endpoint (send proposalId, support, Bearer token)
- Handle loading/error states; surface
txHash or error to the user
Starting point
wallet_provision_repository.dart in hypha-mobile has the provisioning call started (WIP, uncommitted)
- The JWT-bearer →
apps/api proxy pattern is already in use for reads
Phase
Phase A — spec before code. Kick off with /hypha-task-init #2350-mobile-governance-vote in hypha-context.
Implements the first on-chain write action from the Hypha mobile app: casting a governance vote.
Comes out of #2239 (analysis + direction decision): Path A confirmed — Flutter app sends its Privy JWT to the backend, which uses the Privy Server SDK to sign and submit the transaction in Privy's TEE. No private keys on the mobile device.
Scope
Backend (hypha-web /
apps/api):POST /api/v1/wallet/provision— provision a Privy smart wallet for a user on first governance interaction (verify Flutter JWT via Privy Server SDK, create/retrieve smart wallet, storeuserId → smartWalletAddressmapping)POST /api/v1/vote(or/api/v1/proposals/:id/vote) — verify JWT to identify user + wallet, encode the vote function call, submit transaction via Privy Server SDK, returntxHashMobile (hypha-mobile / Flutter):
onPressed: () {}) to the vote endpoint (sendproposalId,support, Bearer token)txHashor error to the userStarting point
wallet_provision_repository.dartin hypha-mobile has the provisioning call started (WIP, uncommitted)apps/apiproxy pattern is already in use for readsPhase
Phase A — spec before code. Kick off with
/hypha-task-init #2350-mobile-governance-votein hypha-context.