From 8d86883190106d1c0ced6241140c251786404ebc Mon Sep 17 00:00:00 2001 From: microwavedcola1 Date: Tue, 27 Sep 2022 17:33:51 +0200 Subject: [PATCH] ts: remove debug code Signed-off-by: microwavedcola1 --- ts/client/src/accounts/healthCache.ts | 18 +----------------- ts/client/src/accounts/mangoAccount.ts | 6 ++++-- ts/client/src/client.ts | 2 +- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/ts/client/src/accounts/healthCache.ts b/ts/client/src/accounts/healthCache.ts index 6762ab45e..c7444cfed 100644 --- a/ts/client/src/accounts/healthCache.ts +++ b/ts/client/src/accounts/healthCache.ts @@ -46,22 +46,6 @@ export class HealthCache { ) {} static fromDto(dto) { - // console.log( - JSON.stringify( - dto, - function replacer(k, v) { - // console.log(k); - console.log(v); - // if (v instanceof BN) { - // console.log(v); - // return new I80F48(v).toNumber(); - // } - // return v; - }, - 2, - ), - // ); - process.exit(0); return new HealthCache( dto.tokenInfos.map((dto) => TokenInfo.fromDto(dto)), dto.serum3Infos.map((dto) => Serum3Info.fromDto(dto)), @@ -173,7 +157,7 @@ export class HealthCache { } } - if (liabs.gt(I80F48.fromNumber(0.001))) { + if (liabs.gt(I80F48.fromNumber(0.001))) { return HUNDRED_I80F48().mul(assets.sub(liabs).div(liabs)); } else { return MAX_I80F48(); diff --git a/ts/client/src/accounts/mangoAccount.ts b/ts/client/src/accounts/mangoAccount.ts index 5fe16409e..d97166bb5 100644 --- a/ts/client/src/accounts/mangoAccount.ts +++ b/ts/client/src/accounts/mangoAccount.ts @@ -286,8 +286,10 @@ export class MangoAccount { * PNL is defined here as spot value + serum3 open orders value + perp value - net deposits value (evaluated at native quote price at the time of the deposit/withdraw) * spot value + serum3 open orders value + perp value is returned by getEquity (open orders values are added to spot token values implicitly) */ - getPnl(): I80F48 | undefined { - return this.getEquity()?.add((I80F48.fromI64(this.netDeposits)).mul(I80F48.fromNumber(-1))) + getPnl(): I80F48 | undefined { + return this.getEquity()?.add( + I80F48.fromI64(this.netDeposits).mul(I80F48.fromNumber(-1)), + ); } /** diff --git a/ts/client/src/client.ts b/ts/client/src/client.ts index 3110f6791..316220daa 100644 --- a/ts/client/src/client.ts +++ b/ts/client/src/client.ts @@ -616,7 +616,7 @@ export class MangoClient { await this.program.account.mangoAccount.fetch(mangoAccountPk), ); } - + public async getMangoAccountWithSlot(mangoAccountPk: PublicKey) { const resp = await this.program.provider.connection.getAccountInfoAndContext(