Fix funds.toNumber is not a function

This commit is contained in:
mmv 2019-03-13 15:01:02 +04:00
parent c7efc2b3bb
commit 91c3c9fa91
2 changed files with 5 additions and 4 deletions

View File

@ -91,10 +91,11 @@ export const getProviderInfo: Function = async (): Promise<ProviderProps> => {
}
export const getBalanceInEtherOf = async (safeAddress: string) => {
const funds: BigNumber = await web3.eth.getBalance(safeAddress)
if (!funds || funds === '0') {
const funds: String = await web3.eth.getBalance(safeAddress)
if (!funds) {
return '0'
}
return web3.fromWei(funds.toNumber(), 'ether').toString()
return web3.utils.fromWei(funds, 'ether').toString()
}

View File

@ -10,4 +10,4 @@ export const copyToClipboard = (text: string) => {
} catch (err) {
console.error(err.message)
}
}
}