bug: use program id from account, not idl, when resolving relations (#2221)

This commit is contained in:
Noah Prince 2022-10-11 11:44:41 -05:00 committed by GitHub
parent fd467df932
commit 52a7e1e278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 5 deletions

View File

@ -231,12 +231,8 @@ export class AccountsResolver<IDL extends Idl, I extends AllInstructions<IDL>> {
found += matching.length;
if (matching.length > 0) {
const programId = await this.parseProgramId(
accountDesc as IdlAccount
);
const account = await this._accountStore.fetchAccount({
publicKey: accountKey,
programId,
});
await Promise.all(
matching.map(async (rel) => {
@ -506,7 +502,7 @@ export class AccountStore<IDL extends Idl> {
throw new Error(`invalid account info for ${address}`);
}
const data = account.data;
const accounts = await this.ensureIdl(programId);
const accounts = await this.ensureIdl(account.owner);
if (accounts) {
const firstAccountLayout = Object.values(accounts)[0] as any;
if (!firstAccountLayout) {