Skip to content

Commit

Permalink
Relocate & refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
pxrl committed Feb 13, 2025
1 parent 649b699 commit 79d8536
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
16 changes: 10 additions & 6 deletions src/clients/TransactionClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ export class TransactionClient {
}

let response: TransactionResponse;
const start = performance.now();
try {
response = await this._submit(txn, nonce);
} catch (error) {
this.logger.info({
at: "TransactionClient#submit",
message: `Transaction ${idx + 1} submission on ${networkName} failed or timed out.`,
mrkdwn,
duration: Math.round(performance.now() - start),
// @dev `error` _sometimes_ doesn't decode correctly (especially on Polygon), so fish for the reason.
errorMessage: isError(error) ? (error as Error).message : undefined,
error: stringifyThrownValue(error),
Expand All @@ -110,17 +112,19 @@ export class TransactionClient {
return txnResponses;
}

nonce = response.nonce + 1;
const blockExplorer = blockExplorerLink(response.hash, txn.chainId);
mrkdwn += ` ${idx + 1}. ${txn.message || "No message"} (${blockExplorer}): ${txn.mrkdwn || "No markdown"}\n`;
this.logger.info({
at: "TransactionClient#submit",
message: `Completed ${networkName} transaction submission! 🧙`,
duration: Math.round(performance.now() - start),
mrkdwn,
});

nonce = response.nonce + 1;
txnResponses.push(response);
}

this.logger.info({
at: "TransactionClient#submit",
message: `Completed ${networkName} transaction submission! 🧙`,
mrkdwn,
});

return txnResponses;
}
Expand Down
5 changes: 0 additions & 5 deletions src/relayer/Relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,13 +846,8 @@ export class Relayer {
multiCallerClient.clearTransactionQueue(chainId);
return [];
}

const chain = getNetworkName(chainId);
const profiler = this.profiler.start(`${chain} transaction submission.`);
pendingTxnReceipts[chainId] = multiCallerClient.executeTxnQueue(chainId, simulate);
const txnReceipts = await pendingTxnReceipts[chainId];
profiler.stop({ message: `Completed ${chain} transaction submission.`, nTxns: txnReceipts.length, txnReceipts });

delete pendingTxnReceipts[chainId];

return txnReceipts.map(({ hash }) => hash);
Expand Down

0 comments on commit 79d8536

Please sign in to comment.