-
Notifications
You must be signed in to change notification settings - Fork 42
refactor: align controller package with StarkNet wallet API spec #2053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Updated controller package to use standard types from @starknet-io/types-js: - Replace custom error codes with standard wallet API error types (UNKNOWN_ERROR, etc.) - Use standard Address type instead of string for account addresses - Update error handling to use proper error codes (163 instead of 63) - Import standard types consistently across wallet adapters - Add WalletApiError union type for better error type safety 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add createUserRejectedError helper function for consistent error creation - Update IFrame base class to support cancellation callbacks via onCancel - Implement cancellation handling in controller connect method - Add withCancellation method to wrap operations with cancel support - Update account execute and signMessage to reject with USER_REFUSED_OP on cancel - Ensure all pending promises are properly rejected when user clicks outside modal 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Applied prettier formatting from turbo lint:fix 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
| return operation.finally(() => { | ||
| this.onCancel = originalOnCancel; | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Concurrent Operations Overwrite Cancellation Handlers
The withCancellation method has a race condition where concurrent operations overwrite the shared onCancel handler. This means only the most recent operation's cancellation handler is active, causing earlier operations to lose their ability to be cancelled when the user clicks outside.
Summary
@starknet-io/types-jsChanges
Initial Changes (Wallet API Alignment)
UNKNOWN_ERROR)Addresstype instead ofstringfor account addressesUSER_REFUSED_OP,INVALID_REQUEST_PAYLOAD, etc.)New Changes (USER_REFUSED_OP Handling)
onCancelcallback to IFrame base class to detect when users click outside modalcreateUserRejectedError()helper for consistent USER_REFUSED_OP error creationTest Plan
pnpm format:check)Breaking Changes
None - all changes maintain backward compatibility while improving spec compliance.
🤖 Generated with Claude Code