Skip to content

Commit 8b67945

Browse files
authored
Merge pull request #462 from blocknative/issues/torus-type-error
Issues/torus type error
2 parents 1172a7c + 2549acf commit 8b67945

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/modules/select/wallets/torus.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ function torus(options: TorusOptions & { networkId: number }): WalletModule {
2323
loginMethod
2424
} = options
2525

26+
let account: string
27+
2628
return {
2729
name: label || 'Torus',
2830
svg: svg || torusIcon,
@@ -59,25 +61,27 @@ function torus(options: TorusOptions & { networkId: number }): WalletModule {
5961
name: 'Torus',
6062
connect: async () => {
6163
const result = await instance.login({ verifier: loginMethod })
64+
account = result[0]
6265
return { message: result[0] }
6366
},
6467
disconnect: () => instance.cleanUp(),
6568
address: {
66-
get: () => Promise.resolve(instance.web3.eth.accounts[0])
69+
get: () => Promise.resolve(account)
6770
},
6871
network: {
69-
get: () => Promise.resolve(Number(instance.web3.version.network))
72+
get: () => Promise.resolve(Number(networkId))
7073
},
7174
balance: {
7275
get: () =>
7376
new Promise(async (resolve, reject) => {
7477
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) => {
7781
if (err) {
7882
reject(`Error while checking Balance: ${err}`)
7983
} else {
80-
resolve(data.toString(10))
84+
resolve(data.toString())
8185
}
8286
}
8387
)

0 commit comments

Comments
 (0)