### Process In Polkadot Asset Hub, we can submit an extrinsic and pay fees in an asset different than the native one, e.g. in `USDC`. The fee estimation can be done using the following two calls : 1. `transactionPaymentApi.queryCallInfo` : returns the fees in DOT 1. `assetConversionApi.quotePriceTokensForExactTokens` : converts the DOT amount of fees in USDC amount ### Steps For example for an `assets.transfer` call, the steps would be the following: 1. Prepare the `assets.transfer` call with the parameters necessary (asset id, amount, etc) and get the hex of that call. 1. Input the hex in `transactionPaymentApi.queryCallInfo` in pjs-apps (screenshot below) with the corresponding length. ![binance1](https://hackmd.io/_uploads/r1c4jiLfA.png) - Alternatively, we can use the `/transaction/fee-estimate` endpoint of Sidecar ([docs](https://paritytech.github.io/substrate-api-sidecar/dist/)) that does the same. - Pay attention to the units of the resulting amount. 1. By submitting the call, we get the fee of the extrinsic in `DOT` units. We copy the `partial fee` of that result. 1. Prepare the `assetConversion.quotePriceTokensForExactTokens` (screenshot below) by setting the corresponding Multilocations for `DOT` and `USDC` (1337) respectively. In the `amount` field, we should specify the `partial fee` from step 3 and make sure to adjust the units/decimals. ![binance2](https://hackmd.io/_uploads/Hymx2i8f0.png) - Since we are checking the actual fee, the `include_fee` field should be set to `No` 🤔 I think! 1. After submitting the call, the returned amount represents the fee we should take into account when executing our `assets.transfer` call. - The units displayed next to the returned amount are currently `DOT`, but this is due to a UI issue/bug (open issue [here](https://github.com/polkadot-js/apps/issues/10430)). Ideally, it shouldn't display any units, and the result should be interpreted based on the units of the queried token (in this case, `USDC`). ### Upcoming Updates - Polkadot wiki will be updated soon with related guides - https://github.com/w3f/polkadot-wiki/issues/5830 - Sidecar might provide some related information also. ### Useful Resources - https://wiki.polkadot.network/docs/learn-guides-asset-conversion#swap-to-an-exact-amount-of-tokens - https://wiki.polkadot.network/docs/learn-DOT