From c7c91a8e4f51adf6412e2bef37f996cb25e2252b Mon Sep 17 00:00:00 2001 From: rouzwelt Date: Wed, 20 Nov 2024 19:58:18 +0000 Subject: [PATCH] Update account.ts --- src/account.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/account.ts b/src/account.ts index 0c3cec5a..552444cc 100644 --- a/src/account.ts +++ b/src/account.ts @@ -529,20 +529,20 @@ export async function sweepToMainWallet( } } - if (cumulativeGasLimit.mul(gasPrice).mul(120).div(100).gt(fromWallet.BALANCE)) { + if (cumulativeGasLimit.mul(gasPrice).mul(125).div(100).gt(fromWallet.BALANCE)) { const span = tracer?.startSpan("fund-wallet-to-sweep", undefined, mainCtx); span?.setAttribute("details.wallet", fromWallet.account.address); try { const transferAmount = cumulativeGasLimit .mul(gasPrice) - .mul(120) + .mul(125) .div(100) .sub(fromWallet.BALANCE); span?.setAttribute("details.amount", ethers.utils.formatUnits(transferAmount)); const hash = await toWallet.sendTransaction({ to: fromWallet.account.address, value: transferAmount.toBigInt(), - nonce: await getNonce(fromWallet), + nonce: await getNonce(toWallet), }); const receipt = await toWallet.waitForTransactionReceipt({ hash, @@ -640,6 +640,7 @@ export async function sweepToMainWallet( if (transferAmount.gt(0)) { span?.setAttribute("details.amount", ethers.utils.formatUnits(transferAmount)); const hash = await fromWallet.sendTransaction({ + gasPrice, to: toWallet.account.address, value: transferAmount.toBigInt(), gas: gasLimit.toBigInt(),