Skip to content

fix(adapter): add hardware wallet sign timeout and exponential backoff reconnect (closes #973) - #979

Open
area523ufo wants to merge 1 commit into
Sorokit:mainfrom
area523ufo:fix/adapter-hardware-timeout-backoff-973
Open

area523ufo wants to merge 1 commit into
Sorokit:mainfrom
area523ufo:fix/adapter-hardware-timeout-backoff-973

Conversation

@area523ufo

Copy link
Copy Markdown

Closes #973

Summary

Hardens WalletAdapterManager in src/lib/adapter.ts:

  1. Hardware wallet signing timeout: Added configurable hardwareSignTimeoutMs (default 60_000ms for hardware wallets like Ledger) enforced via Promise.race during signTransaction, returning a clear timeout error if the device does not respond in time.
  2. Exponential backoff reconnection: Added reconnectWithBackoff() supporting configurable maxReconnectAttempts and reconnectBaseDelayMs (baseDelay * 2^attempt) with automatic session state updates.
  3. Network switch validation: Validates target network before switching and notifies listeners cleanly.

Verification

  • Expanded src/lib/__tests__/adapter.test.ts with tests for hardware wallet signing timeouts, exponential backoff reconnection retries, and session persistence.
  • All unit tests pass via npx vitest run.

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.

Add hardware wallet timeout handling and reconnection backoff in adapter.ts

1 participant