Skip to content

Commit

Permalink
recent fees
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarett Dunn committed Dec 15, 2023
1 parent 2d55275 commit 6b4c1d0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cli-config/src/config_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ impl ConfigInput {
let config_file = CONFIG_FILE.as_ref()
.unwrap_or(&default_config);
let config = Config::load(&config_file).unwrap_or(Config::default());
if config.json_rpc_url.is_empty() {
println!("config.json_rpc_url: {}", config.json_rpc_url);
if config.json_rpc_url.len() == 0 {
return 0;
}
if config.json_rpc_url.contains("api.solana.com") {
Expand All @@ -154,17 +155,19 @@ impl ConfigInput {
let rpc_client = RpcClient::new_with_commitment(
config.json_rpc_url,
commitment_config.unwrap_or(
CommitmentConfig::confirmed()
CommitmentConfig::finalized()
),
);
let recent_fees = rpc_client.get_recent_prioritization_fees(
&[]
).unwrap_or_default();
recent_fees
let recent_fees = recent_fees
.iter()
.map(|fee| fee.prioritization_fee)
.sum::<u64>()
.checked_div(recent_fees.len() as u64).unwrap_or(10000)
.checked_div(recent_fees.len() as u64).unwrap_or(10000);
println!("recent_fees: {}", recent_fees);
recent_fees
}


Expand Down

0 comments on commit 6b4c1d0

Please sign in to comment.