Armani Ferrante 4 жил өмнө
parent
commit
f8276be2b8

+ 1 - 0
client/example/Cargo.toml

@@ -16,3 +16,4 @@ shellexpand = "2.1.0"
 anyhow = "1.0.32"
 rand = "0.7.3"
 clap = "3.0.0-beta.2"
+solana-sdk = "1.7.11"

+ 3 - 7
client/example/src/main.rs

@@ -5,6 +5,7 @@ use anchor_client::solana_sdk::signature::{Keypair, Signer};
 use anchor_client::solana_sdk::system_instruction;
 use anchor_client::{Client, Cluster, EventContext};
 use anyhow::Result;
+use solana_sdk::system_program;
 // The `accounts` and `instructions` modules are generated by the framework.
 use basic_2::accounts as basic_2_accounts;
 use basic_2::instruction as basic_2_instruction;
@@ -146,16 +147,11 @@ fn basic_2(client: &Client, pid: Pubkey) -> Result<()> {
     // Build and send a transaction.
     program
         .request()
-        .instruction(system_instruction::create_account(
-            &authority,
-            &counter.pubkey(),
-            program.rpc().get_minimum_balance_for_rent_exemption(500)?,
-            500,
-            &pid,
-        ))
         .signer(&counter)
         .accounts(basic_2_accounts::Create {
             counter: counter.pubkey(),
+            user: authority,
+            system_program: system_program::ID,
         })
         .args(basic_2_instruction::Create { authority })
         .send()?;