client: Fix example (#671)
This commit is contained in:
parent
2cc82bc11a
commit
f8276be2b8
|
@ -16,3 +16,4 @@ shellexpand = "2.1.0"
|
||||||
anyhow = "1.0.32"
|
anyhow = "1.0.32"
|
||||||
rand = "0.7.3"
|
rand = "0.7.3"
|
||||||
clap = "3.0.0-beta.2"
|
clap = "3.0.0-beta.2"
|
||||||
|
solana-sdk = "1.7.11"
|
|
@ -5,6 +5,7 @@ use anchor_client::solana_sdk::signature::{Keypair, Signer};
|
||||||
use anchor_client::solana_sdk::system_instruction;
|
use anchor_client::solana_sdk::system_instruction;
|
||||||
use anchor_client::{Client, Cluster, EventContext};
|
use anchor_client::{Client, Cluster, EventContext};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
use solana_sdk::system_program;
|
||||||
// The `accounts` and `instructions` modules are generated by the framework.
|
// The `accounts` and `instructions` modules are generated by the framework.
|
||||||
use basic_2::accounts as basic_2_accounts;
|
use basic_2::accounts as basic_2_accounts;
|
||||||
use basic_2::instruction as basic_2_instruction;
|
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.
|
// Build and send a transaction.
|
||||||
program
|
program
|
||||||
.request()
|
.request()
|
||||||
.instruction(system_instruction::create_account(
|
|
||||||
&authority,
|
|
||||||
&counter.pubkey(),
|
|
||||||
program.rpc().get_minimum_balance_for_rent_exemption(500)?,
|
|
||||||
500,
|
|
||||||
&pid,
|
|
||||||
))
|
|
||||||
.signer(&counter)
|
.signer(&counter)
|
||||||
.accounts(basic_2_accounts::Create {
|
.accounts(basic_2_accounts::Create {
|
||||||
counter: counter.pubkey(),
|
counter: counter.pubkey(),
|
||||||
|
user: authority,
|
||||||
|
system_program: system_program::ID,
|
||||||
})
|
})
|
||||||
.args(basic_2_instruction::Create { authority })
|
.args(basic_2_instruction::Create { authority })
|
||||||
.send()?;
|
.send()?;
|
||||||
|
|
Loading…
Reference in New Issue