From 0225b7c0fd40c67b92c4f4bc60fd4b6752d5c030 Mon Sep 17 00:00:00 2001 From: Noah Prince <83885631+ChewingGlass@users.noreply.github.com> Date: Fri, 7 Jul 2023 14:30:38 -0700 Subject: [PATCH] lang: Allow polymorphic CPI calls matching an interface (#2559) --- CHANGELOG.md | 1 + lang/syn/src/codegen/program/cpi.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d1d7f992..60133dce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The minor version will be incremented upon a breaking change and the patch versi - lang: Add `get_lamports`, `add_lamports` and `sub_lamports` methods for all account types ([#2552](https://github.com/coral-xyz/anchor/pull/2552)). - client: Add a helper struct `DynSigner` to simplify use of `Client where >` with Solana clap CLI utils that loads `Signer` as `Box` ([#2550](https://github.com/coral-xyz/anchor/pull/2550)). +- lang: Allow CPI calls matching an interface without pinning program ID ([#2559](https://github.com/coral-xyz/anchor/pull/2559)). ### Fixes diff --git a/lang/syn/src/codegen/program/cpi.rs b/lang/syn/src/codegen/program/cpi.rs index 6a8e0d929..117fbf7b2 100644 --- a/lang/syn/src/codegen/program/cpi.rs +++ b/lang/syn/src/codegen/program/cpi.rs @@ -40,7 +40,7 @@ pub fn generate(program: &Program) -> proc_macro2::TokenStream { data.append(&mut ix_data); let accounts = ctx.to_account_metas(None); anchor_lang::solana_program::instruction::Instruction { - program_id: crate::ID, + program_id: ctx.program.key(), accounts, data, }