From 4103d61492e940a3070979b1f204f67da9e2f2ff Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Sun, 20 Mar 2022 10:59:21 +0300 Subject: [PATCH] update deprecated api --- cli/src/lib.rs | 24 ++++++++++++------------ client/src/lib.rs | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 55a2fc8773..712e641c69 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -1556,12 +1556,12 @@ fn idl_set_buffer(cfg_override: &ConfigOverride, program_id: Pubkey, buffer: Pub }; // Build the transaction. - let (recent_hash, _fee_calc) = client.get_recent_blockhash()?; + let latest_hash = client.get_latest_blockhash()?; let tx = Transaction::new_signed_with_payer( &[set_buffer_ix], Some(&keypair.pubkey()), &[&keypair], - recent_hash, + latest_hash, ); // Send the transaction. @@ -1647,12 +1647,12 @@ fn idl_set_authority( data, }; // Send transaction. - let (recent_hash, _fee_calc) = client.get_recent_blockhash()?; + let latest_hash = client.get_latest_blockhash()?; let tx = Transaction::new_signed_with_payer( &[ix], Some(&keypair.pubkey()), &[&keypair], - recent_hash, + latest_hash, ); client.send_and_confirm_transaction_with_spinner_and_config( &tx, @@ -1732,12 +1732,12 @@ fn idl_write(cfg: &Config, program_id: &Pubkey, idl: &Idl, idl_address: Pubkey) data, }; // Send transaction. - let (recent_hash, _fee_calc) = client.get_recent_blockhash()?; + let latest_hash = client.get_latest_blockhash()?; let tx = Transaction::new_signed_with_payer( &[ix], Some(&keypair.pubkey()), &[&keypair], - recent_hash, + latest_hash, ); client.send_and_confirm_transaction_with_spinner_and_config( &tx, @@ -2156,7 +2156,7 @@ fn start_test_validator( .and_then(|test| test.startup_wait) .unwrap_or(5_000); while count < ms_wait { - let r = client.get_recent_blockhash(); + let r = client.get_latest_blockhash(); if r.is_ok() { break; } @@ -2165,7 +2165,7 @@ fn start_test_validator( } if count == ms_wait { eprintln!( - "Unable to get recent blockhash. Test validator does not look started. Check {} for errors. Consider increasing [test.startup_wait] in Anchor.toml.", + "Unable to get latest blockhash. Test validator does not look started. Check {} for errors. Consider increasing [test.startup_wait] in Anchor.toml.", test_ledger_log_filename ); validator_handle.kill()?; @@ -2385,12 +2385,12 @@ fn create_idl_account( accounts, data, }; - let (recent_hash, _fee_calc) = client.get_recent_blockhash()?; + let latest_hash = client.get_latest_blockhash()?; let tx = Transaction::new_signed_with_payer( &[ix], Some(&keypair.pubkey()), &[&keypair], - recent_hash, + latest_hash, ); client.send_and_confirm_transaction_with_spinner_and_config( &tx, @@ -2451,12 +2451,12 @@ fn create_idl_buffer( }; // Build the transaction. - let (recent_hash, _fee_calc) = client.get_recent_blockhash()?; + let latest_hash = client.get_latest_blockhash()?; let tx = Transaction::new_signed_with_payer( &[create_account_ix, create_buffer_ix], Some(&keypair.pubkey()), &[&keypair, &buffer], - recent_hash, + latest_hash, ); // Send the transaction. diff --git a/client/src/lib.rs b/client/src/lib.rs index af79175855..b3291ac2d6 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -544,12 +544,12 @@ impl<'a> RequestBuilder<'a> { let rpc_client = RpcClient::new_with_commitment(self.cluster, self.options); let tx = { - let (recent_hash, _fee_calc) = rpc_client.get_recent_blockhash()?; + let latest_hash = rpc_client.get_latest_blockhash()?; Transaction::new_signed_with_payer( &instructions, Some(&self.payer.pubkey()), &signers, - recent_hash, + latest_hash, ) };