Explorar o código

Fix program account not being passed to CPI (#316)

* Fix program account not being passed to CPI

* Fix transaction sending
guibescos %!s(int64=3) %!d(string=hai) anos
pai
achega
57bdb092f5

+ 7 - 1
pythnet/remote-executor/cli/src/main.rs

@@ -1,6 +1,5 @@
 #![deny(warnings)]
 pub mod cli;
-
 use std::str::FromStr;
 
 use anchor_client::{
@@ -318,6 +317,13 @@ pub fn get_execute_instruction(
 
     // Add the rest of `remaining_accounts` from the payload
     for instruction in executor_payload.instructions {
+        // Push program_id
+        account_metas.push(AccountMeta {
+            pubkey: instruction.program_id,
+            is_signer: false,
+            is_writable: false,
+        });
+        // Push other accounts
         for account_meta in Instruction::from(&instruction).accounts {
             if account_meta.pubkey != executor_key {
                 account_metas.push(account_meta.clone());

+ 7 - 0
pythnet/remote-executor/programs/remote-executor/src/tests/executor_simulator.rs

@@ -340,6 +340,13 @@ impl ExecutorSimulator {
 
         // Add the rest of `remaining_accounts` from parsing the payload
         for instruction in executor_payload.instructions {
+            // Push program_id
+            account_metas.push(AccountMeta {
+                pubkey: instruction.program_id,
+                is_signer: false,
+                is_writable: false,
+            });
+            // Push other accounts
             for account_meta in Instruction::from(&instruction).accounts {
                 if account_meta.pubkey != executor_key {
                     account_metas.push(account_meta.clone());