Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSinclair authored Jul 13, 2023
2 parents ac4005d + 66e8423 commit d6876ca
Show file tree
Hide file tree
Showing 18 changed files with 607 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .changeset/selfish-actors-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@rainbow-me/rainbowkit': patch
---

Talisman Support

**Example usage**

```ts
import {
getDefaultWallets,
connectorsForWallets,
} from '@rainbow-me/rainbowkit';
import { talismanWallet } from '@rainbow-me/rainbowkit/wallets';
const { wallets } = getDefaultWallets({ appName, chains });
const connectors = connectorsForWallets([
...wallets,
{
groupName: 'Other',
wallets: [talismanWallet({ projectId, chains })],
},
]);
```
23 changes: 23 additions & 0 deletions .changeset/shaggy-cameras-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@rainbow-me/rainbowkit': patch
---

Safeheron Support

**Example usage**

```ts
import {
getDefaultWallets,
connectorsForWallets,
} from '@rainbow-me/rainbowkit';
import { safeheronWallet } from '@rainbow-me/rainbowkit/wallets';
const { wallets } = getDefaultWallets({ appName, chains });
const connectors = connectorsForWallets([
...wallets,
{
groupName: 'Other',
wallets: [safeheronWallet({ chains })],
},
]);
```
23 changes: 23 additions & 0 deletions .changeset/short-follow-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@rainbow-me/rainbowkit': patch
---

Frontier Wallet Support

**Example usage**

```ts
import {
getDefaultWallets,
connectorsForWallets,
} from '@rainbow-me/rainbowkit';
import { frontierWallet } from '@rainbow-me/rainbowkit/wallets';
const { wallets } = getDefaultWallets({ appName, chains });
const connectors = connectorsForWallets([
...wallets,
{
groupName: 'Other',
wallets: [frontierWallet({ projectId, chains })],
},
]);
```
23 changes: 23 additions & 0 deletions .changeset/swift-news-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@rainbow-me/rainbowkit': patch
---

BitKeep Support

**Example usage**

```ts
import {
getDefaultWallets,
connectorsForWallets,
} from '@rainbow-me/rainbowkit';
import { bitKeepWallet } from '@rainbow-me/rainbowkit/wallets';
const { wallets } = getDefaultWallets({ appName, projectId, chains });
const connectors = connectorsForWallets([
...wallets,
{
groupName: 'Other',
wallets: [bitKeepWallet({ projectId, chains })],
},
]);
```
8 changes: 8 additions & 0 deletions packages/example/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ import {
} from '@rainbow-me/rainbowkit';
import {
argentWallet,
bitKeepWallet,
bitskiWallet,
dawnWallet,
frontierWallet,
imTokenWallet,
ledgerWallet,
mewWallet,
okxWallet,
omniWallet,
phantomWallet,
rabbyWallet,
safeheronWallet,
tahoWallet,
talismanWallet,
tokenPocketWallet,
trustWallet,
xdefiWallet,
Expand Down Expand Up @@ -92,16 +96,20 @@ const connectors = connectorsForWallets([
groupName: 'Other',
wallets: [
argentWallet({ chains, projectId }),
bitKeepWallet({ chains, projectId }),
bitskiWallet({ chains }),
dawnWallet({ chains }),
frontierWallet({ chains, projectId }),
imTokenWallet({ chains, projectId }),
ledgerWallet({ chains, projectId }),
mewWallet({ chains }),
okxWallet({ chains, projectId }),
omniWallet({ chains, projectId }),
phantomWallet({ chains }),
rabbyWallet({ chains }),
safeheronWallet({ chains }),
tahoWallet({ chains }),
talismanWallet({ chains }),
tokenPocketWallet({ chains, projectId }),
trustWallet({ chains, projectId }),
xdefiWallet({ chains }),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/* eslint-disable sort-keys-fix/sort-keys-fix */
import type { InjectedConnectorOptions } from '@wagmi/core/connectors/injected';
import { InjectedConnector } from 'wagmi/connectors/injected';
import { Chain } from '../../../components/RainbowKitProvider/RainbowKitChainContext';
import { getWalletConnectUri } from '../../../utils/getWalletConnectUri';
import { isAndroid } from '../../../utils/isMobile';
import { Wallet } from '../../Wallet';
import { getWalletConnectConnector } from '../../getWalletConnectConnector';
import type {
WalletConnectConnectorOptions,
WalletConnectLegacyConnectorOptions,
} from '../../getWalletConnectConnector';

export interface BitKeepWalletLegacyOptions {
projectId?: string;
chains: Chain[];
walletConnectVersion: '1';
walletConnectOptions?: WalletConnectLegacyConnectorOptions;
}

export interface BitKeepWalletOptions {
projectId: string;
chains: Chain[];
walletConnectVersion?: '2';
walletConnectOptions?: WalletConnectConnectorOptions;
}

export const bitKeepWallet = ({
chains,
projectId,
walletConnectOptions,
walletConnectVersion = '2',
...options
}: (BitKeepWalletLegacyOptions | BitKeepWalletOptions) &
InjectedConnectorOptions): Wallet => {
const isBitKeepInjected =
typeof window !== 'undefined' &&
// @ts-expect-error
window.bitkeep !== undefined &&
// @ts-expect-error
window.bitkeep.ethereum !== undefined &&
// @ts-expect-error
window.bitkeep.ethereum.isBitKeep === true;

const shouldUseWalletConnect = !isBitKeepInjected;

return {
id: 'bitKeep',
name: 'BitKeep',
iconUrl: async () => (await import('./bitKeepWallet.svg')).default,
iconAccent: '#f6851a',
iconBackground: '#fff',
installed: !shouldUseWalletConnect ? isBitKeepInjected : undefined,
downloadUrls: {
android: 'https://bitkeep.com/en/download?type=2',
ios: 'https://apps.apple.com/app/bitkeep/id1395301115',
mobile: 'https://bitkeep.com/en/download?type=2',
qrCode: 'https://bitkeep.com/en/download',
chrome:
'https://chrome.google.com/webstore/detail/bitkeep-crypto-nft-wallet/jiidiaalihmmhddjgbnbgdfflelocpak',
browserExtension: 'https://bitkeep.com/en/download',
},

createConnector: () => {
const connector = shouldUseWalletConnect
? getWalletConnectConnector({
chains,
options: walletConnectOptions,
projectId,
version: walletConnectVersion,
})
: new InjectedConnector({
chains,
options: {
// @ts-expect-error
getProvider: () => window.bitkeep.ethereum,
...options,
},
});

const getUri = async () => {
const uri = await getWalletConnectUri(connector, walletConnectVersion);

return isAndroid()
? uri
: `bitkeep://wc?uri=${encodeURIComponent(uri)}`;
};

return {
connector,
extension: {
instructions: {
learnMoreUrl: 'https://study.bitkeep.com',
steps: [
{
description:
'We recommend pinning BitKeep to your taskbar for quicker access to your wallet.',
step: 'install',
title: 'Install the BitKeep extension',
},
{
description:
'Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.',
step: 'create',
title: 'Create or Import a Wallet',
},
{
description:
'Once you set up your wallet, click below to refresh the browser and load up the extension.',
step: 'refresh',
title: 'Refresh your browser',
},
],
},
},
mobile: {
getUri: shouldUseWalletConnect ? getUri : undefined,
},
qrCode: shouldUseWalletConnect
? {
getUri: async () =>
getWalletConnectUri(connector, walletConnectVersion),
instructions: {
learnMoreUrl: 'https://study.bitkeep.com',
steps: [
{
description:
'We recommend putting BitKeep on your home screen for quicker access.',
step: 'install',
title: 'Open the BitKeep app',
},
{
description:
'Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.',
step: 'create',
title: 'Create or Import a Wallet',
},
{
description:
'After you scan, a connection prompt will appear for you to connect your wallet.',
step: 'scan',
title: 'Tap the scan button',
},
],
},
}
: undefined,
};
},
};
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d6876ca

Please sign in to comment.