File tree Expand file tree Collapse file tree 1 file changed +25
-15
lines changed
src/modules/select/wallets Expand file tree Collapse file tree 1 file changed +25
-15
lines changed Original file line number Diff line number Diff line change @@ -19,34 +19,44 @@ function fortmatic(
19
19
apiKey ,
20
20
networkId === 1 ? undefined : networkName ( networkId )
21
21
)
22
+
22
23
const provider = instance . getProvider ( )
23
- const { BigNumber } = helpers
24
+ const { BigNumber, getAddress } = helpers
25
+
26
+ let enabled : boolean
24
27
25
28
return {
26
29
provider,
27
30
instance,
28
31
interface : {
29
32
name : 'Fortmatic' ,
30
- connect : instance . user . login ,
31
- disconnect : instance . user . logout ,
33
+ connect : ( ) =>
34
+ instance . user . login ( ) . then ( ( res : any ) => {
35
+ enabled = true
36
+ return res
37
+ } ) ,
38
+ disconnect : ( ) => instance . user . logout ( ) ,
32
39
address : {
33
- get : ( ) => Promise . resolve ( provider . account )
40
+ get : ( ) => ( enabled ? getAddress ( provider ) : Promise . resolve ( ) )
34
41
} ,
35
42
network : {
36
43
get : ( ) => Promise . resolve ( networkId )
37
44
} ,
38
45
balance : {
39
- get : ( ) =>
40
- provider . account &&
41
- instance . user
42
- . getBalances ( )
43
- . then ( ( res : any ) =>
44
- res [ 0 ]
45
- ? BigNumber ( res [ 0 ] . crypto_amount )
46
- . times ( BigNumber ( '1000000000000000000' ) )
47
- . toString ( 10 )
48
- : null
49
- )
46
+ get : async ( ) => {
47
+ return (
48
+ enabled &&
49
+ instance . user
50
+ . getBalances ( )
51
+ . then ( ( res : any ) =>
52
+ res [ 0 ]
53
+ ? BigNumber ( res [ 0 ] . crypto_amount )
54
+ . times ( BigNumber ( '1000000000000000000' ) )
55
+ . toString ( 10 )
56
+ : null
57
+ )
58
+ )
59
+ }
50
60
} ,
51
61
dashboard : ( ) => instance . user . settings ( )
52
62
}
You can’t perform that action at this time.
0 commit comments