diff --git a/CHANGELOG.md b/CHANGELOG.md index 07032bec6b..20f4cfcb0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ Changelog ## 3.3.0 +### Fixes + +- Fixed issue with hardware wallet delegation ([PR 2369](https://github.com/input-output-hk/daedalus/pull/2369)) + ### Chores - Updated `cardano-launcher` to version `0.20210215.0` ([PR 2363](https://github.com/input-output-hk/daedalus/pull/2363)) diff --git a/source/renderer/app/stores/HardwareWalletsStore.js b/source/renderer/app/stores/HardwareWalletsStore.js index b04c283bd7..0284b196cd 100644 --- a/source/renderer/app/stores/HardwareWalletsStore.js +++ b/source/renderer/app/stores/HardwareWalletsStore.js @@ -160,6 +160,7 @@ export default class HardwareWalletsStore extends Store { @observable isListeningForDevice: boolean = false; @observable isConnectInitiated: boolean = false; @observable isExportKeyAborted: boolean = false; + @observable activeDelegationWalletId: ?string = null; cardanoAdaAppPollingInterval: ?IntervalID = null; checkTransactionTimeInterval: ?IntervalID = null; @@ -432,7 +433,16 @@ export default class HardwareWalletsStore extends Store { // Check if active wallet exist - this means that hw exist but we need to check if relevant device connected to it let recognizedPairedHardwareWallet; let relatedConnectionData; - const activeWalletId = get(this.stores.wallets, ['active', 'id']); + + let activeWalletId; + if (this.activeDelegationWalletId && this.isTransactionInitiated) { + // Active wallet can be different that wallet we want to delegate + activeWalletId = this.activeDelegationWalletId; + } else { + // For regular tx we are using active wallet + activeWalletId = get(this.stores.wallets, ['active', 'id']); + } + if (activeWalletId) { // Check if device connected to wallet logger.debug('[HW-DEBUG] HWStore - active wallet exists'); @@ -1375,11 +1385,12 @@ export default class HardwareWalletsStore extends Store { }; initiateTransaction = async (params: { walletId: ?string }) => { + const { walletId } = params; runInAction('HardwareWalletsStore:: Initiate Transaction', () => { this.isTransactionInitiated = true; this.hwDeviceStatus = HwDeviceStatuses.CONNECTING; + this.activeDelegationWalletId = walletId; }); - const { walletId } = params; const hardwareWalletConnectionData = get( this.hardwareWalletsConnectionData, walletId @@ -1444,7 +1455,6 @@ export default class HardwareWalletsStore extends Store { throw e; } } - runInAction( 'HardwareWalletsStore:: Set active device path for Transaction send', () => { @@ -1455,7 +1465,6 @@ export default class HardwareWalletsStore extends Store { // Add more cases / edge cases if needed if (deviceType === DeviceTypes.TREZOR && walletId) { logger.debug('[HW-DEBUG] Sign Trezor: ', { id }); - const transportDevice = await this.establishHardwareWalletConnection(); if (transportDevice) { runInAction( @@ -1505,6 +1514,7 @@ export default class HardwareWalletsStore extends Store { this.txBody = null; this.activeDevicePath = null; this.unfinishedWalletTxSigning = null; + this.activeDelegationWalletId = null; }); };