Skip to content

Commit

Permalink
Deprecate "confirmed" RpcClient methods (solana-labs#16520)
Browse files Browse the repository at this point in the history
* Remove obsolete client methods

* Deprecate GetConfirmed client methods

* Rename Confirmed config structs, with appropriate deprecation

* Fixup client apps

* Map RpcRequest to deprecated when targeting older nodes
  • Loading branch information
CriesofCarrots authored Apr 15, 2021
1 parent ba77e48 commit 974e6dd
Show file tree
Hide file tree
Showing 10 changed files with 395 additions and 101 deletions.
6 changes: 3 additions & 3 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use solana_client::{
nonce_utils,
rpc_client::RpcClient,
rpc_config::{
RpcConfirmedTransactionConfig, RpcLargestAccountsFilter, RpcSendTransactionConfig,
RpcLargestAccountsFilter, RpcSendTransactionConfig, RpcTransactionConfig,
RpcTransactionLogsFilter,
},
rpc_response::RpcKeyedAccount,
Expand Down Expand Up @@ -1033,9 +1033,9 @@ fn process_confirm(
let mut transaction = None;
let mut get_transaction_error = None;
if config.verbose {
match rpc_client.get_confirmed_transaction_with_config(
match rpc_client.get_transaction_with_config(
signature,
RpcConfirmedTransactionConfig {
RpcTransactionConfig {
encoding: Some(UiTransactionEncoding::Base64),
commitment: Some(CommitmentConfig::confirmed()),
},
Expand Down
20 changes: 10 additions & 10 deletions cli/src/cluster_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ use solana_client::{
pubsub_client::PubsubClient,
rpc_client::{GetConfirmedSignaturesForAddress2Config, RpcClient},
rpc_config::{
RpcAccountInfoConfig, RpcConfirmedBlockConfig, RpcConfirmedTransactionConfig,
RpcLargestAccountsConfig, RpcLargestAccountsFilter, RpcProgramAccountsConfig,
RpcTransactionLogsConfig, RpcTransactionLogsFilter,
RpcAccountInfoConfig, RpcBlockConfig, RpcLargestAccountsConfig, RpcLargestAccountsFilter,
RpcProgramAccountsConfig, RpcTransactionConfig, RpcTransactionLogsConfig,
RpcTransactionLogsFilter,
},
rpc_filter,
rpc_response::SlotInfo,
Expand Down Expand Up @@ -975,12 +975,12 @@ pub fn process_get_block(
};

let encoded_confirmed_block = rpc_client
.get_confirmed_block_with_config(
.get_block_with_config(
slot,
RpcConfirmedBlockConfig {
RpcBlockConfig {
encoding: Some(UiTransactionEncoding::Base64),
commitment: Some(CommitmentConfig::confirmed()),
..RpcConfirmedBlockConfig::default()
..RpcBlockConfig::default()
},
)?
.into();
Expand Down Expand Up @@ -1108,7 +1108,7 @@ pub fn process_show_block_production(
"Fetching confirmed blocks between slots {} and {}...",
start_slot, end_slot
));
let confirmed_blocks = rpc_client.get_confirmed_blocks(start_slot, Some(end_slot))?;
let confirmed_blocks = rpc_client.get_blocks(start_slot, Some(end_slot))?;

let start_slot_index = (start_slot - first_slot_in_epoch) as usize;
let end_slot_index = (end_slot - first_slot_in_epoch) as usize;
Expand Down Expand Up @@ -1829,7 +1829,7 @@ pub fn process_transaction_history(
limit: usize,
show_transactions: bool,
) -> ProcessResult {
let results = rpc_client.get_confirmed_signatures_for_address2_with_config(
let results = rpc_client.get_signatures_for_address_with_config(
address,
GetConfirmedSignaturesForAddress2Config {
before,
Expand Down Expand Up @@ -1868,9 +1868,9 @@ pub fn process_transaction_history(

if show_transactions {
if let Ok(signature) = result.signature.parse::<Signature>() {
match rpc_client.get_confirmed_transaction_with_config(
match rpc_client.get_transaction_with_config(
&signature,
RpcConfirmedTransactionConfig {
RpcTransactionConfig {
encoding: Some(UiTransactionEncoding::Base64),
commitment: Some(CommitmentConfig::confirmed()),
},
Expand Down
1 change: 1 addition & 0 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod rpc_cache;
pub mod rpc_client;
pub mod rpc_config;
pub mod rpc_custom_error;
pub mod rpc_deprecated_config;
pub mod rpc_filter;
pub mod rpc_request;
pub mod rpc_response;
Expand Down
Loading

0 comments on commit 974e6dd

Please sign in to comment.