client: Fix example (#671)

This commit is contained in:
Armani Ferrante 2021-09-03 11:01:35 -07:00 committed by GitHub
parent 2cc82bc11a
commit f8276be2b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -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"

View File

@ -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()?;