Skip to content

Commit

Permalink
feat: tahoWallet (#1077)
Browse files Browse the repository at this point in the history
* feat: add taho wallet connector

* chore: added changeset and cleaned up shimDisconnect pass-through

---------

Co-authored-by: Daniel Sinclair <d@niel.nyc>
  • Loading branch information
0xzoz and DanielSinclair authored Mar 30, 2023
1 parent 936b523 commit 6a01368
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .changeset/spotty-badgers-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@rainbow-me/rainbowkit': patch
---

Taho Support

**Example usage**

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

Expand Down Expand Up @@ -118,6 +119,7 @@ const connectors = connectorsForWallets([
mewWallet({ chains }),
okxWallet({ chains }),
omniWallet({ chains }),
tahoWallet({ chains }),
trustWallet({ chains }),
],
},
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 @@ -11,6 +11,7 @@ import { okxWallet } from './okxWallet/okxWallet';
import { omniWallet } from './omniWallet/omniWallet';
import { rainbowWallet } from './rainbowWallet/rainbowWallet';
import { safeWallet } from './safeWallet/safeWallet';
import { tahoWallet } from './tahoWallet/tahoWallet';
import { trustWallet } from './trustWallet/trustWallet';
import { walletConnectWallet } from './walletConnectWallet/walletConnectWallet';

Expand All @@ -27,6 +28,7 @@ export {
omniWallet,
rainbowWallet,
safeWallet,
tahoWallet,
trustWallet,
okxWallet,
walletConnectWallet,
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 @@
/* 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 { Wallet } from '../../Wallet';

export interface TahoWalletOptions {
chains: Chain[];
}

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

export const tahoWallet = ({
chains,
...options
}: TahoWalletOptions & InjectedConnectorOptions): Wallet => ({
id: 'taho',
name: 'Taho',
iconBackground: '#d08d57',
iconUrl: async () => (await import('./tahoWallet.svg')).default,
downloadUrls: {
browserExtension:
'https://chrome.google.com/webstore/detail/taho/eajafomhmkipbjmfmhebemolkcicgfmd',
},
installed:
typeof window !== 'undefined' &&
typeof window.tally !== 'undefined' &&
window['tally']
? true
: undefined,
createConnector: () => {
return {
connector: new InjectedConnector({
chains,
options: {
getProvider: () => {
const getTaho = (tally?: any) =>
tally?.isTally ? tally : undefined;
if (typeof window === 'undefined') return;
return getTaho(window.tally);
},
...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 @@ -225,6 +225,16 @@ safeWallet(options: {
});
```

#### Taho

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

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

#### Trust Wallet

```tsx
Expand Down

2 comments on commit 6a01368

@vercel
Copy link

@vercel vercel bot commented on 6a01368 Mar 30, 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 6a01368 Mar 30, 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.