@@ -3,33 +3,44 @@ import { isWalletInit } from '../../validation'
3
3
4
4
// wallets that qualify for default wallets need to have no
5
5
// init parameters that are required for full functionality
6
- const defaultWalletNames = [
6
+ const desktopDefaultWalletNames = [ 'metamask' , 'authereum' , 'torus' , 'opera' ]
7
+
8
+ const mobileDefaultWalletNames = [
7
9
'metamask' ,
8
- 'dapper ' ,
10
+ 'authereum ' ,
9
11
'coinbase' ,
10
12
'trust' ,
11
- 'authereum' ,
12
13
'torus' ,
13
14
'opera' ,
14
15
'operaTouch' ,
15
16
'status' ,
16
17
'hyperpay' ,
17
- 'unilogin' ,
18
18
'tokenpocket' ,
19
19
'dcent' ,
20
20
'atoken'
21
21
]
22
22
23
23
function select (
24
24
wallets : Array < WalletInitOptions | WalletModule > | undefined ,
25
- networkId : number
25
+ networkId : number ,
26
+ isMobile : boolean
26
27
) {
28
+ const defaultWalletNames = isMobile
29
+ ? mobileDefaultWalletNames
30
+ : desktopDefaultWalletNames
31
+
27
32
if ( wallets ) {
28
33
return Promise . all (
29
34
wallets . map ( wallet => {
30
35
if ( isWalletInit ( wallet ) ) {
31
36
const { walletName, ...initParams } = wallet
32
- const module = getModule ( walletName )
37
+
38
+ let module
39
+ try {
40
+ module = getModule ( walletName )
41
+ } catch ( error ) {
42
+ console . warn ( error )
43
+ }
33
44
34
45
if ( ! module ) {
35
46
throw new Error ( `${ walletName } is not a valid walletName.` )
@@ -58,18 +69,19 @@ function select(
58
69
59
70
function getModule ( name : string ) : Promise < any > | undefined {
60
71
switch ( name ) {
72
+ // Deprecated wallets
73
+ case 'dapper' :
74
+ case 'squarelink' :
75
+ case 'unilogin' :
76
+ throw new Error ( `${ name . toUpperCase ( ) } wallet has been deprecated` )
61
77
case 'meetone' :
62
78
return import ( './wallets/meetone' )
63
79
case 'metamask' :
64
80
return import ( './wallets/metamask' )
65
- case 'dapper' :
66
- return import ( './wallets/dapper' )
67
81
case 'portis' :
68
82
return import ( './wallets/portis' )
69
83
case 'fortmatic' :
70
84
return import ( './wallets/fortmatic' )
71
- case 'squarelink' :
72
- return import ( './wallets/squarelink' )
73
85
case 'authereum' :
74
86
return import ( './wallets/authereum' )
75
87
case 'trust' :
@@ -96,8 +108,6 @@ function getModule(name: string): Promise<any> | undefined {
96
108
return import ( './wallets/wallet-link' )
97
109
case 'imToken' :
98
110
return import ( './wallets/imtoken' )
99
- case 'unilogin' :
100
- return import ( './wallets/unilogin' )
101
111
case 'mykey' :
102
112
return import ( './wallets/mykey' )
103
113
case 'huobiwallet' :
0 commit comments