Skip to content

Commit 18d103f

Browse files
authored
Merge pull request #3031 from input-output-hk/fix/ddw-1134-fix-catalyst-registration-hw
[DDW-1134] Fix Catalyst registration with hardware wallets
2 parents 0b49b33 + 0f54666 commit 18d103f

File tree

4 files changed

+48
-26
lines changed

4 files changed

+48
-26
lines changed

source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@ class VotingRegistrationDialogContainer extends Component<Props, State> {
255255
const { calculateTransactionFee } = transactions;
256256
const { getAddressesByWalletId } = addresses;
257257
const { getWalletById } = wallets;
258-
const { selectCoins, initiateTransaction } = hardwareWallets;
258+
const {
259+
selectCoins,
260+
initiateTransaction,
261+
updateTxSignRequest,
262+
} = hardwareWallets;
259263
const { prepareVotingData } = voting;
260264
const amount = formattedAmountToLovelace(
261265
`${VOTING_REGISTRATION_FEE_CALCULATION_AMOUNT}`
@@ -276,12 +280,15 @@ class VotingRegistrationDialogContainer extends Component<Props, State> {
276280
votingData = await prepareVotingData({
277281
walletId: this.selectedWalletId,
278282
});
279-
({ fee } = await selectCoins({
283+
const coinSelection = await selectCoins({
280284
walletId: this.selectedWalletId,
281285
address: address.id,
282286
amount,
283287
metadata: votingData.metadata,
284-
}));
288+
});
289+
290+
updateTxSignRequest(coinSelection);
291+
fee = coinSelection.fee;
285292
} else {
286293
({ fee } = await calculateTransactionFee({
287294
walletId: this.selectedWalletId,

source/renderer/app/i18n/locales/ja-JP.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@
157157
"environment.network.alonzo_purple": "Alonzo Purple",
158158
"environment.network.development": "開発",
159159
"environment.network.mainnet": "メインネット",
160-
"environment.network.preprod": "Pre-Prod",
161-
"environment.network.preview": "Preview",
160+
"environment.network.preprod": "プリプロ",
161+
"environment.network.preview": "プレビュー",
162162
"environment.network.selfnode": "Selfnode",
163163
"environment.network.shelley_qa": "Shelley QA",
164164
"environment.network.staging": "ステージング",
@@ -682,8 +682,8 @@
682682
"test.environment.daedalusFlightLabel": "Cardano Mainnet - Daedalus Flight",
683683
"test.environment.developmentLabel": "開発",
684684
"test.environment.mainnetLabel": "メインネット",
685-
"test.environment.preprodLabel": "Pre-Prod",
686-
"test.environment.previewLabel": "Preview",
685+
"test.environment.preprodLabel": "プリプロ",
686+
"test.environment.previewLabel": "プレビュー",
687687
"test.environment.selfnodeLabel": "Selfnode",
688688
"test.environment.shelleyQaLabel": "Shelley QA",
689689
"test.environment.stagingLabel": "ステージング",

source/renderer/app/stores/VotingStore.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ import { formattedArrayBufferToHexString } from '../utils/formatters';
1111
import walletUtils from '../utils/walletUtils';
1212
import {
1313
VOTING_PHASE_CHECK_INTERVAL,
14-
VOTING_REGISTRATION_TRANSACTION_POLLING_INTERVAL,
1514
VOTING_REGISTRATION_MIN_TRANSACTION_CONFIRMATIONS,
15+
VOTING_REGISTRATION_TRANSACTION_POLLING_INTERVAL,
1616
} from '../config/votingConfig';
17-
import { votingPDFGenerator } from '../utils/votingPDFGenerator';
17+
import {
18+
votingPDFGenerator,
19+
VotingPDFGeneratorResult,
20+
} from '../utils/votingPDFGenerator';
1821
import { i18nContext } from '../utils/i18nContext';
1922
import type { PathRoleIdentityType } from '../utils/hardwareWalletUtils';
2023
import type {
@@ -423,23 +426,21 @@ export default class VotingStore extends Store {
423426
const { network, isMainnet } = this.environment;
424427
const intl = i18nContext(currentLocale);
425428

426-
try {
427-
await votingPDFGenerator({
428-
nextVotingFundNumber,
429-
qrCode,
430-
walletName,
431-
currentLocale,
432-
currentDateFormat,
433-
currentTimeFormat,
434-
desktopDirectoryPath,
435-
network,
436-
isMainnet,
437-
intl,
438-
});
439-
// @ts-ignore ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
429+
const result = await votingPDFGenerator({
430+
nextVotingFundNumber,
431+
qrCode,
432+
walletName,
433+
currentLocale,
434+
currentDateFormat,
435+
currentTimeFormat,
436+
desktopDirectoryPath,
437+
network,
438+
isMainnet,
439+
intl,
440+
});
441+
442+
if (result === VotingPDFGeneratorResult.FileSaved) {
440443
this.actions.voting.saveAsPDFSuccess.trigger();
441-
} catch (error) {
442-
throw new Error(error);
443444
}
444445
};
445446
_checkVotingRegistrationTransaction = async () => {

source/renderer/app/utils/votingPDFGenerator.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const messages = defineMessages({
3434
description: 'PDF author',
3535
},
3636
});
37+
3738
type Params = {
3839
nextVotingFundNumber: number;
3940
qrCode: string;
@@ -46,6 +47,12 @@ type Params = {
4647
isMainnet: boolean;
4748
intl: Record<string, any>;
4849
};
50+
51+
export enum VotingPDFGeneratorResult {
52+
FileSaved = 'FileSaved',
53+
CancelledByUser = 'CancelledByUser',
54+
}
55+
4956
export const votingPDFGenerator = async ({
5057
nextVotingFundNumber,
5158
qrCode,
@@ -57,7 +64,7 @@ export const votingPDFGenerator = async ({
5764
network,
5865
isMainnet,
5966
intl,
60-
}: Params) => {
67+
}: Params): Promise<VotingPDFGeneratorResult> => {
6168
// Consolidate data
6269
const title = intl.formatMessage(messages.title, {
6370
nextVotingFundNumber,
@@ -93,6 +100,11 @@ export const votingPDFGenerator = async ({
93100
};
94101
const dialogPath = await showSaveDialogChannel.send(params);
95102
const filePath = dialogPath.filePath || '';
103+
104+
if (dialogPath.canceled || !filePath) {
105+
return VotingPDFGeneratorResult.CancelledByUser;
106+
}
107+
96108
await generateVotingPDFChannel.send({
97109
title,
98110
currentLocale,
@@ -106,4 +118,6 @@ export const votingPDFGenerator = async ({
106118
filePath,
107119
author,
108120
});
121+
122+
return VotingPDFGeneratorResult.FileSaved;
109123
};

0 commit comments

Comments
 (0)