fix dot at balance end

pull/4511/head
aniket-engg 9 months ago committed by yann300
parent aa77a3ec16
commit 778007dbac
  1. 3
      apps/remix-ide/src/blockchain/providers/injected.ts
  2. 3
      apps/remix-ide/src/blockchain/providers/node.ts
  3. 3
      apps/remix-ide/src/blockchain/providers/vm.ts

@ -29,7 +29,8 @@ export class InjectedProvider {
async getBalanceInEther (address) {
const balance = await this.executionContext.web3().eth.getBalance(address)
return Web3.utils.fromWei(balance.toString(10), 'ether')
const balInString = balance.toString(10)
return balInString === '0' ? balInString : Web3.utils.fromWei(balInString, 'ether')
}
getGasPrice (cb) {

@ -35,7 +35,8 @@ export class NodeProvider {
async getBalanceInEther (address) {
const balance = await this.executionContext.web3().eth.getBalance(address)
return Web3.utils.fromWei(balance.toString(10), 'ether')
const balInString = balance.toString(10)
return balInString === '0' ? balInString : Web3.utils.fromWei(balInString, 'ether')
}
getGasPrice (cb) {

@ -97,7 +97,8 @@ export class VMProvider {
async getBalanceInEther (address) {
const balance = await this.web3.eth.getBalance(address, undefined, { number: FMT_NUMBER.HEX, bytes: FMT_BYTES.HEX })
return fromWei(toBigInt(balance).toString(10), 'ether')
const balInString = toBigInt(balance).toString(10)
return balInString === '0' ? balInString : fromWei(balInString, 'ether')
}
getGasPrice (cb) {

Loading…
Cancel
Save