Skip to content

Commit

Permalink
update deprecated api
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Mar 20, 2022
1 parent bb7c18d commit 4103d61
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand All @@ -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()?;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
};

Expand Down

0 comments on commit 4103d61

Please sign in to comment.