-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
imToken
to available wallet (#325)
* feat: add to available wallet * Update packages/rainbowkit/src/wallets/walletConnectors/imToken/imToken.ts Co-authored-by: Nick Beattie <nick@nickbytes.com> * chore: remove from coolmode docs * fix: use color instead of transparent * chore: update imtoken svg * chore: update imToken svg for site * chore: add changeset for imToken wallet Co-authored-by: Nick Beattie <nick@nickbytes.com>
- Loading branch information
Showing
8 changed files
with
108 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,5 @@ | ||
--- | ||
'@rainbow-me/rainbowkit': patch | ||
--- | ||
|
||
Adds imToken to available wallets |
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/imToken/imToken.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions
69
packages/rainbowkit/src/wallets/walletConnectors/imToken/imToken.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,69 @@ | ||
/* eslint-disable sort-keys-fix/sort-keys-fix */ | ||
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect'; | ||
import { Chain } from '../../../components/RainbowKitProvider/RainbowKitChainContext'; | ||
import { rpcUrlsForChains } from '../../../utils/rpcUrlsForChains'; | ||
import { Wallet } from '../../Wallet'; | ||
|
||
export interface ImTokenOptions { | ||
chains: Chain[]; | ||
} | ||
|
||
export const imToken = ({ chains }: ImTokenOptions): Wallet => ({ | ||
id: 'imToken', | ||
name: 'imToken', | ||
iconUrl: async () => (await import('./imToken.svg')).default, | ||
iconBackground: '#098de6', | ||
downloadUrls: { | ||
android: 'https://play.google.com/store/apps/details?id=im.token.app', | ||
ios: 'https://itunes.apple.com/us/app/imtoken2/id1384798940', | ||
qrCode: 'https://token.im/download', | ||
}, | ||
createConnector: () => { | ||
const rpc = rpcUrlsForChains(chains); | ||
const connector = new WalletConnectConnector({ | ||
chains, | ||
options: { | ||
qrcode: false, | ||
rpc, | ||
}, | ||
}); | ||
return { | ||
connector, | ||
mobile: { | ||
getUri: async () => { | ||
const { uri } = (await connector.getProvider()).connector; | ||
return `imtokenv2://wc?uri=${encodeURIComponent(uri)}`; | ||
}, | ||
}, | ||
qrCode: { | ||
getUri: async () => (await connector.getProvider()).connector.uri, | ||
instructions: { | ||
learnMoreUrl: | ||
typeof window !== 'undefined' && | ||
window.navigator.language.includes('zh') | ||
? 'https://support.token.im/hc/zh-cn/categories/360000925393' | ||
: 'https://support.token.im/hc/en-us/categories/360000925393', | ||
steps: [ | ||
{ | ||
description: | ||
'Put imToken app on your home screen for faster access to your wallet.', | ||
step: 'install', | ||
title: 'Open the imToken app', | ||
}, | ||
{ | ||
description: 'Create a new wallet or import an existing one.', | ||
step: 'create', | ||
title: 'Create or Import a Wallet', | ||
}, | ||
{ | ||
description: | ||
'Choose New Connection, then scan the QR code and confirm the prompt to connect.', | ||
step: 'scan', | ||
title: 'Tap Scanner Icon in top right corner', | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
}, | ||
}); |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5224d54
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.vercel.app
rainbowkit-example-git-main-rainbowdotme.vercel.app
rainbowkit-example-rainbowdotme.vercel.app
5224d54
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.com
rainbowkit-site-rainbowdotme.vercel.app
www.rainbowkit.com
rainbowkit-site-git-main-rainbowdotme.vercel.app
rainbowkit.vercel.app