diff --git a/.changeset/sour-lemons-dance.md b/.changeset/sour-lemons-dance.md new file mode 100644 index 0000000000..cee98585af --- /dev/null +++ b/.changeset/sour-lemons-dance.md @@ -0,0 +1,5 @@ +--- +"@rainbow-me/rainbowkit": patch +--- + +Added BeraSig support with `berasigWallet` wallet connector diff --git a/packages/example/src/wagmi.ts b/packages/example/src/wagmi.ts index 2c9f9d03cd..9a8cbb9a3f 100644 --- a/packages/example/src/wagmi.ts +++ b/packages/example/src/wagmi.ts @@ -1,6 +1,7 @@ import { type Chain, getDefaultConfig } from '@rainbow-me/rainbowkit'; import { argentWallet, + berasigWallet, bestWallet, bifrostWallet, binanceWallet, @@ -187,6 +188,7 @@ export const config = getDefaultConfig({ groupName: 'Other', wallets: [ argentWallet, + berasigWallet, bestWallet, bifrostWallet, binanceWallet, diff --git a/packages/rainbowkit/src/components/RainbowKitProvider/provideRainbowKitChains.ts b/packages/rainbowkit/src/components/RainbowKitProvider/provideRainbowKitChains.ts index 4f03fd93b2..31920b8d95 100644 --- a/packages/rainbowkit/src/components/RainbowKitProvider/provideRainbowKitChains.ts +++ b/packages/rainbowkit/src/components/RainbowKitProvider/provideRainbowKitChains.ts @@ -217,7 +217,7 @@ const chainMetadataByName: Record = { optimismKovan: { chainId: 69, ...optimismIcon }, optimismSepolia: { chainId: 11155420, ...optimismIcon }, polygon: { chainId: 137, name: 'Polygon', ...polygonIcon }, - polygonAmoy: {chainId: 80002, ... polygonIcon}, + polygonAmoy: { chainId: 80002, ...polygonIcon }, polygonMumbai: { chainId: 80_001, ...polygonIcon }, rinkeby: { chainId: 4, ...ethereumIcon }, ropsten: { chainId: 3, ...ethereumIcon }, diff --git a/packages/rainbowkit/src/locales/en_US.json b/packages/rainbowkit/src/locales/en_US.json index b2ac6761f5..feeb3a8dc3 100644 --- a/packages/rainbowkit/src/locales/en_US.json +++ b/packages/rainbowkit/src/locales/en_US.json @@ -243,6 +243,23 @@ } }, + "berasig": { + "extension": { + "step1": { + "title": "Install the BeraSig extension", + "description": "We recommend pinning BeraSig to your taskbar for easier access to your wallet." + }, + "step2": { + "title": "Create a Wallet", + "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone." + }, + "step3": { + "title": "Refresh your browser", + "description": "Once you set up your wallet, click below to refresh the browser and load up the extension." + } + } + }, + "best": { "qr_code": { "step1": { diff --git a/packages/rainbowkit/src/wallets/walletConnectors/berasigWallet/berasigWallet.svg b/packages/rainbowkit/src/wallets/walletConnectors/berasigWallet/berasigWallet.svg new file mode 100644 index 0000000000..1210ab45fe --- /dev/null +++ b/packages/rainbowkit/src/wallets/walletConnectors/berasigWallet/berasigWallet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/rainbowkit/src/wallets/walletConnectors/berasigWallet/berasigWallet.ts b/packages/rainbowkit/src/wallets/walletConnectors/berasigWallet/berasigWallet.ts new file mode 100644 index 0000000000..f2e72f8ddc --- /dev/null +++ b/packages/rainbowkit/src/wallets/walletConnectors/berasigWallet/berasigWallet.ts @@ -0,0 +1,67 @@ +import type { DefaultWalletOptions, Wallet } from '../../Wallet'; +import { + getInjectedConnector, + hasInjectedProvider, +} from '../../getInjectedConnector'; +import { getWalletConnectConnector } from '../../getWalletConnectConnector'; + +export type BerasigWalletOptions = DefaultWalletOptions; + +export const berasigWallet = ({ + projectId, + walletConnectParameters, +}: BerasigWalletOptions): Wallet => { + const isBerasigWalletInjected = hasInjectedProvider({ + namespace: 'berasig.ethereum', + }); + + const shouldUseWalletConnect = !isBerasigWalletInjected; + return { + id: 'berasig', + name: 'BeraSig', + iconUrl: async () => (await import('./berasigWallet.svg')).default, + iconBackground: '#ffffff', + installed: isBerasigWalletInjected, + downloadUrls: { + android: 'https://play.google.com/store/apps/details?id=io.berasig.ios', + ios: 'https://apps.apple.com/us/app/berasig-wallet-on-berachain/id6502052535', + qrCode: 'https://berasig.com', + mobile: 'https://berasig.com', + browserExtension: + 'https://chromewebstore.google.com/detail/berasig/ckedkkegjbflcfblcjklibnedmfjppbj', + }, + extension: { + instructions: { + steps: [ + { + description: + 'wallet_connectors.berasig.extension.step1.description', + step: 'install', + title: 'wallet_connectors.berasig.extension.step1.title', + }, + { + description: + 'wallet_connectors.berasig.extension.step2.description', + step: 'create', + title: 'wallet_connectors.berasig.extension.step2.title', + }, + { + description: + 'wallet_connectors.berasig.extension.step3.description', + step: 'refresh', + title: 'wallet_connectors.berasig.extension.step3.title', + }, + ], + learnMoreUrl: 'https://berasig.com', + }, + }, + createConnector: shouldUseWalletConnect + ? getWalletConnectConnector({ + projectId, + walletConnectParameters, + }) + : getInjectedConnector({ + namespace: 'berasig.ethereum', + }), + }; +}; diff --git a/packages/rainbowkit/src/wallets/walletConnectors/index.ts b/packages/rainbowkit/src/wallets/walletConnectors/index.ts index 5cc31ce6ab..60ad42fba8 100644 --- a/packages/rainbowkit/src/wallets/walletConnectors/index.ts +++ b/packages/rainbowkit/src/wallets/walletConnectors/index.ts @@ -1,4 +1,5 @@ import { argentWallet } from './argentWallet/argentWallet'; +import { berasigWallet } from './berasigWallet/berasigWallet'; import { bestWallet } from './bestWallet/bestWallet'; import { bifrostWallet } from './bifrostWallet/bifrostWallet'; import { binanceWallet } from './binanceWallet/binanceWallet'; @@ -63,6 +64,7 @@ import { zerionWallet } from './zerionWallet/zerionWallet'; export { argentWallet, + berasigWallet, bestWallet, bifrostWallet, binanceWallet, diff --git a/site/data/en-US/docs/custom-wallet-list.mdx b/site/data/en-US/docs/custom-wallet-list.mdx index 8c47281cef..4dfdda4af3 100644 --- a/site/data/en-US/docs/custom-wallet-list.mdx +++ b/site/data/en-US/docs/custom-wallet-list.mdx @@ -110,6 +110,12 @@ import { oneInchWallet } from '@rainbow-me/rainbowkit/wallets'; import { argentWallet } from '@rainbow-me/rainbowkit/wallets'; ``` +#### BeraSig + +```tsx +import { berasigWallet } from '@rainbow-me/rainbowkit/wallets'; +``` + #### Best Wallet ```tsx