瀏覽代碼

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

Noah Prince 3 年之前
父節點
當前提交
52a7e1e278
共有 1 個文件被更改,包括 1 次插入5 次删除
  1. 1 5
      ts/packages/anchor/src/program/accounts-resolver.ts

+ 1 - 5
ts/packages/anchor/src/program/accounts-resolver.ts

@@ -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) {