-
Notifications
You must be signed in to change notification settings - Fork 689
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
e7ae257
commit c434ca7
Showing
6 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 })], | ||
}, | ||
]); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/rainbowkit/src/wallets/walletConnectors/enkryptWallet/enkryptWallet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions
85
packages/rainbowkit/src/wallets/walletConnectors/enkryptWallet/enkryptWallet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c434ca7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rainbowkit-site – ./
rainbowkit.vercel.app
rainbowkit.com
rainbowkit-site-git-main-rainbowdotme.vercel.app
rainbowkit-site-rainbowdotme.vercel.app
www.rainbowkit.com
c434ca7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rainbowkit-example – ./
rainbowkit-example-rainbowdotme.vercel.app
rainbowkit-example-git-main-rainbowdotme.vercel.app
rainbowkit-example.vercel.app