From 6be539886f1b3f7a8d2a274680d12a1877e344e0 Mon Sep 17 00:00:00 2001 From: acheron Date: Tue, 17 Dec 2024 20:46:33 +0100 Subject: [PATCH] Use `ProgramRpcClientSendTransaction::new_with_confirmation` everywhere else This is done in order to keep the changes minimal and behavior the same. --- single-pool/cli/src/config.rs | 2 +- single-pool/cli/tests/test.rs | 2 +- token-upgrade/cli/src/main.rs | 8 +++--- token/cli/tests/command.rs | 42 ++++++++++++++++++----------- token/transfer-hook/cli/src/main.rs | 2 +- 5 files changed, 33 insertions(+), 23 deletions(-) diff --git a/single-pool/cli/src/config.rs b/single-pool/cli/src/config.rs index 649c2c7ea17..664bdbd5f79 100644 --- a/single-pool/cli/src/config.rs +++ b/single-pool/cli/src/config.rs @@ -65,7 +65,7 @@ impl Config { // and program client let program_client = Arc::new(ProgramRpcClient::new( rpc_client.clone(), - ProgramRpcClientSendTransaction, + ProgramRpcClientSendTransaction::new_with_confirmation(), )); // resolve default signer diff --git a/single-pool/cli/tests/test.rs b/single-pool/cli/tests/test.rs index bceafc59d44..fd51c9efd29 100644 --- a/single-pool/cli/tests/test.rs +++ b/single-pool/cli/tests/test.rs @@ -56,7 +56,7 @@ async fn setup(initialize: bool) -> Env { let rpc_client = Arc::new(validator.get_async_rpc_client()); let program_client: PClient = Arc::new(ProgramRpcClient::new( rpc_client.clone(), - ProgramRpcClientSendTransaction, + ProgramRpcClientSendTransaction::new_with_confirmation(), )); // write the payer to disk diff --git a/token-upgrade/cli/src/main.rs b/token-upgrade/cli/src/main.rs index 852418d7d4c..cfbfbcc3480 100644 --- a/token-upgrade/cli/src/main.rs +++ b/token-upgrade/cli/src/main.rs @@ -89,7 +89,7 @@ async fn process_create_escrow_account( let program_client = Arc::new(ProgramRpcClient::new( rpc_client.clone(), - ProgramRpcClientSendTransaction, + ProgramRpcClientSendTransaction::new_with_confirmation(), )); let token = Token::new( program_client.clone(), @@ -545,7 +545,7 @@ mod test { let rpc_client = Arc::new(test_validator.get_async_rpc_client()); let client = Arc::new(ProgramRpcClient::new( rpc_client.clone(), - ProgramRpcClientSendTransaction, + ProgramRpcClientSendTransaction::new_with_confirmation(), )); let mint_authority = Keypair::new(); @@ -614,7 +614,7 @@ mod test { let rpc_client = Arc::new(test_validator.get_async_rpc_client()); let client = Arc::new(ProgramRpcClient::new( rpc_client.clone(), - ProgramRpcClientSendTransaction, + ProgramRpcClientSendTransaction::new_with_confirmation(), )); let mint_authority = Keypair::new(); @@ -721,7 +721,7 @@ mod test { let rpc_client = Arc::new(test_validator.get_async_rpc_client()); let client = Arc::new(ProgramRpcClient::new( rpc_client.clone(), - ProgramRpcClientSendTransaction, + ProgramRpcClientSendTransaction::new_with_confirmation(), )); let mint_authority = Keypair::new(); diff --git a/token/cli/tests/command.rs b/token/cli/tests/command.rs index 34bd1e7f9f7..2d3965ce292 100644 --- a/token/cli/tests/command.rs +++ b/token/cli/tests/command.rs @@ -190,9 +190,11 @@ fn test_config_with_default_signer<'a>( ) -> Config<'a> { let websocket_url = test_validator.rpc_pubsub_url(); let rpc_client = Arc::new(test_validator.get_async_rpc_client()); - let program_client: Arc> = Arc::new( - ProgramRpcClient::new(rpc_client.clone(), ProgramRpcClientSendTransaction), - ); + let program_client: Arc> = + Arc::new(ProgramRpcClient::new( + rpc_client.clone(), + ProgramRpcClientSendTransaction::new_with_confirmation(), + )); Config { rpc_client, program_client, @@ -219,9 +221,11 @@ fn test_config_without_default_signer<'a>( ) -> Config<'a> { let websocket_url = test_validator.rpc_pubsub_url(); let rpc_client = Arc::new(test_validator.get_async_rpc_client()); - let program_client: Arc> = Arc::new( - ProgramRpcClient::new(rpc_client.clone(), ProgramRpcClientSendTransaction), - ); + let program_client: Arc> = + Arc::new(ProgramRpcClient::new( + rpc_client.clone(), + ProgramRpcClientSendTransaction::new_with_confirmation(), + )); Config { rpc_client, program_client, @@ -3132,7 +3136,7 @@ async fn do_offline_multisig_transfer( let offline_program_client: Arc> = Arc::new(ProgramOfflineClient::new( blockhash, - ProgramRpcClientSendTransaction, + ProgramRpcClientSendTransaction::new_with_confirmation(), )); let mut args = vec![ "spl-token".to_string(), @@ -3192,9 +3196,11 @@ async fn do_offline_multisig_transfer( assert!(!absent_signers.contains(&token.to_string())); // now send the transaction - let rpc_program_client: Arc> = Arc::new( - ProgramRpcClient::new(config.rpc_client.clone(), ProgramRpcClientSendTransaction), - ); + let rpc_program_client: Arc> = + Arc::new(ProgramRpcClient::new( + config.rpc_client.clone(), + ProgramRpcClientSendTransaction::new_with_confirmation(), + )); config.program_client = rpc_program_client; let mut args = vec![ "spl-token".to_string(), @@ -3849,9 +3855,11 @@ async fn transfer_hook(test_validator: &TestValidator, payer: &Keypair) { // Make sure that parsing transfer hook accounts works let real_program_client = config.program_client; let blockhash = Hash::default(); - let program_client: Arc> = Arc::new( - ProgramOfflineClient::new(blockhash, ProgramRpcClientSendTransaction), - ); + let program_client: Arc> = + Arc::new(ProgramOfflineClient::new( + blockhash, + ProgramRpcClientSendTransaction::new_with_confirmation(), + )); config.program_client = program_client; let _result = exec_test_cmd( &config, @@ -3965,9 +3973,11 @@ async fn transfer_hook_with_transfer_fee(test_validator: &TestValidator, payer: // Make sure that parsing transfer hook accounts and expected-fee works let blockhash = Hash::default(); - let program_client: Arc> = Arc::new( - ProgramOfflineClient::new(blockhash, ProgramRpcClientSendTransaction), - ); + let program_client: Arc> = + Arc::new(ProgramOfflineClient::new( + blockhash, + ProgramRpcClientSendTransaction::new_with_confirmation(), + )); config.program_client = program_client; let _result = exec_test_cmd( diff --git a/token/transfer-hook/cli/src/main.rs b/token/transfer-hook/cli/src/main.rs index bf7273b1766..9ca78ccac38 100644 --- a/token/transfer-hook/cli/src/main.rs +++ b/token/transfer-hook/cli/src/main.rs @@ -601,7 +601,7 @@ mod test { let rpc_client = Arc::new(test_validator.get_async_rpc_client()); let client = Arc::new(ProgramRpcClient::new( rpc_client.clone(), - ProgramRpcClientSendTransaction, + ProgramRpcClientSendTransaction::new_with_confirmation(), )); let token = Token::new(