Skip to content

Commit 703870f

Browse files
authored
[DDW-759] Fixed hardware wallet delegation (#2738)
* [DDW-759] Fixed hardware wallet delegation * [DDW-759] Updated CHANGELOG * [DDW-759] Updated localizations
1 parent 2c48d40 commit 703870f

File tree

6 files changed

+38
-23
lines changed

6 files changed

+38
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Features
66

77
- Implemented "Catalyst Fund7" voting registration changes ([PR 2732](https://github.com/input-output-hk/daedalus/pull/2732))
8-
- Added "Over-saturation" warning in the delegation wizard ([PR 2733](https://github.com/input-output-hk/daedalus/pull/2733))
8+
- Added "Over-saturation" warning in the delegation wizard ([PR 2733](https://github.com/input-output-hk/daedalus/pull/2733), [PR 2738](https://github.com/input-output-hk/daedalus/pull/2738))
99
- Added Catalyst footer links ([PR 2721](https://github.com/input-output-hk/daedalus/pull/2721))
1010

1111
### Fixes

source/renderer/app/components/staking/delegation-setup-wizard/DelegationSetupWizardDialog.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type Props = {
4343
getStakePoolById: Function,
4444
hwDeviceStatus: HwDeviceStatus,
4545
isTrezor: boolean,
46+
onThumbPoolSelect: Function,
4647
};
4748

4849
const getOversaturationPercentage = (
@@ -108,6 +109,7 @@ export default class DelegationSetupWizardDialog extends Component<Props> {
108109
hwDeviceStatus,
109110
isTrezor,
110111
maxDelegationFunds,
112+
onThumbPoolSelect,
111113
} = this.props;
112114

113115
const selectedWalletId = get(selectedWallet, 'id', null);
@@ -156,9 +158,10 @@ export default class DelegationSetupWizardDialog extends Component<Props> {
156158
selectedPool={selectedPool}
157159
onClose={onClose}
158160
onBack={onBack}
159-
onSelectPool={onSelectPool}
160-
onContinue={onContinue}
161+
onSelectPool={onThumbPoolSelect}
162+
onContinue={onSelectPool}
161163
oversaturationPercentage={oversaturationPercentage}
164+
onThumbPoolSelect={onThumbPoolSelect}
162165
/>
163166
);
164167
break;

source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseStakePoolDialog.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ type Props = {
5050
intl: intlShape.isRequired,
5151
onContinue: Function,
5252
oversaturationPercentage: number,
53+
onThumbPoolSelect: Function,
5354
};
5455

5556
type FooterProps = {
@@ -90,22 +91,25 @@ const DelegationStepsChooseStakePoolDialog = observer((props: Props) => {
9091
setSearchValue('');
9192
});
9293

93-
const handleSelect = useCallback((value: string) => {
94-
const _selectedPool = find(
95-
stakePoolsList,
96-
(stakePool) => stakePool.id === value
97-
);
98-
setSelectedPool(_selectedPool);
99-
props.onSelectPool(_selectedPool.id);
100-
});
94+
const handleSelect = useCallback(
95+
(value: string) => {
96+
const _selectedPool = find(
97+
stakePoolsList,
98+
(stakePool) => stakePool.id === value
99+
);
100+
setSelectedPool(_selectedPool);
101+
props.onThumbPoolSelect(_selectedPool.id);
102+
},
103+
[props.onThumbPoolSelect, stakePoolsList]
104+
);
101105

102106
useEffect(() => {
103107
if (preselectedPool && preselectedPool.id) handleSelect(preselectedPool.id);
104108
}, [preselectedPool]);
105109

106110
const onContinue = useCallback(() => {
107-
props.onContinue();
108-
}, [props.onContinue]);
111+
props.onContinue(selectedPool);
112+
}, [props.onContinue, selectedPool]);
109113

110114
const {
111115
name: selectedWalletName,

source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from '../../../config/stakingConfig';
1313
import type { DelegationCalculateFeeResponse } from '../../../api/staking/types';
1414
import type { InjectedDialogContainerProps } from '../../../types/injectedPropsType';
15+
import StakePool from '../../../domains/StakePool';
1516

1617
const messages = defineMessages({
1718
learnMoreLinkUrl: {
@@ -155,11 +156,15 @@ export default class DelegationSetupWizardDialogContainer extends Component<
155156
this.handleContinue();
156157
};
157158

158-
handleSelectPool = (poolId: string) => {
159-
this._handleCalculateTransactionFee(poolId);
159+
handleChoosePool = (poolId: string) => {
160160
this.setState({ selectedPoolId: poolId });
161161
};
162162

163+
handleSelectPool = (pool: StakePool) => {
164+
this._handleCalculateTransactionFee(pool.id);
165+
this.handleContinue();
166+
};
167+
163168
render() {
164169
const {
165170
activeStep,
@@ -230,6 +235,7 @@ export default class DelegationSetupWizardDialogContainer extends Component<
230235
onContinue={this.handleContinue}
231236
onSelectWallet={this.handleSelectWallet}
232237
onSelectPool={this.handleSelectPool}
238+
onThumbPoolSelect={this.handleChoosePool}
233239
onBack={this.onBack}
234240
onLearnMoreClick={this.handleLearnMoreClick}
235241
onConfirm={this.handleConfirm}

source/renderer/app/i18n/locales/defaultMessages.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17105,55 +17105,55 @@
1710517105
"description": "\"Learn more\" link URL on the delegation setup \"intro\" dialog.",
1710617106
"end": {
1710717107
"column": 3,
17108-
"line": 22
17108+
"line": 23
1710917109
},
1711017110
"file": "source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.js",
1711117111
"id": "staking.delegationSetup.intro.step.dialog.learnMore.url",
1711217112
"start": {
1711317113
"column": 20,
17114-
"line": 17
17114+
"line": 18
1711517115
}
1711617116
},
1711717117
{
1711817118
"defaultMessage": "!!!Wallet",
1711917119
"description": "Step 1 label text on delegation steps dialog.",
1712017120
"end": {
1712117121
"column": 3,
17122-
"line": 27
17122+
"line": 28
1712317123
},
1712417124
"file": "source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.js",
1712517125
"id": "staking.delegationSetup.steps.step.1.label",
1712617126
"start": {
1712717127
"column": 29,
17128-
"line": 23
17128+
"line": 24
1712917129
}
1713017130
},
1713117131
{
1713217132
"defaultMessage": "!!!Stake pool",
1713317133
"description": "Step 2 label text on delegation steps dialog.",
1713417134
"end": {
1713517135
"column": 3,
17136-
"line": 32
17136+
"line": 33
1713717137
},
1713817138
"file": "source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.js",
1713917139
"id": "staking.delegationSetup.steps.step.2.label",
1714017140
"start": {
1714117141
"column": 29,
17142-
"line": 28
17142+
"line": 29
1714317143
}
1714417144
},
1714517145
{
1714617146
"defaultMessage": "!!!Confirmation",
1714717147
"description": "Step 3 label text on delegation steps dialog.",
1714817148
"end": {
1714917149
"column": 3,
17150-
"line": 37
17150+
"line": 38
1715117151
},
1715217152
"file": "source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.js",
1715317153
"id": "staking.delegationSetup.steps.step.3.label",
1715417154
"start": {
1715517155
"column": 29,
17156-
"line": 33
17156+
"line": 34
1715717157
}
1715817158
}
1715917159
],

source/renderer/app/stores/StakingStore.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ export default class StakingStore extends Store {
291291
if (isHardwareWallet) {
292292
joinTransaction = await this.stores.hardwareWallets._sendMoney({
293293
isDelegationTransaction: true,
294+
selectedWalletId: walletId,
294295
});
295296
} else {
296297
joinTransaction = await this.joinStakePoolRequest.execute({
@@ -327,6 +328,7 @@ export default class StakingStore extends Store {
327328
if (isHardwareWallet) {
328329
quitTransaction = await this.stores.hardwareWallets._sendMoney({
329330
isDelegationTransaction: true,
331+
selectedWalletId: walletId,
330332
});
331333
} else {
332334
quitTransaction = await this.quitStakePoolRequest.execute({

0 commit comments

Comments
 (0)