asset-transfer-api icon indicating copy to clipboard operation
asset-transfer-api copied to clipboard

getDestinationXcmWeightToFeeAsset throws an error with Interlay parachain

Open Imod7 opened this issue 9 months ago • 2 comments

Description

When calling getDestinationXcmWeightToFeeAsset with Interlay parachain, we have following behavior:

  1. If the Interlay url is given in the chainUrl

     const destinationFeesInfo = await AssetTransferApi.getDestinationXcmWeightToFeeAsset(
           'interlay-parachain',
           'wss://interlay-rpc.dwellir.com',
           this.safeXcmVersion,
           dryRunResult,
           tokenCode,
         );
    

    the following error is thrown:

    Error estimating fee:' TypeError: Cannot read properties of undefined (reading 'queryXcmWeight')
    
  2. If the Bifrost url is given in the chainUrl

    const destinationFeesInfo = await AssetTransferApi.getDestinationXcmWeightToFeeAsset(
          'interlay-parachain',
          'wss://bifrost-polkadot.ibp.network',
          this.safeXcmVersion,
          dryRunResult,
          tokenCode,
        );
    

    The fee is retrieved

Root Cause

It seems that Interlay does not currently support the xcmPaymentApi so the queryXcmWeight function is not found when using their runtime.

Suggested Solution

Update the API to check for this error case.

Credits

Creadits to @marshacb for checking this issue.

Imod7 avatar Apr 22 '25 08:04 Imod7

It seems that Interlay does not currently support the xcmPaymentApi so the queryXcmWeight function is not found when using their runtime.

There are 2 solutions here, neither of which are trivial

  1. Push adoption of xcmPaymentApi everywhere
  2. Use dryRuns

dryRuns should effectively be supported everywhere but the computation becomes more complex. We also run into issues such as dryRuns failing due to lack of funds, which then must be hacked around by batching a minting call from root before dry running the desired extrinsic. Changes to the fee asset also become complex.

Related issue: https://github.com/paritytech/asset-transfer-api/issues/609

andrew-ifrita avatar Aug 08 '25 13:08 andrew-ifrita

Marking as won't fix as we are dropping support for asset-transfer-api in favor of ParaSpell. See more in this issue: https://github.com/paritytech/asset-transfer-api/issues/652

andrew-ifrita avatar Aug 29 '25 08:08 andrew-ifrita