Files
pezkuwi-subxt/prdoc/1.10.0/pr_3607.prdoc
T
Egor_P ddb53c87f5 [Backport] Version bumps and prdoc reorg from 1.10.0 (#4052)
This PR backports `spec_version`, `node_version` bumps and reordering of
the prdocs from the 1.10.0 release branch
2024-04-10 06:30:00 +00:00

27 lines
1.4 KiB
Plaintext

# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
title: "XCM fee payment API"
doc:
- audience: Runtime Dev
description: |
A runtime API was added for estimating the fees required for XCM execution and delivery.
This is the basic building block needed for UIs to accurately estimate fees.
An example implementation is shown in the PR. Ideally it's simple to implement, you only need to call existing parts of your XCM config.
The API looks like so:
```rust
fn query_acceptable_payment_assets(xcm_version: Version) -> Result<Vec<VersionedAssetId>, Error>;
fn query_xcm_weight(message: VersionedXcm<Call>) -> Result<Weight, Error>;
fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, Error>;
fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result<VersionedAssets, Error>;
```
The first three relate to XCM execution fees, given an XCM, you can query its weight, then which assets are acceptable for buying weight and convert weight to a number of those assets.
The last one takes in a destination and a message you want to send from the runtime you're executing this on, it will give you the delivery fees.
crates:
- name: xcm-fee-payment-runtime-api
- name: rococo-runtime
- name: westend-runtime