feat: implement approval gate for wallet commands and add SSE transpo…#16
feat: implement approval gate for wallet commands and add SSE transpo…#16andrew-virtuals wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 14d8f65. Configure here.
| if (!json && isTTY()) { | ||
| process.stdout.write(" Signing wallet verification..."); | ||
| } | ||
| signature = await provider.signMessage( |
There was a problem hiding this comment.
Topup command creates redundant expensive provider adapter
Low Severity
In the topup command, createProviderAdapter() is called at line 285 for chain validation, and then withApprovalGate at line 369 internally calls createProviderAdapter() a second time (plus creates an SSE transport). Before this PR, the single provider was reused for both validation and signing. Each createProviderFromConfig call potentially involves API calls (wallet ID lookup, builder code fetch) and creates a full PrivyAlchemyEvmProviderAdapter, making this a meaningful duplication of expensive work in the card+challenge flow.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 14d8f65. Configure here.


…rt creation
Note
Medium Risk
Touches wallet signing and transaction-broadcast flows by adding an SSE-based approval gate, which could impact interactive authorization and resource cleanup if the transport isn’t connected/disconnected correctly.
Overview
Introduces
withApprovalGateto run wallet provider operations with an SSESTREAMS.WALLETtransport connected for approval, and ensures the transport is disconnected afterward.Updates wallet CLI commands (
sign-message,sign-typed-data,send-transaction, and card top-up challenge signing) to execute via this gate, moving the supported-chain validation forsend-transactioninside the gated section.Adds
createSseTransportinagentFactoryto centralize SSE transport setup (context wiring + connect) for a given provider and set of streams.Reviewed by Cursor Bugbot for commit 253cfc0. Bugbot is set up for automated code reviews on this repo. Configure here.