refactor: align controller package with StarkNet wallet API spec#2053
Open
refactor: align controller package with StarkNet wallet API spec#2053
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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