Skip to content

Conversation

@petar-omni
Copy link
Collaborator

No description provided.

@vercel
Copy link

vercel bot commented Jan 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
perps-widget Ready Ready Preview, Comment Jan 30, 2026 2:05pm

Request Review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the wallet signer architecture to provide better type safety and separation between browser and ledger wallet types. The refactoring moves signer-related domain types to a dedicated src/domain/signer.ts file and updates the type system to distinguish between BrowserWalletAccount (address-only) and LedgerWalletAccount (address + id).

Changes:

  • Introduced separate BrowserSigner and LedgerSigner types with corresponding wallet account types that have different fields
  • Moved error classes (SignTransactionError, SwitchAccountError, SwitchChainError) from domain/wallet to domain/signer
  • Refactored signTransaction to no longer require an explicit account parameter, retrieving it from internal state instead

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/domain/signer.ts New file containing signer types, wallet account schemas, and error classes with discriminated unions for browser vs ledger
src/domain/wallet.ts Updated to use signer types from domain/signer, refined wallet type definitions with proper type narrowing helpers
src/domain/transactions.ts Removed optional fields (maxFeePerGas, maxPriorityFeePerGas, nonce) from EvmTx schema
src/domain/tokens.ts New file with token utilities (unrelated to signer refactoring)
src/services/wallet/signer.ts Simplified to a thin Context.Tag wrapper for the Signer type
src/services/wallet/browser-signer.ts Updated to use BrowserWalletAccount and new SignerService, removed account parameter from signTransaction
src/services/wallet/ledger-signer/index.ts Updated to use LedgerWalletAccount and new SignerService, signTransaction now retrieves account from state
src/services/wallet/wallet-service.ts Refactored wallet state matching to use discriminated union types with Match.exhaustive
src/atoms/wallet-atom.ts Split switchAccount atom into browser and ledger variants, updated wallet comparison logic
src/components/molecules/address-switcher.tsx Refactored to handle browser and ledger accounts separately with dedicated list components
src/components/modules/Account/Deposit/state.tsx Updated to use new token utilities and improved percentage calculation handling
src/components/modules/Account/Withdraw/state.tsx Improved percentage calculation with proper 100% handling and precision control

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@petar-omni petar-omni merged commit 69604d4 into main Jan 30, 2026
14 checks passed
@petar-omni petar-omni deleted the feat/misc branch January 30, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants