Skip to content

Commit

Permalink
Use ProgramRpcClientSendTransaction::new_with_confirmation everywhe…
Browse files Browse the repository at this point in the history
…re else

This is done in order to keep the changes minimal and behavior the same.
  • Loading branch information
acheroncrypto committed Dec 17, 2024
1 parent 5e0d030 commit 6be5398
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion single-pool/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion single-pool/cli/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions token-upgrade/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
42 changes: 26 additions & 16 deletions token/cli/tests/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn ProgramClient<ProgramRpcClientSendTransaction>> = Arc::new(
ProgramRpcClient::new(rpc_client.clone(), ProgramRpcClientSendTransaction),
);
let program_client: Arc<dyn ProgramClient<ProgramRpcClientSendTransaction>> =
Arc::new(ProgramRpcClient::new(
rpc_client.clone(),
ProgramRpcClientSendTransaction::new_with_confirmation(),
));
Config {
rpc_client,
program_client,
Expand All @@ -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<dyn ProgramClient<ProgramRpcClientSendTransaction>> = Arc::new(
ProgramRpcClient::new(rpc_client.clone(), ProgramRpcClientSendTransaction),
);
let program_client: Arc<dyn ProgramClient<ProgramRpcClientSendTransaction>> =
Arc::new(ProgramRpcClient::new(
rpc_client.clone(),
ProgramRpcClientSendTransaction::new_with_confirmation(),
));
Config {
rpc_client,
program_client,
Expand Down Expand Up @@ -3132,7 +3136,7 @@ async fn do_offline_multisig_transfer(
let offline_program_client: Arc<dyn ProgramClient<ProgramRpcClientSendTransaction>> =
Arc::new(ProgramOfflineClient::new(
blockhash,
ProgramRpcClientSendTransaction,
ProgramRpcClientSendTransaction::new_with_confirmation(),
));
let mut args = vec![
"spl-token".to_string(),
Expand Down Expand Up @@ -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<dyn ProgramClient<ProgramRpcClientSendTransaction>> = Arc::new(
ProgramRpcClient::new(config.rpc_client.clone(), ProgramRpcClientSendTransaction),
);
let rpc_program_client: Arc<dyn ProgramClient<ProgramRpcClientSendTransaction>> =
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(),
Expand Down Expand Up @@ -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<dyn ProgramClient<ProgramRpcClientSendTransaction>> = Arc::new(
ProgramOfflineClient::new(blockhash, ProgramRpcClientSendTransaction),
);
let program_client: Arc<dyn ProgramClient<ProgramRpcClientSendTransaction>> =
Arc::new(ProgramOfflineClient::new(
blockhash,
ProgramRpcClientSendTransaction::new_with_confirmation(),
));
config.program_client = program_client;
let _result = exec_test_cmd(
&config,
Expand Down Expand Up @@ -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<dyn ProgramClient<ProgramRpcClientSendTransaction>> = Arc::new(
ProgramOfflineClient::new(blockhash, ProgramRpcClientSendTransaction),
);
let program_client: Arc<dyn ProgramClient<ProgramRpcClientSendTransaction>> =
Arc::new(ProgramOfflineClient::new(
blockhash,
ProgramRpcClientSendTransaction::new_with_confirmation(),
));
config.program_client = program_client;

let _result = exec_test_cmd(
Expand Down
2 changes: 1 addition & 1 deletion token/transfer-hook/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 6be5398

Please sign in to comment.