diff --git a/ts/client/src/accounts/mangoAccount.ts b/ts/client/src/accounts/mangoAccount.ts index f9a4d9dee..e8905ef9a 100644 --- a/ts/client/src/accounts/mangoAccount.ts +++ b/ts/client/src/accounts/mangoAccount.ts @@ -450,6 +450,7 @@ export class MangoAccount { let res = 'MangoAccount'; res = res + '\n pk: ' + this.publicKey.toString(); res = res + '\n name: ' + this.name; + res = res + '\n owner: ' + this.owner; res = res + '\n delegate: ' + this.delegate; res = diff --git a/ts/client/src/debug-scripts/mb-debug-user.ts b/ts/client/src/debug-scripts/mb-debug-user.ts index 5cfc937ce..522db06b2 100644 --- a/ts/client/src/debug-scripts/mb-debug-user.ts +++ b/ts/client/src/debug-scripts/mb-debug-user.ts @@ -1,8 +1,7 @@ import { AnchorProvider, Wallet } from '@project-serum/anchor'; -import { Connection, Keypair } from '@solana/web3.js'; +import { Connection, Keypair, PublicKey } from '@solana/web3.js'; import fs from 'fs'; import { Group } from '../accounts/group'; -import { I80F48 } from '../accounts/I80F48'; import { HealthType, MangoAccount } from '../accounts/mangoAccount'; import { MangoClient } from '../client'; import { MANGO_V4_ID } from '../constants'; @@ -14,6 +13,7 @@ async function debugUser( mangoAccount: MangoAccount, ) { console.log(mangoAccount.toString(group)); + await mangoAccount.reload(client, group); console.log( @@ -67,8 +67,6 @@ async function debugUser( ), ); - console.log(group.banksMapByName.get('SOL')[0].mint.toBase58()); - async function getMaxWithdrawWithBorrowForTokenUiWrapper(token) { console.log( `mangoAccount.getMaxWithdrawWithBorrowForTokenUi(group, ${token}) ` + @@ -147,7 +145,6 @@ async function main() { ); const group = await client.getGroupForCreator(admin.publicKey, 2); - console.log(`${group.toString()}`); for (const keypair of [ process.env.MB_PAYER_KEYPAIR, @@ -159,18 +156,26 @@ async function main() { ); const userWallet = new Wallet(user); console.log(`User ${userWallet.publicKey.toBase58()}`); - const mangoAccounts = await client.getMangoAccountsForOwner( - group, - user.publicKey, - ); + // const mangoAccounts = await client.getMangoAccountsForOwner( + // group, + // user.publicKey, + // ); + const mangoAccounts = await Promise.all([ + await client.getMangoAccount({ + publicKey: new PublicKey( + '6mqHfpJqnXcu6RgDYZSVW9CQXQPFyRYhgvdzvWXN9mPW', + ), + } as any), + ]); for (const mangoAccount of mangoAccounts) { console.log(`MangoAccount ${mangoAccount.publicKey}`); - if ( - 'etVgrWPAQe3aUMiuZT32tEMnbtuD2yRxip6eEkSRrLV' === - // '2UWD1ZBiYdusXgXputE68MBL4Kz47nZptzMn6rLnzn1K' === - // '9B8uwqH8FJqLn9kvGPVb5GEksLvmyXb3B8UKCFtRs5cq' === - mangoAccount.publicKey.toBase58() - ) { + // if ( + // 'etVgrWPAQe3aUMiuZT32tEMnbtuD2yRxip6eEkSRrLV' === + // '2UWD1ZBiYdusXgXputE68MBL4Kz47nZptzMn6rLnzn1K' === + // '9B8uwqH8FJqLn9kvGPVb5GEksLvmyXb3B8UKCFtRs5cq' === + // mangoAccount.publicKey.toBase58() + // ) + { await debugUser(client, group, mangoAccount); } }