allow fetching mango account by publickey
This commit is contained in:
parent
5b4a810c5e
commit
0def209608
|
@ -602,10 +602,14 @@ export class MangoClient {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getMangoAccount(mangoAccount: MangoAccount) {
|
public async getMangoAccount(mangoAccount: MangoAccount | PublicKey) {
|
||||||
|
const mangoAccountPk =
|
||||||
|
mangoAccount instanceof MangoAccount
|
||||||
|
? mangoAccount.publicKey
|
||||||
|
: mangoAccount;
|
||||||
return MangoAccount.from(
|
return MangoAccount.from(
|
||||||
mangoAccount.publicKey,
|
mangoAccountPk,
|
||||||
await this.program.account.mangoAccount.fetch(mangoAccount.publicKey),
|
await this.program.account.mangoAccount.fetch(mangoAccountPk),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue