Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/sdk-coin-ada/src/ada.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ export class Ada extends BaseCoin {
* @param {string} [params.endingScanIndex] - receive address index to end scanning at. default to startingScanIndex + 20 (exclusive).
*/
async recoverConsolidations(params: MPCConsolidationRecoveryOptions): Promise<MPCTxs | MPCSweepTxs> {
const isUnsignedSweep = !params.userKey && !params.backupKey && !params.walletPassphrase;
const isUnsignedSweep = !params.walletPassphrase;
const startIdx = params.startingScanIndex || 1;
const endIdx = params.endingScanIndex || startIdx + DEFAULT_SCAN_FACTOR;

Expand Down
18 changes: 18 additions & 0 deletions modules/sdk-coin-ada/test/unit/ada.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,24 @@ describe('ADA', function () {
res.should.not.be.empty();
res.transactions.length.should.equal(2);
});

it('should treat as unsigned sweep when walletPassphrase is absent even if keys are provided', async function () {
// recover() determines isUnsignedSweep solely from !walletPassphrase.
// recoverConsolidations must use the same signal so result handling is consistent.
// Providing userKey/backupKey without walletPassphrase must still produce an unsigned sweep
// (MPCSweepTxs), not silently mangle the result by treating it as a signed MPCTxs.
const res = await basecoin.recoverConsolidations({
userKey: consolidationWrwUser.userKey,
backupKey: consolidationWrwUser.backupKey,
bitgoKey: consolidationWrwUser.bitgoKey,
// walletPassphrase intentionally omitted
startingScanIndex: 1,
endingScanIndex: 4,
});
res.should.not.be.empty();
// unsigned sweep returns MPCSweepTxs shape with txRequests
res.txRequests.length.should.equal(2);
});
});

describe('Recover Transactions Failure:', () => {
Expand Down
Loading