From 8897f382fcbbf57ddd2710a8464d730437200da3 Mon Sep 17 00:00:00 2001 From: rouzwelt Date: Wed, 27 Mar 2024 23:07:19 +0000 Subject: [PATCH] log tx --- src/modes/crouter.js | 3 ++- src/modes/curve.js | 3 ++- src/modes/router.js | 2 ++ src/modes/srouter.js | 2 ++ src/modes/suniv2.js | 2 ++ src/modes/zeroex.js | 2 ++ src/utils.js | 46 ++++++++++++++++++++++---------------------- 7 files changed, 35 insertions(+), 25 deletions(-) diff --git a/src/modes/crouter.js b/src/modes/crouter.js index 885941b4..1621e97c 100644 --- a/src/modes/crouter.js +++ b/src/modes/crouter.js @@ -685,7 +685,7 @@ const crouterClear = async( ">>> Transaction submitted successfully to the network, waiting for transaction to mine...", "\n" ); - + console.log(tx); const receipt = config.timeout ? await promiseTimeout( tx.wait(), @@ -693,6 +693,7 @@ const crouterClear = async( `Transaction failed to mine after ${config.timeout}ms` ) : await tx.wait(); + console.log(receipt); const income = getIncome(signer, receipt); const clearActualPrice = getActualPrice( receipt, diff --git a/src/modes/curve.js b/src/modes/curve.js index 79ef0a58..3a0d5e31 100644 --- a/src/modes/curve.js +++ b/src/modes/curve.js @@ -567,7 +567,7 @@ const curveClear = async( ">>> Transaction submitted successfully to the network, waiting for transaction to mine...", "\n" ); - + console.log(tx); const receipt = config.timeout ? await promiseTimeout( tx.wait(), @@ -575,6 +575,7 @@ const curveClear = async( `Transaction failed to mine after ${config.timeout}ms` ) : await tx.wait(); + console.log(receipt); const income = getIncome(signer, receipt); const clearActualPrice = getActualPrice( receipt, diff --git a/src/modes/router.js b/src/modes/router.js index 0c77a260..673e7001 100644 --- a/src/modes/router.js +++ b/src/modes/router.js @@ -404,6 +404,7 @@ const routerClear = async( ">>> Transaction submitted successfully to the network, waiting for transaction to mine...", "\n" ); + console.log(tx); const receipt = config.timeout ? await promiseTimeout( tx.wait(), @@ -411,6 +412,7 @@ const routerClear = async( `Transaction failed to mine after ${config.timeout}ms` ) : await tx.wait(); + console.log(receipt); const income = getIncome(signer, receipt); const clearActualPrice = getActualPrice( receipt, diff --git a/src/modes/srouter.js b/src/modes/srouter.js index b06a308f..ae1cad8f 100644 --- a/src/modes/srouter.js +++ b/src/modes/srouter.js @@ -238,6 +238,7 @@ const srouterClear = async( ">>> Transaction submitted successfully to the network, waiting for transaction to mine...", "\n" ); + console.log(tx); const receipt = config.timeout ? await promiseTimeout( tx.wait(), @@ -245,6 +246,7 @@ const srouterClear = async( `Transaction failed to mine after ${config.timeout}ms` ) : await tx.wait(); + console.log(receipt); if (receipt.status === 1) { const clearActualAmount = getActualClearAmount( arbAddress, diff --git a/src/modes/suniv2.js b/src/modes/suniv2.js index ff4a3e0b..82b9eb31 100644 --- a/src/modes/suniv2.js +++ b/src/modes/suniv2.js @@ -234,6 +234,7 @@ const suniv2Clear = async( ">>> Transaction submitted successfully to the network, waiting for transaction to mine...", "\n" ); + console.log(tx); const receipt = config.timeout ? await promiseTimeout( tx.wait(), @@ -241,6 +242,7 @@ const suniv2Clear = async( `Transaction failed to mine after ${config.timeout}ms` ) : await tx.wait(); + console.log(receipt); if (receipt.status === 1) { const clearActualAmount = getActualClearAmount( arbAddress, diff --git a/src/modes/zeroex.js b/src/modes/zeroex.js index 7952b9f6..d24dda3d 100644 --- a/src/modes/zeroex.js +++ b/src/modes/zeroex.js @@ -383,6 +383,7 @@ const zeroExClear = async( ">>> Transaction submitted successfully to the network, waiting for transaction to mine...", "\n" ); + console.log(tx); const receipt = config.timeout ? await promiseTimeout( tx.wait(), @@ -390,6 +391,7 @@ const zeroExClear = async( `Transaction failed to mine after ${config.timeout}ms` ) : await tx.wait(); + console.log(receipt); const income = getIncome(signer, receipt); const clearActualPrice = getActualPrice( receipt, diff --git a/src/utils.js b/src/utils.js index 3ec3c2b3..f5479c28 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1223,7 +1223,7 @@ const getOrderDetailsFromJson = async(jsonContent, signer) => { * @param {...any} data - The optinnal data to hide */ const appGlobalLogger = (scrub, ...data) => { - const largeDataPattern = /0x[a-fA-F0-9]{128,}/g; + // const largeDataPattern = /0x[a-fA-F0-9]{128,}/g; const consoleMethods = ["log", "warn", "error", "info", "debug"]; // Stringifies an object @@ -1284,7 +1284,7 @@ const appGlobalLogger = (scrub, ...data) => { const orgConsole = console[methodName]; console[methodName] = function (...params) { const modifiedParams = []; - const shortenedLogs = []; + // const shortenedLogs = []; for (let i = 0; i < params.length; i++) { let logItem = params[i]; if ( @@ -1301,33 +1301,33 @@ const appGlobalLogger = (scrub, ...data) => { "**********" ); } - logItem = logItem.replace( - largeDataPattern, - largeData => { - if (!shortenedLogs.includes(largeData)) { - shortenedLogs.push(largeData); - return largeData; - } - else return largeData.slice(0, 67) + "..."; - } - ); + // logItem = logItem.replace( + // largeDataPattern, + // largeData => { + // if (!shortenedLogs.includes(largeData)) { + // shortenedLogs.push(largeData); + // return largeData; + // } + // else return largeData.slice(0, 67) + "..."; + // } + // ); } else if (typeof logItem === "object" && logItem !== null) { logItem = objStringify(logItem); if (scrub) for (let j = 0; j < _data.length; j++) { logItem = objStrReplacer(logItem, _data[j], "**********"); } - logItem = objStrReplacer( - logItem, - largeDataPattern, - largeData => { - if (!shortenedLogs.includes(largeData)) { - shortenedLogs.push(largeData); - return largeData; - } - else return largeData.slice(0, 67) + "..."; - } - ); + // logItem = objStrReplacer( + // logItem, + // largeDataPattern, + // largeData => { + // if (!shortenedLogs.includes(largeData)) { + // shortenedLogs.push(largeData); + // return largeData; + // } + // else return largeData.slice(0, 67) + "..."; + // } + // ); } modifiedParams.push(logItem); }