Skip to content

Commit

Permalink
Last fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ntn-x2 committed Oct 8, 2024
1 parent b6782c7 commit 282119f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pallets/pallet-asset-switch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use frame_support::traits::{
};
use parity_scale_codec::{Decode, Encode};
use sp_runtime::traits::{TrailingZeroInput, Zero};
use sp_std::boxed::Box;
use sp_std::{boxed::Box, vec};

pub use crate::pallet::*;

Expand Down
1 change: 0 additions & 1 deletion runtimes/common/src/asset_switch/runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ pub enum Error {
InvalidInput,
SwitchPoolNotFound,
SwitchPoolNotSet,
Other(String),
Internal,
}
6 changes: 3 additions & 3 deletions runtimes/peregrine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,12 +1628,12 @@ impl_runtime_apis! {
return Err(AssetSwitchApiError::SwitchPoolNotSet);
};

let from_v4 = AccountId32ToAccountId32JunctionConverter::try_convert(from).map_err(|e| AssetSwitchApiError::Other(e.to_string()))?;
let to_v4 = Location::try_from(to.clone()).map_err(|_| AssetSwitchApiError::Other(format!("Failed to convert provided location {:?} to a `v4` variant.", to)))?;
let from_v4 = AccountId32ToAccountId32JunctionConverter::try_convert(from).map_err(|_| AssetSwitchApiError::Internal)?;
let to_v4 = Location::try_from(to.clone()).map_err(|_| AssetSwitchApiError::Internal)?;
let our_location_for_destination = {
let universal_location = UniversalLocation::get();
universal_location.invert_target(&to_v4)
}.map_err(|_| AssetSwitchApiError::Other(format!("Failed to invert target for target destination {:?}", to)))?;
}.map_err(|_| AssetSwitchApiError::Internal)?;
let asset_id_v4 = AssetId::try_from(switch_pair.remote_asset_id).map_err(|_| AssetSwitchApiError::Internal)?;
let remote_asset_fee_v4 = Asset::try_from(switch_pair.remote_xcm_fee).map_err(|_| AssetSwitchApiError::Internal)?;

Expand Down
6 changes: 3 additions & 3 deletions runtimes/spiritnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1618,12 +1618,12 @@ impl_runtime_apis! {
return Err(AssetSwitchApiError::SwitchPoolNotSet);
};

let from_v4 = AccountId32ToAccountId32JunctionConverter::try_convert(from).map_err(|e| AssetSwitchApiError::Other(e.to_string()))?;
let to_v4 = Location::try_from(to.clone()).map_err(|_| AssetSwitchApiError::Other(format!("Failed to convert provided location {:?} to a `v4` variant.", to)))?;
let from_v4 = AccountId32ToAccountId32JunctionConverter::try_convert(from).map_err(|_| AssetSwitchApiError::Internal)?;
let to_v4 = Location::try_from(to.clone()).map_err(|_| AssetSwitchApiError::Internal)?;
let our_location_for_destination = {
let universal_location = UniversalLocation::get();
universal_location.invert_target(&to_v4)
}.map_err(|_| AssetSwitchApiError::Other(format!("Failed to invert target for target destination {:?}", to)))?;
}.map_err(|_| AssetSwitchApiError::Internal)?;
let asset_id_v4 = AssetId::try_from(switch_pair.remote_asset_id).map_err(|_| AssetSwitchApiError::Internal)?;
let remote_asset_fee_v4 = Asset::try_from(switch_pair.remote_xcm_fee).map_err(|_| AssetSwitchApiError::Internal)?;

Expand Down

0 comments on commit 282119f

Please sign in to comment.