Bug: XcmPaymentApi.queryWeightToAssetFee is returning WeightNotComputable error
Hello Hydration team, I am trying to get the fee using Hydration XcmPaymentApi, but it's not accepting the snowbridge USDC asset location and instead it's returning WeightNotComputable error. In Hydration app I can set this asset as fee asset without a problem.
Expected Behavior
I should be able to get the fee from XcmPaymentApi.
Actual Behavior
I get a WeightNotComputable error instead.
Steps to Reproduce
- Open PolkadotJS,
- Select Hydration
- Go to runtime calls
- Select XcmPaymentApi.queryWeightToAssetFee
- Enter this location and weight
weight:
refTime: 1000
proofSize: 1000
location:
{
"parents": 2,
"interior": {
"X2": [
{
"GlobalConsensus": {
"Ethereum": {
"chainId": 1
}
}
},
{
"AccountKey20": {
"network": null,
"key": "0xdac17f958d2ee523a2206206994597c13d831ec7"
}
}
]
}
}
- Observe the WeightNotComputableError
Context
I am trying to get an origin execution fee in this currency
To add some context, we are trying to implement custom fee asset fee queries. Basically, in the Hydration app, we are able to choose from many fee assets - for example, the displayed ETH asset. We would like to display the fees for transactions in that asset dynamically to the user once they select it. We are able to query which fee asset they have set, but we need XCM Payment Api to calculate the fee for the transactions, which, as Michael pointed out, returns WeightNotComputable for certain assets.
cc @mrq1911 @dmoka sorry to bother you guys, but since you allow these assets to be set as payment assets in UI and in Runtime, it would be nice if we could query XCM Payment API in them also.
Thanks in advance! With kind regards, Team ParaSpell✨
@dudo50 As for this, just debugged it, the runtime api doesn't work because there is no onchain route for asset pair 0-1000767 (TETHER native).
But one thing to clarify: you mention that "it is not accepting snowbridge USDC", but the location you try to query for is for Tether, and not USDC.
here is the tether location (which is used in your query):
But for USDC, here is the location:
So the question: do you want to do your fee query for USDC or USDT, or both?
@dmoka so this is similar problem to previous issue?
We would like to have all assets that Hydration accepts as fee payment assets, because if user selects it as fee asset through Hydration UI we can dynamically display fees to the user in selected asset. Because you guys have query for which asset they chose as fee payment asset.
Currently we are unable, because XCM Payment API does not accept them in query weight to fee unfortunately.
With kind regards, Team ParaSpell✨
@dmoka so this is similar problem to previous issue?
We would like to have all assets that Hydration accepts as fee payment assets, because if user selects it as fee asset through Hydration UI we can dynamically display fees to the user in selected asset. Because you guys have query for which asset they chose as fee payment asset.
Yeah, the root cause is the same, missing on chain routes
Make sense, will analyse them and prepare a proposal for adding the missing ones. Will do it ASAP, will get back to you with updates this week.
Thanks a lot!
Feel free to let us know if there is any way we can be of help.
With kind regards, Team ParaSpell✨
Hey @dudo50,
I am back. Did some analyses, and here are the asset pairs where we can add new routes:
For xcm swap
DOT(5) <> MYTH(30) MYTH(30) <> USDC(1000766) MYTH(30) <> USDT(1000767)
For making the XcmPaymentApi runtime API work
HDX(0) <> wstETH(1000809) HDX(0) <> sUSDe(1000625) HDX(0) <> USDC(1000766) HDX(0) <> EWT(252525) HDX(0) <> USDT(1000767) HDX(0) <> atBTC(1006) HDX(0) <> sUSDS(1000745) HDX(0) <> aPAGX(1039) HDX(0) <> aDOT(1001) HDX(0) <> aUSDT(1002) HDX(0) <> aWBTC(1004) HDX(0) <> avDOT(1005) HDX(0) <> ETH(34) HDX(0) <> HUSDS(1112) HDX(0) <> HUSDC(1110) HDX(0) <> HUSDe(1113)
Notes
As for routes involving GDOT, we can't add them at the moment.
Let me know if you might miss some important ones for your use cases.
I need to do some final testing, then we will do the technical committee proposal, probably early next week.
This will definitely help.
It would be nice to have all assets HDX <> Asset for XCM Payment API
But as it is not possible at the moment, we understand.
We will test this after the referendum to see whether it resolves most of the pathways we use.
Thanks! And thanks for taking your time debugging this, we really appreciate your efforts!
With kind regards, Team ParaSpell✨
@dudo50 took a bit of time, but we finally added the missing routes.
Please verify and let us know if they work for your usecases.
Thanks, Daniel
Thanks @dmoka this will greatly improve the experience.
You can close for now.
We will reopen in case any other scenario is found.
With kind regards,
Team ParaSpell✨️