Update clap to v3.1.6 (#224)
This commit is contained in:
parent
5b43fe1455
commit
9a6f6abcb0
File diff suppressed because it is too large
Load Diff
|
@ -35,7 +35,7 @@ pub fn create_account_rent_exempt(
|
||||||
|
|
||||||
let instructions = vec![create_account_instr];
|
let instructions = vec![create_account_instr];
|
||||||
|
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
|
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
&instructions,
|
&instructions,
|
||||||
|
@ -63,7 +63,7 @@ pub fn create_token_account(
|
||||||
payer,
|
payer,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let signers = vec![payer, &spl_account];
|
let signers = vec![payer, &spl_account];
|
||||||
|
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
|
@ -143,7 +143,7 @@ pub fn create_and_init_mint(
|
||||||
)?;
|
)?;
|
||||||
let instructions = vec![create_mint_account_instruction, initialize_mint_instruction];
|
let instructions = vec![create_mint_account_instruction, initialize_mint_instruction];
|
||||||
|
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
&instructions,
|
&instructions,
|
||||||
Some(&payer_keypair.pubkey()),
|
Some(&payer_keypair.pubkey()),
|
||||||
|
@ -193,7 +193,7 @@ pub fn mint_to_new_account(
|
||||||
|
|
||||||
let instructions = vec![create_recip_instr, init_recip_instr, mint_tokens_instr];
|
let instructions = vec![create_recip_instr, init_recip_instr, mint_tokens_instr];
|
||||||
|
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
&instructions,
|
&instructions,
|
||||||
Some(&payer.pubkey()),
|
Some(&payer.pubkey()),
|
||||||
|
@ -221,7 +221,7 @@ pub fn transfer(
|
||||||
&[],
|
&[],
|
||||||
amount,
|
amount,
|
||||||
)?;
|
)?;
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let signers = [payer, from_authority];
|
let signers = [payer, from_authority];
|
||||||
let txn =
|
let txn =
|
||||||
Transaction::new_signed_with_payer(&[instr], Some(&payer.pubkey()), &signers, recent_hash);
|
Transaction::new_signed_with_payer(&[instr], Some(&payer.pubkey()), &signers, recent_hash);
|
||||||
|
|
|
@ -11,7 +11,7 @@ path = "src/bin/main.rs"
|
||||||
serum_dex = { path = "../", default-features = false, features = ["client"] }
|
serum_dex = { path = "../", default-features = false, features = ["client"] }
|
||||||
serum-common = { path = "../../common", features = ["client"] }
|
serum-common = { path = "../../common", features = ["client"] }
|
||||||
spl-token = { version = "3.0.0-pre1", features = ["no-entrypoint"], default-features = false }
|
spl-token = { version = "3.0.0-pre1", features = ["no-entrypoint"], default-features = false }
|
||||||
clap = "3.0.0-beta.1"
|
clap = { version = "3.1.6", features = ["derive"] }
|
||||||
enumflags2 = "0.6.4"
|
enumflags2 = "0.6.4"
|
||||||
solana-client = "1.6.18"
|
solana-client = "1.6.18"
|
||||||
solana-sdk = "1.6.18"
|
solana-sdk = "1.6.18"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::Clap;
|
use clap::Parser;
|
||||||
use crank::Opts;
|
use crank::Opts;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
|
|
@ -11,7 +11,7 @@ use std::sync::{Arc, Mutex};
|
||||||
use std::{thread, time};
|
use std::{thread, time};
|
||||||
|
|
||||||
use anyhow::{format_err, Result};
|
use anyhow::{format_err, Result};
|
||||||
use clap::Clap;
|
use clap::Parser;
|
||||||
use debug_print::debug_println;
|
use debug_print::debug_println;
|
||||||
use enumflags2::BitFlags;
|
use enumflags2::BitFlags;
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
|
@ -63,7 +63,7 @@ fn read_keypair_file(s: &str) -> Result<Keypair> {
|
||||||
.map_err(|_| format_err!("failed to read keypair from {}", s))
|
.map_err(|_| format_err!("failed to read keypair from {}", s))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clap, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
pub struct Opts {
|
pub struct Opts {
|
||||||
#[clap(default_value = "mainnet")]
|
#[clap(default_value = "mainnet")]
|
||||||
pub cluster: Cluster,
|
pub cluster: Cluster,
|
||||||
|
@ -77,7 +77,7 @@ impl Opts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clap, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
Genesis {
|
Genesis {
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
|
@ -726,7 +726,7 @@ pub fn consume_events_once(
|
||||||
&payer.pubkey(),
|
&payer.pubkey(),
|
||||||
rand::random::<u64>() % 10000 + 1,
|
rand::random::<u64>() % 10000 + 1,
|
||||||
);
|
);
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
&[instruction, random_instruction],
|
&[instruction, random_instruction],
|
||||||
Some(&payer.pubkey()),
|
Some(&payer.pubkey()),
|
||||||
|
@ -761,7 +761,7 @@ fn consume_events(
|
||||||
Some(i) => i,
|
Some(i) => i,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
info!("Consuming events ...");
|
info!("Consuming events ...");
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
std::slice::from_ref(&instruction),
|
std::slice::from_ref(&instruction),
|
||||||
|
@ -968,7 +968,7 @@ pub fn cancel_order_by_client_order_id(
|
||||||
&state.event_q,
|
&state.event_q,
|
||||||
client_order_id,
|
client_order_id,
|
||||||
)?];
|
)?];
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let txn = Transaction::new_signed_with_payer(ixs, Some(&owner.pubkey()), &[owner], recent_hash);
|
let txn = Transaction::new_signed_with_payer(ixs, Some(&owner.pubkey()), &[owner], recent_hash);
|
||||||
|
|
||||||
debug_println!("Canceling order by client order id instruction ...");
|
debug_println!("Canceling order by client order id instruction ...");
|
||||||
|
@ -997,7 +997,7 @@ pub fn close_open_orders(
|
||||||
&owner.pubkey(),
|
&owner.pubkey(),
|
||||||
&state.market,
|
&state.market,
|
||||||
)?];
|
)?];
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let txn = Transaction::new_signed_with_payer(ixs, Some(&owner.pubkey()), &[owner], recent_hash);
|
let txn = Transaction::new_signed_with_payer(ixs, Some(&owner.pubkey()), &[owner], recent_hash);
|
||||||
|
|
||||||
debug_println!("Simulating close open orders instruction ...");
|
debug_println!("Simulating close open orders instruction ...");
|
||||||
|
@ -1046,7 +1046,7 @@ pub fn init_open_orders(
|
||||||
)?);
|
)?);
|
||||||
signers.push(owner);
|
signers.push(owner);
|
||||||
|
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
&instructions,
|
&instructions,
|
||||||
Some(&owner.pubkey()),
|
Some(&owner.pubkey()),
|
||||||
|
@ -1109,7 +1109,7 @@ pub fn place_order(
|
||||||
instructions.push(instruction);
|
instructions.push(instruction);
|
||||||
signers.push(payer);
|
signers.push(payer);
|
||||||
|
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
&instructions,
|
&instructions,
|
||||||
Some(&payer.pubkey()),
|
Some(&payer.pubkey()),
|
||||||
|
@ -1146,7 +1146,7 @@ fn settle_funds(
|
||||||
AccountMeta::new_readonly(spl_token::ID, false),
|
AccountMeta::new_readonly(spl_token::ID, false),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let mut signers = vec![payer];
|
let mut signers = vec![payer];
|
||||||
if let Some(s) = signer {
|
if let Some(s) = signer {
|
||||||
signers.push(s);
|
signers.push(s);
|
||||||
|
@ -1231,7 +1231,7 @@ pub fn list_market(
|
||||||
|
|
||||||
instructions.push(init_market_instruction);
|
instructions.push(init_market_instruction);
|
||||||
|
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let signers = vec![
|
let signers = vec![
|
||||||
payer,
|
payer,
|
||||||
&market_key,
|
&market_key,
|
||||||
|
@ -1363,7 +1363,7 @@ pub fn match_orders(
|
||||||
data: instruction_data,
|
data: instruction_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
std::slice::from_ref(&instruction),
|
std::slice::from_ref(&instruction),
|
||||||
Some(&payer.pubkey()),
|
Some(&payer.pubkey()),
|
||||||
|
@ -1412,7 +1412,7 @@ fn create_account(
|
||||||
|
|
||||||
let instructions = vec![create_account_instr, init_account_instr];
|
let instructions = vec![create_account_instr, init_account_instr];
|
||||||
|
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
|
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
&instructions,
|
&instructions,
|
||||||
|
@ -1446,7 +1446,7 @@ fn mint_to_existing_account(
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let instructions = vec![mint_tokens_instr];
|
let instructions = vec![mint_tokens_instr];
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
&instructions,
|
&instructions,
|
||||||
Some(&payer.pubkey()),
|
Some(&payer.pubkey()),
|
||||||
|
@ -1475,7 +1475,7 @@ fn initialize_token_account(client: &RpcClient, mint: &Pubkey, owner: &Keypair)
|
||||||
)?;
|
)?;
|
||||||
let signers = vec![owner, &recip_keypair];
|
let signers = vec![owner, &recip_keypair];
|
||||||
let instructions = vec![create_recip_instr, init_recip_instr];
|
let instructions = vec![create_recip_instr, init_recip_instr];
|
||||||
let (recent_hash, _fee_calc) = client.get_recent_blockhash()?;
|
let recent_hash = client.get_latest_blockhash()?;
|
||||||
let txn = Transaction::new_signed_with_payer(
|
let txn = Transaction::new_signed_with_payer(
|
||||||
&instructions,
|
&instructions,
|
||||||
Some(&owner.pubkey()),
|
Some(&owner.pubkey()),
|
||||||
|
|
Loading…
Reference in New Issue