polkadot-js / api

Promise and RxJS APIs around Polkadot and Substrate based chains via RPC calls. It is dynamically generated based on what the Substrate runtime provides in terms of metadata.
Apache License 2.0
1.07k stars 349 forks source link

Ensure signAsync and dryRun is fully compatible with signedTransaction, and add `withSignedTransaction` option #5920

Closed TarikGul closed 3 months ago

TarikGul commented 3 months ago

Summary

To ensure https://github.com/polkadot-js/api/pull/5914 does not break all dApps we have done a few things in this PR. I will list them out, then work through each change.

withSignedTransaction

This option has been added to SignerOptions. When using signAndSend or signAsync you may now enable or disable the use of signedTransaction by adding withSignedTransaction. When withSignedTransaction is not enabled but the signer adds a signedTransaction the api will error.

signAsync

signAsync now accepts signedTransaction as well. This means that if withSignedTransaction is enabled, and signedTransaction is present the api will adjust the current payload attached to the SubmittableExtrinsic, and add the signature. Then the user can call .send() as they please.

NOTE: With the previous PR linked above signAsync broke for certain cases, therefore the functionality needed to be extended to it.

dryRun

All steps will be the same as signAsync with the exception that .send() has never needed to be called.

polkadot-js-bot commented 3 months ago

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.