polkadot-sdk icon indicating copy to clipboard operation
polkadot-sdk copied to clipboard

`XcmPaymentApi::query_delivery_fees()` should allow querying fee using custom asset

Open acatangiu opened this issue 11 months ago • 4 comments

The current XcmPaymentApi::query_delivery_fees() strictly returns fee required in native assets. https://github.com/paritytech/polkadot-sdk/blob/568231a9a85d94954c002532a0f4351a3bb59e83/polkadot/xcm/xcm-runtime-apis/src/fees.rs#L68

But the delivery fee can also be paid using assets other than native.

I suggest enhancing the API with an optional asset specifier so that users/dapps can directly query the fee in their desired asset:

- fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result<VersionedAssets, Error>;
+ fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>, asset: Option<VersionedAssetId>) -> Result<VersionedAssets, Error>;

or to be aligned with XcmPaymentApi::query_weight_to_asset_fee()

- fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result<VersionedAssets, Error>;
+ fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>, asset: VersionedAssetId) -> Result<u128, Error>;

acatangiu avatar Jan 06 '25 15:01 acatangiu

cc @franciscoaguirre @x3c41a

acatangiu avatar Jan 06 '25 15:01 acatangiu

I would like to take this one

I would like to take this one

yes, please do. we're here to help if you have any further questions

acatangiu avatar Jan 07 '25 11:01 acatangiu