api: DryRunApi implementation doesn't seem to work properly

Issue type:

  • Bug report
  • Feature request
  • Support request
  • Other

I saw that some time ago the dryRunApi has been implemented to be able to calculate fees for both extrinsic and XCMs. I am trying to use this API using polkadot js library but I can’t make it work.

I am getting this error:

No signer specified, either via api.setSigner or via sign options. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.

const crossChainSendPayload: any = this.getCrossChainSendPayload(data.toAddress, amount, data.parachainId);
const extrinsicPayload = api.tx[xcmPallet][method](...Object.values(crossChainSendPayload));
const dryRunResult = await extrinsicPayload.dryRun(address);

Or This error: image with this code

const crossChainSendPayload: any = this.getCrossChainSendPayload(data.toAddress, amount, data.parachainId);
const extrinsicPayload = node.tx[xcmPallet][method](...Object.values(crossChainSendPayload));
const call = node.createType('RuntimeCall', extrinsicPayload.method.toHex());

const result = await node.call.dryRunApi.dryRunCall({
    system: { signed: decodeAddress(address) },
}, extrinsicPayload.method.toHex());

I have seen the implementation here, either we need to set a blockhash or a signer. But isn’t it possible to dry run without a signer and blockhash ? By just giving an address it should be enough right ?

We need to calculate the fees for both XCM and basic extrinsic so we need this call to make it consistantly working. Thanks

  • Version:

  • Environment:

    • Node.js v20.10.0
    • Browser
    • Other (limited support for other environments)
  • Language:

    • JavaScript
    • TypeScript 5.4.5
    • Other

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (12 by maintainers)

Most upvoted comments

The reason the call doesn’t work is you’re specifying { parents: 0, interior: Here } in the assets to teleport when you’re on Asset Hub. It should be { parents: 1, interior: Here }. WND is always identified by the relative location of the Westend Relay Chain. The same also happens with KSM and DOT on system parachains.

Thanks a lot for your time and effort, will check if it is working asap