added getCompleteMarginACcountsForOwner
This commit is contained in:
parent
3d88bd40c7
commit
222262e43a
|
@ -148,6 +148,7 @@ export class MarginAccount {
|
||||||
this.openOrdersAccounts = await Promise.all(promises)
|
this.openOrdersAccounts = await Promise.all(promises)
|
||||||
return this.openOrdersAccounts
|
return this.openOrdersAccounts
|
||||||
}
|
}
|
||||||
|
|
||||||
toPrettyString(
|
toPrettyString(
|
||||||
mangoGroup: MangoGroup
|
mangoGroup: MangoGroup
|
||||||
): string {
|
): string {
|
||||||
|
@ -954,6 +955,18 @@ export class MangoClient {
|
||||||
new MarginAccount(publicKey, MarginAccountLayout.decode(accountInfo == null ? undefined : accountInfo.data))
|
new MarginAccount(publicKey, MarginAccountLayout.decode(accountInfo == null ? undefined : accountInfo.data))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getCompleteMarginAccountsForOwner(
|
||||||
|
connection: Connection,
|
||||||
|
programId: PublicKey,
|
||||||
|
mangoGroup: MangoGroup,
|
||||||
|
owner: Account | Wallet
|
||||||
|
): Promise<MarginAccount[]> {
|
||||||
|
|
||||||
|
const marginAccounts = await this.getMarginAccountsForOwner(connection, programId, mangoGroup, owner)
|
||||||
|
await Promise.all(marginAccounts.map((ma) => ma.loadOpenOrders(connection, mangoGroup.dexProgramId)))
|
||||||
|
return marginAccounts
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getMultipleAccounts(
|
async function getMultipleAccounts(
|
||||||
|
|
Loading…
Reference in New Issue