Skip to content

Commit

Permalink
feat: enkryptWallet support (#1419)
Browse files Browse the repository at this point in the history
* feat: enkrypt wallet support

* fix: backticks

* chore: amend icon

* fix: amend icon colors

* test: check injection

* chore: revert

---------

Co-authored-by: Daniel Sinclair <[email protected]>
  • Loading branch information
kvhnuke and DanielSinclair authored Aug 22, 2023
1 parent e7ae257 commit c434ca7
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .changeset/good-gifts-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@rainbow-me/rainbowkit': patch
---

Enkrypt Wallet Support

**Example usage**

```ts
import {
getDefaultWallets,
connectorsForWallets,
} from '@rainbow-me/rainbowkit';
import { enkryptWallet } from '@rainbow-me/rainbowkit/wallets';
const { wallets } = getDefaultWallets({ appName, chains });
const connectors = connectorsForWallets([
...wallets,
{
groupName: 'Other',
wallets: [enkryptWallet({ chains })],
},
]);
```
2 changes: 2 additions & 0 deletions packages/example/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
coin98Wallet,
coreWallet,
dawnWallet,
enkryptWallet,
foxWallet,
frameWallet,
frontierWallet,
Expand Down Expand Up @@ -107,6 +108,7 @@ const connectors = connectorsForWallets([
coin98Wallet({ chains, projectId }),
coreWallet({ chains, projectId }),
dawnWallet({ chains }),
enkryptWallet({ chains }),
foxWallet({ chains, projectId }),
frameWallet({ chains }),
frontierWallet({ chains, projectId }),
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,85 @@
/* eslint-disable sort-keys-fix/sort-keys-fix */
import type { InjectedConnectorOptions } from '@wagmi/core';
import { InjectedConnector } from 'wagmi/connectors/injected';
import type { Chain } from '../../../components/RainbowKitProvider/RainbowKitChainContext';
import type { Wallet } from '../../Wallet';

declare global {
interface Window {
enkrypt: {
providers: {
ethereum: any;
};
};
}
}

export interface EnkryptWalletOptions {
chains: Chain[];
}

export const enkryptWallet = ({
chains,
...options
}: EnkryptWalletOptions & InjectedConnectorOptions): Wallet => {
const isEnkryptInjected =
typeof window !== 'undefined' &&
typeof window.enkrypt !== 'undefined' &&
window?.enkrypt?.providers?.ethereum;
return {
id: 'enkrypt',
name: 'Enkrypt Wallet',
installed: isEnkryptInjected ? true : undefined,
iconUrl: async () => (await import('./enkryptWallet.svg')).default,
iconBackground: '#FFFFFF',
downloadUrls: {
qrCode: 'https://www.enkrypt.com',
chrome:
'https://chrome.google.com/webstore/detail/enkrypt-ethereum-polkadot/kkpllkodjeloidieedojogacfhpaihoh',
browserExtension: 'https://www.enkrypt.com/',
edge: 'https://microsoftedge.microsoft.com/addons/detail/enkrypt-ethereum-polkad/gfenajajnjjmmdojhdjmnngomkhlnfjl',
firefox: 'https://addons.mozilla.org/en-US/firefox/addon/enkrypt/',
opera: 'https://addons.opera.com/en/extensions/details/enkrypt/',
safari: 'https://apps.apple.com/app/enkrypt-web3-wallet/id1640164309',
},
createConnector: () => {
return {
connector: new InjectedConnector({
chains,
options: {
getProvider: () =>
isEnkryptInjected
? window?.enkrypt?.providers?.ethereum
: undefined,
...options,
},
}),
extension: {
instructions: {
learnMoreUrl: 'https://blog.enkrypt.com/what-is-a-web3-wallet/',
steps: [
{
description:
'We recommend pinning Enkrypt Wallet to your taskbar for quicker access to your wallet.',
step: 'install',
title: 'Install the Enkrypt Wallet 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',
},
],
},
},
};
},
};
};
2 changes: 2 additions & 0 deletions packages/rainbowkit/src/wallets/walletConnectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { coin98Wallet } from './coin98Wallet/coin98Wallet';
import { coinbaseWallet } from './coinbaseWallet/coinbaseWallet';
import { coreWallet } from './coreWallet/coreWallet';
import { dawnWallet } from './dawnWallet/dawnWallet';
import { enkryptWallet } from './enkryptWallet/enkryptWallet';
import { foxWallet } from './foxWallet/foxWallet';
import { frameWallet } from './frameWallet/frameWallet';
import { frontierWallet } from './frontierWallet/frontierWallet';
Expand Down Expand Up @@ -41,6 +42,7 @@ export {
coinbaseWallet,
coreWallet,
dawnWallet,
enkryptWallet,
foxWallet,
frameWallet,
frontierWallet,
Expand Down
9 changes: 9 additions & 0 deletions site/data/docs/custom-wallet-list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ dawnWallet(options: {
});
```

#### Enkrypt Wallet

```tsx
import { enkryptWallet } from '@rainbow-me/rainbowkit/wallets';
enkryptWallet(options: {
chains: Chain[];
});
```

#### FoxWallet

```tsx
Expand Down

2 comments on commit c434ca7

@vercel
Copy link

@vercel vercel bot commented on c434ca7 Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on c434ca7 Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.