Skip to content

Commit

Permalink
feat: add safeheron wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
ty committed Apr 19, 2023
1 parent 4bbaac1 commit e4d48c3
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 0 deletions.
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 Wallet 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 })],
},
]);
```
2 changes: 2 additions & 0 deletions packages/example/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
mewWallet,
okxWallet,
omniWallet,
safeheronWallet,
tahoWallet,
trustWallet,
zerionWallet,
Expand Down Expand Up @@ -93,6 +94,7 @@ const connectors = connectorsForWallets([
mewWallet({ chains }),
okxWallet({ chains, projectId }),
omniWallet({ chains, projectId }),
safeheronWallet({ chains }),
tahoWallet({ chains }),
trustWallet({ chains, projectId }),
zerionWallet({ chains, projectId }),
Expand Down
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 @@ -12,6 +12,7 @@ import { okxWallet } from './okxWallet/okxWallet';
import { omniWallet } from './omniWallet/omniWallet';
import { rainbowWallet } from './rainbowWallet/rainbowWallet';
import { safeWallet } from './safeWallet/safeWallet';
import { safeheronWallet } from './safeheronWallet/safeheronWallet';
import { tahoWallet } from './tahoWallet/tahoWallet';
import { trustWallet } from './trustWallet/trustWallet';
import { walletConnectWallet } from './walletConnectWallet/walletConnectWallet';
Expand All @@ -31,6 +32,7 @@ export {
omniWallet,
rainbowWallet,
safeWallet,
safeheronWallet,
tahoWallet,
trustWallet,
okxWallet,
Expand Down
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,43 @@
/* eslint-disable sort-keys-fix/sort-keys-fix */
import type { InjectedConnectorOptions } from '@wagmi/core/dist/connectors/injected';
import { InjectedConnector } from 'wagmi/connectors/injected';
import { Chain } from '../../../components/RainbowKitProvider/RainbowKitChainContext';
import { Wallet } from '../../Wallet';

export interface SafeheronWalletOptions {
chains: Chain[];
}

declare global {
interface Window {
safeheron: any;
}
}

export const safeheronWallet = ({
chains,
...options
}: SafeheronWalletOptions & InjectedConnectorOptions): Wallet => ({
id: 'safeheron',
name: 'Safeheron',
installed:
typeof window !== 'undefined' &&
typeof window.safeheron !== 'undefined' &&
(window.safeheron as any).isSafeheron === true,
iconUrl: async () => (await import('./safeheronWallet.svg')).default,
iconBackground: '#fff',
downloadUrls: {
browserExtension:
'https://chrome.google.com/webstore/detail/safeheron/aiaghdjafpiofpainifbgfgjfpclngoh',
},
createConnector: () => ({
connector: new InjectedConnector({
chains,
options: {
getProvider: () =>
typeof window !== 'undefined' ? window.safeheron : undefined,
...options,
},
}),
}),
});
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 @@ -243,6 +243,16 @@ safeWallet(options: {
});
```

#### Safeheron

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

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

#### Taho

```tsx
Expand Down

0 comments on commit e4d48c3

Please sign in to comment.