Skip to content

Commit 4266cbc

Browse files
carlosalafranciscoaguirre
authored andcommitted
xcm: convert properly assets in xcmpayment apis (paritytech#7134)
Port paritytech#6459 changes to relays as well, which were probably forgotten in that PR. Thanks! --------- Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by: command-bot <>
1 parent d1dc924 commit 4266cbc

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

polkadot/runtime/rococo/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,8 @@ sp_api::impl_runtime_apis! {
18851885
}
18861886

18871887
fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, XcmPaymentApiError> {
1888-
match asset.try_as::<AssetId>() {
1888+
let latest_asset_id: Result<AssetId, ()> = asset.clone().try_into();
1889+
match latest_asset_id {
18891890
Ok(asset_id) if asset_id.0 == xcm_config::TokenLocation::get() => {
18901891
// for native token
18911892
Ok(WeightToFee::weight_to_fee(&weight))

polkadot/runtime/westend/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2445,7 +2445,8 @@ sp_api::impl_runtime_apis! {
24452445
}
24462446

24472447
fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, XcmPaymentApiError> {
2448-
match asset.try_as::<AssetId>() {
2448+
let latest_asset_id: Result<AssetId, ()> = asset.clone().try_into();
2449+
match latest_asset_id {
24492450
Ok(asset_id) if asset_id.0 == xcm_config::TokenLocation::get() => {
24502451
// for native token
24512452
Ok(WeightToFee::weight_to_fee(&weight))

prdoc/pr_7134.prdoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
title: 'xcm: convert properly assets in xcmpayment apis'
2+
doc:
3+
- audience: Runtime User
4+
description: |-
5+
Port #6459 changes to relays as well, which were probably forgotten in that PR.
6+
Thanks!
7+
crates:
8+
- name: rococo-runtime
9+
bump: patch
10+
- name: westend-runtime
11+
bump: patch

0 commit comments

Comments
 (0)