From 9c36bfdc1139998207eafc733ed72e595a62218a Mon Sep 17 00:00:00 2001 From: 0oooooooo0 <121there@gmail.com> Date: Tue, 20 Aug 2024 04:00:10 +0900 Subject: [PATCH] feat: add kaia wallet (#2148) * feat: add kaia wallet * chore: changeset * fix: lint --------- Co-authored-by: Daniel Sinclair --- .changeset/poor-lemons-check.md | 5 + packages/example/src/wagmi.ts | 10 +- packages/rainbowkit/src/locales/en_US.json | 31 ++++++ .../src/wallets/walletConnectors/index.ts | 6 +- .../kaiaWallet/kaiaWallet.svg | 16 ++++ .../walletConnectors/kaiaWallet/kaiaWallet.ts | 96 +++++++++++++++++++ site/data/en-US/docs/custom-wallet-list.mdx | 72 +++++++------- 7 files changed, 197 insertions(+), 39 deletions(-) create mode 100644 .changeset/poor-lemons-check.md create mode 100644 packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.svg create mode 100644 packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.ts diff --git a/.changeset/poor-lemons-check.md b/.changeset/poor-lemons-check.md new file mode 100644 index 0000000000..18157c0645 --- /dev/null +++ b/.changeset/poor-lemons-check.md @@ -0,0 +1,5 @@ +--- +"@rainbow-me/rainbowkit": patch +--- + +Added Kaia Wallet support with `kaiaWallet` wallet connector diff --git a/packages/example/src/wagmi.ts b/packages/example/src/wagmi.ts index f4fa146220..4db20b523c 100644 --- a/packages/example/src/wagmi.ts +++ b/packages/example/src/wagmi.ts @@ -22,6 +22,7 @@ import { gateWallet, imTokenWallet, iopayWallet, + kaiaWallet, kaikasWallet, krakenWallet, kresusWallet, @@ -182,15 +183,15 @@ export const config = getDefaultConfig({ wallets: [ argentWallet, bifrostWallet, + binanceWallet, bitgetWallet, bitskiWallet, bitverseWallet, bloomWallet, bybitWallet, - binanceWallet, clvWallet, - compassWallet, coin98Wallet, + compassWallet, coreWallet, dawnWallet, desigWallet, @@ -201,9 +202,10 @@ export const config = getDefaultConfig({ gateWallet, imTokenWallet, iopayWallet, - kresusWallet, - krakenWallet, + kaiaWallet, kaikasWallet, + krakenWallet, + kresusWallet, ledgerWallet, magicEdenWallet, mewWallet, diff --git a/packages/rainbowkit/src/locales/en_US.json b/packages/rainbowkit/src/locales/en_US.json index e56759f591..69fcb9cd8a 100644 --- a/packages/rainbowkit/src/locales/en_US.json +++ b/packages/rainbowkit/src/locales/en_US.json @@ -633,6 +633,37 @@ } }, + "kaia": { + "extension": { + "step1": { + "description": "We recommend pinning Kaia to your taskbar for quicker access to your wallet.", + "title": "Install the Kaia extension" + }, + "step2": { + "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.", + "title": "Create or Import a Wallet" + }, + "step3": { + "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.", + "title": "Refresh your browser" + } + }, + "qr_code": { + "step1": { + "title": "Open the Kaia app", + "description": "Put Kaia app on 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 Scanner Icon in top right corner", + "description": "Choose New Connection, then scan the QR code and confirm the prompt to connect." + } + } + }, + "kraken": { "qr_code": { "step1": { diff --git a/packages/rainbowkit/src/wallets/walletConnectors/index.ts b/packages/rainbowkit/src/wallets/walletConnectors/index.ts index d6ebfc2aae..7e30b15de6 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/index.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/index.ts @@ -22,6 +22,7 @@ import { gateWallet } from './gateWallet/gateWallet'; import { imTokenWallet } from './imTokenWallet/imTokenWallet'; import { injectedWallet } from './injectedWallet/injectedWallet'; import { iopayWallet } from './iopayWallet/iopayWallet'; +import { kaiaWallet } from './kaiaWallet/kaiaWallet'; import { kaikasWallet } from './kaikasWallet/kaikasWallet'; import { krakenWallet } from './krakenWallet/krakenWallet'; import { kresusWallet } from './kresusWallet/kresusWallet'; @@ -59,13 +60,13 @@ import { zerionWallet } from './zerionWallet/zerionWallet'; export { argentWallet, bifrostWallet, + binanceWallet, bitgetWallet, bitskiWallet, bitverseWallet, bloomWallet, - bybitWallet, braveWallet, - binanceWallet, + bybitWallet, clvWallet, coin98Wallet, coinbaseWallet, @@ -81,6 +82,7 @@ export { imTokenWallet, injectedWallet, iopayWallet, + kaiaWallet, kaikasWallet, krakenWallet, kresusWallet, diff --git a/packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.svg b/packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.svg new file mode 100644 index 0000000000..476b582d51 --- /dev/null +++ b/packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.ts new file mode 100644 index 0000000000..ad0d84d062 --- /dev/null +++ b/packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.ts @@ -0,0 +1,96 @@ +import { DefaultWalletOptions, Wallet } from '../../Wallet'; +import { + getInjectedConnector, + hasInjectedProvider, +} from '../../getInjectedConnector'; +import { getWalletConnectConnector } from '../../getWalletConnectConnector'; + +export type KaiaWalletOptions = DefaultWalletOptions; + +export const kaiaWallet = ({ + projectId, + walletConnectParameters, +}: KaiaWalletOptions): Wallet => { + const isKaiaWalletInjected = hasInjectedProvider({ + namespace: 'klaytn', + }); + + const shouldUseWalletConnect = !isKaiaWalletInjected; + + const getUri = (uri: string) => { + return `kaikas://walletconnect?uri=${encodeURIComponent(uri)}`; + }; + + return { + id: 'kaia', + name: 'Kaia Wallet', + iconUrl: async () => (await import('./kaiaWallet.svg')).default, + installed: isKaiaWalletInjected || undefined, + iconBackground: '#fff', + downloadUrls: { + chrome: + 'https://chromewebstore.google.com/detail/kaia-wallet/jblndlipeogpafnldhgmapagcccfchpi', + browserExtension: 'https://app.kaiawallet.io', + qrCode: 'https://app.kaiawallet.io', + ios: 'https://apps.apple.com/us/app/kaia-wallet/id6502896387', + android: 'https://play.google.com/store/apps/details?id=io.klutch.wallet', + mobile: 'https://app.kaiawallet.io', + }, + mobile: { getUri: shouldUseWalletConnect ? getUri : undefined }, + qrCode: shouldUseWalletConnect + ? { + getUri: (uri: string) => uri, + instructions: { + learnMoreUrl: 'https://kaiawallet.io', + steps: [ + { + description: 'wallet_connectors.kaia.qr_code.step1.description', + step: 'install', + title: 'wallet_connectors.kaia.qr_code.step1.title', + }, + { + description: 'wallet_connectors.kaia.qr_code.step2.description', + step: 'create', + title: 'wallet_connectors.kaia.qr_code.step2.title', + }, + { + description: 'wallet_connectors.kaia.qr_code.step3.description', + step: 'refresh', + title: 'wallet_connectors.kaia.qr_code.step3.title', + }, + ], + }, + } + : undefined, + extension: { + instructions: { + learnMoreUrl: 'https://kaiawallet.io', + steps: [ + { + description: 'wallet_connectors.kaia.extension.step1.description', + step: 'install', + title: 'wallet_connectors.kaia.extension.step1.title', + }, + { + description: 'wallet_connectors.kaia.extension.step2.description', + step: 'create', + title: 'wallet_connectors.kaia.extension.step2.title', + }, + { + description: 'wallet_connectors.kaia.extension.step3.description', + step: 'refresh', + title: 'wallet_connectors.kaia.extension.step3.title', + }, + ], + }, + }, + createConnector: shouldUseWalletConnect + ? getWalletConnectConnector({ + projectId, + walletConnectParameters, + }) + : getInjectedConnector({ + namespace: 'klaytn', + }), + }; +}; diff --git a/site/data/en-US/docs/custom-wallet-list.mdx b/site/data/en-US/docs/custom-wallet-list.mdx index 65a2014ba2..c840a0e858 100644 --- a/site/data/en-US/docs/custom-wallet-list.mdx +++ b/site/data/en-US/docs/custom-wallet-list.mdx @@ -98,12 +98,24 @@ import { safeWallet } from '@rainbow-me/rainbowkit/wallets'; The following wallets are provided via the `wallet` object (in alphabetical order). +#### 1inch Wallet + +```tsx +import { oneInchWallet } from '@rainbow-me/rainbowkit/wallets'; +``` + #### Argent ```tsx import { argentWallet } from '@rainbow-me/rainbowkit/wallets'; ``` +#### Binance Web3 Wallet + +```tsx +import { binanceWallet } from '@rainbow-me/rainbowkit/wallets'; +``` + #### Bitget ```tsx @@ -134,22 +146,16 @@ import { bitverseWallet } from '@rainbow-me/rainbowkit/wallets'; import { bloomWallet } from '@rainbow-me/rainbowkit/wallets'; ``` -#### Bybit Wallet - -```tsx -import { bybitWallet } from '@rainbow-me/rainbowkit/wallets'; -``` - #### Brave Wallet ```tsx import { braveWallet } from '@rainbow-me/rainbowkit/wallets'; ``` -#### Binance Web3 Wallet +#### Bybit Wallet ```tsx -import { binanceWallet } from '@rainbow-me/rainbowkit/wallets'; +import { bybitWallet } from '@rainbow-me/rainbowkit/wallets'; ``` #### Coinbase @@ -169,16 +175,16 @@ import { coinbaseWallet } from '@rainbow-me/rainbowkit/wallets'; coinbaseWallet.preference = 'smartWalletOnly'; ``` -#### Compass Wallet +#### Coin98 Wallet ```tsx -import { compassWallet } from '@rainbow-me/rainbowkit/compassWallet'; +import { coin98Wallet } from '@rainbow-me/rainbowkit/wallets'; ``` -#### Coin98 Wallet +#### Compass Wallet ```tsx -import { coin98Wallet } from '@rainbow-me/rainbowkit/wallets'; +import { compassWallet } from '@rainbow-me/rainbowkit/compassWallet'; ``` #### Core @@ -223,12 +229,6 @@ import { frontierWallet } from '@rainbow-me/rainbowkit/wallets'; import { gateWallet } from '@rainbow-me/rainbowkit/wallets'; ``` -#### Ledger Live - -```tsx -import { ledgerWallet } from '@rainbow-me/rainbowkit/wallets'; -``` - #### imToken ```tsx @@ -241,6 +241,18 @@ import { imTokenWallet } from '@rainbow-me/rainbowkit/wallets'; import { iopayWallet } from '@rainbow-me/rainbowkit/wallets'; ``` +#### Kaia Wallet + +```tsx +import { kaiaWallet } from '@rainbow-me/rainbowkit/wallets'; +``` + +#### Kaikas + +```tsx +import { kaikasWallet } from '@rainbow-me/rainbowkit/wallets'; +``` + #### Kraken Wallet ```tsx @@ -253,10 +265,10 @@ import { krakenWallet } from '@rainbow-me/rainbowkit/wallets'; import { kresusWallet } from '@rainbow-me/rainbowkit/wallets'; ``` -#### Kaikas - -```tsx -import { kaikasWallet } from '@rainbow-me/rainbowkit/wallets'; +#### Ledger Live + +```tsx +import { ledgerWallet } from '@rainbow-me/rainbowkit/wallets'; ``` #### Magic Eden Wallet @@ -265,16 +277,16 @@ import { kaikasWallet } from '@rainbow-me/rainbowkit/wallets'; import { magicEdenWallet } from '@rainbow-me/rainbowkit/wallets'; ``` -#### MetaMask +#### MEW Wallet ```tsx -import { metaMaskWallet } from '@rainbow-me/rainbowkit/wallets'; +import { mewWallet } from '@rainbow-me/rainbowkit/wallets'; ``` -#### MEW Wallet +#### MetaMask ```tsx -import { mewWallet } from '@rainbow-me/rainbowkit/wallets'; +import { metaMaskWallet } from '@rainbow-me/rainbowkit/wallets'; ``` #### OKX Wallet @@ -289,12 +301,6 @@ import { okxWallet } from '@rainbow-me/rainbowkit/wallets'; import { omniWallet } from '@rainbow-me/rainbowkit/wallets'; ``` -#### 1inch Wallet - -```tsx -import { oneInchWallet } from '@rainbow-me/rainbowkit/wallets'; -``` - #### OneKey ```tsx @@ -468,4 +474,4 @@ const connectors = connectorsForWallets( ], { appName: 'RainbowKit App', projectId: 'YOUR_PROJECT_ID' }, ); -``` \ No newline at end of file +```