Skip to content

Commit

Permalink
Remove deprecated solana fees command
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots committed Jun 28, 2024
1 parent 5a630e0 commit ad8a225
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 79 deletions.
10 changes: 0 additions & 10 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ pub enum CliCommand {
ClusterVersion,
Feature(FeatureCliCommand),
Inflation(InflationCliCommand),
Fees {
blockhash: Option<Hash>,
},
FindProgramDerivedAddress {
seeds: Vec<Vec<u8>>,
program_id: Pubkey,
Expand Down Expand Up @@ -640,12 +637,6 @@ pub fn parse_command(
("feature", Some(matches)) => {
parse_feature_subcommand(matches, default_signer, wallet_manager)
}
("fees", Some(matches)) => {
let blockhash = value_of::<Hash>(matches, "blockhash");
Ok(CliCommandInfo::without_signers(CliCommand::Fees {
blockhash,
}))
}
("first-available-block", Some(_matches)) => Ok(CliCommandInfo::without_signers(
CliCommand::FirstAvailableBlock,
)),
Expand Down Expand Up @@ -911,7 +902,6 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
seed,
program_id,
} => process_create_address_with_seed(config, from_pubkey.as_ref(), seed, program_id),
CliCommand::Fees { ref blockhash } => process_fees(&rpc_client, config, blockhash.as_ref()),
CliCommand::Feature(feature_subcommand) => {
process_feature_subcommand(&rpc_client, config, feature_subcommand)
}
Expand Down
69 changes: 0 additions & 69 deletions cli/src/cluster_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,6 @@ impl ClusterQuerySubCommands for App<'_, '_> {
SubCommand::with_name("cluster-version")
.about("Get the version of the cluster entrypoint"),
)
// Deprecated in v1.8.0
.subcommand(
SubCommand::with_name("fees")
.about("Display current cluster fees (Deprecated in v1.8.0)")
.arg(
Arg::with_name("blockhash")
.long("blockhash")
.takes_value(true)
.value_name("BLOCKHASH")
.validator(is_hash)
.help("Query fees for BLOCKHASH instead of the most recent blockhash"),
),
)
.subcommand(
SubCommand::with_name("first-available-block")
.about("Get the first available block in the storage"),
Expand Down Expand Up @@ -982,42 +969,6 @@ pub fn process_cluster_version(rpc_client: &RpcClient, config: &CliConfig) -> Pr
}
}

pub fn process_fees(
rpc_client: &RpcClient,
config: &CliConfig,
blockhash: Option<&Hash>,
) -> ProcessResult {
let fees = if let Some(recent_blockhash) = blockhash {
#[allow(deprecated)]
let result = rpc_client.get_fee_calculator_for_blockhash_with_commitment(
recent_blockhash,
config.commitment,
)?;
if let Some(fee_calculator) = result.value {
CliFees::some(
result.context.slot,
*recent_blockhash,
fee_calculator.lamports_per_signature,
None,
None,
)
} else {
CliFees::none()
}
} else {
#[allow(deprecated)]
let result = rpc_client.get_fees_with_commitment(config.commitment)?;
CliFees::some(
result.context.slot,
result.value.blockhash,
result.value.fee_calculator.lamports_per_signature,
None,
Some(result.value.last_valid_block_height),
)
};
Ok(config.output_format.formatted_string(&fees))
}

pub fn process_first_available_block(rpc_client: &RpcClient) -> ProcessResult {
let first_available_block = rpc_client.get_first_available_block()?;
Ok(format!("{first_available_block}"))
Expand Down Expand Up @@ -2376,26 +2327,6 @@ mod tests {
CliCommandInfo::without_signers(CliCommand::ClusterVersion)
);

let test_fees = test_commands.clone().get_matches_from(vec!["test", "fees"]);
assert_eq!(
parse_command(&test_fees, &default_signer, &mut None).unwrap(),
CliCommandInfo::without_signers(CliCommand::Fees { blockhash: None })
);

let blockhash = Hash::new_unique();
let test_fees = test_commands.clone().get_matches_from(vec![
"test",
"fees",
"--blockhash",
&blockhash.to_string(),
]);
assert_eq!(
parse_command(&test_fees, &default_signer, &mut None).unwrap(),
CliCommandInfo::without_signers(CliCommand::Fees {
blockhash: Some(blockhash)
})
);

let slot = 100;
let test_get_block_time =
test_commands
Expand Down

0 comments on commit ad8a225

Please sign in to comment.