fix displaying menu when tx is still ongoing
This commit is contained in:
parent
af8ca0894d
commit
daf41954da
|
@ -39,15 +39,15 @@ class Actions {
|
|||
connect(url, cb) {
|
||||
console.dir("connecting to: " + url);
|
||||
|
||||
this.provider = new Provider();
|
||||
this.provider = new Provider();
|
||||
const accounts = [{mnemonic: ""}]
|
||||
this.provider.initAccounts(accounts);
|
||||
this.provider.startWeb3Provider("ws", url)
|
||||
this.provider.initAccounts(accounts);
|
||||
this.provider.startWeb3Provider("ws", url)
|
||||
|
||||
//web3.setProvider(url);
|
||||
|
||||
setTimeout(async () => {
|
||||
this.web3 = this.provider.web3;
|
||||
this.web3 = this.provider.web3;
|
||||
|
||||
let accounts = await this.web3.eth.getAccounts();
|
||||
console.dir("== accounts");
|
||||
|
|
|
@ -30,7 +30,6 @@ class Provider {
|
|||
//} else {
|
||||
this.accounts.push(this.web3.eth.accounts.privateKeyToAccount('0x' + wallet.getPrivateKey().toString('hex')));
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,23 @@
|
|||
const Spinner = require('cli-spinner').Spinner;
|
||||
|
||||
const executeAndWait = async (toSend, account) => {
|
||||
const spinner = new Spinner('%s');
|
||||
spinner.setSpinnerString(18);
|
||||
spinner.start();
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const spinner = new Spinner('%s');
|
||||
spinner.setSpinnerString(18);
|
||||
spinner.start();
|
||||
|
||||
try {
|
||||
const estimatedGas = await toSend.estimateGas({from: account});
|
||||
const receipt = await toSend.send({from: account, gas: estimatedGas + 10000});
|
||||
try {
|
||||
const estimatedGas = await toSend.estimateGas({from: account});
|
||||
const receipt = await toSend.send({from: account, gas: estimatedGas + 10000});
|
||||
|
||||
spinner.stop(true);
|
||||
return receipt;
|
||||
} catch(error) {
|
||||
console.log("Error: ", error.message);
|
||||
spinner.stop(true);
|
||||
}
|
||||
spinner.stop(true);
|
||||
return resolve(receipt);
|
||||
} catch(error) {
|
||||
console.log("Error: ", error.message);
|
||||
spinner.stop(true);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Reference in New Issue