Deprecate FeeCalculator returning APIs (#19120)
This commit is contained in:
@@ -8,6 +8,9 @@ use {
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
|
||||
pub enum RpcRequest {
|
||||
Custom {
|
||||
method: &'static str,
|
||||
},
|
||||
DeregisterNode,
|
||||
GetAccountInfo,
|
||||
GetBalance,
|
||||
@@ -18,7 +21,6 @@ pub enum RpcRequest {
|
||||
GetBlocksWithLimit,
|
||||
GetBlockTime,
|
||||
GetClusterNodes,
|
||||
|
||||
#[deprecated(since = "1.7.0", note = "Please use RpcRequest::GetBlock instead")]
|
||||
GetConfirmedBlock,
|
||||
#[deprecated(since = "1.7.0", note = "Please use RpcRequest::GetBlocks instead")]
|
||||
@@ -38,11 +40,23 @@ pub enum RpcRequest {
|
||||
note = "Please use RpcRequest::GetTransaction instead"
|
||||
)]
|
||||
GetConfirmedTransaction,
|
||||
|
||||
GetEpochInfo,
|
||||
GetEpochSchedule,
|
||||
#[deprecated(
|
||||
since = "1.8.0",
|
||||
note = "Please use RpcRequest::GetFeeForMessage instead"
|
||||
)]
|
||||
GetFeeCalculatorForBlockhash,
|
||||
GetFeeForMessage,
|
||||
#[deprecated(
|
||||
since = "1.8.0",
|
||||
note = "Please do not use, will no longer be available in the future"
|
||||
)]
|
||||
GetFeeRateGovernor,
|
||||
#[deprecated(
|
||||
since = "1.8.0",
|
||||
note = "Please use RpcRequest::GetFeeForMessage instead"
|
||||
)]
|
||||
GetFees,
|
||||
GetFirstAvailableBlock,
|
||||
GetGenesisHash,
|
||||
@@ -52,12 +66,17 @@ pub enum RpcRequest {
|
||||
GetInflationRate,
|
||||
GetInflationReward,
|
||||
GetLargestAccounts,
|
||||
GetLatestBlockhash,
|
||||
GetLeaderSchedule,
|
||||
GetMaxRetransmitSlot,
|
||||
GetMaxShredInsertSlot,
|
||||
GetMinimumBalanceForRentExemption,
|
||||
GetMultipleAccounts,
|
||||
GetProgramAccounts,
|
||||
#[deprecated(
|
||||
since = "1.8.0",
|
||||
note = "Please use RpcRequest::GetLatestBlockhash instead"
|
||||
)]
|
||||
GetRecentBlockhash,
|
||||
GetRecentPerformanceSamples,
|
||||
GetSnapshotSlot,
|
||||
@@ -80,21 +99,20 @@ pub enum RpcRequest {
|
||||
GetTransactionCount,
|
||||
GetVersion,
|
||||
GetVoteAccounts,
|
||||
IsBlockhashValid,
|
||||
MinimumLedgerSlot,
|
||||
RegisterNode,
|
||||
RequestAirdrop,
|
||||
SendTransaction,
|
||||
SimulateTransaction,
|
||||
SignVote,
|
||||
Custom {
|
||||
method: &'static str,
|
||||
},
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
impl fmt::Display for RpcRequest {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let method = match self {
|
||||
RpcRequest::Custom { method } => method,
|
||||
RpcRequest::DeregisterNode => "deregisterNode",
|
||||
RpcRequest::GetAccountInfo => "getAccountInfo",
|
||||
RpcRequest::GetBalance => "getBalance",
|
||||
@@ -113,6 +131,7 @@ impl fmt::Display for RpcRequest {
|
||||
RpcRequest::GetEpochInfo => "getEpochInfo",
|
||||
RpcRequest::GetEpochSchedule => "getEpochSchedule",
|
||||
RpcRequest::GetFeeCalculatorForBlockhash => "getFeeCalculatorForBlockhash",
|
||||
RpcRequest::GetFeeForMessage => "getFeeForMessage",
|
||||
RpcRequest::GetFeeRateGovernor => "getFeeRateGovernor",
|
||||
RpcRequest::GetFees => "getFees",
|
||||
RpcRequest::GetFirstAvailableBlock => "getFirstAvailableBlock",
|
||||
@@ -123,6 +142,7 @@ impl fmt::Display for RpcRequest {
|
||||
RpcRequest::GetInflationRate => "getInflationRate",
|
||||
RpcRequest::GetInflationReward => "getInflationReward",
|
||||
RpcRequest::GetLargestAccounts => "getLargestAccounts",
|
||||
RpcRequest::GetLatestBlockhash => "getLatestBlockhash",
|
||||
RpcRequest::GetLeaderSchedule => "getLeaderSchedule",
|
||||
RpcRequest::GetMaxRetransmitSlot => "getMaxRetransmitSlot",
|
||||
RpcRequest::GetMaxShredInsertSlot => "getMaxShredInsertSlot",
|
||||
@@ -151,13 +171,13 @@ impl fmt::Display for RpcRequest {
|
||||
RpcRequest::GetTransactionCount => "getTransactionCount",
|
||||
RpcRequest::GetVersion => "getVersion",
|
||||
RpcRequest::GetVoteAccounts => "getVoteAccounts",
|
||||
RpcRequest::IsBlockhashValid => "isBlockhashValid",
|
||||
RpcRequest::MinimumLedgerSlot => "minimumLedgerSlot",
|
||||
RpcRequest::RegisterNode => "registerNode",
|
||||
RpcRequest::RequestAirdrop => "requestAirdrop",
|
||||
RpcRequest::SendTransaction => "sendTransaction",
|
||||
RpcRequest::SimulateTransaction => "simulateTransaction",
|
||||
RpcRequest::SignVote => "signVote",
|
||||
RpcRequest::Custom { method } => method,
|
||||
};
|
||||
|
||||
write!(f, "{}", method)
|
||||
@@ -261,14 +281,17 @@ mod tests {
|
||||
let request = test_request.build_request_json(1, Value::Null);
|
||||
assert_eq!(request["method"], "getEpochInfo");
|
||||
|
||||
#[allow(deprecated)]
|
||||
let test_request = RpcRequest::GetRecentBlockhash;
|
||||
let request = test_request.build_request_json(1, Value::Null);
|
||||
assert_eq!(request["method"], "getRecentBlockhash");
|
||||
|
||||
#[allow(deprecated)]
|
||||
let test_request = RpcRequest::GetFeeCalculatorForBlockhash;
|
||||
let request = test_request.build_request_json(1, json!([addr]));
|
||||
assert_eq!(request["method"], "getFeeCalculatorForBlockhash");
|
||||
|
||||
#[allow(deprecated)]
|
||||
let test_request = RpcRequest::GetFeeRateGovernor;
|
||||
let request = test_request.build_request_json(1, Value::Null);
|
||||
assert_eq!(request["method"], "getFeeRateGovernor");
|
||||
@@ -298,6 +321,7 @@ mod tests {
|
||||
let addr = json!("deadbeefXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNHhx");
|
||||
|
||||
// Test request with CommitmentConfig and no params
|
||||
#[allow(deprecated)]
|
||||
let test_request = RpcRequest::GetRecentBlockhash;
|
||||
let request = test_request.build_request_json(1, json!([commitment_config]));
|
||||
assert_eq!(request["params"], json!([commitment_config.clone()]));
|
||||
|
Reference in New Issue
Block a user