Skip to content

Commit 2a0e745

Browse files
authored
Remove get_time_automation_fees RPC function (#448)
1 parent c9f8ab0 commit 2a0e745

File tree

5 files changed

+0
-84
lines changed

5 files changed

+0
-84
lines changed

pallets/automation-time/rpc/runtime-api/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ sp_api::decl_runtime_apis! {
5454
Balance: Codec,
5555
{
5656
fn query_fee_details(uxt: Block::Extrinsic) -> Result<FeeDetails<Balance>, Vec<u8>>;
57-
fn get_time_automation_fees(action: AutomationAction, executions: u32) -> Balance;
5857
fn calculate_optimal_autostaking(
5958
principal: i128,
6059
collator: AccountId

pallets/automation-time/rpc/src/lib.rs

-35
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ pub trait AutomationTimeApi<BlockHash, AccountId, Hash, Balance> {
4343
at: Option<BlockHash>,
4444
) -> RpcResult<FeeDetails<NumberOrHex>>;
4545

46-
#[method(name = "automationTime_getTimeAutomationFees")]
47-
fn get_time_automation_fees(
48-
&self,
49-
action: AutomationAction,
50-
executions: u32,
51-
at: Option<BlockHash>,
52-
) -> RpcResult<u64>;
53-
5446
/// Returns optimal autostaking period based on principal and a target collator.
5547
#[method(name = "automationTime_calculateOptimalAutostaking")]
5648
fn caclulate_optimal_autostaking(
@@ -154,33 +146,6 @@ where
154146
})
155147
}
156148

157-
fn get_time_automation_fees(
158-
&self,
159-
action: AutomationAction,
160-
executions: u32,
161-
at: Option<<Block as BlockT>::Hash>,
162-
) -> RpcResult<u64> {
163-
let api = self.client.runtime_api();
164-
let at = BlockId::hash(at.unwrap_or_else(||
165-
// If the block hash is not supplied assume the best block.
166-
self.client.info().best_hash));
167-
let runtime_api_result =
168-
api.get_time_automation_fees(&at, action, executions).map_err(|e| {
169-
CallError::Custom(ErrorObject::owned(
170-
Error::RuntimeError.into(),
171-
"Unable to get time automation fees",
172-
Some(e.to_string()),
173-
))
174-
})?;
175-
runtime_api_result.try_into().map_err(|_| {
176-
JsonRpseeError::Call(CallError::Custom(ErrorObject::owned(
177-
Error::RuntimeError.into(),
178-
"RPC value doesn't fit in u64 representation",
179-
Some("RPC value cannot be translated into u64 representation".to_string()),
180-
)))
181-
})
182-
}
183-
184149
fn caclulate_optimal_autostaking(
185150
&self,
186151
principal: i128,

runtime/neumann/src/lib.rs

-16
Original file line numberDiff line numberDiff line change
@@ -1196,22 +1196,6 @@ impl_runtime_apis! {
11961196
})
11971197
}
11981198

1199-
/**
1200-
* The get_time_automation_fees RPC function is used to get the execution fee of scheduling a time-automation task.
1201-
* This function requires the action type and the number of executions in order to generate an estimate.
1202-
* However, the AutomationTime::calculate_schedule_fee_amount requires an Action enum from the automation time pallet,
1203-
* which requires more information than is necessary for this calculation.
1204-
* Therefore, for ease of use, this function will just require an integer representing the action type and an integer
1205-
* representing the number of executions. For all of the extraneous information, the function will provide faux inputs for it.
1206-
*
1207-
*/
1208-
fn get_time_automation_fees(
1209-
action: AutomationAction,
1210-
executions: u32,
1211-
) -> Balance {
1212-
AutomationTime::calculate_schedule_fee_amount(&(action.into()), executions).expect("Can only fail for DynamicDispatch which is not an option here")
1213-
}
1214-
12151199
fn calculate_optimal_autostaking(
12161200
principal: i128,
12171201
collator: AccountId

runtime/oak/src/lib.rs

-16
Original file line numberDiff line numberDiff line change
@@ -1201,22 +1201,6 @@ impl_runtime_apis! {
12011201
})
12021202
}
12031203

1204-
/**
1205-
* The get_time_automation_fees RPC function is used to get the execution fee of scheduling a time-automation task.
1206-
* This function requires the action type and the number of executions in order to generate an estimate.
1207-
* However, the AutomationTime::calculate_schedule_fee_amount requires an Action enum from the automation time pallet,
1208-
* which requires more information than is necessary for this calculation.
1209-
* Therefore, for ease of use, this function will just require an integer representing the action type and an integer
1210-
* representing the number of executions. For all of the extraneous information, the function will provide faux inputs for it.
1211-
*
1212-
*/
1213-
fn get_time_automation_fees(
1214-
action: AutomationAction,
1215-
executions: u32,
1216-
) -> Balance {
1217-
AutomationTime::calculate_schedule_fee_amount(&(action.into()), executions).expect("Can only fail for DynamicDispatch which is not an option here")
1218-
}
1219-
12201204
fn calculate_optimal_autostaking(
12211205
principal: i128,
12221206
collator: AccountId

runtime/turing/src/lib.rs

-16
Original file line numberDiff line numberDiff line change
@@ -1220,22 +1220,6 @@ impl_runtime_apis! {
12201220
})
12211221
}
12221222

1223-
/**
1224-
* The get_time_automation_fees RPC function is used to get the execution fee of scheduling a time-automation task.
1225-
* This function requires the action type and the number of executions in order to generate an estimate.
1226-
* However, the AutomationTime::calculate_schedule_fee_amount requires an Action enum from the automation time pallet,
1227-
* which requires more information than is necessary for this calculation.
1228-
* Therefore, for ease of use, this function will just require an integer representing the action type and an integer
1229-
* representing the number of executions. For all of the extraneous information, the function will provide faux inputs for it.
1230-
*
1231-
*/
1232-
fn get_time_automation_fees(
1233-
action: AutomationAction,
1234-
executions: u32,
1235-
) -> Balance {
1236-
AutomationTime::calculate_schedule_fee_amount(&(action.into()), executions).expect("Can only fail for DynamicDispatch which is not an option here")
1237-
}
1238-
12391223
fn calculate_optimal_autostaking(
12401224
principal: i128,
12411225
collator: AccountId

0 commit comments

Comments
 (0)