From f93cd0e285f115f654b6b8e037ff8500fa8facf6 Mon Sep 17 00:00:00 2001 From: proinsights Date: Thu, 26 Sep 2024 06:50:24 +0100 Subject: [PATCH] feat: paraSwapWallet connector (#2189) * feat: paraSwapWallet * chore: prettify * chore: prettify * chore: fix linting --------- Co-authored-by: proinsights --- .changeset/calm-spies-yell.md | 5 ++ packages/example/src/wagmi.ts | 2 + packages/rainbowkit/src/locales/en_US.json | 17 ++++++ .../src/wallets/walletConnectors/index.ts | 2 + .../paraSwapWallet/paraSwapWallet.svg | 1 + .../paraSwapWallet/paraswapWallet.ts | 52 +++++++++++++++++++ site/data/en-US/docs/custom-wallet-list.mdx | 6 +++ 7 files changed, 85 insertions(+) create mode 100644 .changeset/calm-spies-yell.md create mode 100644 packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraSwapWallet.svg create mode 100644 packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraswapWallet.ts diff --git a/.changeset/calm-spies-yell.md b/.changeset/calm-spies-yell.md new file mode 100644 index 000000000..2f70de950 --- /dev/null +++ b/.changeset/calm-spies-yell.md @@ -0,0 +1,5 @@ +--- +"@rainbow-me/rainbowkit": patch +--- + +Added ParaSwap Wallet support with `paraSwapWallet` wallet connector diff --git a/packages/example/src/wagmi.ts b/packages/example/src/wagmi.ts index 8b74e5d64..139c9c0aa 100644 --- a/packages/example/src/wagmi.ts +++ b/packages/example/src/wagmi.ts @@ -36,6 +36,7 @@ import { omniWallet, oneInchWallet, oneKeyWallet, + paraSwapWallet, phantomWallet, rabbyWallet, rainbowWallet, @@ -216,6 +217,7 @@ export const config = getDefaultConfig({ omniWallet, oneInchWallet, oneKeyWallet, + paraSwapWallet, phantomWallet, rabbyWallet, ramperWallet, diff --git a/packages/rainbowkit/src/locales/en_US.json b/packages/rainbowkit/src/locales/en_US.json index 9063f5e95..724229b11 100644 --- a/packages/rainbowkit/src/locales/en_US.json +++ b/packages/rainbowkit/src/locales/en_US.json @@ -997,6 +997,23 @@ } }, + "paraswap": { + "qr_code": { + "step1": { + "title": "Open the ParaSwap app", + "description": "Add ParaSwap Wallet to your home screen for faster access to your wallet." + }, + "step2": { + "title": "Create or Import a Wallet", + "description": "Create a new wallet or import an existing one." + }, + "step3": { + "title": "Tap the QR icon and scan", + "description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect." + } + } + }, + "phantom": { "extension": { "step1": { diff --git a/packages/rainbowkit/src/wallets/walletConnectors/index.ts b/packages/rainbowkit/src/wallets/walletConnectors/index.ts index 21d8ac198..b8593430d 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/index.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/index.ts @@ -36,6 +36,7 @@ import { okxWallet } from './okxWallet/okxWallet'; import { omniWallet } from './omniWallet/omniWallet'; import { oneInchWallet } from './oneInchWallet/oneInchWallet'; import { oneKeyWallet } from './oneKeyWallet/oneKeyWallet'; +import { paraSwapWallet } from './paraSwapWallet/paraswapWallet'; import { phantomWallet } from './phantomWallet/phantomWallet'; import { rabbyWallet } from './rabbyWallet/rabbyWallet'; import { rainbowWallet } from './rainbowWallet/rainbowWallet'; @@ -97,6 +98,7 @@ export { omniWallet, oneInchWallet, oneKeyWallet, + paraSwapWallet, phantomWallet, rabbyWallet, rainbowWallet, diff --git a/packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraSwapWallet.svg b/packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraSwapWallet.svg new file mode 100644 index 000000000..47857f798 --- /dev/null +++ b/packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraSwapWallet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraswapWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraswapWallet.ts new file mode 100644 index 000000000..1bef05ad3 --- /dev/null +++ b/packages/rainbowkit/src/wallets/walletConnectors/paraSwapWallet/paraswapWallet.ts @@ -0,0 +1,52 @@ +import type { Wallet } from '../../Wallet'; +import type { DefaultWalletOptions } from '../../Wallet'; +import { getWalletConnectConnector } from '../../getWalletConnectConnector'; + +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)}`; + }, + }, + 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, + }), +}); diff --git a/site/data/en-US/docs/custom-wallet-list.mdx b/site/data/en-US/docs/custom-wallet-list.mdx index a6e95bfcc..5c1d8397f 100644 --- a/site/data/en-US/docs/custom-wallet-list.mdx +++ b/site/data/en-US/docs/custom-wallet-list.mdx @@ -307,6 +307,12 @@ import { omniWallet } from '@rainbow-me/rainbowkit/wallets'; import { oneKeyWallet } from '@rainbow-me/rainbowkit/wallets'; ``` +#### ParaSwap + +```tsx +import { paraSwapWallet } from '@rainbow-me/rainbowkit/wallets'; +``` + #### Phantom ```tsx