Enterprise wallet integration (rebased on testnet) - #409
Conversation
2c8a0b7 to
c50866b
Compare
The desktop-side Cloud Wallet changes (cloudWalletOrigins config, OAuth callback path serving, empty popup preload, and the window.open popup allowlist) previously existed only in the dropped origin/main merge commit. Reapply them on top of the encapsulate-games base, whose desktop/ tree is identical to the prior main.
e117d3a to
c82f6f7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 4 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c82f6f7. Configure here.
| ); | ||
| } | ||
| return { status: 'error', message }; | ||
| } |
There was a problem hiding this comment.
OAuth pending state not shared
High Severity
The OAuth callback reads appState_cloudWalletOAuthPending from sessionStorage and treats a miss as a state mismatch. That key is written in the opener, but the callback runs in a popup that first loaded a cross-origin authorize URL, so it has a separate empty sessionStorage. Login then posts an error instead of the authorization code, and Cloud Wallet connect cannot complete.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit c82f6f7. Configure here.
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <meta name="theme-color" content="#000000" /> | ||
| <link rel="icon" href="favicon.svg" type="image/svg+xml" /> | ||
| <base href="/" /> |
There was a problem hiding this comment.
Callback page scripts fail to load
High Severity
The desktop OAuth callback is served as index.html at chiagaming://app/oauth/callback, while scripts and styles stay relative (index.js, bootstrap.mjs). The new <base href="/" /> is ignored because CSP sets base-uri 'none', so those assets resolve under /oauth/ and 404. The callback bundle never runs, so no postMessage reaches the opener.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit c82f6f7. Configure here.
| this.monitoringReady = false; | ||
| this.fireConnectionChange(false); | ||
| throw e; | ||
| } |
There was a problem hiding this comment.
Reconnect clears Cloud auth tokens
Medium Severity
Stored-session finalize calls clearCloudWalletAuth() on any failure from token refresh, resolveWalletId(), or startMonitoring(). A transient GraphQL or network error during silent resume therefore wipes durable OAuth tokens and forces a full popup login. resolveWalletId also turns a stored-id read error into the same fatal path instead of retrying or listing consented wallets.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit c82f6f7. Configure here.
| const feeValue = fee || 0n; | ||
| if (feeValue !== 0n) { | ||
| throw new Error('Cloud Wallet v1 does not support nonzero external fees'); | ||
| } |
There was a problem hiding this comment.
Cloud spend rejects configured fees
Medium Severity
spend throws when fee is any nonzero bigint, while the connected Wallet tab still exposes the shared transaction-fee control for Cloud Wallet. A player who leaves or sets a default fee will fail broadcasts and on-chain resolution even though the UI accepted the fee.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit c82f6f7. Configure here.


Note
High Risk
Introduces OAuth token handling, GraphQL spend/broadcast paths, and widens Electron popup/network policy—security-sensitive wallet and desktop surfaces.
Overview
Adds Cloud Wallet as a third
blockchainType(simulator|walletconnect|cloud), wired through the sameInternalBlockchainInterface/ Shell connection lifecycle as the other backends.Player app: New
CloudBlockchainInterfacedrives OAuth (PKCE popup +/oauth/callbackhandoff viaOAuthCallback), persisted config (cloudWalletConfig) and tokens (cloudWalletAuth), GraphQL for balance/coins/broadcast, and gaming funding viacreateGamingFundingSpendplus an approval popup. Hub play readiness treats Cloud like the simulator (ready when connected).SimulatorSetupModalis replaced by a genericConnectionSetupModalwith typed setup fields; Shell usesneedsWalletPairing/needsConnectionSetupPromptso WalletConnect still shows QR, the simulator can skip the balance modal on silent reconnect, and Cloud never auto-finalizes without OAuth config (including resume).Desktop: Simulator is hidden but WalletConnect and Cloud remain.
cloudWalletOriginsextends CSP and egress; OAuth useschiagaming://app/oauth/callback(protocol handler servesindex.html); Cloud popups get an empty preload and restrictedwindow.open/ navigation rules.Docs and session save validation accept
cloudas a persisted wallet preference.Reviewed by Cursor Bugbot for commit c82f6f7. Bugbot is set up for automated code reviews on this repo. Configure here.