From e1d7fa556de3f83e5ced1fd43d37a9f077c4a36b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bo=CC=88rner?= Date: Wed, 11 Dec 2024 14:31:14 +0100 Subject: [PATCH] chore: removed cf_pool_simulate_swap_v1 --- state-chain/custom-rpc/src/lib.rs | 35 ++++++++----------------- state-chain/runtime/src/runtime_apis.rs | 7 ----- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/state-chain/custom-rpc/src/lib.rs b/state-chain/custom-rpc/src/lib.rs index af23ae0832..5e96ffeddb 100644 --- a/state-chain/custom-rpc/src/lib.rs +++ b/state-chain/custom-rpc/src/lib.rs @@ -45,7 +45,7 @@ use sc_rpc_spec_v2::chain_head::{ api::ChainHeadApiServer, ChainHead, ChainHeadConfig, FollowEvent, }; use serde::{Deserialize, Serialize}; -use sp_api::{ApiError, ApiExt, CallApiAt}; +use sp_api::{ApiError, CallApiAt}; use sp_core::U256; use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT, UniqueSaturatedInto}, @@ -67,7 +67,7 @@ use state_chain_runtime::{ SimulatedSwapInformation, TransactionScreeningEvents, ValidatorInfo, VaultSwapDetails, }, safe_mode::RuntimeSafeMode, - Block, Hash, NetworkFee, SolanaInstance, + Hash, NetworkFee, SolanaInstance, }; use std::{ collections::{BTreeMap, HashMap}, @@ -1514,33 +1514,20 @@ where .collect() }); self.with_runtime_api(at, |api, hash| { - if api.api_version::>(hash).unwrap().unwrap() < 2 { - let old_result = api.cf_pool_simulate_swap_before_version_2( + Ok::<_, CfApiError>( + api.cf_pool_simulate_swap( hash, from_asset, to_asset, amount, + broker_commission, + dca_parameters, additional_orders, - )?; - Ok(old_result.map(|old_version| { - into_rpc_swap_output(old_version.into(), from_asset, to_asset) - })?) - } else { - Ok::<_, CfApiError>( - api.cf_pool_simulate_swap( - hash, - from_asset, - to_asset, - amount, - broker_commission, - dca_parameters, - additional_orders, - )? - .map(|simulated_swap_info_v2| { - into_rpc_swap_output(simulated_swap_info_v2, from_asset, to_asset) - })?, - ) - } + )? + .map(|simulated_swap_info_v2| { + into_rpc_swap_output(simulated_swap_info_v2, from_asset, to_asset) + })?, + ) }) } diff --git a/state-chain/runtime/src/runtime_apis.rs b/state-chain/runtime/src/runtime_apis.rs index f21bf117bc..5d27a8f3bc 100644 --- a/state-chain/runtime/src/runtime_apis.rs +++ b/state-chain/runtime/src/runtime_apis.rs @@ -318,13 +318,6 @@ decl_runtime_apis!( base_asset: Asset, quote_asset: Asset, ) -> Result; - #[changed_in(2)] - fn cf_pool_simulate_swap( - from: Asset, - to: Asset, - amount: AssetAmount, - additional_limit_orders: Option>, - ) -> Result; fn cf_pool_simulate_swap( from: Asset, to: Asset,