refactor: adopt WalletFactory pattern for type-safe wallet IDs
Refactors wallet connectors to use the new WalletFactory helper type,
which preserves literal ID types through 'as const' assertions. This provides better type safety and enables stricter type checking for wallet identifiers throughout the codebase.
Changes:
- Add WalletFactory helper type to Wallet.ts
- Add appName and appIcon to CreateWalletFn type for wallets that require them (baseAccount, coinbaseWallet, geminiWallet)
- Convert all wallet connectors to use WalletFactory pattern
- Flatten type definitions in baseAccount and coinbaseWallet
- Update WalletButton components to work with new types
- All wallet IDs now use 'as const' for literal type preservation
PR-Codex overview
This PR focuses on improving the TypeScript typings and structure of various wallet connector implementations in the rainbowkit package. It enhances type safety and consistency by utilizing the satisfies operator and updating the wallet connector functions.
Detailed summary
- Updated wallet connector functions to use
satisfies Walletfor type safety. - Changed return types from
(): Walletto() =>for consistency. - Replaced
iddefinitions withas constfor literal type preservation. - Modified the
WalletButtonand related props to useWalletId. - Refactored
argentWallet,wigwamWallet,tahoWallet, and others to align with new type definitions. - Enhanced the mapping of wallet connectors to ensure consistent typing across the board.
The following files were skipped due to too many changes:
packages/rainbowkit/src/wallets/walletConnectors/oktoWallet/oktoWallet.ts,packages/rainbowkit/src/wallets/walletConnectors/omniWallet/omniWallet.ts,packages/rainbowkit/src/wallets/walletConnectors/oneInchWallet/oneInchWallet.ts,packages/rainbowkit/src/wallets/walletConnectors/kresusWallet/kresusWallet.ts,packages/rainbowkit/src/wallets/walletConnectors/bestWallet/bestWallet.ts,packages/rainbowkit/src/wallets/walletConnectors/readyWallet/readyWallet.ts,packages/rainbowkit/src/wallets/walletConnectors/bitverseWallet/bitverseWallet.ts,packages/rainbowkit/src/wallets/walletConnectors/talismanWallet/talismanWallet.ts,packages/rainbowkit/src/wallets/walletConnectors/iopayWallet/iopayWallet.ts,packages/rainbowkit/src/wallets/walletConnectors/imTokenWallet/imTokenWallet.ts,packages/rainbowkit/src/wallets/walletConnectors/ledgerWallet/ledgerWallet.ts
✨ Ask PR-Codex anything about this PR by commenting with
/codex {your question}
⚠️ No Changeset found
Latest commit: eac8f7ff52590b3a95a3ed381bed4e9c4dab5f62
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| rainbowkit-example | Dec 7, 2025 8:17am | |||
| rainbowkit-site | Preview | Comment | Dec 7, 2025 8:17am |
-
#2589
-
#2588
👈 (View in Graphite)
-
#2590
-
main
This stack of pull requests is managed by Graphite. Learn more about stacking.