mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 22:41:02 +00:00
xcm-builder: PayOverXcm supports fallible convertors for asset kind and beneficiary conversion (#1572)
`PayOverXcm` type accepts two converters to transform the `AssetKind` and `Beneficiary` parameter types into recognized `xcm` types. In this PR, we've modified the bounds for these converters, transitioning from `Convert` to `TryConvert`. One such use case for this adjustment is when dealing with versioned xcm types for `AssetKind` and `Beneficiary`. These types might be not convertible to the latest xcm version, hence the need for fallible conversion. This changes required for https://github.com/paritytech/polkadot-sdk/pull/1333
This commit is contained in:
@@ -29,9 +29,9 @@ pub struct AssetKind {
|
||||
}
|
||||
|
||||
pub struct LocatableAssetKindConverter;
|
||||
impl sp_runtime::traits::Convert<AssetKind, LocatableAssetId> for LocatableAssetKindConverter {
|
||||
fn convert(value: AssetKind) -> LocatableAssetId {
|
||||
LocatableAssetId { asset_id: value.asset_id, location: value.destination }
|
||||
impl sp_runtime::traits::TryConvert<AssetKind, LocatableAssetId> for LocatableAssetKindConverter {
|
||||
fn try_convert(value: AssetKind) -> Result<LocatableAssetId, AssetKind> {
|
||||
Ok(LocatableAssetId { asset_id: value.asset_id, location: value.destination })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user