Skip to content

Commit

Permalink
fix(common): move prepare just before send tx (#2364)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Mar 5, 2024
1 parent 884642a commit 2b54f50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions packages/common/src/sendTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,15 @@ export async function sendTransaction<
account,
} as CallParameters<TChain>);

// TODO: estimate gas

return request;
}

const preparedRequest = await prepare();

return await nonceManager.mempoolQueue.add(
() =>
pRetry(
async () => {
const preparedRequest = await prepare();

if (!nonceManager.hasNonce()) {
await nonceManager.resetNonce();
}
Expand Down
4 changes: 2 additions & 2 deletions packages/common/src/writeContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ export async function writeContract<
return result.request as unknown as WriteContractParameters<abi, functionName, args, chain, account, chainOverride>;
}

const preparedWrite = await prepareWrite();

return nonceManager.mempoolQueue.add(
() =>
pRetry(
async () => {
const preparedWrite = await prepareWrite();

if (!nonceManager.hasNonce()) {
await nonceManager.resetNonce();
}
Expand Down

0 comments on commit 2b54f50

Please sign in to comment.