diff --git a/packages/example/src/pages/index.tsx b/packages/example/src/pages/index.tsx index 6d2c0b1d4a..24e4c02b9a 100644 --- a/packages/example/src/pages/index.tsx +++ b/packages/example/src/pages/index.tsx @@ -241,9 +241,11 @@ const Example = ({ authEnabled }: AppContextProps) => { gap: '20px', }} > - {['rainbow', 'metamask', 'baseAccount'].map((connector) => { - return ; - })} + {(['rainbow', 'metaMask', 'baseAccount'] as const).map( + (connector) => { + return ; + }, + )} diff --git a/packages/rainbowkit/build.js b/packages/rainbowkit/build.js index fb82b15ed8..d2cdb09756 100644 --- a/packages/rainbowkit/build.js +++ b/packages/rainbowkit/build.js @@ -133,16 +133,28 @@ const walletsBuildOptions = { outdir: 'dist/wallets/walletConnectors', }; +const componentsBuildOptions = { + ...baseBuildConfig((result) => { + if (result.errors.length) { + console.error('❌ components build failed', result.errors); + } else console.log('✅ components build succeeded'); + }), + entryPoints: await getAllEntryPoints('src/components'), + outdir: 'dist/components', +}; + const build = async () => { // Build and watch for new changes if --watch flag is passed if (isWatching) { - const [mainContext, walletsContext] = await Promise.all([ + const [mainContext, walletsContext, componentsContext] = await Promise.all([ esbuild.context(mainBuildOptions), esbuild.context(walletsBuildOptions), + esbuild.context(componentsBuildOptions), ]); await mainContext.watch(); await walletsContext.watch(); + await componentsContext.watch(); return; } @@ -150,6 +162,7 @@ const build = async () => { await Promise.all([ esbuild.build(mainBuildOptions), esbuild.build(walletsBuildOptions), + esbuild.build(componentsBuildOptions), ]); }; diff --git a/packages/rainbowkit/components/package.json b/packages/rainbowkit/components/package.json new file mode 100644 index 0000000000..e9432561fb --- /dev/null +++ b/packages/rainbowkit/components/package.json @@ -0,0 +1,3 @@ +{ + "main": "../dist/components/index.js" +} diff --git a/packages/rainbowkit/package.json b/packages/rainbowkit/package.json index 36a4264a80..353d7e2f35 100644 --- a/packages/rainbowkit/package.json +++ b/packages/rainbowkit/package.json @@ -5,13 +5,15 @@ "files": [ "dist", "styles.css", - "wallets" + "wallets", + "components" ], "type": "module", "exports": { ".": "./dist/index.js", "./styles.css": "./dist/index.css", - "./wallets": "./dist/wallets/walletConnectors/index.js" + "./wallets": "./dist/wallets/walletConnectors/index.js", + "./components": "./dist/components/index.js" }, "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/rainbowkit/src/components/Avatar/Avatar.tsx b/packages/rainbowkit/src/components/Avatar/Avatar.tsx index c9d82f1aed..30738ff3ed 100644 --- a/packages/rainbowkit/src/components/Avatar/Avatar.tsx +++ b/packages/rainbowkit/src/components/Avatar/Avatar.tsx @@ -3,12 +3,12 @@ import { Box } from '../Box/Box'; import { SpinnerIcon } from '../Icons/Spinner'; import { AvatarContext } from '../RainbowKitProvider/AvatarContext'; -interface AvatarProps { +export type AvatarProps = { address: string; loading?: boolean; imageUrl?: string | null; size: number; -} +}; export function Avatar({ address, imageUrl, loading, size }: AvatarProps) { const AvatarComponent = useContext(AvatarContext); diff --git a/packages/rainbowkit/src/components/WalletButton/WalletButton.tsx b/packages/rainbowkit/src/components/WalletButton/WalletButton.tsx index cf94e43995..79107e5673 100644 --- a/packages/rainbowkit/src/components/WalletButton/WalletButton.tsx +++ b/packages/rainbowkit/src/components/WalletButton/WalletButton.tsx @@ -5,9 +5,13 @@ import { Box } from '../Box/Box'; import { SpinnerIcon } from '../Icons/Spinner'; import { I18nContext } from '../RainbowKitProvider/I18nContext'; import * as styles from './WalletButton.css'; -import { WalletButtonRenderer } from './WalletButtonRenderer'; +import { WalletButtonRenderer, type WalletId } from './WalletButtonRenderer'; -export const WalletButton = ({ wallet }: { wallet?: string }) => { +export interface WalletButtonProps { + wallet?: WalletId; +} + +export const WalletButton = ({ wallet }: WalletButtonProps) => { return ( {({ ready, connect, connected, mounted, connector, loading }) => { diff --git a/packages/rainbowkit/src/components/WalletButton/WalletButtonRenderer.tsx b/packages/rainbowkit/src/components/WalletButton/WalletButtonRenderer.tsx index a127af839a..c1444ca27d 100644 --- a/packages/rainbowkit/src/components/WalletButton/WalletButtonRenderer.tsx +++ b/packages/rainbowkit/src/components/WalletButton/WalletButtonRenderer.tsx @@ -23,9 +23,13 @@ import { useModalState, } from '../RainbowKitProvider/ModalContext'; import { WalletButtonContext } from '../RainbowKitProvider/WalletButtonContext'; +import type * as walletConnectors from '../../wallets/walletConnectors'; + +type WalletFactories = typeof walletConnectors; +export type WalletId = ReturnType['id']; export interface WalletButtonRendererProps { - wallet?: string; + wallet?: WalletId; children: (renderProps: { error: boolean; loading: boolean; diff --git a/packages/rainbowkit/src/components/index.ts b/packages/rainbowkit/src/components/index.ts index fee89786b2..813d484549 100644 --- a/packages/rainbowkit/src/components/index.ts +++ b/packages/rainbowkit/src/components/index.ts @@ -1,3 +1,29 @@ +// ============================ Button Components ============================ +// Main connect button with wallet connection flow export { ConnectButton } from './ConnectButton/ConnectButton'; +export type { ConnectButtonProps } from './ConnectButton/ConnectButton'; + +// Individual wallet button for specific wallet connections export { WalletButton } from './WalletButton/WalletButton'; -export { RainbowKitProvider } from './RainbowKitProvider/RainbowKitProvider'; +export type { WalletButtonProps } from './WalletButton/WalletButton'; + +// ============================ Avatar Components ============================ +// Main Avatar component that displays user avatars with optional loading states +export { Avatar } from './Avatar/Avatar'; +export type { AvatarProps } from './Avatar/Avatar'; + +// Default emoji-based avatar implementation +export { EmojiAvatar } from './Avatar/EmojiAvatar'; +export type { AvatarComponentProps as EmojiAvatarProps } from './RainbowKitProvider/AvatarContext'; + +// Utility function to generate emoji avatars based on wallet addresses +export { emojiAvatarForAddress } from './Avatar/emojiAvatarForAddress'; + +// ============================ Modal Components ============================ +// Modal for displaying account details, balance, and disconnect functionality +export { AccountModal } from './AccountModal/AccountModal'; +export type { AccountModalProps } from './AccountModal/AccountModal'; + +// Modal for switching between different chains +export { ChainModal } from './ChainModal/ChainModal'; +export type { ChainModalProps } from './ChainModal/ChainModal'; diff --git a/packages/rainbowkit/src/wallets/Wallet.ts b/packages/rainbowkit/src/wallets/Wallet.ts index 02e4071cf1..36db1207c5 100644 --- a/packages/rainbowkit/src/wallets/Wallet.ts +++ b/packages/rainbowkit/src/wallets/Wallet.ts @@ -1,6 +1,5 @@ import type { Connector, CreateConnectorFn } from 'wagmi'; import type { WalletConnectParameters } from 'wagmi/connectors'; -import type { CoinbaseWalletOptions } from './walletConnectors/coinbaseWallet/coinbaseWallet'; import type { WalletConnectWalletOptions } from './walletConnectors/walletConnectWallet/walletConnectWallet'; export type InstructionStepName = @@ -77,6 +76,18 @@ export type Wallet = { createConnector: (walletDetails: WalletDetailsParams) => CreateConnectorFn; } & RainbowKitConnector; +/** + * Generic helper type for wallet factory functions that preserves literal ID types. + * + * @remarks + * - The `as const` assertion on the `id` field is REQUIRED for literal type preservation + * - Without it, TypeScript infers `id: string` instead of `id: 'literal'` + * - The `satisfies Wallet` validates the implementation conforms to the Wallet interface + */ +export type WalletFactory = Opts extends void + ? () => Wallet & { id: ID } + : (options: Opts) => Wallet & { id: ID }; + export interface DefaultWalletOptions { projectId: string; walletConnectParameters?: RainbowKitWalletConnectParameters; @@ -84,10 +95,14 @@ export interface DefaultWalletOptions { export type CreateWalletFn = ( // These parameters will be used when creating a wallet. If injected - // wallet doesn't have parameters it will just ignore these passed in parameters - createWalletParams: CoinbaseWalletOptions & - Omit & - DefaultWalletOptions, + // wallet doesn't have parameters it will just ignore these passed in parameters. + // Note: appName and appIcon are required by certain wallets (baseAccount, + // coinbaseWallet, geminiWallet) that need app metadata for their connectors. + createWalletParams: Omit & + DefaultWalletOptions & { + appName: string; + appIcon?: string; + }, ) => Wallet; export type WalletList = { diff --git a/packages/rainbowkit/src/wallets/walletConnectors/ZilPayWallet/zilPayWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/ZilPayWallet/zilPayWallet.ts index d9ac89fca5..ea380e468a 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/ZilPayWallet/zilPayWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/ZilPayWallet/zilPayWallet.ts @@ -10,12 +10,12 @@ export type ZilPayWalletOptions = DefaultWalletOptions; export const zilPayWallet = ({ projectId, walletConnectParameters, -}: ZilPayWalletOptions): Wallet => { +}: ZilPayWalletOptions) => { const isZilPayInjected = hasInjectedProvider({ flag: 'isZilPay' }); const shouldUseWalletConnect = !isZilPayInjected; return { - id: 'zilpay', + id: 'zilpay' as const, name: 'ZilPay', rdns: 'io.zilpay', iconUrl: async () => (await import('./zilPayWallet.svg')).default, @@ -69,5 +69,5 @@ export const zilPayWallet = ({ : getInjectedConnector({ flag: 'isZilPay', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/argentWallet/argentWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/argentWallet/argentWallet.ts index da6a3bf2ac..d2346ffc65 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/argentWallet/argentWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/argentWallet/argentWallet.ts @@ -9,11 +9,11 @@ export type ArgentWalletOptions = ReadyWalletOptions; /** * @deprecated Use {@link readyWallet} instead. */ -export const argentWallet = (options: ArgentWalletOptions): Wallet => { +export const argentWallet = (options: ArgentWalletOptions) => { const wallet = readyWallet(options); return { ...wallet, - id: 'argent', - }; + id: 'argent' as const, + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/backpackWallet/backpackWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/backpackWallet/backpackWallet.ts index f84102c678..cf57ae6eae 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/backpackWallet/backpackWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/backpackWallet/backpackWallet.ts @@ -4,9 +4,9 @@ import { } from '../../getInjectedConnector'; import type { Wallet } from '../../Wallet'; -export const backpackWallet = (): Wallet => { +export const backpackWallet = () => { return { - id: 'backpack', + id: 'backpack' as const, name: 'Backpack', rdns: 'app.backpack.mobile', iconUrl: async () => (await import('./backpackWallet.svg')).default, @@ -48,5 +48,5 @@ export const backpackWallet = (): Wallet => { }, }, createConnector: getInjectedConnector({ namespace: 'backpack.ethereum' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/baseAccount/baseAccount.ts b/packages/rainbowkit/src/wallets/walletConnectors/baseAccount/baseAccount.ts index bbc2441d2d..d9ddcf0b7b 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/baseAccount/baseAccount.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/baseAccount/baseAccount.ts @@ -3,26 +3,22 @@ import { type BaseAccountParameters, baseAccount as baseAccountConnector, } from 'wagmi/connectors'; -import type { Wallet, WalletDetailsParams } from '../../Wallet'; +import type { Wallet, WalletDetailsParams, WalletFactory } from '../../Wallet'; -export interface BaseAccountOptions { +// supports preference, paymasterUrls, subAccounts +export interface BaseAccountOptions + extends Omit { appName: string; appIcon?: string; } -// supports preference, paymasterUrls, subAccounts -type AcceptedBaseAccountParameters = Omit< - BaseAccountParameters, - 'appName' | 'appLogoUrl' ->; - -interface BaseAccount extends AcceptedBaseAccountParameters { - (params: BaseAccountOptions): Wallet; -} - -export const baseAccount: BaseAccount = ({ appName, appIcon }) => { +export const baseAccount: WalletFactory = ({ + appName, + appIcon, + ...optionalConfig +}) => { return { - id: 'baseAccount', + id: 'baseAccount' as const, name: 'Base Account', shortName: 'Base Account', rdns: 'app.base.account', @@ -32,11 +28,6 @@ export const baseAccount: BaseAccount = ({ appName, appIcon }) => { // a popup will appear prompting the user to connect or create a wallet via passkey. installed: true, createConnector: (walletDetails: WalletDetailsParams) => { - // Extract all AcceptedBaseAccountParameters from baseAccount - // This approach avoids type errors for properties not yet in upstream connector - const { ...optionalConfig }: AcceptedBaseAccountParameters = - baseAccount as any; - const connector: CreateConnectorFn = baseAccountConnector({ appName, appLogoUrl: appIcon, @@ -48,5 +39,5 @@ export const baseAccount: BaseAccount = ({ appName, appIcon }) => { ...walletDetails, })); }, - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/berasigWallet/berasigWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/berasigWallet/berasigWallet.ts index 85f848b7d3..570020e0ef 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/berasigWallet/berasigWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/berasigWallet/berasigWallet.ts @@ -10,14 +10,14 @@ export type BerasigWalletOptions = DefaultWalletOptions; export const berasigWallet = ({ projectId, walletConnectParameters, -}: BerasigWalletOptions): Wallet => { +}: BerasigWalletOptions) => { const isBerasigWalletInjected = hasInjectedProvider({ namespace: 'berasig.ethereum', }); const shouldUseWalletConnect = !isBerasigWalletInjected; return { - id: 'berasig', + id: 'berasig' as const, name: 'BeraSig', rdns: 'app.berasig', iconUrl: async () => (await import('./berasigWallet.svg')).default, @@ -64,5 +64,5 @@ export const berasigWallet = ({ : getInjectedConnector({ namespace: 'berasig.ethereum', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/bestWallet/bestWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/bestWallet/bestWallet.ts index a1dadca29a..0aaa6b3f4b 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/bestWallet/bestWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/bestWallet/bestWallet.ts @@ -7,49 +7,50 @@ export type BestWalletOptions = DefaultWalletOptions; export const bestWallet = ({ projectId, walletConnectParameters, -}: BestWalletOptions): Wallet => ({ - id: 'bestWallet', - name: 'Best Wallet', - iconUrl: async () => (await import('./bestWallet.svg')).default, - iconBackground: '#5961FF', - downloadUrls: { - android: 'https://best.sng.link/Dnio2/rto7?_smtype=3', - ios: 'https://best.sng.link/Dnio2/rto7?_smtype=3', - mobile: 'https://best.sng.link/Dnio2/rto7?_smtype=3', - qrCode: 'https://best.sng.link/Dnio2/rto7?_smtype=3', - }, +}: BestWalletOptions) => + ({ + id: 'bestWallet' as const, + name: 'Best Wallet', + iconUrl: async () => (await import('./bestWallet.svg')).default, + iconBackground: '#5961FF', + downloadUrls: { + android: 'https://best.sng.link/Dnio2/rto7?_smtype=3', + ios: 'https://best.sng.link/Dnio2/rto7?_smtype=3', + mobile: 'https://best.sng.link/Dnio2/rto7?_smtype=3', + qrCode: 'https://best.sng.link/Dnio2/rto7?_smtype=3', + }, - mobile: { - getUri: (uri: string) => { - return `bw://connect/wc?uri=${encodeURIComponent(uri)}`; + mobile: { + getUri: (uri: string) => { + return `bw://connect/wc?uri=${encodeURIComponent(uri)}`; + }, }, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://best.sng.link/Dnio2/rto7?_smtype=3', - steps: [ - { - description: 'wallet_connectors.best.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.best.qr_code.step1.title', - }, - { - description: 'wallet_connectors.best.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.best.qr_code.step2.title', - }, - { - description: 'wallet_connectors.best.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.best.qr_code.step3.title', - }, - ], + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://best.sng.link/Dnio2/rto7?_smtype=3', + steps: [ + { + description: 'wallet_connectors.best.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.best.qr_code.step1.title', + }, + { + description: 'wallet_connectors.best.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.best.qr_code.step2.title', + }, + { + description: 'wallet_connectors.best.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.best.qr_code.step3.title', + }, + ], + }, }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/bifrostWallet/bifrostWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/bifrostWallet/bifrostWallet.ts index a37008b3ad..ac61b26d60 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/bifrostWallet/bifrostWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/bifrostWallet/bifrostWallet.ts @@ -12,7 +12,7 @@ export type BifrostWalletOptions = DefaultWalletOptions; export const bifrostWallet = ({ projectId, walletConnectParameters, -}: BifrostWalletOptions): Wallet => { +}: BifrostWalletOptions) => { const isBifrostInjected = hasInjectedProvider({ flag: 'isBifrost' }); const shouldUseWalletConnect = !isBifrostInjected; @@ -24,7 +24,7 @@ export const bifrostWallet = ({ }; return { - id: 'bifrostWallet', + id: 'bifrostWallet' as const, name: 'Bifrost Wallet', rdns: 'com.bifrostwallet', iconUrl: async () => (await import('./bifrostWallet.svg')).default, @@ -77,5 +77,5 @@ export const bifrostWallet = ({ : getInjectedConnector({ flag: 'isBifrost', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/binanceWallet/binanceWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/binanceWallet/binanceWallet.ts index c4d0ef1437..96edbe77c2 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/binanceWallet/binanceWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/binanceWallet/binanceWallet.ts @@ -11,7 +11,7 @@ export type BinanceWalletOptions = DefaultWalletOptions; export const binanceWallet = ({ projectId, walletConnectParameters, -}: BinanceWalletOptions): Wallet => { +}: BinanceWalletOptions) => { const isBinanceInjected = hasInjectedProvider({ namespace: 'binancew3w.isExtension', flag: 'isBinance', @@ -19,7 +19,7 @@ export const binanceWallet = ({ const shouldUseWalletConnect = !isBinanceInjected; return { - id: 'binance', + id: 'binance' as const, name: 'Binance Wallet', rdns: 'com.binance.wallet', iconUrl: async () => (await import('./binanceWallet.svg')).default, @@ -80,5 +80,5 @@ export const binanceWallet = ({ : getInjectedConnector({ flag: 'isBinance', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/bitgetWallet/bitgetWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/bitgetWallet/bitgetWallet.ts index 134810ad62..7584f16916 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/bitgetWallet/bitgetWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/bitgetWallet/bitgetWallet.ts @@ -11,7 +11,7 @@ export type BitgetWalletOptions = DefaultWalletOptions; export const bitgetWallet = ({ projectId, walletConnectParameters, -}: BitgetWalletOptions): Wallet => { +}: BitgetWalletOptions) => { const isBitKeepInjected = hasInjectedProvider({ namespace: 'bitkeep.ethereum', flag: 'isBitKeep', @@ -19,7 +19,7 @@ export const bitgetWallet = ({ const shouldUseWalletConnect = !isBitKeepInjected; return { - id: 'bitget', + id: 'bitget' as const, name: 'Bitget Wallet', rdns: 'com.bitget.web3', iconUrl: async () => (await import('./bitgetWallet.svg')).default, @@ -106,5 +106,5 @@ export const bitgetWallet = ({ namespace: 'bitkeep.ethereum', flag: 'isBitKeep', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/bitskiWallet/bitskiWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/bitskiWallet/bitskiWallet.ts index 58fb59b595..7ad5ecdbb8 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/bitskiWallet/bitskiWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/bitskiWallet/bitskiWallet.ts @@ -4,39 +4,40 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const bitskiWallet = (): Wallet => ({ - id: 'bitski', - name: 'Bitski', - installed: hasInjectedProvider({ flag: 'isBitski' }), - iconUrl: async () => (await import('./bitskiWallet.svg')).default, - iconBackground: '#fff', - downloadUrls: { - chrome: - 'https://chrome.google.com/webstore/detail/bitski/feejiigddaafeojfddjjlmfkabimkell', - browserExtension: 'https://bitski.com', - }, - extension: { - instructions: { - learnMoreUrl: - 'https://bitski.zendesk.com/hc/articles/12803972818836-How-to-install-the-Bitski-browser-extension', - steps: [ - { - description: 'wallet_connectors.bitski.extension.step1.description', - step: 'install', - title: 'wallet_connectors.bitski.extension.step1.title', - }, - { - description: 'wallet_connectors.bitski.extension.step2.description', - step: 'create', - title: 'wallet_connectors.bitski.extension.step2.title', - }, - { - description: 'wallet_connectors.bitski.extension.step3.description', - step: 'refresh', - title: 'wallet_connectors.bitski.extension.step3.title', - }, - ], +export const bitskiWallet = () => + ({ + id: 'bitski' as const, + name: 'Bitski', + installed: hasInjectedProvider({ flag: 'isBitski' }), + iconUrl: async () => (await import('./bitskiWallet.svg')).default, + iconBackground: '#fff', + downloadUrls: { + chrome: + 'https://chrome.google.com/webstore/detail/bitski/feejiigddaafeojfddjjlmfkabimkell', + browserExtension: 'https://bitski.com', }, - }, - createConnector: getInjectedConnector({ flag: 'isBitski' }), -}); + extension: { + instructions: { + learnMoreUrl: + 'https://bitski.zendesk.com/hc/articles/12803972818836-How-to-install-the-Bitski-browser-extension', + steps: [ + { + description: 'wallet_connectors.bitski.extension.step1.description', + step: 'install', + title: 'wallet_connectors.bitski.extension.step1.title', + }, + { + description: 'wallet_connectors.bitski.extension.step2.description', + step: 'create', + title: 'wallet_connectors.bitski.extension.step2.title', + }, + { + description: 'wallet_connectors.bitski.extension.step3.description', + step: 'refresh', + title: 'wallet_connectors.bitski.extension.step3.title', + }, + ], + }, + }, + createConnector: getInjectedConnector({ flag: 'isBitski' }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/bitverseWallet/bitverseWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/bitverseWallet/bitverseWallet.ts index 3b2ffb8f49..848305d226 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/bitverseWallet/bitverseWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/bitverseWallet/bitverseWallet.ts @@ -6,46 +6,47 @@ export type BitverseWalletOptions = DefaultWalletOptions; export const bitverseWallet = ({ projectId, walletConnectParameters, -}: BitverseWalletOptions): Wallet => ({ - id: 'bitverse', - name: 'Bitverse Wallet', - iconUrl: async () => (await import('./bitverseWallet.svg')).default, - iconBackground: '#171728', - downloadUrls: { - android: - 'https://play.google.com/store/apps/details?id=com.bitverse.app&pli=1', - ios: 'https://apps.apple.com/us/app/bitverse-discover-web3-wealth/id1645515614', - qrCode: 'https://www.bitverse.zone/download', - }, - mobile: { - getUri: (uri: string) => - `bitverseapp://open/wallet/wc?uri=${encodeURIComponent(uri)}`, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://www.bitverse.zone', - steps: [ - { - description: 'wallet_connectors.bitverse.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.bitverse.qr_code.step1.title', - }, - { - description: 'wallet_connectors.bitverse.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.bitverse.qr_code.step2.title', - }, - { - description: 'wallet_connectors.bitverse.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.bitverse.qr_code.step3.title', - }, - ], +}: BitverseWalletOptions) => + ({ + id: 'bitverse' as const, + name: 'Bitverse Wallet', + iconUrl: async () => (await import('./bitverseWallet.svg')).default, + iconBackground: '#171728', + downloadUrls: { + android: + 'https://play.google.com/store/apps/details?id=com.bitverse.app&pli=1', + ios: 'https://apps.apple.com/us/app/bitverse-discover-web3-wealth/id1645515614', + qrCode: 'https://www.bitverse.zone/download', }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + mobile: { + getUri: (uri: string) => + `bitverseapp://open/wallet/wc?uri=${encodeURIComponent(uri)}`, + }, + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://www.bitverse.zone', + steps: [ + { + description: 'wallet_connectors.bitverse.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.bitverse.qr_code.step1.title', + }, + { + description: 'wallet_connectors.bitverse.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.bitverse.qr_code.step2.title', + }, + { + description: 'wallet_connectors.bitverse.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.bitverse.qr_code.step3.title', + }, + ], + }, + }, + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/bloomWallet/bloomWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/bloomWallet/bloomWallet.ts index 137beb1268..2deae785e2 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/bloomWallet/bloomWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/bloomWallet/bloomWallet.ts @@ -4,41 +4,42 @@ import { getWalletConnectConnector } from '../../getWalletConnectConnector'; export const bloomWallet = ({ projectId, walletConnectParameters, -}: DefaultWalletOptions): Wallet => ({ - id: 'bloom', - name: 'Bloom Wallet', - iconBackground: '#000', - iconAccent: '#000', - iconUrl: async () => (await import('./bloomWallet.svg')).default, - downloadUrls: { - desktop: 'https://bloomwallet.io/', - }, - desktop: { - getUri: (uri: string) => - `bloom://wallet-connect/wc?uri=${encodeURIComponent(uri)}`, - instructions: { - learnMoreUrl: 'https://bloomwallet.io/', - steps: [ - { - description: 'wallet_connectors.bloom.desktop.step1.description', - step: 'install', - title: 'wallet_connectors.bloom.desktop.step1.title', - }, - { - description: 'wallet_connectors.bloom.desktop.step2.description', - step: 'create', - title: 'wallet_connectors.bloom.desktop.step2.title', - }, - { - description: 'wallet_connectors.bloom.desktop.step3.description', - step: 'refresh', - title: 'wallet_connectors.bloom.desktop.step3.title', - }, - ], +}: DefaultWalletOptions) => + ({ + id: 'bloom' as const, + name: 'Bloom Wallet', + iconBackground: '#000', + iconAccent: '#000', + iconUrl: async () => (await import('./bloomWallet.svg')).default, + downloadUrls: { + desktop: 'https://bloomwallet.io/', }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + desktop: { + getUri: (uri: string) => + `bloom://wallet-connect/wc?uri=${encodeURIComponent(uri)}`, + instructions: { + learnMoreUrl: 'https://bloomwallet.io/', + steps: [ + { + description: 'wallet_connectors.bloom.desktop.step1.description', + step: 'install', + title: 'wallet_connectors.bloom.desktop.step1.title', + }, + { + description: 'wallet_connectors.bloom.desktop.step2.description', + step: 'create', + title: 'wallet_connectors.bloom.desktop.step2.title', + }, + { + description: 'wallet_connectors.bloom.desktop.step3.description', + step: 'refresh', + title: 'wallet_connectors.bloom.desktop.step3.title', + }, + ], + }, + }, + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/braveWallet/braveWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/braveWallet/braveWallet.ts index 08f85ce70e..d22c55cb60 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/braveWallet/braveWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/braveWallet/braveWallet.ts @@ -4,18 +4,19 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const braveWallet = (): Wallet => ({ - id: 'brave', - name: 'Brave Wallet', - rdns: 'com.brave.wallet', - iconUrl: async () => (await import('./braveWallet.svg')).default, - iconBackground: '#fff', - installed: hasInjectedProvider({ flag: 'isBraveWallet' }), - downloadUrls: { - // We're opting not to provide a download prompt if Brave isn't the current - // browser since it's unlikely to be a desired behavior for users. It's - // more of a convenience for users who are already using Brave rather than - // an explicit wallet choice for users coming from other browsers. - }, - createConnector: getInjectedConnector({ flag: 'isBraveWallet' }), -}); +export const braveWallet = () => + ({ + id: 'brave' as const, + name: 'Brave Wallet', + rdns: 'com.brave.wallet', + iconUrl: async () => (await import('./braveWallet.svg')).default, + iconBackground: '#fff', + installed: hasInjectedProvider({ flag: 'isBraveWallet' }), + downloadUrls: { + // We're opting not to provide a download prompt if Brave isn't the current + // browser since it's unlikely to be a desired behavior for users. It's + // more of a convenience for users who are already using Brave rather than + // an explicit wallet choice for users coming from other browsers. + }, + createConnector: getInjectedConnector({ flag: 'isBraveWallet' }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/bybitWallet/bybitWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/bybitWallet/bybitWallet.ts index e542f13a2f..2076a644a7 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/bybitWallet/bybitWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/bybitWallet/bybitWallet.ts @@ -10,7 +10,7 @@ export type BifrostWalletOptions = DefaultWalletOptions; export const bybitWallet = ({ projectId, walletConnectParameters, -}: BifrostWalletOptions): Wallet => { +}: BifrostWalletOptions) => { const isBybitInjected = hasInjectedProvider({ namespace: 'bybitWallet', }); @@ -24,7 +24,7 @@ export const bybitWallet = ({ }; return { - id: 'bybit', + id: 'bybit' as const, name: 'Bybit Wallet', rdns: 'com.bybit', iconUrl: async () => (await import('./bybitWallet.svg')).default, @@ -100,5 +100,5 @@ export const bybitWallet = ({ : getInjectedConnector({ namespace: 'bybitWallet', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/clvWallet/clvWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/clvWallet/clvWallet.ts index 5f970de821..049dbb5a8f 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/clvWallet/clvWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/clvWallet/clvWallet.ts @@ -10,12 +10,12 @@ export type CLVWalletOptions = DefaultWalletOptions; export const clvWallet = ({ projectId, walletConnectParameters, -}: CLVWalletOptions): Wallet => { +}: CLVWalletOptions) => { const isCLVInjected = hasInjectedProvider({ namespace: 'clover' }); const shouldUseWalletConnect = !isCLVInjected; return { - id: 'clv', + id: 'clv' as const, name: 'CLV', iconUrl: async () => (await import('./clvWallet.svg')).default, iconBackground: '#fff', @@ -84,5 +84,5 @@ export const clvWallet = ({ walletConnectParameters, }) : getInjectedConnector({ namespace: 'clover' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/coin98Wallet/coin98Wallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/coin98Wallet/coin98Wallet.ts index 805a3f1526..b2a868712b 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/coin98Wallet/coin98Wallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/coin98Wallet/coin98Wallet.ts @@ -10,7 +10,7 @@ export type Coin98WalletOptions = DefaultWalletOptions; export const coin98Wallet = ({ projectId, walletConnectParameters, -}: Coin98WalletOptions): Wallet => { +}: Coin98WalletOptions) => { const isCoin98WalletInjected = hasInjectedProvider({ namespace: 'coin98.provider', flag: 'isCoin98', @@ -18,7 +18,7 @@ export const coin98Wallet = ({ const shouldUseWalletConnect = !isCoin98WalletInjected; return { - id: 'coin98', + id: 'coin98' as const, name: 'Coin98 Wallet', iconUrl: async () => (await import('./coin98Wallet.svg')).default, installed: !shouldUseWalletConnect ? isCoin98WalletInjected : undefined, @@ -97,5 +97,5 @@ export const coin98Wallet = ({ namespace: 'coin98Wallet', flag: 'isCoin98', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/coinbaseWallet/coinbaseWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/coinbaseWallet/coinbaseWallet.ts index c979de2182..febe15731a 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/coinbaseWallet/coinbaseWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/coinbaseWallet/coinbaseWallet.ts @@ -4,32 +4,30 @@ import { coinbaseWallet as coinbaseConnector, } from 'wagmi/connectors'; import { isIOS } from '../../../utils/isMobile'; -import type { Wallet, WalletDetailsParams } from '../../Wallet'; +import type { Wallet, WalletDetailsParams, WalletFactory } from '../../Wallet'; -export interface CoinbaseWalletOptions { +// supports preference, paymasterUrls, subAccounts +export interface CoinbaseWalletOptions + extends Omit< + CoinbaseWalletParameters<'4'>, + 'headlessMode' | 'version' | 'appName' | 'appLogoUrl' + > { appName: string; appIcon?: string; } -// supports preference, paymasterUrls, subAccounts -type AcceptedCoinbaseWalletParameters = Omit< - CoinbaseWalletParameters<'4'>, - 'headlessMode' | 'version' | 'appName' | 'appLogoUrl' ->; - -interface CoinbaseWallet extends AcceptedCoinbaseWalletParameters { - (params: CoinbaseWalletOptions): Wallet; -} - /** * @deprecated Use `baseAccount` instead. This wallet connector will be removed in a future version. */ -export const coinbaseWallet: CoinbaseWallet = ({ appName, appIcon }) => { +export const coinbaseWallet: WalletFactory< + CoinbaseWalletOptions, + 'coinbase' +> = ({ appName, appIcon, ...optionalConfig }) => { const getUri = (uri: string) => uri; const ios = isIOS(); return { - id: 'coinbase', + id: 'coinbase' as const, name: 'Coinbase Wallet', shortName: 'Coinbase', rdns: 'com.coinbase.wallet', @@ -107,11 +105,6 @@ export const coinbaseWallet: CoinbaseWallet = ({ appName, appIcon }) => { }, }), createConnector: (walletDetails: WalletDetailsParams) => { - // Extract all AcceptedCoinbaseWalletParameters from coinbaseWallet - // This approach avoids type errors for properties not yet in upstream connector - const { ...optionalConfig }: AcceptedCoinbaseWalletParameters = - coinbaseWallet as any; - const connector: CreateConnectorFn = coinbaseConnector({ appName, appLogoUrl: appIcon, @@ -123,5 +116,5 @@ export const coinbaseWallet: CoinbaseWallet = ({ appName, appIcon }) => { ...walletDetails, })); }, - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/compassWallet/compassWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/compassWallet/compassWallet.ts index 86a281325e..7c1b880ecc 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/compassWallet/compassWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/compassWallet/compassWallet.ts @@ -4,11 +4,11 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const compassWallet = (): Wallet => { +export const compassWallet = () => { const isCompassInjected = hasInjectedProvider({ namespace: 'compassEvm' }); return { - id: 'compass', + id: 'compass' as const, name: 'Compass Wallet', installed: isCompassInjected, rdns: 'io.leapwallet.CompassWallet', @@ -45,5 +45,5 @@ export const compassWallet = (): Wallet => { }, }, createConnector: getInjectedConnector({ namespace: 'compassEvm' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/coreWallet/coreWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/coreWallet/coreWallet.ts index 82e8925fec..5490e3c6ac 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/coreWallet/coreWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/coreWallet/coreWallet.ts @@ -10,14 +10,14 @@ export type CoreWalletOptions = DefaultWalletOptions; export const coreWallet = ({ projectId, walletConnectParameters, -}: CoreWalletOptions): Wallet => { +}: CoreWalletOptions) => { const isCoreInjected = hasInjectedProvider({ namespace: 'avalanche', flag: 'isAvalanche', }); const shouldUseWalletConnect = !isCoreInjected; return { - id: 'core', + id: 'core' as const, name: 'Core', rdns: 'app.core.extension', iconUrl: async () => (await import('./coreWallet.svg')).default, @@ -92,5 +92,5 @@ export const coreWallet = ({ namespace: 'avalanche', flag: 'isAvalanche', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/ctrlWallet/ctrlWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/ctrlWallet/ctrlWallet.ts index a1583cdb68..da633c9196 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/ctrlWallet/ctrlWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/ctrlWallet/ctrlWallet.ts @@ -4,9 +4,9 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const ctrlWallet = (): Wallet => { - return { - id: 'ctrl', +export const ctrlWallet = () => + ({ + id: 'ctrl' as const, name: 'CTRL Wallet', rdns: 'xyz.ctrl', installed: hasInjectedProvider({ namespace: 'ctrl.ethereum' }), @@ -39,9 +39,8 @@ export const ctrlWallet = (): Wallet => { ], }, }, - createConnector: getInjectedConnector({ namespace: 'xfi.ethereum' }), - }; -}; + createConnector: getInjectedConnector({ namespace: 'ctrl.ethereum' }), + }) satisfies Wallet; /** * @deprecated Use `ctrlWallet` instead. This wallet connector will be removed in a future version. diff --git a/packages/rainbowkit/src/wallets/walletConnectors/dawnWallet/dawnWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/dawnWallet/dawnWallet.ts index 49f4f73f03..47cdc038df 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/dawnWallet/dawnWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/dawnWallet/dawnWallet.ts @@ -5,16 +5,17 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const dawnWallet = (): Wallet => ({ - id: 'dawn', - name: 'Dawn', - iconUrl: async () => (await import('./dawnWallet.svg')).default, - iconBackground: '#000000', - installed: hasInjectedProvider({ flag: 'isDawn' }), - hidden: () => !isIOS(), - downloadUrls: { - ios: 'https://apps.apple.com/us/app/dawn-ethereum-wallet/id1673143782', - mobile: 'https://dawnwallet.xyz', - }, - createConnector: getInjectedConnector({ flag: 'isDawn' }), -}); +export const dawnWallet = () => + ({ + id: 'dawn' as const, + name: 'Dawn', + iconUrl: async () => (await import('./dawnWallet.svg')).default, + iconBackground: '#000000', + installed: hasInjectedProvider({ flag: 'isDawn' }), + hidden: () => !isIOS(), + downloadUrls: { + ios: 'https://apps.apple.com/us/app/dawn-ethereum-wallet/id1673143782', + mobile: 'https://dawnwallet.xyz', + }, + createConnector: getInjectedConnector({ flag: 'isDawn' }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/desigWallet/desigWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/desigWallet/desigWallet.ts index b7acffc91e..6e54ff5ac1 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/desigWallet/desigWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/desigWallet/desigWallet.ts @@ -4,9 +4,9 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const desigWallet = (): Wallet => { +export const desigWallet = () => { return { - id: 'desig', + id: 'desig' as const, name: 'Desig Wallet', iconUrl: async () => (await import('./desigWallet.svg')).default, iconBackground: '#ffffff', @@ -44,5 +44,5 @@ export const desigWallet = (): Wallet => { createConnector: getInjectedConnector({ namespace: 'desig.ethereum', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/enkryptWallet/enkryptWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/enkryptWallet/enkryptWallet.ts index 534aae01b3..2f54302474 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/enkryptWallet/enkryptWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/enkryptWallet/enkryptWallet.ts @@ -4,9 +4,9 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const enkryptWallet = (): Wallet => { +export const enkryptWallet = () => { return { - id: 'enkrypt', + id: 'enkrypt' as const, name: 'Enkrypt Wallet', rdns: 'com.enkrypt', installed: hasInjectedProvider({ namespace: 'enkrypt.providers.ethereum' }), @@ -50,5 +50,5 @@ export const enkryptWallet = (): Wallet => { createConnector: getInjectedConnector({ namespace: 'enkrypt.providers.ethereum', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/foxWallet/foxWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/foxWallet/foxWallet.ts index 5a8c91bdce..1d75ac062a 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/foxWallet/foxWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/foxWallet/foxWallet.ts @@ -10,14 +10,14 @@ export type FoxWalletOptions = DefaultWalletOptions; export const foxWallet = ({ projectId, walletConnectParameters, -}: FoxWalletOptions): Wallet => { +}: FoxWalletOptions) => { const isFoxInjected = hasInjectedProvider({ namespace: 'foxwallet.ethereum', }); const shouldUseWalletConnect = !isFoxInjected; return { - id: 'foxwallet', + id: 'foxwallet' as const, name: 'FoxWallet', iconUrl: async () => (await import('./foxWallet.svg')).default, iconBackground: '#fff', @@ -66,5 +66,5 @@ export const foxWallet = ({ walletConnectParameters, }) : getInjectedConnector({ namespace: 'foxwallet.ethereum' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/frameWallet/frameWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/frameWallet/frameWallet.ts index 01f17d3c01..fe612695b4 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/frameWallet/frameWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/frameWallet/frameWallet.ts @@ -4,38 +4,39 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const frameWallet = (): Wallet => ({ - id: 'frame', - name: 'Frame', - rdns: 'sh.frame', - installed: hasInjectedProvider({ flag: 'isFrame' }), - iconUrl: async () => (await import('./frameWallet.svg')).default, - iconBackground: '#121C20', - downloadUrls: { - browserExtension: 'https://frame.sh/', - }, - extension: { - instructions: { - learnMoreUrl: - 'https://docs.frame.sh/docs/Getting%20Started/Installation/', - steps: [ - { - description: 'wallet_connectors.frame.extension.step1.description', - step: 'install', - title: 'wallet_connectors.frame.extension.step1.title', - }, - { - description: 'wallet_connectors.frame.extension.step2.description', - step: 'create', - title: 'wallet_connectors.frame.extension.step2.title', - }, - { - description: 'wallet_connectors.frame.extension.step3.description', - step: 'refresh', - title: 'wallet_connectors.frame.extension.step3.title', - }, - ], +export const frameWallet = () => + ({ + id: 'frame' as const, + name: 'Frame', + rdns: 'sh.frame', + installed: hasInjectedProvider({ flag: 'isFrame' }), + iconUrl: async () => (await import('./frameWallet.svg')).default, + iconBackground: '#121C20', + downloadUrls: { + browserExtension: 'https://frame.sh/', }, - }, - createConnector: getInjectedConnector({ flag: 'isFrame' }), -}); + extension: { + instructions: { + learnMoreUrl: + 'https://docs.frame.sh/docs/Getting%20Started/Installation/', + steps: [ + { + description: 'wallet_connectors.frame.extension.step1.description', + step: 'install', + title: 'wallet_connectors.frame.extension.step1.title', + }, + { + description: 'wallet_connectors.frame.extension.step2.description', + step: 'create', + title: 'wallet_connectors.frame.extension.step2.title', + }, + { + description: 'wallet_connectors.frame.extension.step3.description', + step: 'refresh', + title: 'wallet_connectors.frame.extension.step3.title', + }, + ], + }, + }, + createConnector: getInjectedConnector({ flag: 'isFrame' }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/frontierWallet/frontierWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/frontierWallet/frontierWallet.ts index 7e2b6fc5cd..53e871e45c 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/frontierWallet/frontierWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/frontierWallet/frontierWallet.ts @@ -12,14 +12,14 @@ export type FrontierWalletOptions = DefaultWalletOptions; export const frontierWallet = ({ projectId, walletConnectParameters, -}: FrontierWalletOptions): Wallet => { +}: FrontierWalletOptions) => { const isFrontierInjected = hasInjectedProvider({ namespace: 'frontier.ethereum', flag: 'isFrontier', }); const shouldUseWalletConnect = !isFrontierInjected; return { - id: 'frontier', + id: 'frontier' as const, name: 'Frontier Wallet', rdns: 'xyz.frontier.wallet', installed: !shouldUseWalletConnect ? isFrontierInjected : undefined, @@ -108,5 +108,5 @@ export const frontierWallet = ({ namespace: 'frontier.ethereum', flag: 'isFrontier', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/gateWallet/gateWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/gateWallet/gateWallet.ts index 7e0ad2f670..4323127434 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/gateWallet/gateWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/gateWallet/gateWallet.ts @@ -11,12 +11,12 @@ export type GateWalletOptions = DefaultWalletOptions; export const gateWallet = ({ projectId, walletConnectParameters, -}: GateWalletOptions): Wallet => { +}: GateWalletOptions) => { const isGateInjected = hasInjectedProvider({ namespace: 'gatewallet' }); const shouldUseWalletConnect = !isGateInjected; return { - id: 'gate', + id: 'gate' as const, name: 'Gate Wallet', rdns: 'io.gate.wallet', iconUrl: async () => (await import('./gateWallet.svg')).default, @@ -95,5 +95,5 @@ export const gateWallet = ({ walletConnectParameters, }) : getInjectedConnector({ namespace: 'gatewallet' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/geminiWallet/geminiWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/geminiWallet/geminiWallet.ts index f6bfdd724f..1b35fe39db 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/geminiWallet/geminiWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/geminiWallet/geminiWallet.ts @@ -1,18 +1,21 @@ import { type CreateConnectorFn, createConnector } from 'wagmi'; -import { gemini } from 'wagmi/connectors'; -import type { Wallet, WalletDetailsParams } from '../../Wallet'; +import { gemini, type GeminiParameters } from 'wagmi/connectors'; +import type { Wallet, WalletDetailsParams, WalletFactory } from '../../Wallet'; -export interface GeminiWalletOptions { +type AcceptedGeminiParameters = Omit; + +export interface GeminiWalletOptions extends AcceptedGeminiParameters { appName: string; appIcon?: string; } -export const geminiWallet = ({ +export const geminiWallet: WalletFactory = ({ appName, appIcon, -}: GeminiWalletOptions): Wallet => { + ...optionalConfig +}) => { return { - id: 'gemini', + id: 'gemini' as const, name: 'Gemini Wallet', shortName: 'Gemini', rdns: 'com.gemini.wallet', @@ -78,6 +81,7 @@ export const geminiWallet = ({ name: appName, icons: appIcon ? [appIcon] : undefined, }, + ...optionalConfig, }); return createConnector((config) => ({ @@ -85,5 +89,5 @@ export const geminiWallet = ({ ...walletDetails, })); }, - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/imTokenWallet/imTokenWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/imTokenWallet/imTokenWallet.ts index 2e5e009039..857aaafad3 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/imTokenWallet/imTokenWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/imTokenWallet/imTokenWallet.ts @@ -6,51 +6,52 @@ export type ImTokenWalletOptions = DefaultWalletOptions; export const imTokenWallet = ({ projectId, walletConnectParameters, -}: ImTokenWalletOptions): Wallet => ({ - id: 'imToken', - name: 'imToken', - iconUrl: async () => (await import('./imTokenWallet.svg')).default, - iconBackground: '#098de6', - downloadUrls: { - android: 'https://play.google.com/store/apps/details?id=im.token.app', - ios: 'https://itunes.apple.com/us/app/imtoken2/id1384798940', - mobile: 'https://token.im/download', - qrCode: 'https://token.im/download', - }, - mobile: { - getUri: (uri: string) => { - return `imtokenv2://wc?uri=${encodeURIComponent(uri)}`; +}: ImTokenWalletOptions) => + ({ + id: 'imToken' as const, + name: 'imToken', + iconUrl: async () => (await import('./imTokenWallet.svg')).default, + iconBackground: '#098de6', + downloadUrls: { + android: 'https://play.google.com/store/apps/details?id=im.token.app', + ios: 'https://itunes.apple.com/us/app/imtoken2/id1384798940', + mobile: 'https://token.im/download', + qrCode: 'https://token.im/download', }, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: - typeof window !== 'undefined' && - window.navigator.language.includes('zh') - ? 'https://support.token.im/hc/zh-cn/categories/360000925393' - : 'https://support.token.im/hc/en-us/categories/360000925393', - steps: [ - { - description: 'wallet_connectors.im_token.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.im_token.qr_code.step1.title', - }, - { - description: 'wallet_connectors.im_token.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.im_token.qr_code.step2.title', - }, - { - description: 'wallet_connectors.im_token.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.im_token.qr_code.step3.title', - }, - ], + mobile: { + getUri: (uri: string) => { + return `imtokenv2://wc?uri=${encodeURIComponent(uri)}`; + }, }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: + typeof window !== 'undefined' && + window.navigator.language.includes('zh') + ? 'https://support.token.im/hc/zh-cn/categories/360000925393' + : 'https://support.token.im/hc/en-us/categories/360000925393', + steps: [ + { + description: 'wallet_connectors.im_token.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.im_token.qr_code.step1.title', + }, + { + description: 'wallet_connectors.im_token.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.im_token.qr_code.step2.title', + }, + { + description: 'wallet_connectors.im_token.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.im_token.qr_code.step3.title', + }, + ], + }, + }, + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/injectedWallet/injectedWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/injectedWallet/injectedWallet.ts index 81ed27089f..e8d78d33ea 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/injectedWallet/injectedWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/injectedWallet/injectedWallet.ts @@ -1,10 +1,11 @@ import type { Wallet } from '../../Wallet'; import { getInjectedConnector } from '../../getInjectedConnector'; -export const injectedWallet = (): Wallet => ({ - id: 'injected', - name: 'Browser Wallet', - iconUrl: async () => (await import('./injectedWallet.svg')).default, - iconBackground: '#fff', - createConnector: getInjectedConnector({}), -}); +export const injectedWallet = () => + ({ + id: 'injected' as const, + name: 'Browser Wallet', + iconUrl: async () => (await import('./injectedWallet.svg')).default, + iconBackground: '#fff', + createConnector: getInjectedConnector({}), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/iopayWallet/iopayWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/iopayWallet/iopayWallet.ts index 6dcd5d0b2d..0b249b8a92 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/iopayWallet/iopayWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/iopayWallet/iopayWallet.ts @@ -17,50 +17,51 @@ function isIoPayMobile(): boolean { export const iopayWallet = ({ projectId, walletConnectParameters, -}: IoPayWalletOptions): Wallet => ({ - id: 'iopay', - name: 'ioPay Wallet', - iconUrl: async () => (await import('./iopayWallet.svg')).default, - iconBackground: '#fff', - downloadUrls: { - android: - 'https://play.google.com/store/apps/details?id=io.iotex.iopay.gp&pli=1', - ios: 'https://apps.apple.com/us/app/iopay-multichain-crypto-wallet/id1478086371', - qrCode: 'https://iopay.me/', - browserExtension: 'https://iopay.me/', - }, - mobile: { - getUri: (uri: string) => { - return isAndroid() ? uri : `iopay://wc?uri=${encodeURIComponent(uri)}`; +}: IoPayWalletOptions) => + ({ + id: 'iopay' as const, + name: 'ioPay Wallet', + iconUrl: async () => (await import('./iopayWallet.svg')).default, + iconBackground: '#fff', + downloadUrls: { + android: + 'https://play.google.com/store/apps/details?id=io.iotex.iopay.gp&pli=1', + ios: 'https://apps.apple.com/us/app/iopay-multichain-crypto-wallet/id1478086371', + qrCode: 'https://iopay.me/', + browserExtension: 'https://iopay.me/', }, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://iopay.me/', - steps: [ - { - description: 'wallet_connectors.iopay.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.iopay.qr_code.step1.title', - }, - { - description: 'wallet_connectors.iopay.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.iopay.qr_code.step2.title', - }, - { - description: 'wallet_connectors.iopay.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.iopay.qr_code.step3.title', - }, - ], + mobile: { + getUri: (uri: string) => { + return isAndroid() ? uri : `iopay://wc?uri=${encodeURIComponent(uri)}`; + }, }, - }, - createConnector: isIoPayMobile() - ? getInjectedConnector({}) - : getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://iopay.me/', + steps: [ + { + description: 'wallet_connectors.iopay.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.iopay.qr_code.step1.title', + }, + { + description: 'wallet_connectors.iopay.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.iopay.qr_code.step2.title', + }, + { + description: 'wallet_connectors.iopay.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.iopay.qr_code.step3.title', + }, + ], + }, + }, + createConnector: isIoPayMobile() + ? getInjectedConnector({}) + : getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.ts index a1bbc98442..3ae1efac2a 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.ts @@ -10,7 +10,7 @@ export type KaiaWalletOptions = DefaultWalletOptions; export const kaiaWallet = ({ projectId, walletConnectParameters, -}: KaiaWalletOptions): Wallet => { +}: KaiaWalletOptions) => { const isKaiaWalletInjected = hasInjectedProvider({ namespace: 'klaytn', }); @@ -22,7 +22,7 @@ export const kaiaWallet = ({ }; return { - id: 'kaia', + id: 'kaia' as const, name: 'Kaia Wallet', iconUrl: async () => (await import('./kaiaWallet.svg')).default, installed: isKaiaWalletInjected || undefined, @@ -92,5 +92,5 @@ export const kaiaWallet = ({ : getInjectedConnector({ namespace: 'klaytn', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/kaikasWallet/kaikasWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/kaikasWallet/kaikasWallet.ts index 8edd9d9534..21b814db9a 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/kaikasWallet/kaikasWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/kaikasWallet/kaikasWallet.ts @@ -10,7 +10,7 @@ export type KaikasWalletOptions = DefaultWalletOptions; export const kaikasWallet = ({ projectId, walletConnectParameters, -}: KaikasWalletOptions): Wallet => { +}: KaikasWalletOptions) => { const isKaikasWalletInjected = hasInjectedProvider({ namespace: 'klaytn', }); @@ -22,7 +22,7 @@ export const kaikasWallet = ({ }; return { - id: 'kaikas', + id: 'kaikas' as const, name: 'Kaikas Wallet', iconUrl: async () => (await import('./kaikasWallet.svg')).default, installed: isKaikasWalletInjected || undefined, @@ -95,5 +95,5 @@ export const kaikasWallet = ({ : getInjectedConnector({ namespace: 'klaytn', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/krakenWallet/krakenWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/krakenWallet/krakenWallet.ts index 21f062b97e..4f6cdfe5c8 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/krakenWallet/krakenWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/krakenWallet/krakenWallet.ts @@ -7,48 +7,49 @@ export type KrakenWalletOptions = DefaultWalletOptions; export const krakenWallet = ({ projectId, walletConnectParameters, -}: KrakenWalletOptions): Wallet => ({ - id: 'kraken', - name: 'Kraken Wallet', - iconUrl: async () => (await import('./krakenWallet.svg')).default, - iconBackground: '#FFD8EA', - downloadUrls: { - ios: 'https://apps.apple.com/us/app/kraken-wallet/id1626327149', - mobile: 'https://kraken.com/wallet', - qrCode: 'https://kraken.com/wallet', - }, +}: KrakenWalletOptions) => + ({ + id: 'kraken' as const, + name: 'Kraken Wallet', + iconUrl: async () => (await import('./krakenWallet.svg')).default, + iconBackground: '#FFD8EA', + downloadUrls: { + ios: 'https://apps.apple.com/us/app/kraken-wallet/id1626327149', + mobile: 'https://kraken.com/wallet', + qrCode: 'https://kraken.com/wallet', + }, - mobile: { - getUri: (uri: string) => { - return `krakenwallet://wc?uri=${encodeURIComponent(uri)}`; + mobile: { + getUri: (uri: string) => { + return `krakenwallet://wc?uri=${encodeURIComponent(uri)}`; + }, }, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://kraken.com/wallet', - steps: [ - { - description: 'wallet_connectors.kraken.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.kraken.qr_code.step1.title', - }, - { - description: 'wallet_connectors.kraken.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.kraken.qr_code.step2.title', - }, - { - description: 'wallet_connectors.kraken.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.kraken.qr_code.step3.title', - }, - ], + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://kraken.com/wallet', + steps: [ + { + description: 'wallet_connectors.kraken.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.kraken.qr_code.step1.title', + }, + { + description: 'wallet_connectors.kraken.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.kraken.qr_code.step2.title', + }, + { + description: 'wallet_connectors.kraken.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.kraken.qr_code.step3.title', + }, + ], + }, }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/kresusWallet/kresusWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/kresusWallet/kresusWallet.ts index 4d53b45e74..380c472f26 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/kresusWallet/kresusWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/kresusWallet/kresusWallet.ts @@ -6,46 +6,47 @@ export type KresusWalletOptions = DefaultWalletOptions; export const kresusWallet = ({ projectId, walletConnectParameters, -}: KresusWalletOptions): Wallet => ({ - id: 'kresus-wallet', - name: 'Kresus Wallet', - iconUrl: async () => (await import('./kresusWallet.svg')).default, - iconBackground: '#fff', - downloadUrls: { - android: - 'https://play.google.com/store/apps/details?id=com.kresus.superapp', - ios: 'https://apps.apple.com/us/app/kresus-crypto-nft-superapp/id6444355152', - qrCode: 'https://kresusconnect.kresus.com/download', - }, - mobile: { - getUri: (uri: string) => - `com.kresus.superapp://wc?uri=${encodeURIComponent(uri)}`, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://kresus.com/', - steps: [ - { - description: 'wallet_connectors.kresus.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.kresus.qr_code.step1.title', - }, - { - description: 'wallet_connectors.kresus.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.kresus.qr_code.step2.title', - }, - { - description: 'wallet_connectors.kresus.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.kresus.qr_code.step3.title', - }, - ], +}: KresusWalletOptions) => + ({ + id: 'kresus-wallet' as const, + name: 'Kresus Wallet', + iconUrl: async () => (await import('./kresusWallet.svg')).default, + iconBackground: '#fff', + downloadUrls: { + android: + 'https://play.google.com/store/apps/details?id=com.kresus.superapp', + ios: 'https://apps.apple.com/us/app/kresus-crypto-nft-superapp/id6444355152', + qrCode: 'https://kresusconnect.kresus.com/download', }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + mobile: { + getUri: (uri: string) => + `com.kresus.superapp://wc?uri=${encodeURIComponent(uri)}`, + }, + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://kresus.com/', + steps: [ + { + description: 'wallet_connectors.kresus.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.kresus.qr_code.step1.title', + }, + { + description: 'wallet_connectors.kresus.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.kresus.qr_code.step2.title', + }, + { + description: 'wallet_connectors.kresus.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.kresus.qr_code.step3.title', + }, + ], + }, + }, + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/ledgerWallet/ledgerWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/ledgerWallet/ledgerWallet.ts index f566918e6e..7059f8b942 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/ledgerWallet/ledgerWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/ledgerWallet/ledgerWallet.ts @@ -7,83 +7,84 @@ export type LedgerWalletOptions = DefaultWalletOptions; export const ledgerWallet = ({ projectId, walletConnectParameters, -}: LedgerWalletOptions): Wallet => ({ - id: 'ledger', - iconBackground: '#000', - iconAccent: '#000', - name: 'Ledger', - iconUrl: async () => (await import('./ledgerWallet.svg')).default, - downloadUrls: { - android: 'https://play.google.com/store/apps/details?id=com.ledger.live', - ios: 'https://apps.apple.com/us/app/ledger-live-web3-wallet/id1361671700', - mobile: 'https://www.ledger.com/ledger-live', - qrCode: 'https://r354.adj.st/?adj_t=t2esmlk', - windows: 'https://www.ledger.com/ledger-live/download', - macos: 'https://www.ledger.com/ledger-live/download', - linux: 'https://www.ledger.com/ledger-live/download', - desktop: 'https://www.ledger.com/ledger-live', - }, - mobile: { - getUri: (uri: string) => { - return isAndroid() - ? uri - : `ledgerlive://wc?uri=${encodeURIComponent(uri)}`; +}: LedgerWalletOptions) => + ({ + id: 'ledger' as const, + iconBackground: '#000', + iconAccent: '#000', + name: 'Ledger', + iconUrl: async () => (await import('./ledgerWallet.svg')).default, + downloadUrls: { + android: 'https://play.google.com/store/apps/details?id=com.ledger.live', + ios: 'https://apps.apple.com/us/app/ledger-live-web3-wallet/id1361671700', + mobile: 'https://www.ledger.com/ledger-live', + qrCode: 'https://r354.adj.st/?adj_t=t2esmlk', + windows: 'https://www.ledger.com/ledger-live/download', + macos: 'https://www.ledger.com/ledger-live/download', + linux: 'https://www.ledger.com/ledger-live/download', + desktop: 'https://www.ledger.com/ledger-live', }, - }, - desktop: { - getUri: (uri: string) => { - return `ledgerlive://wc?uri=${encodeURIComponent(uri)}`; + mobile: { + getUri: (uri: string) => { + return isAndroid() + ? uri + : `ledgerlive://wc?uri=${encodeURIComponent(uri)}`; + }, }, - instructions: { - learnMoreUrl: - 'https://support.ledger.com/hc/en-us/articles/4404389503889-Getting-started-with-Ledger-Live', - steps: [ - { - description: 'wallet_connectors.ledger.desktop.step1.description', - step: 'install', - title: 'wallet_connectors.ledger.desktop.step1.title', - }, - { - description: 'wallet_connectors.ledger.desktop.step2.description', - step: 'create', - title: 'wallet_connectors.ledger.desktop.step2.title', - }, - { - description: 'wallet_connectors.ledger.desktop.step3.description', - step: 'connect', - title: 'wallet_connectors.ledger.desktop.step3.title', - }, - ], + desktop: { + getUri: (uri: string) => { + return `ledgerlive://wc?uri=${encodeURIComponent(uri)}`; + }, + instructions: { + learnMoreUrl: + 'https://support.ledger.com/hc/en-us/articles/4404389503889-Getting-started-with-Ledger-Live', + steps: [ + { + description: 'wallet_connectors.ledger.desktop.step1.description', + step: 'install', + title: 'wallet_connectors.ledger.desktop.step1.title', + }, + { + description: 'wallet_connectors.ledger.desktop.step2.description', + step: 'create', + title: 'wallet_connectors.ledger.desktop.step2.title', + }, + { + description: 'wallet_connectors.ledger.desktop.step3.description', + step: 'connect', + title: 'wallet_connectors.ledger.desktop.step3.title', + }, + ], + }, }, - }, - qrCode: { - getUri: (uri: string) => { - return `ledgerlive://wc?uri=${encodeURIComponent(uri)}`; + qrCode: { + getUri: (uri: string) => { + return `ledgerlive://wc?uri=${encodeURIComponent(uri)}`; + }, + instructions: { + learnMoreUrl: + 'https://support.ledger.com/hc/en-us/articles/4404389503889-Getting-started-with-Ledger-Live', + steps: [ + { + description: 'wallet_connectors.ledger.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.ledger.qr_code.step1.title', + }, + { + description: 'wallet_connectors.ledger.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.ledger.qr_code.step2.title', + }, + { + description: 'wallet_connectors.ledger.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.ledger.qr_code.step3.title', + }, + ], + }, }, - instructions: { - learnMoreUrl: - 'https://support.ledger.com/hc/en-us/articles/4404389503889-Getting-started-with-Ledger-Live', - steps: [ - { - description: 'wallet_connectors.ledger.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.ledger.qr_code.step1.title', - }, - { - description: 'wallet_connectors.ledger.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.ledger.qr_code.step2.title', - }, - { - description: 'wallet_connectors.ledger.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.ledger.qr_code.step3.title', - }, - ], - }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/magicEdenWallet/magicEdenWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/magicEdenWallet/magicEdenWallet.ts index 8d5faf4eee..db7820002f 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/magicEdenWallet/magicEdenWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/magicEdenWallet/magicEdenWallet.ts @@ -4,9 +4,9 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const magicEdenWallet = (): Wallet => { +export const magicEdenWallet = () => { return { - id: 'magicEden', + id: 'magicEden' as const, name: 'Magic Eden Wallet', rdns: 'io.magiceden.wallet', iconUrl: async () => (await import('./magicEden.svg')).default, @@ -45,5 +45,5 @@ export const magicEdenWallet = (): Wallet => { createConnector: getInjectedConnector({ namespace: 'magicEden.ethereum', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.ts index a2f605de08..7f3baa8750 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.ts @@ -4,8 +4,8 @@ import type { DefaultWalletOptions, Wallet, WalletDetailsParams, + WalletFactory, } from '../../Wallet'; -import { hasInjectedProvider } from '../../getInjectedConnector'; import { getWalletConnectConnector } from '../../getWalletConnectConnector'; import { isMobile } from '../../../utils/isMobile'; import type { WindowProvider } from '../../../types/utils'; @@ -68,10 +68,10 @@ function isMetaMask(ethereum?: WindowProvider['ethereum']): boolean { return true; } -export const metaMaskWallet = ({ - projectId, - walletConnectParameters, -}: MetaMaskWalletOptions): Wallet => { +export const metaMaskWallet: WalletFactory< + MetaMaskWalletOptions, + 'metaMask' +> = ({ projectId, walletConnectParameters }) => { // Custom logic to explicitly detect MetaMask // Whereas hasInjectedProvider only checks for impersonated `isMetaMask` // We need this because MetaMask SDK hangs on impersonated wallets @@ -84,7 +84,7 @@ export const metaMaskWallet = ({ const shouldUseMetaMaskConnector = isMetaMaskInjected || isMobile(); return { - id: 'metaMask', + id: 'metaMask' as const, name: 'MetaMask', rdns: 'io.metamask', iconUrl: async () => (await import('./metaMaskWallet.svg')).default, @@ -200,5 +200,5 @@ export const metaMaskWallet = ({ }; }); }, - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/mewWallet/mewWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/mewWallet/mewWallet.ts index 3298888db3..662ce2a346 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/mewWallet/mewWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/mewWallet/mewWallet.ts @@ -10,7 +10,7 @@ export type MEWWalletOptions = DefaultWalletOptions; export const mewWallet = ({ projectId, walletConnectParameters, -}: MEWWalletOptions): Wallet => { +}: MEWWalletOptions) => { const isMEWInjected = hasInjectedProvider({ flag: 'isMEWwallet' }); const shouldUseWalletConnect = !isMEWInjected; @@ -20,7 +20,7 @@ export const mewWallet = ({ }; return { - id: 'mew', + id: 'mew' as const, name: 'MEW wallet', iconUrl: async () => (await import('./mewWallet.svg')).default, iconBackground: '#fff', @@ -65,5 +65,5 @@ export const mewWallet = ({ walletConnectParameters, }) : getInjectedConnector({ flag: 'isMEWwallet' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/nestWallet/nestWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/nestWallet/nestWallet.ts index e0254963de..cf260a1ffe 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/nestWallet/nestWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/nestWallet/nestWallet.ts @@ -4,40 +4,41 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const nestWallet = (): Wallet => ({ - id: 'nest', - name: 'Nest', - rdns: 'xyz.nestwallet', - iconUrl: async () => (await import('./nestWallet.svg')).default, - iconBackground: '#fff0', - installed: hasInjectedProvider({ flag: 'isNestWallet' }), - downloadUrls: { - browserExtension: 'https://nestwallet.xyz', - }, - extension: { - instructions: { - learnMoreUrl: 'https://nestwallet.xyz', - steps: [ - { - description: - 'wallet_connectors.nestwallet.extension.step1.description', - step: 'install', - title: 'wallet_connectors.nestwallet.extension.step1.title', - }, - { - description: - 'wallet_connectors.nestwallet.extension.step2.description', - step: 'create', - title: 'wallet_connectors.nestwallet.extension.step2.title', - }, - { - description: - 'wallet_connectors.nestwallet.extension.step3.description', - step: 'refresh', - title: 'wallet_connectors.nestwallet.extension.step3.title', - }, - ], +export const nestWallet = () => + ({ + id: 'nest' as const, + name: 'Nest', + rdns: 'xyz.nestwallet', + iconUrl: async () => (await import('./nestWallet.svg')).default, + iconBackground: '#fff0', + installed: hasInjectedProvider({ flag: 'isNestWallet' }), + downloadUrls: { + browserExtension: 'https://nestwallet.xyz', }, - }, - createConnector: getInjectedConnector({ flag: 'isNestWallet' }), -}); + extension: { + instructions: { + learnMoreUrl: 'https://nestwallet.xyz', + steps: [ + { + description: + 'wallet_connectors.nestwallet.extension.step1.description', + step: 'install', + title: 'wallet_connectors.nestwallet.extension.step1.title', + }, + { + description: + 'wallet_connectors.nestwallet.extension.step2.description', + step: 'create', + title: 'wallet_connectors.nestwallet.extension.step2.title', + }, + { + description: + 'wallet_connectors.nestwallet.extension.step3.description', + step: 'refresh', + title: 'wallet_connectors.nestwallet.extension.step3.title', + }, + ], + }, + }, + createConnector: getInjectedConnector({ flag: 'isNestWallet' }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/novaWallet/novaWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/novaWallet/novaWallet.ts index 14cf5474b1..458758f90d 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/novaWallet/novaWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/novaWallet/novaWallet.ts @@ -17,7 +17,7 @@ function isNovaWallet(ethereum?: WindowProvider['ethereum']): boolean { export const novaWallet = ({ projectId, walletConnectParameters, -}: NovaWalletOptions): Wallet => { +}: NovaWalletOptions) => { const isNovaWalletInjected = typeof window !== 'undefined' ? isNovaWallet(window.ethereum) : false; @@ -32,7 +32,7 @@ export const novaWallet = ({ }; return { - id: 'nova', + id: 'nova' as const, name: 'Nova Wallet', rdns: 'io.novawallet', iconUrl: async () => (await import('./novaWallet.svg')).default, @@ -80,5 +80,5 @@ export const novaWallet = ({ : getInjectedConnector({ namespace: 'ethereum', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/oktoWallet/oktoWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/oktoWallet/oktoWallet.ts index 241cf37b6f..54292e7269 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/oktoWallet/oktoWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/oktoWallet/oktoWallet.ts @@ -7,48 +7,49 @@ export type OktoWalletOptions = DefaultWalletOptions; export const oktoWallet = ({ projectId, walletConnectParameters, -}: OktoWalletOptions): Wallet => ({ - id: 'Okto', - name: 'Okto', - iconUrl: async () => (await import('./oktoWallet.svg')).default, - iconBackground: '#fff', - downloadUrls: { - android: - 'https://play.google.com/store/apps/details?id=im.okto.contractwalletclient', - ios: 'https://apps.apple.com/in/app/okto-wallet/id6450688229', - mobile: 'https://okto.tech/', - qrCode: 'https://okto.tech/', - }, - mobile: { - getUri: (uri: string) => { - return isAndroid() ? uri : `okto://wc?uri=${encodeURIComponent(uri)}`; +}: OktoWalletOptions) => + ({ + id: 'Okto' as const, + name: 'Okto', + iconUrl: async () => (await import('./oktoWallet.svg')).default, + iconBackground: '#fff', + downloadUrls: { + android: + 'https://play.google.com/store/apps/details?id=im.okto.contractwalletclient', + ios: 'https://apps.apple.com/in/app/okto-wallet/id6450688229', + mobile: 'https://okto.tech/', + qrCode: 'https://okto.tech/', }, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://okto.tech/', - steps: [ - { - description: 'wallet_connectors.okto.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.okto.qr_code.step1.title', - }, - { - description: 'wallet_connectors.okto.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.okto.qr_code.step2.title', - }, - { - description: 'wallet_connectors.okto.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.okto.qr_code.step3.title', - }, - ], + mobile: { + getUri: (uri: string) => { + return isAndroid() ? uri : `okto://wc?uri=${encodeURIComponent(uri)}`; + }, }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://okto.tech/', + steps: [ + { + description: 'wallet_connectors.okto.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.okto.qr_code.step1.title', + }, + { + description: 'wallet_connectors.okto.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.okto.qr_code.step2.title', + }, + { + description: 'wallet_connectors.okto.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.okto.qr_code.step3.title', + }, + ], + }, + }, + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/okxWallet/okxWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/okxWallet/okxWallet.ts index cc30331cef..27b7611a7e 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/okxWallet/okxWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/okxWallet/okxWallet.ts @@ -11,12 +11,12 @@ export type OKXWalletOptions = DefaultWalletOptions; export const okxWallet = ({ projectId, walletConnectParameters, -}: OKXWalletOptions): Wallet => { +}: OKXWalletOptions) => { const isOKXInjected = hasInjectedProvider({ namespace: 'okxwallet' }); const shouldUseWalletConnect = !isOKXInjected; return { - id: 'okx', + id: 'okx' as const, name: 'OKX Wallet', rdns: 'com.okex.wallet', iconUrl: async () => (await import('./okxWallet.svg')).default, @@ -97,5 +97,5 @@ export const okxWallet = ({ walletConnectParameters, }) : getInjectedConnector({ namespace: 'okxwallet' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/omniWallet/omniWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/omniWallet/omniWallet.ts index 753422a2e8..bc15873074 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/omniWallet/omniWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/omniWallet/omniWallet.ts @@ -7,47 +7,49 @@ export type OmniWalletOptions = DefaultWalletOptions; export const omniWallet = ({ projectId, walletConnectParameters, -}: OmniWalletOptions): Wallet => ({ - id: 'omni', - name: 'Omni', - iconUrl: async () => (await import('./omniWallet.svg')).default, - iconBackground: '#000', - downloadUrls: { - android: 'https://play.google.com/store/apps/details?id=fi.steakwallet.app', - ios: 'https://itunes.apple.com/us/app/id1569375204', - mobile: 'https://omniwallet.app.link', - qrCode: 'https://omniwallet.app.link', - }, - mobile: { - getUri: (uri: string) => { - return isAndroid() ? uri : `omni://wc?uri=${encodeURIComponent(uri)}`; +}: OmniWalletOptions) => + ({ + id: 'omni' as const, + name: 'Omni', + iconUrl: async () => (await import('./omniWallet.svg')).default, + iconBackground: '#000', + downloadUrls: { + android: + 'https://play.google.com/store/apps/details?id=fi.steakwallet.app', + ios: 'https://itunes.apple.com/us/app/id1569375204', + mobile: 'https://omniwallet.app.link', + qrCode: 'https://omniwallet.app.link', }, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://omni.app/support', - steps: [ - { - description: 'wallet_connectors.omni.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.omni.qr_code.step1.title', - }, - { - description: 'wallet_connectors.omni.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.omni.qr_code.step2.title', - }, - { - description: 'wallet_connectors.omni.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.omni.qr_code.step3.title', - }, - ], + mobile: { + getUri: (uri: string) => { + return isAndroid() ? uri : `omni://wc?uri=${encodeURIComponent(uri)}`; + }, }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://omni.app/support', + steps: [ + { + description: 'wallet_connectors.omni.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.omni.qr_code.step1.title', + }, + { + description: 'wallet_connectors.omni.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.omni.qr_code.step2.title', + }, + { + description: 'wallet_connectors.omni.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.omni.qr_code.step3.title', + }, + ], + }, + }, + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/oneInchWallet/oneInchWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/oneInchWallet/oneInchWallet.ts index 44ecff18e7..5aff932ad5 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/oneInchWallet/oneInchWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/oneInchWallet/oneInchWallet.ts @@ -6,45 +6,47 @@ export type OneInchWalletOptions = DefaultWalletOptions; export const oneInchWallet = ({ projectId, walletConnectParameters, -}: OneInchWalletOptions): Wallet => ({ - id: '1inch', - name: '1inch Wallet', - iconUrl: async () => (await import('./oneInchWallet.svg')).default, - iconBackground: '#fff', - downloadUrls: { - android: 'https://play.google.com/store/apps/details?id=io.oneinch.android', - ios: 'https://apps.apple.com/us/app/1inch-crypto-defi-wallet/id1546049391', - mobile: 'https://1inch.io/wallet', - qrCode: 'https://1inch.io/wallet', - }, - mobile: { - getUri: (uri: string) => `oneinch://wc?uri=${encodeURIComponent(uri)}`, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://1inch.io/wallet', - steps: [ - { - description: 'wallet_connectors.1inch.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.1inch.qr_code.step1.title', - }, - { - description: 'wallet_connectors.1inch.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.1inch.qr_code.step2.title', - }, - { - description: 'wallet_connectors.1inch.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.1inch.qr_code.step3.title', - }, - ], +}: OneInchWalletOptions) => + ({ + id: '1inch' as const, + name: '1inch Wallet', + iconUrl: async () => (await import('./oneInchWallet.svg')).default, + iconBackground: '#fff', + downloadUrls: { + android: + 'https://play.google.com/store/apps/details?id=io.oneinch.android', + ios: 'https://apps.apple.com/us/app/1inch-crypto-defi-wallet/id1546049391', + mobile: 'https://1inch.io/wallet', + qrCode: 'https://1inch.io/wallet', }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + mobile: { + getUri: (uri: string) => `oneinch://wc?uri=${encodeURIComponent(uri)}`, + }, + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://1inch.io/wallet', + steps: [ + { + description: 'wallet_connectors.1inch.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.1inch.qr_code.step1.title', + }, + { + description: 'wallet_connectors.1inch.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.1inch.qr_code.step2.title', + }, + { + description: 'wallet_connectors.1inch.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.1inch.qr_code.step3.title', + }, + ], + }, + }, + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/oneKeyWallet/oneKeyWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/oneKeyWallet/oneKeyWallet.ts index 39b52e2942..85006d875d 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/oneKeyWallet/oneKeyWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/oneKeyWallet/oneKeyWallet.ts @@ -4,9 +4,9 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const oneKeyWallet = (): Wallet => { +export const oneKeyWallet = () => { return { - id: 'onekey', + id: 'onekey' as const, name: 'OneKey', rdns: 'so.onekey.app.wallet', iconAccent: '#00B812', @@ -54,5 +54,5 @@ export const oneKeyWallet = (): Wallet => { createConnector: getInjectedConnector({ namespace: '$onekey.ethereum', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraswapWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraswapWallet.ts index 1bef05ad39..ded808f5fd 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraswapWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraswapWallet.ts @@ -7,46 +7,47 @@ export type ParaSwapWalletOptions = DefaultWalletOptions; export const paraSwapWallet = ({ projectId, walletConnectParameters, -}: ParaSwapWalletOptions): Wallet => ({ - id: 'paraswap', - name: 'ParaSwap Wallet', - iconUrl: async () => (await import('./paraSwapWallet.svg')).default, - iconBackground: '#578CFC', - downloadUrls: { - ios: 'https://apps.apple.com/us/app/paraswap-multichain-wallet/id1584610690', - mobile: 'https://paraswap.io', - qrCode: 'https://paraswap.io', - }, - mobile: { - getUri: (uri: string) => { - return `paraswap://wc?uri=${encodeURIComponent(uri)}`; +}: ParaSwapWalletOptions) => + ({ + id: 'paraswap' as const, + name: 'ParaSwap Wallet', + iconUrl: async () => (await import('./paraSwapWallet.svg')).default, + iconBackground: '#578CFC', + downloadUrls: { + ios: 'https://apps.apple.com/us/app/paraswap-multichain-wallet/id1584610690', + mobile: 'https://paraswap.io', + qrCode: 'https://paraswap.io', }, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://paraswap.io', - steps: [ - { - description: 'wallet_connectors.paraswap.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.paraswap.qr_code.step1.title', - }, - { - description: 'wallet_connectors.paraswap.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.paraswap.qr_code.step2.title', - }, - { - description: 'wallet_connectors.paraswap.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.paraswap.qr_code.step3.title', - }, - ], + mobile: { + getUri: (uri: string) => { + return `paraswap://wc?uri=${encodeURIComponent(uri)}`; + }, }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://paraswap.io', + steps: [ + { + description: 'wallet_connectors.paraswap.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.paraswap.qr_code.step1.title', + }, + { + description: 'wallet_connectors.paraswap.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.paraswap.qr_code.step2.title', + }, + { + description: 'wallet_connectors.paraswap.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.paraswap.qr_code.step3.title', + }, + ], + }, + }, + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/phantomWallet/phantomWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/phantomWallet/phantomWallet.ts index ec1e841e74..c614c750a9 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/phantomWallet/phantomWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/phantomWallet/phantomWallet.ts @@ -4,9 +4,9 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const phantomWallet = (): Wallet => { +export const phantomWallet = () => { return { - id: 'phantom', + id: 'phantom' as const, name: 'Phantom', rdns: 'app.phantom', iconUrl: async () => (await import('./phantomWallet.svg')).default, @@ -50,5 +50,5 @@ export const phantomWallet = (): Wallet => { createConnector: getInjectedConnector({ namespace: 'phantom.ethereum', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/portoWallet/portoWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/portoWallet/portoWallet.ts index 79ab5fdd69..821ad38121 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/portoWallet/portoWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/portoWallet/portoWallet.ts @@ -1,10 +1,12 @@ import { porto, type PortoParameters } from 'wagmi/connectors'; -import type { Wallet, WalletDetailsParams } from '../../Wallet'; +import type { Wallet, WalletDetailsParams, WalletFactory } from '../../Wallet'; import { createConnector } from 'wagmi'; -export const portoWallet = (parameters: PortoParameters): Wallet => { +export const portoWallet: WalletFactory = ( + parameters, +) => { return { - id: 'porto', + id: 'porto' as const, name: 'Porto', shortName: 'Porto', rdns: 'xyz.ithaca.porto', @@ -17,5 +19,5 @@ export const portoWallet = (parameters: PortoParameters): Wallet => { ...porto(parameters)(config), ...walletDetails, })), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/rabbyWallet/rabbyWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/rabbyWallet/rabbyWallet.ts index cb30306fc3..99455adb12 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/rabbyWallet/rabbyWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/rabbyWallet/rabbyWallet.ts @@ -4,39 +4,40 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const rabbyWallet = (): Wallet => ({ - id: 'rabby', - name: 'Rabby Wallet', - iconUrl: async () => (await import('./rabbyWallet.svg')).default, - rdns: 'io.rabby', - iconBackground: '#8697FF', - installed: hasInjectedProvider({ flag: 'isRabby' }), - downloadUrls: { - chrome: - 'https://chrome.google.com/webstore/detail/rabby-wallet/acmacodkjbdgmoleebolmdjonilkdbch', - browserExtension: 'https://rabby.io', - }, - extension: { - instructions: { - learnMoreUrl: 'https://rabby.io/', - steps: [ - { - description: 'wallet_connectors.rabby.extension.step1.description', - step: 'install', - title: 'wallet_connectors.rabby.extension.step1.title', - }, - { - description: 'wallet_connectors.rabby.extension.step2.description', - step: 'create', - title: 'wallet_connectors.rabby.extension.step2.title', - }, - { - description: 'wallet_connectors.rabby.extension.step3.description', - step: 'refresh', - title: 'wallet_connectors.rabby.extension.step3.title', - }, - ], +export const rabbyWallet = () => + ({ + id: 'rabby' as const, + name: 'Rabby Wallet', + iconUrl: async () => (await import('./rabbyWallet.svg')).default, + rdns: 'io.rabby', + iconBackground: '#8697FF', + installed: hasInjectedProvider({ flag: 'isRabby' }), + downloadUrls: { + chrome: + 'https://chrome.google.com/webstore/detail/rabby-wallet/acmacodkjbdgmoleebolmdjonilkdbch', + browserExtension: 'https://rabby.io', }, - }, - createConnector: getInjectedConnector({ flag: 'isRabby' }), -}); + extension: { + instructions: { + learnMoreUrl: 'https://rabby.io/', + steps: [ + { + description: 'wallet_connectors.rabby.extension.step1.description', + step: 'install', + title: 'wallet_connectors.rabby.extension.step1.title', + }, + { + description: 'wallet_connectors.rabby.extension.step2.description', + step: 'create', + title: 'wallet_connectors.rabby.extension.step2.title', + }, + { + description: 'wallet_connectors.rabby.extension.step3.description', + step: 'refresh', + title: 'wallet_connectors.rabby.extension.step3.title', + }, + ], + }, + }, + createConnector: getInjectedConnector({ flag: 'isRabby' }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/rainbowWallet/rainbowWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/rainbowWallet/rainbowWallet.ts index 662fd2f696..b0a704dd1a 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/rainbowWallet/rainbowWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/rainbowWallet/rainbowWallet.ts @@ -11,7 +11,7 @@ export type RainbowWalletOptions = DefaultWalletOptions; export const rainbowWallet = ({ projectId, walletConnectParameters, -}: RainbowWalletOptions): Wallet => { +}: RainbowWalletOptions) => { const isRainbowInjected = hasInjectedProvider({ flag: 'isRainbow' }); const shouldUseWalletConnect = !isRainbowInjected; @@ -26,7 +26,7 @@ export const rainbowWallet = ({ }; return { - id: 'rainbow', + id: 'rainbow' as const, name: 'Rainbow', rdns: 'me.rainbow', iconUrl: async () => (await import('./rainbowWallet.svg')).default, @@ -78,5 +78,5 @@ export const rainbowWallet = ({ walletConnectParameters, }) : getInjectedConnector({ flag: 'isRainbow' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/ramperWallet/ramperWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/ramperWallet/ramperWallet.ts index 88f458e615..e5c064168f 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/ramperWallet/ramperWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/ramperWallet/ramperWallet.ts @@ -4,13 +4,13 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const ramperWallet = (): Wallet => { +export const ramperWallet = () => { const isRamperWalletInjected = hasInjectedProvider({ namespace: 'ramper2.provider', }); return { - id: 'ramper', + id: 'ramper' as const, name: 'Ramper Wallet', iconUrl: async () => (await import('./ramperWallet.svg')).default, installed: isRamperWalletInjected, @@ -46,5 +46,5 @@ export const ramperWallet = (): Wallet => { createConnector: getInjectedConnector({ namespace: 'ramper2.provider', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/readyWallet/readyWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/readyWallet/readyWallet.ts index 5588cb24af..9c6a8575b9 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/readyWallet/readyWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/readyWallet/readyWallet.ts @@ -7,50 +7,51 @@ export type ReadyWalletOptions = DefaultWalletOptions; export const readyWallet = ({ projectId, walletConnectParameters, -}: ReadyWalletOptions): Wallet => ({ - id: 'ready', - name: 'Ready', - iconUrl: async () => (await import('./readyWallet.svg')).default, - iconBackground: '#fff', - downloadUrls: { - android: - 'https://play.google.com/store/apps/details?id=im.argent.contractwalletclient', - ios: 'https://apps.apple.com/us/app/argent/id1358741926', - mobile: 'https://www.ready.co/app', - qrCode: 'https://www.ready.co/app', - }, - mobile: { - getUri: (uri: string) => { - return isAndroid() - ? uri - : `argent://app/wc?uri=${encodeURIComponent(uri)}`; +}: ReadyWalletOptions) => + ({ + id: 'ready' as const, + name: 'Ready', + iconUrl: async () => (await import('./readyWallet.svg')).default, + iconBackground: '#fff', + downloadUrls: { + android: + 'https://play.google.com/store/apps/details?id=im.argent.contractwalletclient', + ios: 'https://apps.apple.com/us/app/argent/id1358741926', + mobile: 'https://www.ready.co/app', + qrCode: 'https://www.ready.co/app', }, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://www.ready.co/', - steps: [ - { - description: 'wallet_connectors.ready.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.ready.qr_code.step1.title', - }, - { - description: 'wallet_connectors.ready.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.ready.qr_code.step2.title', - }, - { - description: 'wallet_connectors.ready.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.ready.qr_code.step3.title', - }, - ], + mobile: { + getUri: (uri: string) => { + return isAndroid() + ? uri + : `argent://app/wc?uri=${encodeURIComponent(uri)}`; + }, }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://www.ready.co/', + steps: [ + { + description: 'wallet_connectors.ready.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.ready.qr_code.step1.title', + }, + { + description: 'wallet_connectors.ready.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.ready.qr_code.step2.title', + }, + { + description: 'wallet_connectors.ready.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.ready.qr_code.step3.title', + }, + ], + }, + }, + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/roninWallet/roninWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/roninWallet/roninWallet.ts index 5f3983b4a6..4eabf1f694 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/roninWallet/roninWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/roninWallet/roninWallet.ts @@ -10,7 +10,7 @@ export type RoninWalletOptions = DefaultWalletOptions; export const roninWallet = ({ projectId, walletConnectParameters, -}: RoninWalletOptions): Wallet => { +}: RoninWalletOptions) => { const isRoninInjected = hasInjectedProvider({ namespace: 'ronin.provider', }); @@ -22,7 +22,7 @@ export const roninWallet = ({ }; return { - id: 'ronin', + id: 'ronin' as const, name: 'Ronin Wallet', iconUrl: async () => (await import('./roninWallet.svg')).default, iconBackground: '#ffffff', @@ -99,5 +99,5 @@ export const roninWallet = ({ walletConnectParameters, }) : getInjectedConnector({ namespace: 'ronin.provider' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/safeWallet/safeWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/safeWallet/safeWallet.ts index aca14fd19a..7b393b0b6a 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/safeWallet/safeWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/safeWallet/safeWallet.ts @@ -1,26 +1,27 @@ import { createConnector } from 'wagmi'; import { safe } from 'wagmi/connectors'; -import type { Wallet, WalletDetailsParams } from '../../Wallet'; +import type { Wallet, WalletDetailsParams, WalletFactory } from '../../Wallet'; -export const safeWallet = (): Wallet => ({ - id: 'safe', - name: 'Safe', - iconAccent: '#12ff80', - iconBackground: '#fff', - iconUrl: async () => (await import('./safeWallet.svg')).default, - installed: - // Only allowed in iframe context - // borrowed from wagmi safe connector - !(typeof window === 'undefined') && window?.parent !== window, - downloadUrls: { - // We're opting not to provide a download prompt if the application is not - // already running as a Safe App within the context of the Safe browser, - // since it's unlikely to be a desired behavior for users. - }, - createConnector: (walletDetails: WalletDetailsParams) => { - return createConnector((config) => ({ - ...safe()(config), - ...walletDetails, - })); - }, -}); +export const safeWallet: WalletFactory = () => + ({ + id: 'safe' as const, + name: 'Safe', + iconAccent: '#12ff80', + iconBackground: '#fff', + iconUrl: async () => (await import('./safeWallet.svg')).default, + installed: + // Only allowed in iframe context + // borrowed from wagmi safe connector + !(typeof window === 'undefined') && window?.parent !== window, + downloadUrls: { + // We're opting not to provide a download prompt if the application is not + // already running as a Safe App within the context of the Safe browser, + // since it's unlikely to be a desired behavior for users. + }, + createConnector: (walletDetails: WalletDetailsParams) => { + return createConnector((config) => ({ + ...safe()(config), + ...walletDetails, + })); + }, + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/safeheronWallet/safeheronWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/safeheronWallet/safeheronWallet.ts index 721498af0c..8cf19c246b 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/safeheronWallet/safeheronWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/safeheronWallet/safeheronWallet.ts @@ -4,47 +4,48 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const safeheronWallet = (): Wallet => ({ - id: 'safeheron', - name: 'Safeheron', - installed: hasInjectedProvider({ - namespace: 'safeheron', - flag: 'isSafeheron', - }), - iconUrl: async () => (await import('./safeheronWallet.svg')).default, - iconBackground: '#fff', - downloadUrls: { - chrome: - 'https://chrome.google.com/webstore/detail/safeheron/aiaghdjafpiofpainifbgfgjfpclngoh', - browserExtension: 'https://www.safeheron.com/', - }, - extension: { - instructions: { - learnMoreUrl: 'https://www.safeheron.com/', - steps: [ - { - description: - 'wallet_connectors.safeheron.extension.step1.description', - step: 'install', - title: 'wallet_connectors.safeheron.extension.step1.title', - }, - { - description: - 'wallet_connectors.safeheron.extension.step2.description', - step: 'create', - title: 'wallet_connectors.safeheron.extension.step2.title', - }, - { - description: - 'wallet_connectors.safeheron.extension.step3.description', - step: 'refresh', - title: 'wallet_connectors.safeheron.extension.step3.title', - }, - ], +export const safeheronWallet = () => + ({ + id: 'safeheron' as const, + name: 'Safeheron', + installed: hasInjectedProvider({ + namespace: 'safeheron', + flag: 'isSafeheron', + }), + iconUrl: async () => (await import('./safeheronWallet.svg')).default, + iconBackground: '#fff', + downloadUrls: { + chrome: + 'https://chrome.google.com/webstore/detail/safeheron/aiaghdjafpiofpainifbgfgjfpclngoh', + browserExtension: 'https://www.safeheron.com/', }, - }, - createConnector: getInjectedConnector({ - namespace: 'safeheron', - flag: 'isSafeheron', - }), -}); + extension: { + instructions: { + learnMoreUrl: 'https://www.safeheron.com/', + steps: [ + { + description: + 'wallet_connectors.safeheron.extension.step1.description', + step: 'install', + title: 'wallet_connectors.safeheron.extension.step1.title', + }, + { + description: + 'wallet_connectors.safeheron.extension.step2.description', + step: 'create', + title: 'wallet_connectors.safeheron.extension.step2.title', + }, + { + description: + 'wallet_connectors.safeheron.extension.step3.description', + step: 'refresh', + title: 'wallet_connectors.safeheron.extension.step3.title', + }, + ], + }, + }, + createConnector: getInjectedConnector({ + namespace: 'safeheron', + flag: 'isSafeheron', + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/safepalWallet/safepalWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/safepalWallet/safepalWallet.ts index 4e6f59399e..666b659179 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/safepalWallet/safepalWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/safepalWallet/safepalWallet.ts @@ -14,7 +14,7 @@ export type SafepalWalletOptions = DefaultWalletOptions; export const safepalWallet = ({ projectId, walletConnectParameters, -}: SafepalWalletOptions): Wallet => { +}: SafepalWalletOptions) => { const isSafePalWalletInjected = hasInjectedProvider({ namespace: 'safepalProvider', flag: 'isSafePal', @@ -85,7 +85,7 @@ export const safepalWallet = ({ }; return { - id: 'safepal', + id: 'safepal' as const, name: 'SafePal Wallet', iconUrl: async () => (await import('./safepalWallet.svg')).default, // Note that we never resolve `installed` to `false` because the @@ -116,5 +116,5 @@ export const safepalWallet = ({ namespace: 'safepalProvider', flag: 'isSafePal', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/seifWallet/seifWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/seifWallet/seifWallet.ts index d5935cf4bb..6d9bd24ae3 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/seifWallet/seifWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/seifWallet/seifWallet.ts @@ -4,12 +4,12 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export function seifWallet(): Wallet { +export function seifWallet() { const injectedProvider = hasInjectedProvider({ namespace: '__seif', }); return { - id: 'seif', + id: 'seif' as const, name: 'Seif', installed: !!injectedProvider, iconUrl: async () => (await import('./seifWallet.svg')).default, @@ -22,5 +22,5 @@ export function seifWallet(): Wallet { namespace: '__seif', }), rdns: 'com.passkeywallet.seif', - }; + } satisfies Wallet; } diff --git a/packages/rainbowkit/src/wallets/walletConnectors/subWallet/subWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/subWallet/subWallet.ts index 1499043427..600e2141b1 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/subWallet/subWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/subWallet/subWallet.ts @@ -14,7 +14,7 @@ export type SubWalletOptions = DefaultWalletOptions; export const subWallet = ({ projectId, walletConnectParameters, -}: SubWalletOptions): Wallet => { +}: SubWalletOptions) => { const isSubWalletInjected = hasInjectedProvider({ namespace: 'SubWallet' }); const shouldUseWalletConnect = !isSubWalletInjected; @@ -88,7 +88,7 @@ export const subWallet = ({ }; return { - id: 'subwallet', + id: 'subwallet' as const, name: 'SubWallet', rdns: 'app.subwallet', iconUrl: async () => (await import('./subWallet.svg')).default, @@ -115,5 +115,5 @@ export const subWallet = ({ walletConnectParameters, }) : getInjectedConnector({ namespace: 'SubWallet' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/tahoWallet/tahoWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/tahoWallet/tahoWallet.ts index 1aac034484..73d62e874d 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/tahoWallet/tahoWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/tahoWallet/tahoWallet.ts @@ -4,9 +4,9 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const tahoWallet = (): Wallet => { +export const tahoWallet = () => { return { - id: 'taho', + id: 'taho' as const, name: 'Taho', iconBackground: '#d08d57', iconUrl: async () => (await import('./tahoWallet.svg')).default, @@ -43,5 +43,5 @@ export const tahoWallet = (): Wallet => { namespace: 'tally', flag: 'isTally', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/talismanWallet/talismanWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/talismanWallet/talismanWallet.ts index f6074e52c7..b62f72279e 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/talismanWallet/talismanWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/talismanWallet/talismanWallet.ts @@ -4,47 +4,51 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const talismanWallet = (): Wallet => ({ - id: 'talisman', - name: 'Talisman', - rdns: 'xyz.talisman', - iconUrl: async () => (await import('./talismanWallet.svg')).default, - iconBackground: '#fff', - installed: hasInjectedProvider({ - namespace: 'talismanEth', - flag: 'isTalisman', - }), - downloadUrls: { - chrome: - 'https://chrome.google.com/webstore/detail/talisman-polkadot-wallet/fijngjgcjhjmmpcmkeiomlglpeiijkld', - firefox: - 'https://addons.mozilla.org/en-US/firefox/addon/talisman-wallet-extension/', - browserExtension: 'https://talisman.xyz/download', - }, - extension: { - instructions: { - learnMoreUrl: 'https://talisman.xyz/', - steps: [ - { - description: 'wallet_connectors.talisman.extension.step1.description', - step: 'install', - title: 'wallet_connectors.talisman.extension.step1.title', - }, - { - description: 'wallet_connectors.talisman.extension.step2.description', - step: 'create', - title: 'wallet_connectors.talisman.extension.step2.title', - }, - { - description: 'wallet_connectors.talisman.extension.step3.description', - step: 'refresh', - title: 'wallet_connectors.talisman.extension.step3.title', - }, - ], +export const talismanWallet = () => + ({ + id: 'talisman' as const, + name: 'Talisman', + rdns: 'xyz.talisman', + iconUrl: async () => (await import('./talismanWallet.svg')).default, + iconBackground: '#fff', + installed: hasInjectedProvider({ + namespace: 'talismanEth', + flag: 'isTalisman', + }), + downloadUrls: { + chrome: + 'https://chrome.google.com/webstore/detail/talisman-polkadot-wallet/fijngjgcjhjmmpcmkeiomlglpeiijkld', + firefox: + 'https://addons.mozilla.org/en-US/firefox/addon/talisman-wallet-extension/', + browserExtension: 'https://talisman.xyz/download', }, - }, - createConnector: getInjectedConnector({ - namespace: 'talismanEth', - flag: 'isTalisman', - }), -}); + extension: { + instructions: { + learnMoreUrl: 'https://talisman.xyz/', + steps: [ + { + description: + 'wallet_connectors.talisman.extension.step1.description', + step: 'install', + title: 'wallet_connectors.talisman.extension.step1.title', + }, + { + description: + 'wallet_connectors.talisman.extension.step2.description', + step: 'create', + title: 'wallet_connectors.talisman.extension.step2.title', + }, + { + description: + 'wallet_connectors.talisman.extension.step3.description', + step: 'refresh', + title: 'wallet_connectors.talisman.extension.step3.title', + }, + ], + }, + }, + createConnector: getInjectedConnector({ + namespace: 'talismanEth', + flag: 'isTalisman', + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.ts index 188e3af33e..c8b06388d0 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.ts @@ -11,7 +11,7 @@ export type TokenPocketWalletOptions = DefaultWalletOptions; export const tokenPocketWallet = ({ projectId, walletConnectParameters, -}: TokenPocketWalletOptions): Wallet => { +}: TokenPocketWalletOptions) => { const isTokenPocketInjected = hasInjectedProvider({ flag: 'isTokenPocket' }); const shouldUseWalletConnect = !isTokenPocketInjected; @@ -20,7 +20,7 @@ export const tokenPocketWallet = ({ }; return { - id: 'tokenPocket', + id: 'tokenPocket' as const, name: 'TokenPocket', rdns: 'pro.tokenpocket', iconUrl: async () => (await import('./tokenPocketWallet.svg')).default, @@ -99,5 +99,5 @@ export const tokenPocketWallet = ({ walletConnectParameters, }) : getInjectedConnector({ flag: 'isTokenPocket' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/tokenaryWallet/tokenaryWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/tokenaryWallet/tokenaryWallet.ts index 530c955efc..662c22f527 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/tokenaryWallet/tokenaryWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/tokenaryWallet/tokenaryWallet.ts @@ -5,19 +5,20 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const tokenaryWallet = (): Wallet => ({ - id: 'tokenary', - name: 'Tokenary', - iconUrl: async () => (await import('./tokenaryWallet.svg')).default, - iconBackground: '#ffffff', - installed: hasInjectedProvider({ flag: 'isTokenary' }), - hidden: () => !isSafari(), - downloadUrls: { - ios: 'https://tokenary.io/get', - mobile: 'https://tokenary.io', - qrCode: 'https://tokenary.io/get', - safari: 'https://tokenary.io/get', - browserExtension: 'https://tokenary.io/get', - }, - createConnector: getInjectedConnector({ flag: 'isTokenary' }), -}); +export const tokenaryWallet = () => + ({ + id: 'tokenary' as const, + name: 'Tokenary', + iconUrl: async () => (await import('./tokenaryWallet.svg')).default, + iconBackground: '#ffffff', + installed: hasInjectedProvider({ flag: 'isTokenary' }), + hidden: () => !isSafari(), + downloadUrls: { + ios: 'https://tokenary.io/get', + mobile: 'https://tokenary.io', + qrCode: 'https://tokenary.io/get', + safari: 'https://tokenary.io/get', + browserExtension: 'https://tokenary.io/get', + }, + createConnector: getInjectedConnector({ flag: 'isTokenary' }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/trustWallet/trustWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/trustWallet/trustWallet.ts index 3575922920..86d243df31 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/trustWallet/trustWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/trustWallet/trustWallet.ts @@ -15,7 +15,7 @@ export type TrustWalletOptions = DefaultWalletOptions; export const trustWallet = ({ projectId, walletConnectParameters, -}: TrustWalletOptions): Wallet => { +}: TrustWalletOptions) => { const isTrustWalletInjected = isMobile() ? hasInjectedProvider({ flag: 'isTrust' }) : hasInjectedProvider({ flag: 'isTrustWallet' }); @@ -85,7 +85,7 @@ export const trustWallet = ({ }; return { - id: 'trust', + id: 'trust' as const, name: 'Trust Wallet', rdns: 'com.trustwallet.app', iconUrl: async () => (await import('./trustWallet.svg')).default, @@ -116,5 +116,5 @@ export const trustWallet = ({ : isMobile() ? getInjectedConnector({ flag: 'isTrust' }) : getInjectedConnector({ flag: 'isTrustWallet' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/uniswapWallet/uniswapWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/uniswapWallet/uniswapWallet.ts index 7b38d7ca62..a4617283db 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/uniswapWallet/uniswapWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/uniswapWallet/uniswapWallet.ts @@ -7,48 +7,49 @@ export type UniswapWalletOptions = DefaultWalletOptions; export const uniswapWallet = ({ projectId, walletConnectParameters, -}: UniswapWalletOptions): Wallet => ({ - id: 'uniswap', - name: 'Uniswap Wallet', - iconUrl: async () => (await import('./uniswapWallet.svg')).default, - iconBackground: '#FFD8EA', - downloadUrls: { - ios: 'https://apps.apple.com/app/apple-store/id6443944476', - mobile: 'https://wallet.uniswap.org/', - qrCode: 'https://wallet.uniswap.org/', - }, +}: UniswapWalletOptions) => + ({ + id: 'uniswap' as const, + name: 'Uniswap Wallet', + iconUrl: async () => (await import('./uniswapWallet.svg')).default, + iconBackground: '#FFD8EA', + downloadUrls: { + ios: 'https://apps.apple.com/app/apple-store/id6443944476', + mobile: 'https://wallet.uniswap.org/', + qrCode: 'https://wallet.uniswap.org/', + }, - mobile: { - getUri: (uri: string) => { - return `uniswap://wc?uri=${encodeURIComponent(uri)}`; + mobile: { + getUri: (uri: string) => { + return `uniswap://wc?uri=${encodeURIComponent(uri)}`; + }, }, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://wallet.uniswap.org/', - steps: [ - { - description: 'wallet_connectors.uniswap.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.uniswap.qr_code.step1.title', - }, - { - description: 'wallet_connectors.uniswap.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.uniswap.qr_code.step2.title', - }, - { - description: 'wallet_connectors.uniswap.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.uniswap.qr_code.step3.title', - }, - ], + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://wallet.uniswap.org/', + steps: [ + { + description: 'wallet_connectors.uniswap.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.uniswap.qr_code.step1.title', + }, + { + description: 'wallet_connectors.uniswap.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.uniswap.qr_code.step2.title', + }, + { + description: 'wallet_connectors.uniswap.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.uniswap.qr_code.step3.title', + }, + ], + }, }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/universalProfilesWallet/universalProfilesWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/universalProfilesWallet/universalProfilesWallet.ts index 4a6b46a01f..bb96f1808d 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/universalProfilesWallet/universalProfilesWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/universalProfilesWallet/universalProfilesWallet.ts @@ -11,13 +11,13 @@ export type UniversalProfilesWalletOptions = DefaultWalletOptions; export const universalProfilesWallet = ({ projectId, walletConnectParameters, -}: UniversalProfilesWalletOptions): Wallet => { +}: UniversalProfilesWalletOptions) => { const isInjected = hasInjectedProvider({ namespace: 'lukso' }); // const isInjected = typeof window !== "undefined" && !!(window as any).lukso; const shouldUseWalletConnect = !isInjected; return { - id: 'universal-profiles', + id: 'universal-profiles' as const, name: 'Universal Profiles', rdns: 'io.universaleverything.universalprofiles', iconUrl: async () => @@ -96,5 +96,5 @@ export const universalProfilesWallet = ({ : getInjectedConnector({ namespace: 'lukso', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/valoraWallet/valoraWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/valoraWallet/valoraWallet.ts index 9b81c66327..bd61853db7 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/valoraWallet/valoraWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/valoraWallet/valoraWallet.ts @@ -7,46 +7,47 @@ export type ValoraWalletOptions = DefaultWalletOptions; export const valoraWallet = ({ projectId, walletConnectParameters, -}: ValoraWalletOptions): Wallet => ({ - id: 'valora', - name: 'Valora', - iconUrl: async () => (await import('./valoraWallet.svg')).default, - iconBackground: '#FFFFFF', - downloadUrls: { - ios: 'https://apps.apple.com/app/id1520414263?mt=8', - android: 'https://play.google.com/store/apps/details?id=co.clabs.valora', - mobile: 'https://valora.xyz', - qrCode: 'https://valora.xyz', - }, - mobile: { - getUri: (uri: string) => - isAndroid() ? uri : `celo://wallet/wc?uri=${encodeURIComponent(uri)}`, - }, - qrCode: { - getUri: (uri: string) => uri, - instructions: { - learnMoreUrl: 'https://valora.xyz/', - steps: [ - { - description: 'wallet_connectors.valora.qr_code.step1.description', - step: 'install', - title: 'wallet_connectors.valora.qr_code.step1.title', - }, - { - description: 'wallet_connectors.valora.qr_code.step2.description', - step: 'create', - title: 'wallet_connectors.valora.qr_code.step2.title', - }, - { - description: 'wallet_connectors.valora.qr_code.step3.description', - step: 'scan', - title: 'wallet_connectors.valora.qr_code.step3.title', - }, - ], +}: ValoraWalletOptions) => + ({ + id: 'valora' as const, + name: 'Valora', + iconUrl: async () => (await import('./valoraWallet.svg')).default, + iconBackground: '#FFFFFF', + downloadUrls: { + ios: 'https://apps.apple.com/app/id1520414263?mt=8', + android: 'https://play.google.com/store/apps/details?id=co.clabs.valora', + mobile: 'https://valora.xyz', + qrCode: 'https://valora.xyz', }, - }, - createConnector: getWalletConnectConnector({ - projectId, - walletConnectParameters, - }), -}); + mobile: { + getUri: (uri: string) => + isAndroid() ? uri : `celo://wallet/wc?uri=${encodeURIComponent(uri)}`, + }, + qrCode: { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://valora.xyz/', + steps: [ + { + description: 'wallet_connectors.valora.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.valora.qr_code.step1.title', + }, + { + description: 'wallet_connectors.valora.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.valora.qr_code.step2.title', + }, + { + description: 'wallet_connectors.valora.qr_code.step3.description', + step: 'scan', + title: 'wallet_connectors.valora.qr_code.step3.title', + }, + ], + }, + }, + createConnector: getWalletConnectConnector({ + projectId, + walletConnectParameters, + }), + }) satisfies Wallet; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/walletConnectWallet/walletConnectWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/walletConnectWallet/walletConnectWallet.ts index 9a581a3965..e5c415a156 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/walletConnectWallet/walletConnectWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/walletConnectWallet/walletConnectWallet.ts @@ -9,11 +9,11 @@ export interface WalletConnectWalletOptions { export const walletConnectWallet = ({ projectId, options, -}: WalletConnectWalletOptions): Wallet => { +}: WalletConnectWalletOptions) => { const getUri = (uri: string) => uri; return { - id: 'walletConnect', + id: 'walletConnect' as const, name: 'WalletConnect', installed: undefined, iconUrl: async () => (await import('./walletConnectWallet.svg')).default, @@ -23,5 +23,5 @@ export const walletConnectWallet = ({ projectId, walletConnectParameters: options, }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/wigwamWallet/wigwamWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/wigwamWallet/wigwamWallet.ts index 8617cd10d9..4be6bb248a 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/wigwamWallet/wigwamWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/wigwamWallet/wigwamWallet.ts @@ -4,9 +4,9 @@ import { hasInjectedProvider, } from '../../getInjectedConnector'; -export const wigwamWallet = (): Wallet => { +export const wigwamWallet = () => { return { - id: 'wigwam', + id: 'wigwam' as const, name: 'Wigwam', rdns: 'com.wigwam.wallet', iconBackground: '#80EF6E', @@ -46,5 +46,5 @@ export const wigwamWallet = (): Wallet => { namespace: 'wigwamEthereum', flag: 'isWigwam', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/xPortalWallet/xPortalWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/xPortalWallet/xPortalWallet.ts index 13c5296715..7b8003af06 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/xPortalWallet/xPortalWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/xPortalWallet/xPortalWallet.ts @@ -12,7 +12,7 @@ export type XPortalWalletOptions = DefaultWalletOptions; export const xPortalWallet = ({ projectId, walletConnectParameters, -}: XPortalWalletOptions): Wallet => { +}: XPortalWalletOptions) => { const isXPortalInjected = hasInjectedProvider({ flag: 'isxPortal', }); @@ -23,7 +23,7 @@ export const xPortalWallet = ({ }; return { - id: 'xportal', + id: 'xportal' as const, name: 'xPortal', rdns: 'com.elrond.maiar.wallet', iconUrl: async () => (await import('./xPortalWallet.svg')).default, @@ -76,5 +76,5 @@ export const xPortalWallet = ({ : getInjectedConnector({ flag: 'isxPortal', }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/zealWallet/zealWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/zealWallet/zealWallet.ts index 759afa184e..9174f357fc 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/zealWallet/zealWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/zealWallet/zealWallet.ts @@ -10,13 +10,13 @@ export type ZealWalletOptions = DefaultWalletOptions; export const zealWallet = ({ projectId, walletConnectParameters, -}: ZealWalletOptions): Wallet => { +}: ZealWalletOptions) => { const isZealWalletInjected = hasInjectedProvider({ flag: 'isZeal' }); const shouldUseWalletConnect = !isZealWalletInjected; return { - id: 'zeal', + id: 'zeal' as const, name: 'Zeal', rdns: 'app.zeal', iconUrl: async () => (await import('./zealWallet.svg')).default, @@ -91,5 +91,5 @@ export const zealWallet = ({ walletConnectParameters, }) : getInjectedConnector({ flag: 'isZeal' }), - }; + } satisfies Wallet; }; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/zerionWallet/zerionWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/zerionWallet/zerionWallet.ts index b5ed7552ad..9dede20257 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/zerionWallet/zerionWallet.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/zerionWallet/zerionWallet.ts @@ -12,7 +12,7 @@ export type ZerionWalletOptions = DefaultWalletOptions; export const zerionWallet = ({ projectId, walletConnectParameters, -}: ZerionWalletOptions): Wallet => { +}: ZerionWalletOptions) => { const isZerionInjected = hasInjectedProvider({ namespace: 'zerionWallet', flag: 'isZerion', @@ -24,7 +24,7 @@ export const zerionWallet = ({ }; return { - id: 'zerion', + id: 'zerion' as const, name: 'Zerion', rdns: 'io.zerion.wallet', iconUrl: async () => (await import('./zerionWallet.svg')).default, @@ -104,5 +104,5 @@ export const zerionWallet = ({ namespace: 'zerionWallet', flag: 'isZerion', }), - }; + } satisfies Wallet; };