From 2357a7f03492a8870bf9ad895d9c31ea7bf6b356 Mon Sep 17 00:00:00 2001 From: microwavedcola1 Date: Thu, 22 Aug 2024 10:19:53 +0200 Subject: [PATCH] Fixes from review Signed-off-by: microwavedcola1 --- ts/client/src/accounts/mangoAccount.ts | 46 ++++++-------------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/ts/client/src/accounts/mangoAccount.ts b/ts/client/src/accounts/mangoAccount.ts index 349d99bd4..5f88887c7 100644 --- a/ts/client/src/accounts/mangoAccount.ts +++ b/ts/client/src/accounts/mangoAccount.ts @@ -352,18 +352,6 @@ export class MangoAccount { return tp ? tp.balanceUi(bank) : 0; } - public getTokenInUseCount(bank: Bank): number { - const tp = this.getToken(bank.tokenIndex); - if ( - this.publicKey.equals( - new PublicKey('HBVZhx5hEaeANvDdd6pPMzAPoPjk8Gxm6uEUM5xrje6p'), - ) - ) { - console.log(tp); - } - return tp?.inUseCount ?? 0; - } - /** * * @param bank @@ -1275,7 +1263,7 @@ export class MangoAccount { '\n tokens:' + JSON.stringify( this.tokens - .filter((token) => token.isActive()) + .filter((token, i) => token.isActive()) .map((token, i) => token.toString(group, i)), null, 4, @@ -2262,32 +2250,18 @@ export class TokenConditionalSwap { liqorTcsChunkSizeInUsd = 1000; } - const buyTokenPriceImpact = - buyBank.tokenIndex == 0 - ? group.getPriceImpactByTokenIndex( - sellBank.tokenIndex, - liqorTcsChunkSizeInUsd, - 'ask', - ) - : group.getPriceImpactByTokenIndex( - buyBank.tokenIndex, - liqorTcsChunkSizeInUsd, - ); - const sellTokenPriceImpact = - sellBank.tokenIndex == 0 - ? group.getPriceImpactByTokenIndex( - buyBank.tokenIndex, - liqorTcsChunkSizeInUsd, - 'bid', - ) - : group.getPriceImpactByTokenIndex( - buyBank.tokenIndex, - liqorTcsChunkSizeInUsd, - ); + const buyTokenPriceImpact = group.getPriceImpactByTokenIndex( + buyBank.tokenIndex, + liqorTcsChunkSizeInUsd, + ); + const sellTokenPriceImpact = group.getPriceImpactByTokenIndex( + sellBank.tokenIndex, + liqorTcsChunkSizeInUsd, + ); if (buyTokenPriceImpact <= 0 || sellTokenPriceImpact <= 0) { throw new Error( - `Error computing slippage/premium for token conditional swap!`, + `Error compitong slippage/premium for token conditional swap!`, ); }