diff --git a/ts/client/src/accounts/mangoAccount.ts b/ts/client/src/accounts/mangoAccount.ts index 30753aae5..dface5e11 100644 --- a/ts/client/src/accounts/mangoAccount.ts +++ b/ts/client/src/accounts/mangoAccount.ts @@ -353,7 +353,11 @@ export class MangoAccount { ? res + '\n tokens:' + JSON.stringify( - this.tokensActive().map((token) => token.toString(group)), + this.tokens.map((token, i) => + token.isActive() + ? token.toString(group, i) + : `index: ${i} - empty slot`, + ), null, 4, ) @@ -419,7 +423,7 @@ export class TokenPosition { ).toNumber(); } - public toString(group?: Group): string { + public toString(group?: Group, index?: number): string { let extra = ''; if (group) { const bank = group.findBank(this.tokenIndex); @@ -432,7 +436,8 @@ export class TokenPosition { } return ( - 'tokenIndex: ' + + (index !== undefined ? 'index: ' + index : '') + + ', tokenIndex: ' + this.tokenIndex + ', inUseCount: ' + this.inUseCount + diff --git a/ts/client/src/debug-scripts/mb-debug-user.ts b/ts/client/src/debug-scripts/mb-debug-user.ts index 0fdae98da..43cfd25f6 100644 --- a/ts/client/src/debug-scripts/mb-debug-user.ts +++ b/ts/client/src/debug-scripts/mb-debug-user.ts @@ -9,7 +9,16 @@ import { toUiDecimals } from '../utils'; async function debugUser(client, group, mangoAccount) { console.log(mangoAccount.toString(group)); await mangoAccount.reload(client, group); - + console.log( + 'buildFixedAccountRetrieverHealthAccounts ' + + client + .buildFixedAccountRetrieverHealthAccounts(group, mangoAccount, [ + group.banksMap.get('BTC'), + group.banksMap.get('USDC'), + ]) + .map((pk) => pk.toBase58()) + .join(', '), + ); console.log( 'mangoAccount.getEquity() ' + toUiDecimals(mangoAccount.getEquity().toNumber()),