From 04d16724de05d56ed4a7ce7cf36498079fd05a2a Mon Sep 17 00:00:00 2001 From: imstar15 Date: Sun, 8 Oct 2023 12:34:37 +0800 Subject: [PATCH] Remove get_time_automation_fees RPC function --- .../rpc/runtime-api/src/lib.rs | 1 - pallets/automation-time/rpc/src/lib.rs | 35 ------------------- runtime/neumann/src/lib.rs | 16 --------- runtime/oak/src/lib.rs | 16 --------- runtime/turing/src/lib.rs | 16 --------- 5 files changed, 84 deletions(-) diff --git a/pallets/automation-time/rpc/runtime-api/src/lib.rs b/pallets/automation-time/rpc/runtime-api/src/lib.rs index 44322970..bc4a4fe7 100644 --- a/pallets/automation-time/rpc/runtime-api/src/lib.rs +++ b/pallets/automation-time/rpc/runtime-api/src/lib.rs @@ -54,7 +54,6 @@ sp_api::decl_runtime_apis! { Balance: Codec, { fn query_fee_details(uxt: Block::Extrinsic) -> Result, Vec>; - fn get_time_automation_fees(action: AutomationAction, executions: u32) -> Balance; fn calculate_optimal_autostaking( principal: i128, collator: AccountId diff --git a/pallets/automation-time/rpc/src/lib.rs b/pallets/automation-time/rpc/src/lib.rs index d121b476..a725ee00 100644 --- a/pallets/automation-time/rpc/src/lib.rs +++ b/pallets/automation-time/rpc/src/lib.rs @@ -43,14 +43,6 @@ pub trait AutomationTimeApi { at: Option, ) -> RpcResult>; - #[method(name = "automationTime_getTimeAutomationFees")] - fn get_time_automation_fees( - &self, - action: AutomationAction, - executions: u32, - at: Option, - ) -> RpcResult; - /// Returns optimal autostaking period based on principal and a target collator. #[method(name = "automationTime_calculateOptimalAutostaking")] fn caclulate_optimal_autostaking( @@ -154,33 +146,6 @@ where }) } - fn get_time_automation_fees( - &self, - action: AutomationAction, - executions: u32, - at: Option<::Hash>, - ) -> RpcResult { - let api = self.client.runtime_api(); - let at = BlockId::hash(at.unwrap_or_else(|| - // If the block hash is not supplied assume the best block. - self.client.info().best_hash)); - let runtime_api_result = - api.get_time_automation_fees(&at, action, executions).map_err(|e| { - CallError::Custom(ErrorObject::owned( - Error::RuntimeError.into(), - "Unable to get time automation fees", - Some(e.to_string()), - )) - })?; - runtime_api_result.try_into().map_err(|_| { - JsonRpseeError::Call(CallError::Custom(ErrorObject::owned( - Error::RuntimeError.into(), - "RPC value doesn't fit in u64 representation", - Some("RPC value cannot be translated into u64 representation".to_string()), - ))) - }) - } - fn caclulate_optimal_autostaking( &self, principal: i128, diff --git a/runtime/neumann/src/lib.rs b/runtime/neumann/src/lib.rs index 9d63640e..5fc9d069 100644 --- a/runtime/neumann/src/lib.rs +++ b/runtime/neumann/src/lib.rs @@ -1196,22 +1196,6 @@ impl_runtime_apis! { }) } - /** - * The get_time_automation_fees RPC function is used to get the execution fee of scheduling a time-automation task. - * This function requires the action type and the number of executions in order to generate an estimate. - * However, the AutomationTime::calculate_schedule_fee_amount requires an Action enum from the automation time pallet, - * which requires more information than is necessary for this calculation. - * Therefore, for ease of use, this function will just require an integer representing the action type and an integer - * representing the number of executions. For all of the extraneous information, the function will provide faux inputs for it. - * - */ - fn get_time_automation_fees( - action: AutomationAction, - executions: u32, - ) -> Balance { - AutomationTime::calculate_schedule_fee_amount(&(action.into()), executions).expect("Can only fail for DynamicDispatch which is not an option here") - } - fn calculate_optimal_autostaking( principal: i128, collator: AccountId diff --git a/runtime/oak/src/lib.rs b/runtime/oak/src/lib.rs index 9bb7ad0b..20a9e266 100644 --- a/runtime/oak/src/lib.rs +++ b/runtime/oak/src/lib.rs @@ -1201,22 +1201,6 @@ impl_runtime_apis! { }) } - /** - * The get_time_automation_fees RPC function is used to get the execution fee of scheduling a time-automation task. - * This function requires the action type and the number of executions in order to generate an estimate. - * However, the AutomationTime::calculate_schedule_fee_amount requires an Action enum from the automation time pallet, - * which requires more information than is necessary for this calculation. - * Therefore, for ease of use, this function will just require an integer representing the action type and an integer - * representing the number of executions. For all of the extraneous information, the function will provide faux inputs for it. - * - */ - fn get_time_automation_fees( - action: AutomationAction, - executions: u32, - ) -> Balance { - AutomationTime::calculate_schedule_fee_amount(&(action.into()), executions).expect("Can only fail for DynamicDispatch which is not an option here") - } - fn calculate_optimal_autostaking( principal: i128, collator: AccountId diff --git a/runtime/turing/src/lib.rs b/runtime/turing/src/lib.rs index b9756036..c833ad3e 100644 --- a/runtime/turing/src/lib.rs +++ b/runtime/turing/src/lib.rs @@ -1220,22 +1220,6 @@ impl_runtime_apis! { }) } - /** - * The get_time_automation_fees RPC function is used to get the execution fee of scheduling a time-automation task. - * This function requires the action type and the number of executions in order to generate an estimate. - * However, the AutomationTime::calculate_schedule_fee_amount requires an Action enum from the automation time pallet, - * which requires more information than is necessary for this calculation. - * Therefore, for ease of use, this function will just require an integer representing the action type and an integer - * representing the number of executions. For all of the extraneous information, the function will provide faux inputs for it. - * - */ - fn get_time_automation_fees( - action: AutomationAction, - executions: u32, - ) -> Balance { - AutomationTime::calculate_schedule_fee_amount(&(action.into()), executions).expect("Can only fail for DynamicDispatch which is not an option here") - } - fn calculate_optimal_autostaking( principal: i128, collator: AccountId