= {
+ abstain: sharedGovernanceMessages.abstain,
+ no_confidence: sharedGovernanceMessages.noConfidence,
+ drep: sharedGovernanceMessages.delegateToDRep,
+};
+
export type VotingPowerDelegationConfirmationDialogState =
| {
error?: DelegateVotesError;
@@ -124,7 +133,9 @@ function VotingPowerDelegationConfirmationDialog({
{intl.formatMessage(messages.vote)}
- {chosenOption}
+
+ {intl.formatMessage(mapVoteToIntlMessage[chosenOption])}
+
{intl.formatMessage(messages.fee)}
diff --git a/source/renderer/app/components/voting/voting-governance/shared-messages.ts b/source/renderer/app/components/voting/voting-governance/shared-messages.ts
new file mode 100644
index 0000000000..0c030a6af2
--- /dev/null
+++ b/source/renderer/app/components/voting/voting-governance/shared-messages.ts
@@ -0,0 +1,19 @@
+import { defineMessages } from 'react-intl';
+
+export const sharedGovernanceMessages = defineMessages({
+ abstain: {
+ id: 'voting.governance.abstain',
+ defaultMessage: '!!!Abstain',
+ description: 'Translation for the "abstain" governance vote type',
+ },
+ delegateToDRep: {
+ id: 'voting.governance.delegateToDRep',
+ defaultMessage: '!!!Delegate to DRep',
+ description: 'Translation for the "delegate to DRep" governance vote type',
+ },
+ noConfidence: {
+ id: 'voting.governance.noConfidence',
+ defaultMessage: '!!!No Confidence',
+ description: 'Translation for the "no confidence" governance vote type',
+ },
+});
diff --git a/source/renderer/app/components/voting/voting-governance/types.ts b/source/renderer/app/components/voting/voting-governance/types.ts
new file mode 100644
index 0000000000..d7cf2c4deb
--- /dev/null
+++ b/source/renderer/app/components/voting/voting-governance/types.ts
@@ -0,0 +1 @@
+export type VoteType = 'abstain' | 'no_confidence' | 'drep';
diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json
index 361de9600b..a219ce8f39 100644
--- a/source/renderer/app/i18n/locales/defaultMessages.json
+++ b/source/renderer/app/i18n/locales/defaultMessages.json
@@ -4401,16 +4401,6 @@
},
{
"descriptors": [
- {
- "defaultMessage": "!!!Abstain",
- "description": "Translation for the \"abstain\" governance vote type",
- "id": "voting.governance.abstain"
- },
- {
- "defaultMessage": "!!!Delegate to DRep",
- "description": "Translation for the \"delegate to DRep\" governance vote type",
- "id": "voting.governance.delegateToDRep"
- },
{
"defaultMessage": "!!!Please type or paste a valid DRep ID here. Look up {drepDirectoryLink}",
"description": "Label for DRep input on the governance page",
@@ -4441,11 +4431,6 @@
"description": "Headline for Governance",
"id": "voting.governance.heading"
},
- {
- "defaultMessage": "!!!No Confidence",
- "description": "Translation for the \"no confidence\" governance vote type",
- "id": "voting.governance.noConfidence"
- },
{
"defaultMessage": "!!!Governance first paragraph",
"description": "First paragraph for governance page",
@@ -4539,6 +4524,26 @@
],
"path": "source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.messages.ts"
},
+ {
+ "descriptors": [
+ {
+ "defaultMessage": "!!!Abstain",
+ "description": "Translation for the \"abstain\" governance vote type",
+ "id": "voting.governance.abstain"
+ },
+ {
+ "defaultMessage": "!!!Delegate to DRep",
+ "description": "Translation for the \"delegate to DRep\" governance vote type",
+ "id": "voting.governance.delegateToDRep"
+ },
+ {
+ "defaultMessage": "!!!No Confidence",
+ "description": "Translation for the \"no confidence\" governance vote type",
+ "id": "voting.governance.noConfidence"
+ }
+ ],
+ "path": "source/renderer/app/components/voting/voting-governance/shared-messages.ts"
+ },
{
"descriptors": [
{
diff --git a/source/renderer/app/i18n/locales/ja-JP.json b/source/renderer/app/i18n/locales/ja-JP.json
index eaec5776c5..a98f6aa8b0 100755
--- a/source/renderer/app/i18n/locales/ja-JP.json
+++ b/source/renderer/app/i18n/locales/ja-JP.json
@@ -721,7 +721,7 @@
"voting.governance.abstain": "棄権",
"voting.governance.confirmationDialog.button.cancel": "キャンセル",
"voting.governance.confirmationDialog.button.confirm": "確認",
- "voting.governance.confirmationDialog.error.generic": "!!!Something went wrong during transaction submission. Please try again in a few minutes.",
+ "voting.governance.confirmationDialog.error.generic": "トランザクションの初期化中に問題が発生しました。しばらくしてからもう一度お試しください。",
"voting.governance.confirmationDialog.fee": "平均手数料",
"voting.governance.confirmationDialog.password": "パスワードを入力してください",
"voting.governance.confirmationDialog.title": "トランザクションの確認",
@@ -733,9 +733,9 @@
"voting.governance.drepInputLabelLinkUrl": "https://www.1694.io/en/dreps/list",
"voting.governance.drepInputPlaceholder": "DRep IDを追加してください",
"voting.governance.heading": "Cardano投票権の委任",
- "voting.governance.initializeTxError.generic": "!!!Could not initialize transaction. Please try again!",
- "voting.governance.initializeTxError.notEnoughMoney": "!!!Not enough funds",
- "voting.governance.initializeTxError.sameVote": "!!!Chosen same value as previously",
+ "voting.governance.initializeTxError.generic": "トランザクションの初期化中に問題が発生しました。しばらくしてからもう一度お試しください。",
+ "voting.governance.initializeTxError.notEnoughMoney": "このウォレットには必要最低額1ADAが入っていません。ウォレットはまだ同期中かもしれません。別の投票用ウォレットを選択してください。",
+ "voting.governance.initializeTxError.sameVote": "この投票権委任の選択は、以前のトランザクションですでに正常に記録されています。続けるには登録の種類またはDRep IDを変更してください。",
"voting.governance.noConfidence": "不信任",
"voting.governance.paragraph1": "投票権を登録すると、報酬を引き出せるようになります。詳細は{Link}をご覧ください。",
"voting.governance.paragraph1LinkText": "Cardano Governance",
diff --git a/translations/messages.json b/translations/messages.json
index 8d3ca17621..a70cb0e594 100644
--- a/translations/messages.json
+++ b/translations/messages.json
@@ -4401,16 +4401,6 @@
},
{
"descriptors": [
- {
- "defaultMessage": "!!!Abstain",
- "description": "Translation for the \"abstain\" governance vote type",
- "id": "voting.governance.abstain"
- },
- {
- "defaultMessage": "!!!Delegate to DRep",
- "description": "Translation for the \"delegate to DRep\" governance vote type",
- "id": "voting.governance.delegateToDRep"
- },
{
"defaultMessage": "!!!Please type or paste a valid DRep ID here. Look up {drepDirectoryLink}",
"description": "Label for DRep input on the governance page",
@@ -4441,11 +4431,6 @@
"description": "Headline for Governance",
"id": "voting.governance.heading"
},
- {
- "defaultMessage": "!!!No Confidence",
- "description": "Translation for the \"no confidence\" governance vote type",
- "id": "voting.governance.noConfidence"
- },
{
"defaultMessage": "!!!Governance first paragraph",
"description": "First paragraph for governance page",
@@ -4539,6 +4524,26 @@
],
"path": "source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.messages.ts"
},
+ {
+ "descriptors": [
+ {
+ "defaultMessage": "!!!Abstain",
+ "description": "Translation for the \"abstain\" governance vote type",
+ "id": "voting.governance.abstain"
+ },
+ {
+ "defaultMessage": "!!!Delegate to DRep",
+ "description": "Translation for the \"delegate to DRep\" governance vote type",
+ "id": "voting.governance.delegateToDRep"
+ },
+ {
+ "defaultMessage": "!!!No Confidence",
+ "description": "Translation for the \"no confidence\" governance vote type",
+ "id": "voting.governance.noConfidence"
+ }
+ ],
+ "path": "source/renderer/app/components/voting/voting-governance/shared-messages.ts"
+ },
{
"descriptors": [
{
From 58bcd21d6318be5de0fc147974e5865dacc04861 Mon Sep 17 00:00:00 2001
From: Dominik Guzei
Date: Mon, 11 Nov 2024 18:52:10 +0100
Subject: [PATCH 24/30] fix: Catch send error for staking conway wallets which
have not registered voting rights yet [LW-11518]
Signed-off-by: Dominik Guzei
---
CHANGELOG.md | 4 ++++
source/renderer/app/api/api.ts | 3 +++
source/renderer/app/api/errors.ts | 6 ++++++
.../dialogs/send-confirmation/SendConfirmation.view.tsx | 3 ++-
source/renderer/app/i18n/locales/defaultMessages.json | 5 +++++
source/renderer/app/i18n/locales/en-US.json | 1 +
source/renderer/app/i18n/locales/ja-JP.json | 1 +
source/renderer/app/stores/WalletsStore.ts | 8 +++++++-
storybook/stories/wallets/send/WalletSend.stories.tsx | 8 +++++++-
translations/messages.json | 5 +++++
10 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb39c21eb7..f32764fc30 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,10 @@
- Update `cardano-node` to 10.1.1 via `cardano-wallet` [`ba7d3340968`](https://github.com/cardano-foundation/cardano-wallet/commit/ba7d33409680f4e75ef260add8744dcf71f40a77) ([PR 3229](https://github.com/input-output-hk/daedalus/pull/3229))
+### Fixes
+
+- Handle createTransaction error when Conway era wallet has staking rewards but has not participated in governance yet ([PR 3237](https://github.com/input-output-hk/daedalus/pull/3237)
+
## 6.0.2
### Fixes
diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts
index 116e92933a..d533febfe9 100644
--- a/source/renderer/app/api/api.ts
+++ b/source/renderer/app/api/api.ts
@@ -1016,6 +1016,9 @@ export default class AdaApi {
.set('wrongEncryptionPassphrase')
.where('code', 'bad_request')
.inc('message', 'passphrase is too short')
+ .set('conwayWalletNotDelegatedToDRep')
+ .where('code', 'created_invalid_transaction')
+ .inc('message', 'ConwayWdrlNotDelegatedToDRep')
.set('transactionIsTooBig', true, {
linkLabel: 'tooBigTransactionErrorLinkLabel',
linkURL: 'tooBigTransactionErrorLinkURL',
diff --git a/source/renderer/app/api/errors.ts b/source/renderer/app/api/errors.ts
index acac84ba15..1146da01bc 100644
--- a/source/renderer/app/api/errors.ts
+++ b/source/renderer/app/api/errors.ts
@@ -121,6 +121,12 @@ export const messages = defineMessages({
description:
'"Balance after transaction would not leave enough ada in the wallet to support tokens remaining in wallet',
},
+ conwayWalletNotDelegatedToDRep: {
+ id: 'api.errors.conwayWalletNotDelegatedToDRep',
+ defaultMessage: '!!!conwayWalletNotDelegatedToDRep',
+ description:
+ 'Error message shown when conway era wallet has staking rewards but has not participated in governance yet.',
+ },
});
type Balances = {
diff --git a/source/renderer/app/containers/wallet/dialogs/send-confirmation/SendConfirmation.view.tsx b/source/renderer/app/containers/wallet/dialogs/send-confirmation/SendConfirmation.view.tsx
index 37fddf1d35..c8a786b7aa 100644
--- a/source/renderer/app/containers/wallet/dialogs/send-confirmation/SendConfirmation.view.tsx
+++ b/source/renderer/app/containers/wallet/dialogs/send-confirmation/SendConfirmation.view.tsx
@@ -89,7 +89,8 @@ function View({
!isPasswordValid({
isHardwareWallet,
isValid: passphraseField.isValid,
- }),
+ }) ||
+ !!error,
},
];
diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json
index a219ce8f39..1e8322ce0b 100644
--- a/source/renderer/app/i18n/locales/defaultMessages.json
+++ b/source/renderer/app/i18n/locales/defaultMessages.json
@@ -95,6 +95,11 @@
"defaultMessage": "!!!Insufficient funds to support tokens. You need at least an additional {adaAmount} ADA in your wallet to process this transaction.",
"description": "\"Balance after transaction would not leave enough ada in the wallet to support tokens remaining in wallet",
"id": "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens"
+ },
+ {
+ "defaultMessage": "!!!conwayWalletNotDelegatedToDRep",
+ "description": "Error message shown when conway era wallet has staking rewards but has not participated in governance yet.",
+ "id": "api.errors.conwayWalletNotDelegatedToDRep"
}
],
"path": "source/renderer/app/api/errors.ts"
diff --git a/source/renderer/app/i18n/locales/en-US.json b/source/renderer/app/i18n/locales/en-US.json
index 16db52caa1..005021c4b6 100755
--- a/source/renderer/app/i18n/locales/en-US.json
+++ b/source/renderer/app/i18n/locales/en-US.json
@@ -34,6 +34,7 @@
"api.errors.WalletAlreadyImportedError": "Wallet you are trying to import already exists.",
"api.errors.WalletAlreadyRestoredError": "Wallet you are trying to restore already exists.",
"api.errors.WalletFileImportError": "Wallet could not be imported, please make sure you are providing a correct file.",
+ "api.errors.conwayWalletNotDelegatedToDRep": "Daedalus cannot process this transaction because of blocked staking rewards. To unblock your rewards go to the Cardano voting power delegation tab and delegate your voting power",
"api.errors.inputsDepleted": "Your wallet contains only reward funds.
Please send at least 1 ADA to your wallet so that you can spend the funds.",
"api.errors.invalidAddress": "Please enter a valid address.",
"api.errors.invalidSmashServer": "This URL is not a valid SMASH server",
diff --git a/source/renderer/app/i18n/locales/ja-JP.json b/source/renderer/app/i18n/locales/ja-JP.json
index a98f6aa8b0..a51124883a 100755
--- a/source/renderer/app/i18n/locales/ja-JP.json
+++ b/source/renderer/app/i18n/locales/ja-JP.json
@@ -34,6 +34,7 @@
"api.errors.WalletAlreadyImportedError": "インポートしようとしているウォレットは既に存在します。",
"api.errors.WalletAlreadyRestoredError": "復元しようとしているウォレットは既に存在します。",
"api.errors.WalletFileImportError": "ウォレットをインポートできませんでした。有効なファイルを指定していることを確認してください。",
+ "api.errors.conwayWalletNotDelegatedToDRep": "ステーキング報酬がブロックされているため、このトランザクションを処理できません。報酬のブロックを解除するには、Cardano投票権の委任タブに移動し、投票権を委任してください。",
"api.errors.inputsDepleted": "このウォレットには報酬として得られた資金しか入っていません。
資金を使用するには1ADA以上をウォレットに入金してください。",
"api.errors.invalidAddress": "有効なアドレスを入力してください。",
"api.errors.invalidSmashServer": "このURLは有効なSMASHサーバーではありません",
diff --git a/source/renderer/app/stores/WalletsStore.ts b/source/renderer/app/stores/WalletsStore.ts
index 2c29904715..4cb40dfa45 100644
--- a/source/renderer/app/stores/WalletsStore.ts
+++ b/source/renderer/app/stores/WalletsStore.ts
@@ -837,7 +837,12 @@ export default class WalletsStore extends Store {
: null;
const wallet = this.active;
if (!wallet) throw new Error('Active wallet required before sending.');
- // @ts-ignore ts-migrate(1320) FIXME: Type of 'await' operand must either be a valid pro... Remove this comment to see the full error message
+
+ /**
+ * Do not try to catch the request error here, its intended to throw
+ * a localized error created in app/api/api.ts
+ */
+ // @ts-ignore
await this.sendMoneyRequest.execute({
address: receiver,
amount: parseInt(amount, 10),
@@ -847,6 +852,7 @@ export default class WalletsStore extends Store {
assets: formattedAssets,
hasAssetsRemainingAfterTransaction,
});
+ // The following code will not be executed if the request above fails
this.analytics.sendEvent(
EventCategories.WALLETS,
'Transaction made',
diff --git a/storybook/stories/wallets/send/WalletSend.stories.tsx b/storybook/stories/wallets/send/WalletSend.stories.tsx
index 89716a8f01..653fdcf3f1 100644
--- a/storybook/stories/wallets/send/WalletSend.stories.tsx
+++ b/storybook/stories/wallets/send/WalletSend.stories.tsx
@@ -15,11 +15,13 @@ import { NUMBER_OPTIONS } from '../../../../source/renderer/app/config/profileCo
import Wallet, {
HwDeviceStatuses,
} from '../../../../source/renderer/app/domains/Wallet';
+import { messages } from '../../../../source/renderer/app/api/errors';
// Screens
import WalletSendForm from '../../../../source/renderer/app/components/wallet/WalletSendForm';
import type { WalletTokens } from '../../../../source/renderer/app/api/assets/types';
import { WalletSendConfirmationDialogView } from '../../../../source/renderer/app/containers/wallet/dialogs/send-confirmation/SendConfirmation.view';
import { noopAnalyticsTracker as analyticsTracker } from '../../../../source/renderer/app/analytics';
+import LocalizableError from '../../../../source/renderer/app/i18n/LocalizableError';
const allAssets = [
generateAssetToken(
@@ -470,7 +472,11 @@ storiesOf('Wallets / Send', module)
isSubmitting={boolean('isSubmitting', false)}
isHardwareWallet={boolean('isHardwareWallet', false)}
formattedTotalAmount="21.000000"
- error={null}
+ error={
+ new LocalizableError({
+ ...messages.conwayWalletNotDelegatedToDRep,
+ })
+ }
onCancel={action('onCancel')}
onSubmitCb={action('onSubmitCb')}
onTermsCheckboxClick={action('onTermsCheckboxClick')}
diff --git a/translations/messages.json b/translations/messages.json
index a70cb0e594..fa50b46a69 100644
--- a/translations/messages.json
+++ b/translations/messages.json
@@ -95,6 +95,11 @@
"defaultMessage": "!!!Insufficient funds to support tokens. You need at least an additional {adaAmount} ADA in your wallet to process this transaction.",
"description": "\"Balance after transaction would not leave enough ada in the wallet to support tokens remaining in wallet",
"id": "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens"
+ },
+ {
+ "defaultMessage": "!!!conwayWalletNotDelegatedToDRep",
+ "description": "Error message shown when conway era wallet has staking rewards but has not participated in governance yet.",
+ "id": "api.errors.conwayWalletNotDelegatedToDRep"
}
],
"path": "source/renderer/app/api/errors.ts"
From 28670566d385175574110a302ca8ed9c74a1d9d9 Mon Sep 17 00:00:00 2001
From: Dominik Guzei
Date: Wed, 27 Nov 2024 12:31:06 +0100
Subject: [PATCH 25/30] fixup! feat: add final translations [LW-11519]
Signed-off-by: Dominik Guzei
---
...VotingPowerDelegationConfirmationDialog.tsx | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx
index c68e06e313..f46a943d14 100644
--- a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx
+++ b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx
@@ -10,10 +10,9 @@ import Wallet, { HwDeviceStatus } from '../../../domains/Wallet';
import HardwareWalletStatus from '../../hardware-wallet/HardwareWalletStatus';
import styles from './VotingPowerDelegationConfirmationDialog.scss';
import { DelegateVotesError } from '../../../stores/VotingStore';
-import type { Intl } from '../../../types/i18nTypes';
+import type { Intl, ReactIntlMessage } from '../../../types/i18nTypes';
import { messages } from './VotingPowerDelegationConfirmationDialog.messages';
import globalMessages from '../../../i18n/global-messages';
-import { ReactIntlMessageShape } from '../../../i18n/types';
import { VoteType } from './types';
import { sharedGovernanceMessages } from './shared-messages';
@@ -25,10 +24,15 @@ const mapOfTxErrorCodeToIntl: Record<
wrong_encryption_passphrase: globalMessages.invalidSpendingPassword,
};
-const mapVoteToIntlMessage: Record = {
- abstain: sharedGovernanceMessages.abstain,
- no_confidence: sharedGovernanceMessages.noConfidence,
- drep: sharedGovernanceMessages.delegateToDRep,
+const mapVoteToIntlMessage = (vote: VoteType | string): ReactIntlMessage => {
+ switch (vote) {
+ case 'abstain':
+ return sharedGovernanceMessages.abstain;
+ case 'no_confidence':
+ return sharedGovernanceMessages.noConfidence;
+ default:
+ return sharedGovernanceMessages.delegateToDRep;
+ }
};
export type VotingPowerDelegationConfirmationDialogState =
@@ -134,7 +138,7 @@ function VotingPowerDelegationConfirmationDialog({
{intl.formatMessage(messages.vote)}
- {intl.formatMessage(mapVoteToIntlMessage[chosenOption])}
+ {intl.formatMessage(mapVoteToIntlMessage(chosenOption))}
From ba8be718824ddbea95abad91653aeb2937ebcb10 Mon Sep 17 00:00:00 2001
From: Dominik Guzei
Date: Wed, 27 Nov 2024 16:23:40 +0100
Subject: [PATCH 26/30] fixup! feat: add final translations [LW-11519]
Signed-off-by: Dominik Guzei
---
.../VotingPowerDelegation.messages.ts | 12 +++++++++++-
.../voting-governance/VotingPowerDelegation.tsx | 14 +++++++++-----
.../renderer/app/i18n/locales/defaultMessages.json | 12 +++++++++++-
source/renderer/app/i18n/locales/en-US.json | 6 ++++--
source/renderer/app/i18n/locales/ja-JP.json | 6 ++++--
translations/messages.json | 12 +++++++++++-
6 files changed, 50 insertions(+), 12 deletions(-)
diff --git a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.messages.ts b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.messages.ts
index f8066b3983..63a4ada8c9 100644
--- a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.messages.ts
+++ b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.messages.ts
@@ -7,6 +7,11 @@ export const messages = defineMessages({
'!!!Please type or paste a valid DRep ID here. Look up {drepDirectoryLink}',
description: 'Label for DRep input on the governance page',
},
+ drepInputLabelPreprod: {
+ id: 'voting.governance.drepInputLabelPreprod',
+ defaultMessage: '!!!Please type or paste a valid DRep ID here.',
+ description: 'Label for DRep input on the governance page for preprod',
+ },
drepInputLabelLinkText: {
id: 'voting.governance.drepInputLabelLinkText',
defaultMessage: '!!!DRep directory',
@@ -14,7 +19,12 @@ export const messages = defineMessages({
},
drepInputLabelLinkUrl: {
id: 'voting.governance.drepInputLabelLinkUrl',
- defaultMessage: 'https://www.1694.io/en/dreps/list',
+ defaultMessage: 'https://gov.tools/drep_directory',
+ description: 'Label link url for DRep input on the governance page',
+ },
+ drepInputLabelLinkUrlPreview: {
+ id: 'voting.governance.drepInputLabelLinkUrlPreview',
+ defaultMessage: 'https://preview.gov.tools/drep_directory',
description: 'Label link url for DRep input on the governance page',
},
drepInputError: {
diff --git a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.tsx b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.tsx
index d32e4ba3e7..086fd6a574 100644
--- a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.tsx
+++ b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.tsx
@@ -252,16 +252,20 @@ function VotingPowerDelegation({
value={state.drepInputState.value}
label={
onExternalLinkClick(
- intl.formatMessage(messages.drepInputLabelLinkUrl),
+ intl.formatMessage(
+ environment.isMainnet
+ ? messages.drepInputLabelLinkUrl
+ : messages.drepInputLabelLinkUrlPreview
+ ),
event
)
}
diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json
index 1e8322ce0b..a631f8f3be 100644
--- a/source/renderer/app/i18n/locales/defaultMessages.json
+++ b/source/renderer/app/i18n/locales/defaultMessages.json
@@ -4411,16 +4411,26 @@
"description": "Label for DRep input on the governance page",
"id": "voting.governance.drepInputLabel"
},
+ {
+ "defaultMessage": "!!!Please type or paste a valid DRep ID here.",
+ "description": "Label for DRep input on the governance page for preprod",
+ "id": "voting.governance.drepInputLabelPreprod"
+ },
{
"defaultMessage": "!!!DRep directory",
"description": "Label link text for DRep input on the governance page",
"id": "voting.governance.drepInputLabelLinkText"
},
{
- "defaultMessage": "https://www.1694.io/en/dreps/list",
+ "defaultMessage": "https://gov.tools/drep_directory",
"description": "Label link url for DRep input on the governance page",
"id": "voting.governance.drepInputLabelLinkUrl"
},
+ {
+ "defaultMessage": "https://preview.gov.tools/drep_directory",
+ "description": "Label link url for DRep input on the governance page",
+ "id": "voting.governance.drepInputLabelLinkUrlPreview"
+ },
{
"defaultMessage": "!!!Invalid DRep ID",
"description": "Error for DRep input on the governance page",
diff --git a/source/renderer/app/i18n/locales/en-US.json b/source/renderer/app/i18n/locales/en-US.json
index 005021c4b6..86ed0cbd24 100755
--- a/source/renderer/app/i18n/locales/en-US.json
+++ b/source/renderer/app/i18n/locales/en-US.json
@@ -731,7 +731,9 @@
"voting.governance.drepInputError": "Invalid DRep ID",
"voting.governance.drepInputLabel": "Please type or paste a valid DRep ID here. Look up {drepDirectoryLink}",
"voting.governance.drepInputLabelLinkText": "DRep directory",
- "voting.governance.drepInputLabelLinkUrl": "https://www.1694.io/en/dreps/list",
+ "voting.governance.drepInputLabelLinkUrl": "https://gov.tools/drep_directory",
+ "voting.governance.drepInputLabelLinkUrlPreview": "https://preview.gov.tools/drep_directory",
+ "voting.governance.drepInputLabelPreprod": "Please type or paste a valid DRep ID here.",
"voting.governance.drepInputPlaceholder": "Paste DRep ID here …",
"voting.governance.heading": "CARDANO VOTING POWER DELEGATION",
"voting.governance.initializeTxError.generic": "Something went wrong during transaction initialization. Please try again in a few minutes. ",
@@ -1376,4 +1378,4 @@
"wallet.transferFunds.dialog2.total.label": "Total",
"widgets.itemsDropdown.syncingLabel": "Syncing",
"widgets.itemsDropdown.syncingLabelProgress": "Syncing {syncingProgress}%"
-}
\ No newline at end of file
+}
diff --git a/source/renderer/app/i18n/locales/ja-JP.json b/source/renderer/app/i18n/locales/ja-JP.json
index a51124883a..466abca05d 100755
--- a/source/renderer/app/i18n/locales/ja-JP.json
+++ b/source/renderer/app/i18n/locales/ja-JP.json
@@ -731,7 +731,9 @@
"voting.governance.drepInputError": "無効なDRep IDです",
"voting.governance.drepInputLabel": "有効なDRep IDを入力するか貼り付けます。{drepDirectoryLink}で検索する",
"voting.governance.drepInputLabelLinkText": "DRepディレクトリ",
- "voting.governance.drepInputLabelLinkUrl": "https://www.1694.io/en/dreps/list",
+ "voting.governance.drepInputLabelLinkUrl": "https://gov.tools/drep_directory",
+ "voting.governance.drepInputLabelLinkUrlPreview": "https://preview.gov.tools/drep_directory",
+ "voting.governance.drepInputLabelPreprod": "有効なDRep IDを入力するか貼り付けます。",
"voting.governance.drepInputPlaceholder": "DRep IDを追加してください",
"voting.governance.heading": "Cardano投票権の委任",
"voting.governance.initializeTxError.generic": "トランザクションの初期化中に問題が発生しました。しばらくしてからもう一度お試しください。",
@@ -1376,4 +1378,4 @@
"wallet.transferFunds.dialog2.total.label": "合計",
"widgets.itemsDropdown.syncingLabel": "同期",
"widgets.itemsDropdown.syncingLabelProgress": "同期中 {syncingProgress}%"
-}
\ No newline at end of file
+}
diff --git a/translations/messages.json b/translations/messages.json
index fa50b46a69..f1c7ea1bdf 100644
--- a/translations/messages.json
+++ b/translations/messages.json
@@ -4411,16 +4411,26 @@
"description": "Label for DRep input on the governance page",
"id": "voting.governance.drepInputLabel"
},
+ {
+ "defaultMessage": "!!!Please type or paste a valid DRep ID here.",
+ "description": "Label for DRep input on the governance page for preprod",
+ "id": "voting.governance.drepInputLabelPreprod"
+ },
{
"defaultMessage": "!!!DRep directory",
"description": "Label link text for DRep input on the governance page",
"id": "voting.governance.drepInputLabelLinkText"
},
{
- "defaultMessage": "https://www.1694.io/en/dreps/list",
+ "defaultMessage": "https://gov.tools/drep_directory",
"description": "Label link url for DRep input on the governance page",
"id": "voting.governance.drepInputLabelLinkUrl"
},
+ {
+ "defaultMessage": "https://preview.gov.tools/drep_directory",
+ "description": "Label link url for DRep input on the governance page",
+ "id": "voting.governance.drepInputLabelLinkUrlPreview"
+ },
{
"defaultMessage": "!!!Invalid DRep ID",
"description": "Error for DRep input on the governance page",
From 10c01b185ba6ba1f07e929f9dda0a9abd56bc4e8 Mon Sep 17 00:00:00 2001
From: Dominik Guzei
Date: Wed, 27 Nov 2024 16:26:19 +0100
Subject: [PATCH 27/30] fixup! feat: add final translations [LW-11519]
Signed-off-by: Dominik Guzei
---
source/renderer/app/i18n/locales/en-US.json | 2 +-
source/renderer/app/i18n/locales/ja-JP.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/source/renderer/app/i18n/locales/en-US.json b/source/renderer/app/i18n/locales/en-US.json
index 86ed0cbd24..331d8d88fe 100755
--- a/source/renderer/app/i18n/locales/en-US.json
+++ b/source/renderer/app/i18n/locales/en-US.json
@@ -1378,4 +1378,4 @@
"wallet.transferFunds.dialog2.total.label": "Total",
"widgets.itemsDropdown.syncingLabel": "Syncing",
"widgets.itemsDropdown.syncingLabelProgress": "Syncing {syncingProgress}%"
-}
+}
\ No newline at end of file
diff --git a/source/renderer/app/i18n/locales/ja-JP.json b/source/renderer/app/i18n/locales/ja-JP.json
index 466abca05d..7fe92b08a8 100755
--- a/source/renderer/app/i18n/locales/ja-JP.json
+++ b/source/renderer/app/i18n/locales/ja-JP.json
@@ -1378,4 +1378,4 @@
"wallet.transferFunds.dialog2.total.label": "合計",
"widgets.itemsDropdown.syncingLabel": "同期",
"widgets.itemsDropdown.syncingLabelProgress": "同期中 {syncingProgress}%"
-}
+}
\ No newline at end of file
From b4cdb15ef278896af712bd960917483194d35f35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Szymon=20Mas=C5=82owski?=
Date: Wed, 27 Nov 2024 16:27:08 +0100
Subject: [PATCH 28/30] feat: add HW support for VP delegation (#3243)
* feat: add ledger support for VP delegation
* feat: add trezor support for VP delegation
---
source/renderer/app/api/api.ts | 2 +
source/renderer/app/api/transactions/types.ts | 4 +-
.../VotingPowerDelegation.tsx | 23 +--
...otingPowerDelegationConfirmationDialog.tsx | 30 ++--
.../app/stores/HardwareWalletsStore.ts | 2 +
source/renderer/app/stores/VotingStore.ts | 139 ++++++++++++++++--
.../renderer/app/utils/dataSerialization.ts | 21 ++-
.../renderer/app/utils/hardwareWalletUtils.ts | 1 +
source/renderer/app/utils/shelleyLedger.ts | 54 +++++--
source/renderer/app/utils/shelleyTrezor.ts | 38 +++++
10 files changed, 270 insertions(+), 44 deletions(-)
diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts
index d533febfe9..145750657d 100644
--- a/source/renderer/app/api/api.ts
+++ b/source/renderer/app/api/api.ts
@@ -1275,11 +1275,13 @@ export default class AdaApi {
try {
const {
+ transaction,
coin_selection,
fee: { quantity },
} = await constructTransaction(this.config, params);
const result = {
+ transaction,
coinSelection: parseCoinSelectionResponse({
coinSelectionResponse: coin_selection,
}),
diff --git a/source/renderer/app/api/transactions/types.ts b/source/renderer/app/api/transactions/types.ts
index 5b28bda693..5ec16decc8 100644
--- a/source/renderer/app/api/transactions/types.ts
+++ b/source/renderer/app/api/transactions/types.ts
@@ -196,11 +196,13 @@ export type CoinSelectionOutput = {
export type CertificateType =
| 'register_reward_account'
| 'quit_pool'
- | 'join_pool';
+ | 'join_pool'
+ | 'cast_vote';
export type CoinSelectionCertificate = {
pool: string;
certificateType: CertificateType;
rewardAccountPath: Array;
+ vote?: string;
};
export type CoinSelectionCertificates = Array;
export type CoinSelectionWithdrawal = {
diff --git a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.tsx b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.tsx
index 086fd6a574..1fc0a07ea3 100644
--- a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.tsx
+++ b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.tsx
@@ -92,6 +92,16 @@ const mapOfTxErrorCodeToIntl: Record<
not_enough_money: messages.initializeNotEnoughMoney,
};
+const initialState: State = {
+ status: 'form',
+ selectedWallet: null,
+ selectedVoteType: 'drep',
+ drepInputState: {
+ dirty: false,
+ value: '',
+ },
+};
+
function VotingPowerDelegation({
getStakePoolById,
initiateTransaction,
@@ -101,15 +111,7 @@ function VotingPowerDelegation({
wallets,
stakePools,
}: Props) {
- const [state, setState] = useState({
- status: 'form',
- selectedWallet: null,
- selectedVoteType: 'drep',
- drepInputState: {
- dirty: false,
- value: '',
- },
- });
+ const [state, setState] = useState(initialState);
const drepInputIsValid = isDrepIdValid(state.drepInputState.value);
@@ -209,9 +211,8 @@ function VotingPowerDelegation({
onChange={(walletId: string) => {
const selectedWallet = wallets.find((w) => w.id === walletId);
setState({
- ...state,
+ ...initialState,
selectedWallet,
- status: 'form',
});
}}
placeholder={intl.formatMessage(messages.selectWalletPlaceholder)}
diff --git a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx
index f46a943d14..99816318cf 100644
--- a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx
+++ b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx
@@ -4,15 +4,18 @@ import { injectIntl } from 'react-intl';
import { Input } from 'react-polymorph/lib/components/Input';
import { InputSkin } from 'react-polymorph/lib/skins/simple/InputSkin';
import Dialog from '../../widgets/Dialog';
-import DialogCloseButton from '../../widgets/DialogCloseButton';
import { formattedWalletAmount } from '../../../utils/formatters';
-import Wallet, { HwDeviceStatus } from '../../../domains/Wallet';
+import Wallet, {
+ HwDeviceStatus,
+ HwDeviceStatuses,
+} from '../../../domains/Wallet';
import HardwareWalletStatus from '../../hardware-wallet/HardwareWalletStatus';
import styles from './VotingPowerDelegationConfirmationDialog.scss';
import { DelegateVotesError } from '../../../stores/VotingStore';
import type { Intl, ReactIntlMessage } from '../../../types/i18nTypes';
import { messages } from './VotingPowerDelegationConfirmationDialog.messages';
import globalMessages from '../../../i18n/global-messages';
+import LoadingSpinner from '../../widgets/LoadingSpinner';
import { VoteType } from './types';
import { sharedGovernanceMessages } from './shared-messages';
@@ -108,6 +111,13 @@ function VotingPowerDelegationConfirmationDialog({
})();
}, [intl, onSubmit, redirectToWallet, state]);
+ const confirmButtonLabel =
+ state.status === 'awaiting' ? (
+ intl.formatMessage(messages.buttonConfirm)
+ ) : (
+
+ );
+
return (