Skip to content
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

fix(useWallet): ensure consistent wallet interface across adapters #346

Merged
merged 3 commits into from
Feb 13, 2025

Conversation

drichar
Copy link
Collaborator

@drichar drichar commented Feb 13, 2025

Description

This PR fixes inconsistencies in how wallet objects are returned across framework adapters. Previously, activeWallet could return a BaseWallet while wallets returned Wallet[], leading to potential type mismatches.

Details

  • Ensure activeWallet returns same Wallet interface as items in wallets array
  • Extract transformToWallet helper in React/Vue adapters to maintain consistency
  • Preserve BaseWallet internally for transaction signing only
  • Fix Wallet interface to use WalletId type instead of string
  • Remove unused Wallet interface from Solid adapter (uses individual reactive properties instead)

Refactor active wallet handling in React and Vue adapters to consistently
return `Wallet` interface while preserving `BaseWallet` for transaction signing.
Extract `transformToWallet` helper to reduce code duplication.

Fix `Wallet` interface to use `WalletId` type instead of string for `id`.
Remove unused `Wallet` interface from Solid adapter since it follows a more
idiomatic approach of returning individual reactive properties rather than
grouped `Wallet` objects like React and Vue adapters.
Update test mocks to use `BaseWallet` instances instead of `Wallet` objects,
matching the actual implementation which returns `BaseWallet` instances in
the `wallets` array rather than the framework-specific `Wallet` interface.
@drichar drichar merged commit 276df84 into v4 Feb 13, 2025
1 check passed
@drichar drichar deleted the fix/react-vue-activewallet-type branch February 13, 2025 16:51
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.

1 participant