1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

only send auto faucet request if account balance is empty

This commit is contained in:
Matthias Kretschmann 2019-07-18 18:38:49 +02:00
parent 15db426080
commit da70e4d43c
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -37,9 +37,11 @@ export class BurnerWalletProvider {
localStorage.setItem('logType', 'BurnerWallet') localStorage.setItem('logType', 'BurnerWallet')
const provider = new HDWalletProvider(mnemonic, `${nodeUri}`, 0, 1) const provider = new HDWalletProvider(mnemonic, `${nodeUri}`, 0, 1)
this.web3 = new Web3(provider) this.web3 = new Web3(provider)
const accounts = await this.web3.eth.getAccounts()
const balance = await this.web3.eth.getBalance(accounts[0])
// fill with Ether // fill with Ether if account balance is empty
await requestFromFaucet(provider.addresses[0]) balance === '0' && (await requestFromFaucet(provider.addresses[0]))
} }
public async logout() { public async logout() {