From 1be57afb5ce3c99fbb29856065f9ff9ec4d43edc Mon Sep 17 00:00:00 2001 From: rouzwelt Date: Mon, 28 Oct 2024 22:15:07 +0000 Subject: [PATCH 1/2] update [skip ci] --- src/index.ts | 1 + src/processOrders.ts | 8 +++++--- src/types.ts | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index cdb17f6f..1067e9b7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -166,6 +166,7 @@ export async function getConfig( config.dataFetcher = dataFetcher; config.watchedTokens = options.tokens ?? []; config.selfFundOrders = options.selfFundOrders; + config.walletKey = walletKey; // init accounts const { mainAccount, accounts } = await initAccounts(walletKey, config, options, tracer, ctx); diff --git a/src/processOrders.ts b/src/processOrders.ts index 9a33238a..f8e0e744 100644 --- a/src/processOrders.ts +++ b/src/processOrders.ts @@ -189,9 +189,11 @@ export const processOrders = async ( [config.flashbotRpc], undefined, privateKeyToAccount( - ethers.utils.hexlify( - ethers.utils.hexlify(signer.account.getHdKey().privateKey!), - ) as `0x${string}`, + signer.account.getHdKey + ? (ethers.utils.hexlify( + signer.account.getHdKey().privateKey!, + ) as `0x${string}`) + : (config.walletKey as `0x${string}`), ), config.timeout, ) diff --git a/src/types.ts b/src/types.ts index 77bb8717..eff019d7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -139,6 +139,7 @@ export type BotConfig = { mainAccount: ViemClient; accounts: ViemClient[]; selfFundOrders?: SelfFundOrder[]; + walletKey: string; }; export type Report = { From 9bdcc553f35838bc0f46107fd3e23e7e18630321 Mon Sep 17 00:00:00 2001 From: rouzwelt Date: Mon, 28 Oct 2024 22:17:43 +0000 Subject: [PATCH 2/2] Update processOrders.ts --- src/processOrders.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/processOrders.ts b/src/processOrders.ts index f8e0e744..52846aa2 100644 --- a/src/processOrders.ts +++ b/src/processOrders.ts @@ -193,7 +193,9 @@ export const processOrders = async ( ? (ethers.utils.hexlify( signer.account.getHdKey().privateKey!, ) as `0x${string}`) - : (config.walletKey as `0x${string}`), + : ((config.walletKey.startsWith("0x") + ? config.walletKey + : "0x" + config.walletKey) as `0x${string}`), ), config.timeout, )