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

* Ensure signAsync is compatible with signedTransaction

* Fix payload construction

* Update sig

* add withSignedTransaction option

* remove unused type

* Add withSignedTransaction to other type

* Throw error when signTransaction is there but not enabled

* inline docs

* Update inline docs

* lint
This commit is contained in:
Tarik Gul
2024-06-27 15:09:48 -04:00
committed by GitHub
parent 6f199db86a
commit ab3f0253bd
3 changed files with 44 additions and 4 deletions
+10 -1
View File
@@ -104,6 +104,12 @@ export interface SignerPayloadJSON {
* @description The version of the extrinsic we are dealing with
*/
version: number;
/**
* @description Optional flag that enables the use of the `signedTransaction` field in
* `singAndSend`, `signAsync`, and `dryRun`.
*/
withSignedTransaction?: boolean;
}
export interface SignerPayloadRawBase {
@@ -152,7 +158,9 @@ export interface SignerResult {
* and instead broadcasting the transaction directly. There is a small validation layer. Please refer
* to the implementation for more information. If the inputted signed transaction is not actually signed, it will fail with an error.
*
* NOTE: This is only implemented for `signPayload`.
* This will also work for `signAsync`. The new payload will be added to the Extrinsic, and will be sent once the consumer calls `.send()`.
*
* NOTE: This is only implemented for `signPayload`, and will only work when the `withSignedTransaction` option is enabled as an option.
*/
signedTransaction?: HexString | Uint8Array;
}
@@ -191,6 +199,7 @@ export interface SignatureOptions {
assetId?: AnyNumber | object;
mode?: AnyNumber;
metadataHash?: Uint8Array | string;
withSignedTransaction?: boolean;
}
interface ExtrinsicSignatureBase {