Skip to content

Commit 05e0f86

Browse files
committed
actually fix linter :)
1 parent 47f5737 commit 05e0f86

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/plugin-coinbase/src/plugins/advancedTrade.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ export async function appendTradeToCsv(tradeResult: any) {
135135
async function hasEnoughBalance(client: RESTClient, currency: string, amount: number, side: string): Promise<boolean> {
136136
try {
137137
const response = await client.listAccounts({});
138-
const accounts = response;
139-
elizaLogger.info("Accounts:", JSON.parse(accounts));
138+
const accounts = JSON.parse(response);
139+
elizaLogger.info("Accounts:", accounts);
140140
const checkCurrency = side === "BUY" ? "USD" : currency;
141141
elizaLogger.info(`Checking balance for ${side} order of ${amount} ${checkCurrency}`);
142142

143143
// Find account with exact currency match
144-
const account = JSON.parse(accounts)?.accounts.find(acc =>
145-
acc.currency === "USD" &&
146-
("USD" === "USD" ? acc.type === "ACCOUNT_TYPE_FIAT" : acc.type === "ACCOUNT_TYPE_CRYPTO")
144+
const account = accounts?.accounts.find(acc =>
145+
acc.currency === checkCurrency &&
146+
(checkCurrency === "USD" ? acc.type === "ACCOUNT_TYPE_FIAT" : acc.type === "ACCOUNT_TYPE_CRYPTO")
147147
);
148148

149149
if (!account) {

0 commit comments

Comments
 (0)