Skip to content

Commit cf6565d

Browse files
authored
Unblock submit if ethers errors (#30)
1 parent f9eaec7 commit cf6565d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/SmartTransactionsController.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,15 @@ export default class SmartTransactionsController extends BaseController<
491491
);
492492
const time = Date.now();
493493
const metamaskNetworkId = this.getNetwork();
494-
const preTxBalanceBN = await this.ethersProvider.getBalance(txParams?.from);
495-
const preTxBalance = new BigNumber(preTxBalanceBN.toHexString()).toString(
496-
16,
497-
);
494+
let preTxBalance;
495+
try {
496+
const preTxBalanceBN = await this.ethersProvider.getBalance(
497+
txParams?.from,
498+
);
499+
preTxBalance = new BigNumber(preTxBalanceBN.toHexString()).toString(16);
500+
} catch (e) {
501+
console.error('ethers error', e);
502+
}
498503
const nonceLock = await this.nonceTracker.getNonceLock(txParams?.from);
499504
const nonce = ethers.utils.hexlify(nonceLock.nextNonce);
500505
if (txParams && !txParams?.nonce) {

0 commit comments

Comments
 (0)