Skip to content

Commit

Permalink
feat: zealWallet support (#1504)
Browse files Browse the repository at this point in the history
* Add Zeal wallet

* Remove @ts-expect-error

* fix: migration to i18n, rebase fixes

* fix: changeset

* fix: icon

---------

Co-authored-by: Daniel Sinclair <d@niel.nyc>
  • Loading branch information
masm and DanielSinclair authored Oct 15, 2023
1 parent 924d776 commit 2c8abbb
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .changeset/ten-goats-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@rainbow-me/rainbowkit': patch
---

Zeal Support

**Example usage**

```ts
import {
getDefaultWallets,
connectorsForWallets,
} from '@rainbow-me/rainbowkit';
import { zealWallet } from '@rainbow-me/rainbowkit/wallets';
const { wallets } = getDefaultWallets({ appName, chains });
const connectors = connectorsForWallets([
...wallets,
{
groupName: 'Other',
wallets: [zealWallet({ chains })],
},
]);
```
2 changes: 2 additions & 0 deletions packages/example/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
trustWallet,
uniswapWallet,
xdefiWallet,
zealWallet,
zerionWallet,
} from '@rainbow-me/rainbowkit/wallets';

Expand Down Expand Up @@ -136,6 +137,7 @@ const connectors = connectorsForWallets([
trustWallet({ chains, projectId }),
uniswapWallet({ chains, projectId }),
xdefiWallet({ chains }),
zealWallet({ chains }),
zerionWallet({ chains, projectId }),
],
},
Expand Down
17 changes: 17 additions & 0 deletions packages/rainbowkit/src/locales/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,23 @@
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},

"zeal": {
"extension": {
"step1": {
"title": "Install the Zeal extension",
"description": "We recommend pinning Zeal to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import 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."
}
}
}
}
}
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 @@ -31,6 +31,7 @@ import { trustWallet } from './trustWallet/trustWallet';
import { uniswapWallet } from './uniswapWallet/uniswapWallet';
import { walletConnectWallet } from './walletConnectWallet/walletConnectWallet';
import { xdefiWallet } from './xdefiWallet/xdefiWallet';
import { zealWallet } from './zealWallet/zealWallet';
import { zerionWallet } from './zerionWallet/zerionWallet';

export {
Expand Down Expand Up @@ -68,5 +69,6 @@ export {
uniswapWallet,
walletConnectWallet,
xdefiWallet,
zealWallet,
zerionWallet,
};
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function isMetaMask(ethereum?: typeof window['ethereum']): boolean {
if (ethereum.isTokenary) return false;
if (ethereum.isTrust || ethereum.isTrustWallet) return false;
if (ethereum.isXDEFI) return false;
if (ethereum.isZeal) return false;
if (ethereum.isZerion) return false;
return true;
}
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,51 @@
import type { InjectedConnectorOptions } from '@wagmi/core/connectors/injected';
import { InjectedConnector } from 'wagmi/connectors/injected';
import { Chain } from '../../../components/RainbowKitProvider/RainbowKitChainContext';
import { Wallet } from '../../Wallet';
import { hasInjectedProvider } from '../../getInjectedConnector';

export interface ZealWalletOptions {
chains: Chain[];
}

export const zealWallet = ({
chains,
...options
}: ZealWalletOptions & InjectedConnectorOptions): Wallet => ({
id: 'zeal',
name: 'Zeal',
iconUrl: async () => (await import('./zealWallet.svg')).default,
iconBackground: '#fff0',
installed: hasInjectedProvider('isZeal'),
downloadUrls: {
browserExtension: 'https://zeal.app',
},
createConnector: () => ({
connector: new InjectedConnector({
chains,
options,
}),
extension: {
instructions: {
learnMoreUrl: 'https://zeal.app/',
steps: [
{
description: 'wallet_connectors.zeal.extension.step1.description',
step: 'install',
title: 'wallet_connectors.zeal.extension.step1.title',
},
{
description: 'wallet_connectors.zeal.extension.step2.description',
step: 'create',
title: 'wallet_connectors.zeal.extension.step2.title',
},
{
description: 'wallet_connectors.zeal.extension.step3.description',
step: 'refresh',
title: 'wallet_connectors.zeal.extension.step3.title',
},
],
},
},
}),
});
10 changes: 10 additions & 0 deletions site/data/docs/custom-wallet-list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,16 @@ xdefiWallet(options: {
});
```

#### Zeal

```tsx
import { zealWallet } from '@rainbow-me/rainbowkit/wallets';

zealWallet(options: {
chains: Chain[];
});
```

#### Zerion

```tsx
Expand Down

2 comments on commit 2c8abbb

@vercel
Copy link

@vercel vercel bot commented on 2c8abbb Oct 15, 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 2c8abbb Oct 15, 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.