From 1a4912b7dc0951d8ff5bb0f66d0da2e44e31bc9f Mon Sep 17 00:00:00 2001 From: CelestialCrafter Date: Thu, 7 Dec 2023 20:11:04 -0600 Subject: [PATCH] update interface auth --- src/trading/check.js | 2 +- src/trading/uniswap/trade.js | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/trading/check.js b/src/trading/check.js index eea9a80..7e56d8d 100644 --- a/src/trading/check.js +++ b/src/trading/check.js @@ -53,7 +53,7 @@ export default async redis => { return { id: bot._id, - privateKey: bot.privateKey(), + auth: { privateKey: bot.privateKey() }, amount: (10 || bot.strengthToUSD) * strength, strengthToUSD: bot.strengthToUSD, signal diff --git a/src/trading/uniswap/trade.js b/src/trading/uniswap/trade.js index 92e459e..108f66a 100644 --- a/src/trading/uniswap/trade.js +++ b/src/trading/uniswap/trade.js @@ -58,19 +58,17 @@ const executeTransaction = async ( export default tradeData => Promise.allSettled( - tradeData.map( - async ({ id, signal: action, amount: baseAmount, strengthToUSD, privateKey }) => ({ - transactions: [ - await Promise.allSettled([ - executeTransaction(privateKey, { - modToken: tokens.wrapped, - baseAmount, - action - }) - ]), - ...(await executeApproval(privateKey, { strengthToUSD, id })) - ], - id - }) - ) + tradeData.map(async ({ id, signal: action, amount: baseAmount, strengthToUSD, auth }) => ({ + transactions: [ + await Promise.allSettled([ + executeTransaction(auth.privateKey, { + modToken: tokens.wrapped, + baseAmount, + action + }) + ]), + ...(await executeApproval(auth.privateKey, { strengthToUSD, id })) + ], + id + })) );