improve logging
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
5c34b60105
commit
cfdd59379e
|
@ -353,7 +353,11 @@ export class MangoAccount {
|
||||||
? res +
|
? res +
|
||||||
'\n tokens:' +
|
'\n tokens:' +
|
||||||
JSON.stringify(
|
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,
|
null,
|
||||||
4,
|
4,
|
||||||
)
|
)
|
||||||
|
@ -419,7 +423,7 @@ export class TokenPosition {
|
||||||
).toNumber();
|
).toNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
public toString(group?: Group): string {
|
public toString(group?: Group, index?: number): string {
|
||||||
let extra = '';
|
let extra = '';
|
||||||
if (group) {
|
if (group) {
|
||||||
const bank = group.findBank(this.tokenIndex);
|
const bank = group.findBank(this.tokenIndex);
|
||||||
|
@ -432,7 +436,8 @@ export class TokenPosition {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
'tokenIndex: ' +
|
(index !== undefined ? 'index: ' + index : '') +
|
||||||
|
', tokenIndex: ' +
|
||||||
this.tokenIndex +
|
this.tokenIndex +
|
||||||
', inUseCount: ' +
|
', inUseCount: ' +
|
||||||
this.inUseCount +
|
this.inUseCount +
|
||||||
|
|
|
@ -9,7 +9,16 @@ import { toUiDecimals } from '../utils';
|
||||||
async function debugUser(client, group, mangoAccount) {
|
async function debugUser(client, group, mangoAccount) {
|
||||||
console.log(mangoAccount.toString(group));
|
console.log(mangoAccount.toString(group));
|
||||||
await mangoAccount.reload(client, 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(
|
console.log(
|
||||||
'mangoAccount.getEquity() ' +
|
'mangoAccount.getEquity() ' +
|
||||||
toUiDecimals(mangoAccount.getEquity().toNumber()),
|
toUiDecimals(mangoAccount.getEquity().toNumber()),
|
||||||
|
|
Loading…
Reference in New Issue