Skip to content

Commit

Permalink
actually fix linter :)
Browse files Browse the repository at this point in the history
  • Loading branch information
monilpat committed Dec 8, 2024
1 parent 47f5737 commit 05e0f86
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/plugin-coinbase/src/plugins/advancedTrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ export async function appendTradeToCsv(tradeResult: any) {
async function hasEnoughBalance(client: RESTClient, currency: string, amount: number, side: string): Promise<boolean> {
try {
const response = await client.listAccounts({});
const accounts = response;
elizaLogger.info("Accounts:", JSON.parse(accounts));
const accounts = JSON.parse(response);
elizaLogger.info("Accounts:", accounts);
const checkCurrency = side === "BUY" ? "USD" : currency;
elizaLogger.info(`Checking balance for ${side} order of ${amount} ${checkCurrency}`);

// Find account with exact currency match
const account = JSON.parse(accounts)?.accounts.find(acc =>
acc.currency === "USD" &&
("USD" === "USD" ? acc.type === "ACCOUNT_TYPE_FIAT" : acc.type === "ACCOUNT_TYPE_CRYPTO")
const account = accounts?.accounts.find(acc =>
acc.currency === checkCurrency &&
(checkCurrency === "USD" ? acc.type === "ACCOUNT_TYPE_FIAT" : acc.type === "ACCOUNT_TYPE_CRYPTO")
);

if (!account) {
Expand Down

0 comments on commit 05e0f86

Please sign in to comment.