File tree Expand file tree Collapse file tree 5 files changed +60
-4
lines changed Expand file tree Collapse file tree 5 files changed +60
-4
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ function getModule(name: string): Promise<any> | undefined {
81
81
return import ( './wallets/trezor' )
82
82
case 'ledger' :
83
83
return import ( './wallets/ledger' )
84
+ case 'imToken' :
85
+ return import ( './wallets/imtoken' )
84
86
default :
85
87
return
86
88
}
Original file line number Diff line number Diff line change
1
+ const imTokenIcon = `
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 93 93">
3
+ <defs>
4
+ <linearGradient id="a" x1="97.185%" x2="-.038%" y1="3.105%" y2="99.699%">
5
+ <stop offset="0%" stop-color="#11C4D1"/>
6
+ <stop offset="100%" stop-color="#0062AD"/>
7
+ </linearGradient>
8
+ </defs>
9
+ <g fill="none" fill-rule="nonzero">
10
+ <path fill="url(#a)" d="M92.755 63.804s0 9.64-1.028 13.78c-1.028 4.187-2.985 7.06-5.09 9.202-2.154 2.142-4.993 4.09-9.3 5.112-4.356 1.023-13.754.974-13.754.974H29.417s-9.642 0-13.803-1.022c-4.16-1.071-7.097-2.97-9.25-5.113-2.155-2.142-4.112-4.966-5.091-9.3-1.028-4.333-.98-13.682-.98-13.682V29.671s0-9.64 1.029-13.78c1.027-4.187 2.985-7.06 5.09-9.202 2.154-2.142 4.993-4.09 9.3-5.113C20.068.554 29.466.603 29.466.603h34.166s9.642 0 13.803 1.022c4.16 1.071 7.097 2.97 9.25 5.113 2.154 2.142 4.112 4.966 5.091 9.3.98 4.333.98 13.682.98 13.682v34.084z"/>
11
+ <path fill="#FFF" d="M78.267 28.795c1.909 26.244-15.614 38.71-31.326 40.073-14.587 1.265-28.292-7.304-29.467-20.597-.979-10.955 6.07-15.678 11.6-16.117 5.679-.486 10.427 3.263 10.867 7.84.392 4.382-2.447 6.427-4.454 6.573-1.566.146-3.524-.78-3.72-2.727-.147-1.704.538-1.899.342-3.7-.293-3.214-3.181-3.555-4.747-3.409-1.91.146-5.385 2.338-4.944 7.694.49 5.404 5.874 9.69 12.922 9.056 7.636-.682 12.971-6.378 13.363-14.412 0-.439.098-.828.293-1.218.098-.146.147-.292.294-.438.196-.292.392-.536.636-.779l.686-.682c3.328-3.019 15.37-10.225 26.676-7.985.098 0 .196.049.245.097.44 0 .685.341.734.73"/>
12
+ </g>
13
+ </svg>
14
+ `
15
+
16
+ export default imTokenIcon
Original file line number Diff line number Diff line change
1
+ import { mobileWalletInstallMessage } from '../content'
2
+ import { WalletModule , Helpers , CommonWalletOptions } from '../../../interfaces'
3
+
4
+ import imTokenIcon from '../wallet-icons/icon-imtoken'
5
+
6
+ function imtoken ( options : CommonWalletOptions ) : WalletModule {
7
+ const { preferred, label, iconSrc, svg } = options
8
+
9
+ return {
10
+ name : label || 'imToken' ,
11
+ iconSrc,
12
+ svg : svg || imTokenIcon ,
13
+ wallet : async ( helpers : Helpers ) => {
14
+ const { getProviderName, createModernProviderInterface } = helpers
15
+
16
+ const provider =
17
+ ( window as any ) . ethereum ||
18
+ ( ( window as any ) . web3 && ( window as any ) . web3 . currentProvider )
19
+
20
+ return {
21
+ provider,
22
+ interface :
23
+ provider && getProviderName ( provider ) === 'imToken'
24
+ ? createModernProviderInterface ( provider )
25
+ : null
26
+ }
27
+ } ,
28
+ type : 'injected' ,
29
+ link : `imtokenv2://navigate?screen=DappView&url=${ window . location . href } ` ,
30
+ installMessage : mobileWalletInstallMessage ,
31
+ mobile : true ,
32
+ preferred
33
+ }
34
+ }
35
+
36
+ export default imtoken
Original file line number Diff line number Diff line change @@ -153,13 +153,12 @@ export function createLegacyProviderInterface(provider: any): WalletInterface {
153
153
export function getProviderName ( provider : any ) : string | undefined {
154
154
if ( ! provider ) return
155
155
156
- // Torus also exports isMetamask to be true for backward compatibility
157
156
if ( provider . isTorus ) {
158
157
return 'Torus'
159
158
}
160
159
161
- if ( provider . isMetaMask ) {
162
- return 'MetaMask '
160
+ if ( provider . isImToken ) {
161
+ return 'imToken '
163
162
}
164
163
165
164
if ( provider . isDapper ) {
@@ -194,6 +193,10 @@ export function getProviderName(provider: any): string | undefined {
194
193
return 'Status'
195
194
}
196
195
196
+ if ( provider . isMetaMask ) {
197
+ return 'MetaMask'
198
+ }
199
+
197
200
if ( provider . host && provider . host . indexOf ( 'localhost' ) !== - 1 ) {
198
201
return 'localhost'
199
202
}
Original file line number Diff line number Diff line change @@ -660,7 +660,6 @@ export function validateWalletInit(
660
660
optional : true
661
661
} )
662
662
663
-
664
663
validateType ( {
665
664
name : 'walletInit.enabledVerifiers' ,
666
665
value : enabledVerifiers ,
You can’t perform that action at this time.
0 commit comments