* CLI: dynamic signing reboot (#8384) * Add keypair_util_from_path helper * Cli: impl config.keypair as a trait object * SDK: Add Debug and PartialEq for dyn Signer * ClapUtils: Arg parsing from pubkey+signers to Presigner * Impl Signers for &dyn Signer collections * CLI: Add helper for getting signers from args * CLI: Replace SigningAuthority with Signer trait-objs * CLI: Drop disused signers command field * CLI: Drop redundant tests * Add clap validator that handles all current signer types * clap_utils: Factor Presigner resolution to helper * SDK: `From` for boxing Signer implementors to trait objects * SDK: Derive `Clone` for `Presigner` * Remove panic * Cli: dedup signers in transfer for remote-wallet ergonomics * Update docs vis-a-vis ASK changes * Cli: update transaction types to use new dynamic-signer methods * CLI: Fix tests No. 1 what to do about write_keypair outstanding * Work around `CliConfig`'s signer not necessarily being a `Keypair` * CLI: Fix tests No. 2 * Remove unused arg * Remove unused methods * Move offline arg constants upstream * Make cli signing fallible Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com> * Reinstate `create-stale-account` w/ seed test (#8401) automerge * CLI: collect and deduplicate signers (#8398) * Rename (keypair util is not a thing) * Add method to generate_unique_signers * Cli: refactor signer handling and remote-wallet init * Fixup unit tests * Fixup intergation tests * Update keypair path print statement * Remove &None * Use deterministic key in test * Retain storage-account as index * Make signer index-handling less brittle * Cache pubkey on RemoteKeypair::new * Make signer_of consistent + return pubkey * Remove &matches double references * Nonce authorities need special handling * Make solana root key accessible on Ledger (#8421) * Use 44/501 key as ledger id * Add error codes * Ledger key path rework (#8453) automerge * Ledger hardware wallet docs (#8472) * Update protocol documentation * Correct app-version command const * Rough initial Ledger docs * Add more docs * Cleanup * Add remote-wallet to docs TOC Co-authored-by: Greg Fitzgerald <greg@solana.com> * Add flag to confirm key on device Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com> Co-authored-by: Greg Fitzgerald <greg@solana.com>
40 lines
1.3 KiB
Rust
40 lines
1.3 KiB
Rust
use solana_cli::cli::{process_command, CliCommand, CliConfig};
|
|
use solana_client::rpc_client::RpcClient;
|
|
use solana_core::validator::new_validator_for_tests;
|
|
use solana_faucet::faucet::run_local_faucet;
|
|
use solana_sdk::signature::Keypair;
|
|
use std::{fs::remove_dir_all, sync::mpsc::channel};
|
|
|
|
#[test]
|
|
fn test_cli_request_airdrop() {
|
|
let (server, leader_data, alice, ledger_path) = new_validator_for_tests();
|
|
let (sender, receiver) = channel();
|
|
run_local_faucet(alice, sender, None);
|
|
let faucet_addr = receiver.recv().unwrap();
|
|
|
|
let mut bob_config = CliConfig::default();
|
|
bob_config.json_rpc_url = format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port());
|
|
bob_config.command = CliCommand::Airdrop {
|
|
faucet_host: None,
|
|
faucet_port: faucet_addr.port(),
|
|
pubkey: None,
|
|
lamports: 50,
|
|
};
|
|
let keypair = Keypair::new();
|
|
bob_config.signers = vec![&keypair];
|
|
|
|
let sig_response = process_command(&bob_config);
|
|
sig_response.unwrap();
|
|
|
|
let rpc_client = RpcClient::new_socket(leader_data.rpc);
|
|
|
|
let balance = rpc_client
|
|
.retry_get_balance(&bob_config.signers[0].pubkey(), 1)
|
|
.unwrap()
|
|
.unwrap();
|
|
assert_eq!(balance, 50);
|
|
|
|
server.close().unwrap();
|
|
remove_dir_all(ledger_path).unwrap();
|
|
}
|