Cli: move airdrop to rpc requests (#16557)

* Add recent_blockhash to requestAirdrop

* Move tx confirmation to separate method

* Add RpcClient airdrop methods

* Request cli airdrop via RpcClient

* Pass optional faucet_addr into TestValidator and fix tests

* Update client/src/rpc_client.rs

Co-authored-by: Michael Vines <mvines@gmail.com>

Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
Tyera Eulberg
2021-04-15 00:25:23 -06:00
committed by GitHub
parent 76ce28c723
commit 7dfb51c0b4
16 changed files with 261 additions and 305 deletions

View File

@ -1046,7 +1046,7 @@ mod tests {
#[test]
fn test_process_token_allocations() {
let alice = Keypair::new();
let test_validator = TestValidator::with_no_fees(alice.pubkey());
let test_validator = TestValidator::with_no_fees(alice.pubkey(), None);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
@ -1056,7 +1056,7 @@ mod tests {
#[test]
fn test_process_transfer_amount_allocations() {
let alice = Keypair::new();
let test_validator = TestValidator::with_no_fees(alice.pubkey());
let test_validator = TestValidator::with_no_fees(alice.pubkey(), None);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
@ -1066,7 +1066,7 @@ mod tests {
#[test]
fn test_process_stake_allocations() {
let alice = Keypair::new();
let test_validator = TestValidator::with_no_fees(alice.pubkey());
let test_validator = TestValidator::with_no_fees(alice.pubkey(), None);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
@ -1381,7 +1381,7 @@ mod tests {
let fees_in_sol = lamports_to_sol(fees);
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees);
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees, None);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
@ -1464,7 +1464,7 @@ mod tests {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees);
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees, None);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
@ -1574,7 +1574,7 @@ mod tests {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees);
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees, None);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
@ -1683,7 +1683,7 @@ mod tests {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees);
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees, None);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
@ -1998,7 +1998,7 @@ mod tests {
#[test]
fn test_distribute_allocations_dump_db() {
let sender_keypair = Keypair::new();
let test_validator = TestValidator::with_no_fees(sender_keypair.pubkey());
let test_validator = TestValidator::with_no_fees(sender_keypair.pubkey(), None);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());

View File

@ -8,7 +8,7 @@ fn test_process_distribute_with_rpc_client() {
solana_logger::setup();
let mint_keypair = Keypair::new();
let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey());
let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey(), None);
let client = RpcClient::new(test_validator.rpc_url());
test_process_distribute_tokens_with_client(&client, mint_keypair, None);