Skip to content

Commit

Permalink
feat: tokenaryWallet support (#1596)
Browse files Browse the repository at this point in the history
* add tokenary

* fix tokenaryWallet

* Update tokenaryWallet.ts

* fix: tokenary

* chore: changeset

* revert: duplicate isTokenary check

* fix: tokenary metadata

* chore: minify/resize svg icon

* fix: iconBackground

* fix: safari desktop download url

* fix: safari check for tokenary

* fix: missing qrcode url

---------

Co-authored-by: Daniel Sinclair <d@niel.nyc>
  • Loading branch information
grachyov and DanielSinclair committed Nov 20, 2023
1 parent 899c602 commit 74ead9d
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .changeset/chilled-bugs-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@rainbow-me/rainbowkit': patch
---

Tokenary Support

**Example usage**

```ts
import {
getDefaultWallets,
connectorsForWallets,
} from '@rainbow-me/rainbowkit';
import { tokenaryWallet } from '@rainbow-me/rainbowkit/wallets';
const { wallets } = getDefaultWallets({ appName, chains });
const connectors = connectorsForWallets([
...wallets,
{
groupName: 'Other',
wallets: [tokenaryWallet({ chains })],
},
]);
```
2 changes: 2 additions & 0 deletions packages/example/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
tahoWallet,
talismanWallet,
tokenPocketWallet,
tokenaryWallet,
trustWallet,
uniswapWallet,
xdefiWallet,
Expand Down Expand Up @@ -143,6 +144,7 @@ const connectors = connectorsForWallets([
subWallet({ chains, projectId }),
tahoWallet({ chains }),
talismanWallet({ chains }),
tokenaryWallet({ chains }),
tokenPocketWallet({ chains, projectId }),
trustWallet({ chains, projectId }),
uniswapWallet({ 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 @@ -32,6 +32,7 @@ import { subWallet } from './subWallet/subWallet';
import { tahoWallet } from './tahoWallet/tahoWallet';
import { talismanWallet } from './talismanWallet/talismanWallet';
import { tokenPocketWallet } from './tokenPocketWallet/tokenPocketWallet';
import { tokenaryWallet } from './tokenaryWallet/tokenaryWallet';
import { trustWallet } from './trustWallet/trustWallet';
import { uniswapWallet } from './uniswapWallet/uniswapWallet';
import { walletConnectWallet } from './walletConnectWallet/walletConnectWallet';
Expand Down Expand Up @@ -74,6 +75,7 @@ export {
subWallet,
tahoWallet,
talismanWallet,
tokenaryWallet,
tokenPocketWallet,
trustWallet,
uniswapWallet,
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,37 @@
import type { InjectedConnectorOptions } from '@wagmi/core/connectors/injected';
import { InjectedConnector } from 'wagmi/connectors/injected';
import { Chain } from '../../../components/RainbowKitProvider/RainbowKitChainContext';
import { isSafari } from '../../../utils/browsers';
import { Wallet } from '../../Wallet';

export interface TokenaryWalletOptions {
chains: Chain[];
}

export const tokenaryWallet = ({
chains,
...options
}: TokenaryWalletOptions & InjectedConnectorOptions): Wallet => ({
id: 'tokenary',
name: 'Tokenary',
iconUrl: async () => (await import('./tokenaryWallet.svg')).default,
iconBackground: '#ffffff',
installed:
typeof window !== 'undefined' &&
typeof window.ethereum !== 'undefined' &&
window.ethereum.isTokenary,
hidden: () => !isSafari(),
downloadUrls: {
ios: 'https://tokenary.io/get',
mobile: 'https://tokenary.io',
qrCode: 'https://tokenary.io/get',
safari: 'https://tokenary.io/get',
browserExtension: 'https://tokenary.io/get',
},
createConnector: () => ({
connector: new InjectedConnector({
chains,
options,
}),
}),
});
10 changes: 10 additions & 0 deletions site/data/en-US/docs/custom-wallet-list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,16 @@ talismanWallet(options: {
});
```

#### Tokenary

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

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

#### TokenPocket

```tsx
Expand Down

2 comments on commit 74ead9d

@vercel
Copy link

@vercel vercel bot commented on 74ead9d Nov 20, 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 74ead9d Nov 20, 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.