From 0cf5a87c15b6a40bb83349a99d4fc6ab9da5625d Mon Sep 17 00:00:00 2001 From: Michal Date: Tue, 22 Oct 2024 20:18:03 +0100 Subject: [PATCH] Add MixedSets check for HW wallets --- .../src/yoroi-wallets/cardano/cip30/cip30-ledger.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/wallet-mobile/src/yoroi-wallets/cardano/cip30/cip30-ledger.ts b/apps/wallet-mobile/src/yoroi-wallets/cardano/cip30/cip30-ledger.ts index b375a2f489..e15827c8b8 100644 --- a/apps/wallet-mobile/src/yoroi-wallets/cardano/cip30/cip30-ledger.ts +++ b/apps/wallet-mobile/src/yoroi-wallets/cardano/cip30/cip30-ledger.ts @@ -1,4 +1,5 @@ import {Transaction, WasmModuleProxy} from '@emurgo/cross-csl-core' +import {has_transaction_set_tag, TransactionSetsState} from '@emurgo/csl-mobile-bridge' import {createSignedLedgerTxFromCbor} from '@emurgo/yoroi-lib' import {normalizeToAddress} from '@emurgo/yoroi-lib/dist/internals/utils/addresses' import {HW, Wallet} from '@yoroi/types' @@ -21,10 +22,16 @@ class CIP30LedgerExtension { async signTx(cbor: string, partial: boolean, hwDeviceInfo: HW.DeviceInfo, useUSB: boolean): Promise { const {csl, release} = wrappedCsl() try { - const tx = await csl.Transaction.fromHex(cbor) + const tx = await csl.FixedTransaction.fromHex(cbor) if (!partial) await assertHasAllSigners(cbor, this.wallet, this.meta) const txBody = await tx.body() + const transactionSetTag = await has_transaction_set_tag(await txBody.toBytes()) + + if (transactionSetTag === TransactionSetsState.MixedSets) { + throw new Error('Mixed transaction sets are not supported when using a HW wallet') + } + const payload = await toLedgerSignRequest( csl, txBody,