small updates to debug scripts, also log vault balance in ui and native, filter mango accounts by name instead of pubkeys

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-08-26 10:45:50 +02:00
parent 7fbf2b592a
commit 177770c580
2 changed files with 6 additions and 15 deletions

View File

@ -5,6 +5,7 @@ import fs from 'fs';
import { I80F48, ZERO_I80F48 } from '../accounts/I80F48';
import { MangoClient } from '../client';
import { MANGO_V4_ID } from '../constants';
import { toUiDecimals } from '../utils';
async function main() {
const options = AnchorProvider.defaultOptions();
@ -132,14 +133,10 @@ async function main() {
`\n ${'borrowRate'.padEnd(40)} ${(
100 * bank.getBorrowRate().toNumber()
).toFixed(2)}%` +
`\n ${'vault balance'.padEnd(40)} ${coder()
.accounts.decode(
'token',
await (
await client.program.provider.connection.getAccountInfo(bank.vault)
).data,
)
.amount.toNumber()}` +
`\n ${'vault balance'.padEnd(40)} ${toUiDecimals(
vault,
bank.mintDecimals,
)}, ${vault} native` +
`\n ${'last index update'.padEnd(40)} ${new Date(
1000 * bank.indexLastUpdated.toNumber(),
)}` +

View File

@ -173,13 +173,7 @@ async function main() {
for (const mangoAccount of mangoAccounts) {
console.log(`MangoAccount ${mangoAccount.publicKey}`);
// if (
// 'etVgrWPAQe3aUMiuZT32tEMnbtuD2yRxip6eEkSRrLV' ===
// '2UWD1ZBiYdusXgXputE68MBL4Kz47nZptzMn6rLnzn1K' ===
// '9B8uwqH8FJqLn9kvGPVb5GEksLvmyXb3B8UKCFtRs5cq' ===
// mangoAccount.publicKey.toBase58()
// )
{
if (mangoAccount.name === '2nd Account') {
await debugUser(client, group, mangoAccount);
}
}