From ea855868adb781cbfdc73e92a81f9540b0d75c3b Mon Sep 17 00:00:00 2001 From: Alia Aamir Date: Tue, 27 Jun 2023 12:22:01 -0400 Subject: [PATCH] fix(sdk-core): fix uploading unsigned sweep tx for sol, dot and ada WP-155 --- modules/sdk-coin-ada/src/ada.ts | 3 +++ modules/sdk-coin-dot/src/dot.ts | 3 +++ modules/sdk-coin-sol/src/sol.ts | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/modules/sdk-coin-ada/src/ada.ts b/modules/sdk-coin-ada/src/ada.ts index 5a88f9e6c9..0479a410fc 100644 --- a/modules/sdk-coin-ada/src/ada.ts +++ b/modules/sdk-coin-ada/src/ada.ts @@ -55,6 +55,7 @@ interface RecoveryOptions { interface AdaTx { serializedTx: string; scanIndex: number; + coin?: string; } export type AdaTransactionExplanation = TransactionExplanation; @@ -381,6 +382,8 @@ export class Ada extends BaseCoin { txBuilder.addSignature({ pub: adaKeyPair.getKeys().pub }, signatureHex); const signedTransaction = await txBuilder.build(); serializedTx = signedTransaction.toBroadcastFormat(); + } else { + return { serializedTx: serializedTx, scanIndex: i, coin: this.getChain() }; } return { serializedTx: serializedTx, scanIndex: i }; } diff --git a/modules/sdk-coin-dot/src/dot.ts b/modules/sdk-coin-dot/src/dot.ts index f1794d7009..f0dd9d6499 100644 --- a/modules/sdk-coin-dot/src/dot.ts +++ b/modules/sdk-coin-dot/src/dot.ts @@ -62,6 +62,7 @@ interface RecoveryOptions { interface DotTx { serializedTx: string; scanIndex: number; + coin?: string; } const dotUtils = Utils.default; @@ -441,6 +442,8 @@ export class Dot extends BaseCoin { txnBuilder.addSignature({ pub: dotKeyPair.getKeys().pub }, signatureHex); const signedTransaction = await txnBuilder.build(); serializedTx = signedTransaction.toBroadcastFormat(); + } else { + return { serializedTx: serializedTx, scanIndex: i, coin: this.getChain() }; } return { serializedTx: serializedTx, scanIndex: i }; } diff --git a/modules/sdk-coin-sol/src/sol.ts b/modules/sdk-coin-sol/src/sol.ts index f6b8e5cf67..9f3965567f 100644 --- a/modules/sdk-coin-sol/src/sol.ts +++ b/modules/sdk-coin-sol/src/sol.ts @@ -104,6 +104,7 @@ export interface SolParseTransactionOptions extends BaseParseTransactionOptions interface SolTx { serializedTx: string; scanIndex: number; + coin?: string; } interface SolDurableNonceFromNode { @@ -709,6 +710,13 @@ export class Sol extends BaseCoin { const completedTransaction = await txBuilder.build(); const serializedTx = completedTransaction.toBroadcastFormat(); + if (isUnsignedSweep) { + return { + serializedTx: serializedTx, + scanIndex: scanIndex, + coin: this.getChain(), + }; + } return { serializedTx: serializedTx, scanIndex: scanIndex,