File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
src/modules/select/wallets Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ function torus(options: TorusOptions & { networkId: number }): WalletModule {
23
23
loginMethod
24
24
} = options
25
25
26
+ let account : string
27
+
26
28
return {
27
29
name : label || 'Torus' ,
28
30
svg : svg || torusIcon ,
@@ -59,25 +61,27 @@ function torus(options: TorusOptions & { networkId: number }): WalletModule {
59
61
name : 'Torus' ,
60
62
connect : async ( ) => {
61
63
const result = await instance . login ( { verifier : loginMethod } )
64
+ account = result [ 0 ]
62
65
return { message : result [ 0 ] }
63
66
} ,
64
67
disconnect : ( ) => instance . cleanUp ( ) ,
65
68
address : {
66
- get : ( ) => Promise . resolve ( instance . web3 . eth . accounts [ 0 ] )
69
+ get : ( ) => Promise . resolve ( account )
67
70
} ,
68
71
network : {
69
- get : ( ) => Promise . resolve ( Number ( instance . web3 . version . network ) )
72
+ get : ( ) => Promise . resolve ( Number ( networkId ) )
70
73
} ,
71
74
balance : {
72
75
get : ( ) =>
73
76
new Promise ( async ( resolve , reject ) => {
74
77
instance . web3 . eth . getBalance (
75
- instance . web3 . eth . accounts [ 0 ] ,
76
- ( err : any , data : any ) => {
78
+ account ,
79
+ instance . web3 . eth . defaultBlock ,
80
+ ( err : any , data : string ) => {
77
81
if ( err ) {
78
82
reject ( `Error while checking Balance: ${ err } ` )
79
83
} else {
80
- resolve ( data . toString ( 10 ) )
84
+ resolve ( data . toString ( ) )
81
85
}
82
86
}
83
87
)
You can’t perform that action at this time.
0 commit comments