From 4ad3c05457d40e069c2a9363de8ba61c4741decd Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Fri, 10 Dec 2021 13:28:30 +0000 Subject: [PATCH 01/42] [DDW-827] show helpful message --- source/renderer/app/api/api.js | 17 +++++++++++++++++ source/renderer/app/api/errors.js | 7 +++++++ source/renderer/app/api/transactions/types.js | 1 + .../WalletSendAssetsConfirmationDialog.js | 5 ++++- .../send-form/WalletSendConfirmationDialog.js | 6 +++++- .../app/i18n/locales/defaultMessages.json | 14 ++++++++++++++ source/renderer/app/i18n/locales/en-US.json | 1 + source/renderer/app/i18n/locales/ja-JP.json | 1 + source/renderer/app/stores/WalletsStore.js | 3 +++ 9 files changed, 53 insertions(+), 2 deletions(-) diff --git a/source/renderer/app/api/api.js b/source/renderer/app/api/api.js index 6f59b7259f..a1c2de3c57 100644 --- a/source/renderer/app/api/api.js +++ b/source/renderer/app/api/api.js @@ -799,6 +799,7 @@ export default class AdaApi { isLegacy, assets, withdrawal = TransactionWithdrawal, + hasAssetsRemainingAfterTransaction, } = request; try { @@ -836,6 +837,22 @@ export default class AdaApi { return _createTransactionFromServerData(response); } catch (error) { logger.error('AdaApi::createTransaction error', { error }); + const adaToProceedRegex = /(?:.*I need approximately (.*) ada to proceed.*)/; + if ( + error.code === 'cannot_cover_fee' && + hasAssetsRemainingAfterTransaction && + adaToProceedRegex.test(error.message) + ) { + const adaToRemain = Math.ceil( + Number(error.message.replace(adaToProceedRegex, '$1')) + ); + throw new ApiError() + .set('cannotLeaveWalletEmpty', true, { + adaToRemain, + }) + .result(); + } + throw new ApiError(error) .set('wrongEncryptionPassphrase') .where('code', 'bad_request') diff --git a/source/renderer/app/api/errors.js b/source/renderer/app/api/errors.js index 3e69f10af8..47e4e2113e 100644 --- a/source/renderer/app/api/errors.js +++ b/source/renderer/app/api/errors.js @@ -111,4 +111,11 @@ export const messages = defineMessages({ defaultMessage: '!!!This URL is not a valid SMASH server', description: '"This URL is not a valid SMASH server" error message', }, + cannotLeaveWalletEmpty: { + id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', + defaultMessage: + '!!!Balance after transaction would not be enough to support tokens in wallet. A minimum of {adaToRemain} ADA must remain.', + description: + '"Balance after transaction would not be enough to support tokens', + }, }); diff --git a/source/renderer/app/api/transactions/types.js b/source/renderer/app/api/transactions/types.js index bc5c8253ed..74cbc8236e 100644 --- a/source/renderer/app/api/transactions/types.js +++ b/source/renderer/app/api/transactions/types.js @@ -136,6 +136,7 @@ export type CreateTransactionRequest = { isLegacy: boolean, assets?: ApiTokens, withdrawal?: 'self' | Array, + hasAssetsRemainingAfterTransaction?: boolean, }; export type DeleteTransactionRequest = { diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js index 27a0ea97ed..8ead4610d8 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js @@ -141,6 +141,8 @@ export default class WalletSendAssetsConfirmationDialog extends Component< isHardwareWallet, } = this.props; const { passphrase } = form.values(); + const hasAssetsRemainingAfterTransaction = + this.props.allAvailableTokens.length - selectedAssets.length > 0; const transactionData = { receiver, amount: amountToNaturalUnits(amount), @@ -148,6 +150,7 @@ export default class WalletSendAssetsConfirmationDialog extends Component< isHardwareWallet, assets: selectedAssets, assetsAmounts, + hasAssetsRemainingAfterTransaction, }; this.props.onSubmit(transactionData); }, @@ -287,7 +290,7 @@ export default class WalletSendAssetsConfirmationDialog extends Component< onExternalLinkClick={onExternalLinkClick} /> ) : ( - intl.formatMessage(error) + ); } const { name } = wallet; diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js index f2d5474d22..10a0b653fc 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js @@ -115,11 +115,15 @@ export default class WalletSendConfirmationDialog extends Component< isHardwareWallet, } = this.props; const { passphrase } = form.values(); + const hasAssetsRemainingAfterTransaction = + this.props.allAvailableTokens?.length && + this.props.allAvailableTokens.length > 0; const transactionData = { receiver, amount: amountToNaturalUnits(amount), passphrase, isHardwareWallet, + hasAssetsRemainingAfterTransaction, }; this.props.onSubmit(transactionData); }, @@ -235,7 +239,7 @@ export default class WalletSendConfirmationDialog extends Component< onExternalLinkClick={onExternalLinkClick} /> ) : ( - intl.formatMessage(error) + ); } diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index 6e65f4d665..f19626e7e4 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -285,6 +285,20 @@ "column": 22, "line": 109 } + }, + { + "defaultMessage": "!!!Balance after transaction would not be enough to support tokens in wallet. A minimum of {adaToRemain} ADA must remain.", + "description": "\"Balance after transaction would not be enough to support tokens", + "end": { + "column": 3, + "line": 120 + }, + "file": "source/renderer/app/api/errors.js", + "id": "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens", + "start": { + "column": 26, + "line": 114 + } } ], "path": "source/renderer/app/api/errors.json" diff --git a/source/renderer/app/i18n/locales/en-US.json b/source/renderer/app/i18n/locales/en-US.json index 2bf0b52a32..ca55e8f593 100755 --- a/source/renderer/app/i18n/locales/en-US.json +++ b/source/renderer/app/i18n/locales/en-US.json @@ -6,6 +6,7 @@ "api.errors.IncorrectPasswordError": "Incorrect wallet password.", "api.errors.NotEnoughFundsForTransactionError": "Not enough ada. Try sending a smaller amount.", "api.errors.NotEnoughFundsForTransactionFeesError": "Not enough ada for fees. Try sending a smaller amount.", + "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens": "!!!Balance after transaction would not be enough to support tokens in wallet. A minimum of {adaToRemain} ADA must remain.", "api.errors.NotEnoughMoneyToSendError": "Not enough money to make this transaction.", "api.errors.TooBigTransactionError": "Transaction too big due to too many inputs.", "api.errors.TooBigTransactionErrorLinkLabel": "Learn more.", diff --git a/source/renderer/app/i18n/locales/ja-JP.json b/source/renderer/app/i18n/locales/ja-JP.json index a3bec5313e..4d80da3729 100755 --- a/source/renderer/app/i18n/locales/ja-JP.json +++ b/source/renderer/app/i18n/locales/ja-JP.json @@ -6,6 +6,7 @@ "api.errors.IncorrectPasswordError": "ウォレットパスワードが間違っています", "api.errors.NotEnoughFundsForTransactionError": "ADAが不足しています。送金額を減らしてください。", "api.errors.NotEnoughFundsForTransactionFeesError": "手数料分のADAが不足しています。送金額を減らしてください。", + "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens": "!!!Balance after transaction would not be enough to support tokens in wallet. A minimum of {adaToRemain} ADA must remain.", "api.errors.NotEnoughMoneyToSendError": "このトランザクションに必要な資金が不足しています。", "api.errors.TooBigTransactionError": "入力過多によりトランザクションサイズが超過しています。", "api.errors.TooBigTransactionErrorLinkLabel": "もっと知る。", diff --git a/source/renderer/app/stores/WalletsStore.js b/source/renderer/app/stores/WalletsStore.js index 4bc9db31f6..18880a308e 100644 --- a/source/renderer/app/stores/WalletsStore.js +++ b/source/renderer/app/stores/WalletsStore.js @@ -717,12 +717,14 @@ export default class WalletsStore extends Store { passphrase, assets, assetsAmounts: assetsAmountsStr, + hasAssetsRemainingAfterTransaction, }: { receiver: string, amount: string, passphrase: string, assets?: Array, assetsAmounts?: Array, + hasAssetsRemainingAfterTransaction?: boolean, }) => { const assetsAmounts = assetsAmountsStr ? assetsAmountsStr.map((assetAmount) => new BigNumber(assetAmount)) @@ -748,6 +750,7 @@ export default class WalletsStore extends Store { walletId: wallet.id, isLegacy: wallet.isLegacy, assets: formattedAssets, + hasAssetsRemainingAfterTransaction, }); this.refreshWalletsData(); this.actions.dialogs.closeActiveDialog.trigger(); From 160e7c011eaeba0e472ba5af166a50e18ad07e13 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Tue, 18 Jan 2022 14:01:43 +0000 Subject: [PATCH 02/42] [DDW-827] updated error message and translations --- source/renderer/app/api/errors.js | 4 ++-- source/renderer/app/i18n/locales/defaultMessages.json | 4 ++-- source/renderer/app/i18n/locales/en-US.json | 2 +- source/renderer/app/i18n/locales/ja-JP.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/renderer/app/api/errors.js b/source/renderer/app/api/errors.js index 47e4e2113e..9f0eee4578 100644 --- a/source/renderer/app/api/errors.js +++ b/source/renderer/app/api/errors.js @@ -114,8 +114,8 @@ export const messages = defineMessages({ cannotLeaveWalletEmpty: { id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', defaultMessage: - '!!!Balance after transaction would not be enough to support tokens in wallet. A minimum of {adaToRemain} ADA must remain.', + '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', description: - '"Balance after transaction would not be enough to support tokens', + '"Balance after transaction would not leave enough ada in the wallet to support tokens remaining in wallet', }, }); diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index 68bcb2fad2..4e950744c7 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -287,8 +287,8 @@ } }, { - "defaultMessage": "!!!Balance after transaction would not be enough to support tokens in wallet. A minimum of {adaToRemain} ADA must remain.", - "description": "\"Balance after transaction would not be enough to support tokens", + "defaultMessage": "!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.", + "description": "\"Balance after transaction would not leave enough ada in the wallet to support tokens remaining in wallet", "end": { "column": 3, "line": 120 diff --git a/source/renderer/app/i18n/locales/en-US.json b/source/renderer/app/i18n/locales/en-US.json index c8a2dded6d..7769c5d0cd 100755 --- a/source/renderer/app/i18n/locales/en-US.json +++ b/source/renderer/app/i18n/locales/en-US.json @@ -6,7 +6,7 @@ "api.errors.IncorrectPasswordError": "Incorrect wallet password.", "api.errors.NotEnoughFundsForTransactionError": "Not enough ada. Try sending a smaller amount.", "api.errors.NotEnoughFundsForTransactionFeesError": "Not enough ada for fees. Try sending a smaller amount.", - "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens": "!!!Balance after transaction would not be enough to support tokens in wallet. A minimum of {adaToRemain} ADA must remain.", + "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens": "Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.", "api.errors.NotEnoughMoneyToSendError": "Not enough money to make this transaction.", "api.errors.TooBigTransactionError": "Transaction too big due to too many inputs.", "api.errors.TooBigTransactionErrorLinkLabel": "Learn more.", diff --git a/source/renderer/app/i18n/locales/ja-JP.json b/source/renderer/app/i18n/locales/ja-JP.json index 2f5fb2544e..c78872a9e7 100755 --- a/source/renderer/app/i18n/locales/ja-JP.json +++ b/source/renderer/app/i18n/locales/ja-JP.json @@ -6,7 +6,7 @@ "api.errors.IncorrectPasswordError": "ウォレットパスワードが間違っています", "api.errors.NotEnoughFundsForTransactionError": "ADAが不足しています。送金額を減らしてください。", "api.errors.NotEnoughFundsForTransactionFeesError": "手数料分のADAが不足しています。送金額を減らしてください。", - "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens": "!!!Balance after transaction would not be enough to support tokens in wallet. A minimum of {adaToRemain} ADA must remain.", + "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens": "トークンをサポートする資金が不足しています。このトランザクションの後に、ウォレットに{adaToRemain} ADA以上残るようにしてください。", "api.errors.NotEnoughMoneyToSendError": "このトランザクションに必要な資金が不足しています。", "api.errors.TooBigTransactionError": "入力過多によりトランザクションサイズが超過しています。", "api.errors.TooBigTransactionErrorLinkLabel": "もっと知る。", From 56af6df4c83cc957e0e277f53036bb27b04862fa Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Tue, 18 Jan 2022 14:46:22 +0000 Subject: [PATCH 03/42] [DDW-827] fixed flow types for sendMoney --- source/renderer/app/actions/wallets-actions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/source/renderer/app/actions/wallets-actions.js b/source/renderer/app/actions/wallets-actions.js index 0a5050fa6a..cc60f6f164 100644 --- a/source/renderer/app/actions/wallets-actions.js +++ b/source/renderer/app/actions/wallets-actions.js @@ -57,6 +57,7 @@ export default class WalletsActions { passphrase: string, assets?: Array, assetsAmounts?: Array, + hasAssetsRemainingAfterTransaction?: boolean, }> = new Action(); chooseWalletExportType: Action<{ walletExportType: WalletExportTypeChoices, From 2b253a32d3e4a2f04219087a1da746ecdd6d6288 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Tue, 18 Jan 2022 14:49:56 +0000 Subject: [PATCH 04/42] [DDW-827] updated CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f49216e1df..c5ab767804 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## vNext +### Features + +- Implemented error message when trying to leave wallet without enough ada to support tokens ([PR 2783](https://github.com/input-output-hk/daedalus/pull/2783)) + ### Fixes - Fixed immediate language updates of application top menu bar ([PR 2813](https://github.com/input-output-hk/daedalus/pull/2813)) From 55c079a2eb194c52db56daccc8f6d6c583ec4664 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 24 Jan 2022 19:08:54 +0000 Subject: [PATCH 05/42] [DDW-827] Addressed PR comments --- source/renderer/app/api/api.js | 2 +- .../wallet/send-form/WalletSendAssetsConfirmationDialog.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/renderer/app/api/api.js b/source/renderer/app/api/api.js index 3f91299cba..93064ce659 100644 --- a/source/renderer/app/api/api.js +++ b/source/renderer/app/api/api.js @@ -838,7 +838,7 @@ export default class AdaApi { return _createTransactionFromServerData(response); } catch (error) { logger.error('AdaApi::createTransaction error', { error }); - const adaToProceedRegex = /(?:.*I need approximately (.*) ada to proceed.*)/; + const adaToProceedRegex = /I need approximately([\s\d\.,]+)ada to proceed/; if ( error.code === 'cannot_cover_fee' && hasAssetsRemainingAfterTransaction && diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js index 8ead4610d8..95bdcbc586 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js @@ -142,7 +142,7 @@ export default class WalletSendAssetsConfirmationDialog extends Component< } = this.props; const { passphrase } = form.values(); const hasAssetsRemainingAfterTransaction = - this.props.allAvailableTokens.length - selectedAssets.length > 0; + this.props.allAvailableTokens?.length > 0; const transactionData = { receiver, amount: amountToNaturalUnits(amount), From 93dd0e2d174c83287ccc4b19b352aa08cbd992d0 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 24 Jan 2022 21:44:56 +0000 Subject: [PATCH 06/42] [DDW-827] updated regex --- source/renderer/app/api/api.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/renderer/app/api/api.js b/source/renderer/app/api/api.js index 93064ce659..887bae0fb6 100644 --- a/source/renderer/app/api/api.js +++ b/source/renderer/app/api/api.js @@ -838,7 +838,9 @@ export default class AdaApi { return _createTransactionFromServerData(response); } catch (error) { logger.error('AdaApi::createTransaction error', { error }); - const adaToProceedRegex = /I need approximately([\s\d\.,]+)ada to proceed/; + const adaToProceedRegex = new RegExp( + /I need approximately([\s\d.,]+)ada to proceed/ + ); if ( error.code === 'cannot_cover_fee' && hasAssetsRemainingAfterTransaction && From 0f84bcce51424a6b60e0f460581ce1e54f2ac3a1 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Tue, 25 Jan 2022 15:55:05 +0000 Subject: [PATCH 07/42] [DDW-827] updated regex and moved to testable helper method with test cases --- source/renderer/app/api/api.js | 20 ++---- source/renderer/app/api/utils/apiHelpers.js | 24 ++++++++ .../renderer/app/api/utils/apiHelpers.spec.js | 61 +++++++++++++++++++ 3 files changed, 89 insertions(+), 16 deletions(-) create mode 100644 source/renderer/app/api/utils/apiHelpers.spec.js diff --git a/source/renderer/app/api/api.js b/source/renderer/app/api/api.js index 887bae0fb6..105c48748f 100644 --- a/source/renderer/app/api/api.js +++ b/source/renderer/app/api/api.js @@ -245,6 +245,7 @@ import type { AssetLocalData } from './utils/localStorage'; import Asset from '../domains/Asset'; import { getAssets } from './assets/requests/getAssets'; import { getAccountPublicKey } from './wallets/requests/getAccountPublicKey'; +import { throwErrorIfNotEnoughAdaToSupportTokens } from './utils/apiHelpers'; export default class AdaApi { config: RequestConfig; @@ -838,23 +839,10 @@ export default class AdaApi { return _createTransactionFromServerData(response); } catch (error) { logger.error('AdaApi::createTransaction error', { error }); - const adaToProceedRegex = new RegExp( - /I need approximately([\s\d.,]+)ada to proceed/ + throwErrorIfNotEnoughAdaToSupportTokens( + error, + hasAssetsRemainingAfterTransaction ); - if ( - error.code === 'cannot_cover_fee' && - hasAssetsRemainingAfterTransaction && - adaToProceedRegex.test(error.message) - ) { - const adaToRemain = Math.ceil( - Number(error.message.replace(adaToProceedRegex, '$1')) - ); - throw new ApiError() - .set('cannotLeaveWalletEmpty', true, { - adaToRemain, - }) - .result(); - } throw new ApiError(error) .set('wrongEncryptionPassphrase') diff --git a/source/renderer/app/api/utils/apiHelpers.js b/source/renderer/app/api/utils/apiHelpers.js index 5c2ef68a98..5767742dba 100644 --- a/source/renderer/app/api/utils/apiHelpers.js +++ b/source/renderer/app/api/utils/apiHelpers.js @@ -1,5 +1,6 @@ // @flow import { ApiMethodNotYetImplementedError } from '../common/errors'; +import ApiError from '../../domains/ApiError'; export const notYetImplemented = async () => new Promise((resolve, reject) => { @@ -25,3 +26,26 @@ export const testSync = (apiMethod: Function) => { // helper code for deferring API call execution export const wait = (ms: number): Promise => new Promise((resolve) => setTimeout(resolve, ms)); + +export const throwErrorIfNotEnoughAdaToSupportTokens = ( + error: any, + hasAssetsRemainingAfterTransaction: boolean +) => { + const adaToProceedRegex = new RegExp( + /.*I need approximately([\s\d.,]+)ada to proceed.*/ + ); + if ( + error.code === 'cannot_cover_fee' && + hasAssetsRemainingAfterTransaction && + adaToProceedRegex.test(error.message) + ) { + const adaToRemain = Math.ceil( + Number(error.message.replace(adaToProceedRegex, '$1')) + ); + throw new ApiError() + .set('cannotLeaveWalletEmpty', true, { + adaToRemain, + }) + .result(); + } +}; diff --git a/source/renderer/app/api/utils/apiHelpers.spec.js b/source/renderer/app/api/utils/apiHelpers.spec.js new file mode 100644 index 0000000000..868a6c19cb --- /dev/null +++ b/source/renderer/app/api/utils/apiHelpers.spec.js @@ -0,0 +1,61 @@ +import { throwErrorIfNotEnoughAdaToSupportTokens } from './apiHelpers'; + +describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { + it('should not throw if error.code is not "cannot_cover_fee"', () => { + const error = new Error(); + error.code = 'other_error'; + expect(() => + throwErrorIfNotEnoughAdaToSupportTokens(error, true) + ).not.toThrow(); + }); + + it('should not throw error if error code is "cannot_cover_fee" but message does not match reegex', () => { + const error = new Error('other message'); + error.code = 'cannot_cover_fee'; + expect(() => + throwErrorIfNotEnoughAdaToSupportTokens(error, true) + ).not.toThrow(); + }); + + it('should not throw error if error code is not "cannot_cover_fee" and message matches regex', () => { + const error = new Error( + 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' + ); + error.code = 'other_code'; + expect(() => + throwErrorIfNotEnoughAdaToSupportTokens(error, true) + ).not.toThrow(); + }); + + it('should not throw if there are no tokens remaining in wallet after transaction', () => { + const error = new Error(); + error.code = 'cannot_cover_fee'; + expect(() => + throwErrorIfNotEnoughAdaToSupportTokens(error, false) + ).not.toThrow(); + }); + + it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee"', () => { + const error = new Error( + 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.' + ); + error.code = 'cannot_cover_fee'; + + expect(() => + throwErrorIfNotEnoughAdaToSupportTokens(error, true) + ).toThrowError( + new Error({ + additionalValues: { adaToRemain: 1 }, + clause: true, + code: undefined, + defaultMessage: + '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', + forceSet: true, + id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', + isFinalError: false, + tempError: 'cannotLeaveWalletEmpty', + values: { adaToRemain: 1 }, + }) + ); + }); +}); From c9ddad94f2efee087acde31cc3bb93391fd82187 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Thu, 27 Jan 2022 11:33:13 +0000 Subject: [PATCH 08/42] [DDW-827] prevent resubmission in the case of error --- .../wallet/send-form/WalletSendAssetsConfirmationDialog.js | 1 + .../components/wallet/send-form/WalletSendConfirmationDialog.js | 1 + 2 files changed, 2 insertions(+) diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js index 95bdcbc586..97c7fe185d 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js @@ -268,6 +268,7 @@ export default class WalletSendAssetsConfirmationDialog extends Component< primary: true, className: 'confirmButton', disabled: + !!error || (!isHardwareWallet && !passphraseField.isValid) || (isHardwareWallet && hwDeviceStatus !== diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js index 10a0b653fc..4c17efed80 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js @@ -222,6 +222,7 @@ export default class WalletSendConfirmationDialog extends Component< primary: true, className: 'confirmButton', disabled: + !!error || (!isHardwareWallet && !passphraseField.isValid) || (isHardwareWallet && hwDeviceStatus !== From e7bad15b92e7357c15d922fcc27c00f926b4cb9d Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Thu, 27 Jan 2022 12:44:09 +0000 Subject: [PATCH 09/42] [DDW-827] updated unit test and type for helper --- source/renderer/app/api/utils/apiHelpers.js | 2 +- source/renderer/app/api/utils/apiHelpers.spec.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/source/renderer/app/api/utils/apiHelpers.js b/source/renderer/app/api/utils/apiHelpers.js index 5767742dba..27aa604bb5 100644 --- a/source/renderer/app/api/utils/apiHelpers.js +++ b/source/renderer/app/api/utils/apiHelpers.js @@ -29,7 +29,7 @@ export const wait = (ms: number): Promise => export const throwErrorIfNotEnoughAdaToSupportTokens = ( error: any, - hasAssetsRemainingAfterTransaction: boolean + hasAssetsRemainingAfterTransaction?: boolean ) => { const adaToProceedRegex = new RegExp( /.*I need approximately([\s\d.,]+)ada to proceed.*/ diff --git a/source/renderer/app/api/utils/apiHelpers.spec.js b/source/renderer/app/api/utils/apiHelpers.spec.js index 868a6c19cb..f3fc1a907f 100644 --- a/source/renderer/app/api/utils/apiHelpers.spec.js +++ b/source/renderer/app/api/utils/apiHelpers.spec.js @@ -9,6 +9,14 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { ).not.toThrow(); }); + it('should not throw error if error code is "cannot_cover_fee" but hasAssetsRemainingAfterTransaction is undefined', () => { + const error = new Error( + 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' + ); + error.code = 'cannot_cover_fee'; + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error)).not.toThrow(); + }); + it('should not throw error if error code is "cannot_cover_fee" but message does not match reegex', () => { const error = new Error('other message'); error.code = 'cannot_cover_fee'; From 5ed7eb0396e9c1b49462fed7e41ff97f7515b9bb Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:33:34 +0000 Subject: [PATCH 10/42] [DDW-827] temporarily removed husky pre-commit --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 57802061c4..4480742afe 100644 --- a/package.json +++ b/package.json @@ -267,7 +267,6 @@ }, "husky": { "hooks": { - "pre-commit": "pretty-quick --staged", "pre-push": "yarn check:all" } }, From e3d8ad163381b2850f1d899f11d6ee091b87885b Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:34:45 +0000 Subject: [PATCH 11/42] [DDW-827] installed ts packages, and packages required for migration --- package.json | 13 + yarn.lock | 1584 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 1580 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 4480742afe..3dcc7f8cc4 100644 --- a/package.json +++ b/package.json @@ -76,10 +76,12 @@ "@babel/plugin-proposal-decorators": "7.16.4", "@babel/plugin-proposal-object-rest-spread": "7.2.0", "@babel/plugin-transform-runtime": "7.2.0", + "@babel/plugin-transform-typescript": "^7.16.8", "@babel/polyfill": "7.0.0", "@babel/preset-env": "7.16.4", "@babel/preset-flow": "7.16.0", "@babel/preset-react": "7.0.0", + "@babel/preset-typescript": "^7.16.7", "@babel/register": "7.0.0", "@dump247/storybook-state": "1.6.1", "@storybook/addon-actions": "5.3.14", @@ -90,9 +92,17 @@ "@storybook/react": "5.3.14", "@testing-library/jest-dom": "5.15.1", "@testing-library/react": "12.1.2", + "@types/aes-js": "^3.1.1", + "@types/node": "^17.0.13", + "@types/qrcode.react": "^1.0.2", + "@types/react": "^17.0.38", + "@types/react-svg-inline": "^2.1.3", + "@typescript-eslint/eslint-plugin": "^5.10.1", + "@typescript-eslint/parser": "^5.10.1", "asar": "2.1.0", "autodll-webpack-plugin": "0.4.2", "axios": "0.24.0", + "babel-eslint": "^10.1.0", "babel-loader": "8.0.4", "babel-plugin-react-intl": "3.0.1", "bufferutil": "4.0.1", @@ -167,6 +177,9 @@ "thread-loader": "2.1.3", "timemachine": "0.3.2", "transform-loader": "0.2.4", + "ts-migrate": "^0.1.27", + "ts-node": "^10.4.0", + "typescript": "^4.5.5", "url-loader": "2.0.1", "utf-8-validate": "5.0.2", "webdriverio": "5.18.7", diff --git a/yarn.lock b/yarn.lock index b82fb6c08e..d441020095 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,6 +17,13 @@ "@nicolo-ribaudo/chokidar-2" "2.1.8-no-fsevents.3" chokidar "^3.4.0" +"@babel/code-frame@7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== + dependencies: + "@babel/highlight" "^7.10.4" + "@babel/code-frame@7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" @@ -35,6 +42,13 @@ dependencies: "@babel/highlight" "^7.16.0" +"@babel/code-frame@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" + integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== + dependencies: + "@babel/highlight" "^7.16.7" + "@babel/compat-data@^7.10.4", "@babel/compat-data@^7.11.0": version "7.11.0" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.11.0.tgz#e9f73efe09af1355b723a7f39b11bad637d7c99c" @@ -47,6 +61,11 @@ version "7.16.4" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.16.4.tgz#081d6bbc336ec5c2435c6346b2ae1fb98b5ac68e" +"@babel/compat-data@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.16.8.tgz#31560f9f29fdf1868de8cb55049538a1b9732a60" + integrity sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q== + "@babel/core@7.16.0", "@babel/core@^7.1.0", "@babel/core@^7.12.3": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.16.0.tgz#c4ff44046f5fe310525cc9eb4ef5147f0c5374d4" @@ -88,6 +107,27 @@ semver "^5.4.1" source-map "^0.5.0" +"@babel/core@^7.1.6", "@babel/core@^7.13.16": + version "7.16.12" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.16.12.tgz#5edc53c1b71e54881315923ae2aedea2522bb784" + integrity sha512-dK5PtG1uiN2ikk++5OzSYsitZKny4wOCD0nrO4TqnW4BVBTQ2NGS3NgilvT/TEyxTST7LNyWV/T4tXDoD3fOgg== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.16.8" + "@babel/helper-compilation-targets" "^7.16.7" + "@babel/helper-module-transforms" "^7.16.7" + "@babel/helpers" "^7.16.7" + "@babel/parser" "^7.16.12" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.10" + "@babel/types" "^7.16.8" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.1.2" + semver "^6.3.0" + source-map "^0.5.0" + "@babel/eslint-parser@7.16.3": version "7.16.3" resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.16.3.tgz#2a6b1702f3f5aea48e00cea5a5bcc241c437e459" @@ -112,6 +152,15 @@ jsesc "^2.5.1" source-map "^0.5.0" +"@babel/generator@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.16.8.tgz#359d44d966b8cd059d543250ce79596f792f2ebe" + integrity sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw== + dependencies: + "@babel/types" "^7.16.8" + jsesc "^2.5.1" + source-map "^0.5.0" + "@babel/helper-annotate-as-pure@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.4.tgz#5bf0d495a3f757ac3bda48b5bf3b3ba309c72ba3" @@ -124,6 +173,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-annotate-as-pure@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz#bb2339a7534a9c128e3102024c60760a3a7f3862" + integrity sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-builder-binary-assignment-operator-visitor@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.10.4.tgz#bb0b75f31bf98cbf9ff143c1ae578b87274ae1a3" @@ -138,6 +194,14 @@ "@babel/helper-explode-assignable-expression" "^7.16.0" "@babel/types" "^7.16.0" +"@babel/helper-builder-binary-assignment-operator-visitor@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.16.7.tgz#38d138561ea207f0f69eb1626a418e4f7e6a580b" + integrity sha512-C6FdbRaxYjwVu/geKW4ZeQ0Q31AftgRcdSnZ5/jsH6BzCJbtvXvhpfkbkThYSuutZA7nCXpPR6AD9zd1dprMkA== + dependencies: + "@babel/helper-explode-assignable-expression" "^7.16.7" + "@babel/types" "^7.16.7" + "@babel/helper-builder-react-jsx-experimental@^7.10.4", "@babel/helper-builder-react-jsx-experimental@^7.11.5": version "7.11.5" resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx-experimental/-/helper-builder-react-jsx-experimental-7.11.5.tgz#4ea43dd63857b0a35cd1f1b161dc29b43414e79f" @@ -172,6 +236,16 @@ browserslist "^4.17.5" semver "^6.3.0" +"@babel/helper-compilation-targets@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz#06e66c5f299601e6c7da350049315e83209d551b" + integrity sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA== + dependencies: + "@babel/compat-data" "^7.16.4" + "@babel/helper-validator-option" "^7.16.7" + browserslist "^4.17.5" + semver "^6.3.0" + "@babel/helper-create-class-features-plugin@^7.10.4", "@babel/helper-create-class-features-plugin@^7.2.1": version "7.10.5" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.10.5.tgz#9f61446ba80e8240b0a5c85c6fdac8459d6f259d" @@ -194,6 +268,19 @@ "@babel/helper-replace-supers" "^7.16.0" "@babel/helper-split-export-declaration" "^7.16.0" +"@babel/helper-create-class-features-plugin@^7.16.10", "@babel/helper-create-class-features-plugin@^7.16.7": + version "7.16.10" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.10.tgz#8a6959b9cc818a88815ba3c5474619e9c0f2c21c" + integrity sha512-wDeej0pu3WN/ffTxMNCPW5UCiOav8IcLRxSIyp/9+IF2xJUM9h/OYjg0IJLHaL6F8oU8kqMz9nc1vryXhMsgXg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.16.7" + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-member-expression-to-functions" "^7.16.7" + "@babel/helper-optimise-call-expression" "^7.16.7" + "@babel/helper-replace-supers" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/helper-create-regexp-features-plugin@7.16.0", "@babel/helper-create-regexp-features-plugin@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.16.0.tgz#06b2348ce37fccc4f5e18dcd8d75053f2a7c44ff" @@ -209,6 +296,14 @@ "@babel/helper-regex" "^7.10.4" regexpu-core "^4.7.0" +"@babel/helper-create-regexp-features-plugin@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.16.7.tgz#0cb82b9bac358eb73bfbd73985a776bfa6b14d48" + integrity sha512-fk5A6ymfp+O5+p2yCkXAu5Kyj6v0xh0RBeNcAkYUMDvvAAoxvSKXn+Jb37t/yWFiQVDFK1ELpUTD8/aLhCPu+g== + dependencies: + "@babel/helper-annotate-as-pure" "^7.16.7" + regexpu-core "^4.7.1" + "@babel/helper-define-map@^7.10.4": version "7.10.5" resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.10.5.tgz#b53c10db78a640800152692b13393147acb9bb30" @@ -230,6 +325,27 @@ resolve "^1.14.2" semver "^6.1.2" +"@babel/helper-define-polyfill-provider@^0.3.1": + version "0.3.1" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.1.tgz#52411b445bdb2e676869e5a74960d2d3826d2665" + integrity sha512-J9hGMpJQmtWmj46B3kBHmL38UhJGhYX7eqkcq+2gsstyYt341HmPeWspihX43yVRA0mS+8GGk2Gckc7bY/HCmA== + dependencies: + "@babel/helper-compilation-targets" "^7.13.0" + "@babel/helper-module-imports" "^7.12.13" + "@babel/helper-plugin-utils" "^7.13.0" + "@babel/traverse" "^7.13.0" + debug "^4.1.1" + lodash.debounce "^4.0.8" + resolve "^1.14.2" + semver "^6.1.2" + +"@babel/helper-environment-visitor@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz#ff484094a839bde9d89cd63cba017d7aae80ecd7" + integrity sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-explode-assignable-expression@^7.10.4": version "7.11.4" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.11.4.tgz#2d8e3470252cc17aba917ede7803d4a7a276a41b" @@ -242,6 +358,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-explode-assignable-expression@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.7.tgz#12a6d8522fdd834f194e868af6354e8650242b7a" + integrity sha512-KyUenhWMC8VrxzkGP0Jizjo4/Zx+1nNZhgocs+gLzyZyB8SHidhoq9KK/8Ato4anhwsivfkBLftky7gvzbZMtQ== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-function-name@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz#d2d3b20c59ad8c47112fa7d2a94bc09d5ef82f1a" @@ -258,6 +381,15 @@ "@babel/template" "^7.16.0" "@babel/types" "^7.16.0" +"@babel/helper-function-name@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz#f1ec51551fb1c8956bc8dd95f38523b6cf375f8f" + integrity sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA== + dependencies: + "@babel/helper-get-function-arity" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/types" "^7.16.7" + "@babel/helper-get-function-arity@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz#98c1cbea0e2332f33f9a4661b8ce1505b2c19ba2" @@ -270,6 +402,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-get-function-arity@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz#ea08ac753117a669f1508ba06ebcc49156387419" + integrity sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-hoist-variables@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.10.4.tgz#d49b001d1d5a68ca5e6604dda01a6297f7c9381e" @@ -282,6 +421,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-hoist-variables@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz#86bcb19a77a509c7b77d0e22323ef588fa58c246" + integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-member-expression-to-functions@^7.10.4", "@babel/helper-member-expression-to-functions@^7.10.5": version "7.11.0" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.11.0.tgz#ae69c83d84ee82f4b42f96e2a09410935a8f26df" @@ -294,6 +440,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-member-expression-to-functions@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.7.tgz#42b9ca4b2b200123c3b7e726b0ae5153924905b0" + integrity sha512-VtJ/65tYiU/6AbMTDwyoXGPKHgTsfRarivm+YbB5uAzKUyuPjgZSgAFeG87FCigc7KNHu2Pegh1XIT3lXjvz3Q== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz#4c5c54be04bd31670a7382797d75b9fa2e5b5620" @@ -306,6 +459,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-module-imports@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz#25612a8091a999704461c8a222d0efec5d091437" + integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-module-transforms@^7.10.4", "@babel/helper-module-transforms@^7.10.5", "@babel/helper-module-transforms@^7.11.0": version "7.11.0" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz#b16f250229e47211abdd84b34b64737c2ab2d359" @@ -331,6 +491,20 @@ "@babel/traverse" "^7.16.0" "@babel/types" "^7.16.0" +"@babel/helper-module-transforms@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz#7665faeb721a01ca5327ddc6bba15a5cb34b6a41" + integrity sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng== + dependencies: + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-module-imports" "^7.16.7" + "@babel/helper-simple-access" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/helper-validator-identifier" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.7" + "@babel/types" "^7.16.7" + "@babel/helper-optimise-call-expression@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz#50dc96413d594f995a77905905b05893cd779673" @@ -343,6 +517,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-optimise-call-expression@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.7.tgz#a34e3560605abbd31a18546bd2aad3e6d9a174f2" + integrity sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375" @@ -351,6 +532,11 @@ version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz#5ac822ce97eec46741ab70a517971e443a70c5a9" +"@babel/helper-plugin-utils@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz#aa3a8ab4c3cceff8e65eb9e73d87dc4ff320b2f5" + integrity sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA== + "@babel/helper-regex@^7.10.4": version "7.10.5" resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.10.5.tgz#32dfbb79899073c415557053a19bd055aae50ae0" @@ -374,6 +560,15 @@ "@babel/helper-wrap-function" "^7.16.0" "@babel/types" "^7.16.0" +"@babel/helper-remap-async-to-generator@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.16.8.tgz#29ffaade68a367e2ed09c90901986918d25e57e3" + integrity sha512-fm0gH7Flb8H51LqJHy3HJ3wnE1+qtYR2A99K06ahwrawLdOFsCEWjZOrYricXJHoPSudNKxrMBUPEIPxiIIvBw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.16.7" + "@babel/helper-wrap-function" "^7.16.8" + "@babel/types" "^7.16.8" + "@babel/helper-replace-supers@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz#d585cd9388ea06e6031e4cd44b6713cbead9e6cf" @@ -392,6 +587,17 @@ "@babel/traverse" "^7.16.0" "@babel/types" "^7.16.0" +"@babel/helper-replace-supers@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.16.7.tgz#e9f5f5f32ac90429c1a4bdec0f231ef0c2838ab1" + integrity sha512-y9vsWilTNaVnVh6xiJfABzsNpgDPKev9HnAgz6Gb1p6UUwf9NepdlsV7VXGCftJM+jqD5f7JIEubcpLjZj5dBw== + dependencies: + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-member-expression-to-functions" "^7.16.7" + "@babel/helper-optimise-call-expression" "^7.16.7" + "@babel/traverse" "^7.16.7" + "@babel/types" "^7.16.7" + "@babel/helper-simple-access@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz#0f5ccda2945277a2a7a2d3a821e15395edcf3461" @@ -405,6 +611,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-simple-access@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz#d656654b9ea08dbb9659b69d61063ccd343ff0f7" + integrity sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-skip-transparent-expression-wrappers@^7.11.0": version "7.11.0" resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.11.0.tgz#eec162f112c2f58d3af0af125e3bb57665146729" @@ -429,6 +642,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-split-export-declaration@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz#0b648c0c42da9d3920d85ad585f2778620b8726b" + integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-validator-identifier@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" @@ -437,10 +657,20 @@ version "7.15.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" +"@babel/helper-validator-identifier@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" + integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== + "@babel/helper-validator-option@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz#6e72a1fff18d5dfcb878e1e62f1a021c4b72d5a3" +"@babel/helper-validator-option@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23" + integrity sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ== + "@babel/helper-wrap-function@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.10.4.tgz#8a6f701eab0ff39f765b5a1cfef409990e624b87" @@ -459,6 +689,16 @@ "@babel/traverse" "^7.16.0" "@babel/types" "^7.16.0" +"@babel/helper-wrap-function@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.16.8.tgz#58afda087c4cd235de92f7ceedebca2c41274200" + integrity sha512-8RpyRVIAW1RcDDGTA+GpPAwV22wXCfKOoM9bet6TLkGIFTkRQSkH1nMQ5Yet4MpoXe1ZwHPVtNasc2w0uZMqnw== + dependencies: + "@babel/helper-function-name" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.8" + "@babel/types" "^7.16.8" + "@babel/helpers@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.10.4.tgz#2abeb0d721aff7c0a97376b9e1f6f65d7a475044" @@ -475,6 +715,15 @@ "@babel/traverse" "^7.16.3" "@babel/types" "^7.16.0" +"@babel/helpers@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.16.7.tgz#7e3504d708d50344112767c3542fc5e357fffefc" + integrity sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw== + dependencies: + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.7" + "@babel/types" "^7.16.7" + "@babel/highlight@^7.0.0", "@babel/highlight@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143" @@ -491,10 +740,24 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@babel/highlight@^7.16.7": + version "7.16.10" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.16.10.tgz#744f2eb81579d6eea753c227b0f570ad785aba88" + integrity sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + chalk "^2.0.0" + js-tokens "^4.0.0" + "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.0", "@babel/parser@^7.16.3": version "7.16.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.4.tgz#d5f92f57cf2c74ffe9b37981c0e72fee7311372e" +"@babel/parser@^7.1.6", "@babel/parser@^7.13.16", "@babel/parser@^7.16.10", "@babel/parser@^7.16.12", "@babel/parser@^7.16.7", "@babel/parser@^7.7.0": + version "7.16.12" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.12.tgz#9474794f9a650cf5e2f892444227f98e28cdf8b6" + integrity sha512-VfaV15po8RiZssrkPweyvbGVSe4x2y+aciFCgn0n0/SJMR22cwofRV1mtnJQYcSB1wUTaA/X1LnA3es66MCO5A== + "@babel/parser@^7.10.4", "@babel/parser@^7.11.5": version "7.11.5" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037" @@ -505,6 +768,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.7.tgz#4eda6d6c2a0aa79c70fa7b6da67763dfe2141050" + integrity sha512-anv/DObl7waiGEnC24O9zqL0pSuI9hljihqiDuFHC8d7/bjr/4RLGPWuc8rYOff/QPzbEPSkzG8wGG9aDuhHRg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.16.0.tgz#358972eaab006f5eb0826183b0c93cbcaf13e1e2" @@ -513,6 +783,15 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" "@babel/plugin-proposal-optional-chaining" "^7.16.0" +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.16.7.tgz#cc001234dfc139ac45f6bcf801866198c8c72ff9" + integrity sha512-di8vUHRdf+4aJ7ltXhaDbPoszdkh59AQtJM5soLsuHpQJdFQZOA4uGj0V2u/CZ8bJ/u8ULDL5yq6FO/bCXnKHw== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" + "@babel/plugin-proposal-optional-chaining" "^7.16.7" + "@babel/plugin-proposal-async-generator-functions@^7.10.4": version "7.10.5" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.5.tgz#3491cabf2f7c179ab820606cec27fed15e0e8558" @@ -529,6 +808,15 @@ "@babel/helper-remap-async-to-generator" "^7.16.4" "@babel/plugin-syntax-async-generators" "^7.8.4" +"@babel/plugin-proposal-async-generator-functions@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.16.8.tgz#3bdd1ebbe620804ea9416706cd67d60787504bc8" + integrity sha512-71YHIvMuiuqWJQkebWJtdhQTfd4Q4mF76q2IX37uZPkG9+olBxsX+rH1vkhFto4UeJZ9dPY2s+mDvhDm1u2BGQ== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-remap-async-to-generator" "^7.16.8" + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-proposal-class-properties@7.2.1": version "7.2.1" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.2.1.tgz#c734a53e0a1ec40fe5c22ee5069d26da3b187d05" @@ -536,6 +824,14 @@ "@babel/helper-create-class-features-plugin" "^7.2.1" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-proposal-class-properties@^7.1.0", "@babel/plugin-proposal-class-properties@^7.13.0", "@babel/plugin-proposal-class-properties@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.7.tgz#925cad7b3b1a2fcea7e59ecc8eb5954f961f91b0" + integrity sha512-IobU0Xme31ewjYOShSIqd/ZGM/r/cuOz2z0MDbNrhF5FW+ZVgi0f2lyeoj9KFPDOAqsYxmLWZte1WOwlvY9aww== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-proposal-class-properties@^7.10.4", "@babel/plugin-proposal-class-properties@^7.7.0": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.10.4.tgz#a33bf632da390a59c7a8c570045d1115cd778807" @@ -558,6 +854,15 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-class-static-block" "^7.14.5" +"@babel/plugin-proposal-class-static-block@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.16.7.tgz#712357570b612106ef5426d13dc433ce0f200c2a" + integrity sha512-dgqJJrcZoG/4CkMopzhPJjGxsIe9A8RlkQLnL/Vhhx8AA9ZuaRwGSlscSh42hazc7WSrya/IK7mTeoF0DP9tEw== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-class-static-block" "^7.14.5" + "@babel/plugin-proposal-decorators@7.16.4": version "7.16.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.16.4.tgz#9b35ce0716425a93b978e79099e5f7ba217c1364" @@ -580,6 +885,14 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-dynamic-import" "^7.8.3" +"@babel/plugin-proposal-dynamic-import@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.7.tgz#c19c897eaa46b27634a00fee9fb7d829158704b2" + integrity sha512-I8SW9Ho3/8DRSdmDdH3gORdyUuYnk1m4cMxUAdu5oy4n3OfN8flDEH+d60iG7dUfi0KkYwSvoalHzzdRzpWHTg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-dynamic-import" "^7.8.3" + "@babel/plugin-proposal-export-namespace-from@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.10.4.tgz#570d883b91031637b3e2958eea3c438e62c05f54" @@ -594,6 +907,14 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" +"@babel/plugin-proposal-export-namespace-from@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.16.7.tgz#09de09df18445a5786a305681423ae63507a6163" + integrity sha512-ZxdtqDXLRGBL64ocZcs7ovt71L3jhC1RGSyR996svrCi3PYqHNkb3SwPJCs8RIzD86s+WPpt2S73+EHCGO+NUA== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-export-namespace-from" "^7.8.3" + "@babel/plugin-proposal-json-strings@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.10.4.tgz#593e59c63528160233bd321b1aebe0820c2341db" @@ -608,6 +929,14 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-json-strings" "^7.8.3" +"@babel/plugin-proposal-json-strings@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.16.7.tgz#9732cb1d17d9a2626a08c5be25186c195b6fa6e8" + integrity sha512-lNZ3EEggsGY78JavgbHsK9u5P3pQaW7k4axlgFLYkMd7UBsiNahCITShLjNQschPyjtO6dADrL24757IdhBrsQ== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-proposal-logical-assignment-operators@^7.11.0": version "7.11.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.11.0.tgz#9f80e482c03083c87125dee10026b58527ea20c8" @@ -622,6 +951,14 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" +"@babel/plugin-proposal-logical-assignment-operators@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.16.7.tgz#be23c0ba74deec1922e639832904be0bea73cdea" + integrity sha512-K3XzyZJGQCr00+EtYtrDjmwX7o7PLK6U9bi1nCwkQioRFVUv6dJoxbQjtWVtP+bCPy82bONBKG8NPyQ4+i6yjg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" + "@babel/plugin-proposal-nullish-coalescing-operator@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.10.4.tgz#02a7e961fc32e6d5b2db0649e01bf80ddee7e04a" @@ -629,6 +966,14 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0" +"@babel/plugin-proposal-nullish-coalescing-operator@^7.13.8", "@babel/plugin-proposal-nullish-coalescing-operator@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.7.tgz#141fc20b6857e59459d430c850a0011e36561d99" + integrity sha512-aUOrYU3EVtjf62jQrCj63pYZ7k6vns2h/DQvHPWGmsJRYzWXZ6/AsfgpiRy6XiuIDADhJzP2Q9MwSMKauBQ+UQ== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-proposal-nullish-coalescing-operator@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.0.tgz#44e1cce08fe2427482cf446a91bb451528ed0596" @@ -650,6 +995,14 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-numeric-separator" "^7.10.4" +"@babel/plugin-proposal-numeric-separator@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.16.7.tgz#d6b69f4af63fb38b6ca2558442a7fb191236eba9" + integrity sha512-vQgPMknOIgiuVqbokToyXbkY/OmmjAzr/0lhSIbG/KmnzXPGwW/AdhdKpi+O4X/VkWiWjnkKOBiqJrTaC98VKw== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" + "@babel/plugin-proposal-object-rest-spread@7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.2.0.tgz#88f5fec3e7ad019014c97f7ee3c992f0adbf7fb8" @@ -657,6 +1010,17 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" +"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.16.7.tgz#94593ef1ddf37021a25bdcb5754c4a8d534b01d8" + integrity sha512-3O0Y4+dw94HA86qSg9IHfyPktgR7q3gpNVAeiKQd+8jBKFaU5NQS1Yatgo4wY+UFNuLjvxcSmzcsHqrhgTyBUA== + dependencies: + "@babel/compat-data" "^7.16.4" + "@babel/helper-compilation-targets" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-transform-parameters" "^7.16.7" + "@babel/plugin-proposal-object-rest-spread@^7.11.0", "@babel/plugin-proposal-object-rest-spread@^7.6.2": version "7.11.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.11.0.tgz#bd81f95a1f746760ea43b6c2d3d62b11790ad0af" @@ -689,6 +1053,14 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" +"@babel/plugin-proposal-optional-catch-binding@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.16.7.tgz#c623a430674ffc4ab732fd0a0ae7722b67cb74cf" + integrity sha512-eMOH/L4OvWSZAE1VkHbr1vckLG1WUcHGJSLqqQwl2GaUqG6QjddvrOaTUMNYiv77H5IKPMZ9U9P7EaHwvAShfA== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-proposal-optional-chaining@^7.11.0": version "7.11.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.11.0.tgz#de5866d0646f6afdaab8a566382fe3a221755076" @@ -697,6 +1069,15 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.11.0" "@babel/plugin-syntax-optional-chaining" "^7.8.0" +"@babel/plugin-proposal-optional-chaining@^7.13.12", "@babel/plugin-proposal-optional-chaining@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.7.tgz#7cd629564724816c0e8a969535551f943c64c39a" + integrity sha512-eC3xy+ZrUcBtP7x+sq62Q/HYd674pPTb/77XZMb5wbDPGWIdUbSr4Agr052+zaUPSb+gGRnjxXfKFvx5iMJ+DA== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-proposal-optional-chaining@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.0.tgz#56dbc3970825683608e9efb55ea82c2a2d6c8dc0" @@ -719,6 +1100,14 @@ "@babel/helper-create-class-features-plugin" "^7.16.0" "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-proposal-private-methods@^7.16.11": + version "7.16.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.11.tgz#e8df108288555ff259f4527dbe84813aac3a1c50" + integrity sha512-F/2uAkPlXDr8+BHpZvo19w3hLFKge+k75XUprE6jaqKxjGkSYcK+4c+bup5PdW/7W/Rpjwql7FTVEDW+fRAQsw== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.16.10" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-proposal-private-property-in-object@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.16.0.tgz#69e935b2c5c79d2488112d886f0c4e2790fee76f" @@ -728,6 +1117,16 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" +"@babel/plugin-proposal-private-property-in-object@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.16.7.tgz#b0b8cef543c2c3d57e59e2c611994861d46a3fce" + integrity sha512-rMQkjcOFbm+ufe3bTZLyOfsOUOxyvLXZJCTARhJr+8UMSoZmqTe1K1BgkFcrW37rAchWg57yI69ORxiWvUINuQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.16.7" + "@babel/helper-create-class-features-plugin" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + "@babel/plugin-proposal-unicode-property-regex@^7.10.4", "@babel/plugin-proposal-unicode-property-regex@^7.4.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.10.4.tgz#4483cda53041ce3413b7fe2f00022665ddfaa75d" @@ -742,6 +1141,14 @@ "@babel/helper-create-regexp-features-plugin" "^7.16.0" "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-proposal-unicode-property-regex@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.16.7.tgz#635d18eb10c6214210ffc5ff4932552de08188a2" + integrity sha512-QRK0YI/40VLhNVGIjRNAAQkEHws0cswSdFFjpFyt943YmJIU1da9uW63Iu6NFV6CxTZW5eTDCrwZUstBWgp/Rg== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-async-generators@^7.8.0", "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" @@ -802,6 +1209,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-syntax-flow@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.16.7.tgz#202b147e5892b8452bbb0bb269c7ed2539ab8832" + integrity sha512-UDo3YGQO0jH6ytzVwgSLv9i/CzMcUjbKenL67dTrAZPPv6GFAtDhe6jqnvmoKzC/7htNTohhos+onPtDMqJwaQ== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-import-meta@^7.8.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" @@ -874,6 +1288,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-syntax-typescript@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.16.7.tgz#39c9b55ee153151990fb038651d58d3fd03f98f8" + integrity sha512-YhUIJHHGkqPgEcMYkPCKTyGUdoGKWtopIycQyjJH8OjvRgOYsXsaKehLVPScKJWAULPxMa4N1vCe6szREFlZ7A== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-arrow-functions@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.10.4.tgz#e22960d77e697c74f41c501d44d73dbf8a6a64cd" @@ -886,6 +1307,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-arrow-functions@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.7.tgz#44125e653d94b98db76369de9c396dc14bef4154" + integrity sha512-9ffkFFMbvzTvv+7dTp/66xvZAWASuPD5Tl9LK3Z9vhOmANo6j94rik+5YMBt4CwHVMWLWpMsriIc2zsa3WW3xQ== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-async-to-generator@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.10.4.tgz#41a5017e49eb6f3cda9392a51eef29405b245a37" @@ -902,6 +1330,15 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/helper-remap-async-to-generator" "^7.16.0" +"@babel/plugin-transform-async-to-generator@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.16.8.tgz#b83dff4b970cf41f1b819f8b49cc0cfbaa53a808" + integrity sha512-MtmUmTJQHCnyJVrScNzNlofQJ3dLFuobYn3mwOTKHnSCMtbNsqvF71GQmJfFjdrXSsAA7iysFmYWw4bXZ20hOg== + dependencies: + "@babel/helper-module-imports" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-remap-async-to-generator" "^7.16.8" + "@babel/plugin-transform-block-scoped-functions@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.10.4.tgz#1afa595744f75e43a91af73b0d998ecfe4ebc2e8" @@ -914,6 +1351,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-block-scoped-functions@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.16.7.tgz#4d0d57d9632ef6062cdf354bb717102ee042a620" + integrity sha512-JUuzlzmF40Z9cXyytcbZEZKckgrQzChbQJw/5PuEHYeqzCsvebDx0K0jWnIIVcmmDOAVctCgnYs0pMcrYj2zJg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-block-scoping@^7.10.4": version "7.11.1" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.11.1.tgz#5b7efe98852bef8d652c0b28144cd93a9e4b5215" @@ -926,6 +1370,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-block-scoping@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.16.7.tgz#f50664ab99ddeaee5bc681b8f3a6ea9d72ab4f87" + integrity sha512-ObZev2nxVAYA4bhyusELdo9hb3H+A56bxH3FZMbEImZFiEDYVHXQSJ1hQKFlDnlt8G9bBrCZ5ZpURZUrV4G5qQ== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-classes@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.10.4.tgz#405136af2b3e218bc4a1926228bc917ab1a0adc7" @@ -951,6 +1402,20 @@ "@babel/helper-split-export-declaration" "^7.16.0" globals "^11.1.0" +"@babel/plugin-transform-classes@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.16.7.tgz#8f4b9562850cd973de3b498f1218796eb181ce00" + integrity sha512-WY7og38SFAGYRe64BrjKf8OrE6ulEHtr5jEYaZMwox9KebgqPi67Zqz8K53EKk1fFEJgm96r32rkKZ3qA2nCWQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.16.7" + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-optimise-call-expression" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-replace-supers" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + globals "^11.1.0" + "@babel/plugin-transform-computed-properties@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.10.4.tgz#9ded83a816e82ded28d52d4b4ecbdd810cdfc0eb" @@ -963,6 +1428,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-computed-properties@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.16.7.tgz#66dee12e46f61d2aae7a73710f591eb3df616470" + integrity sha512-gN72G9bcmenVILj//sv1zLNaPyYcOzUho2lIJBMh/iakJ9ygCo/hEF9cpGb61SCMEDxbbyBoVQxrt+bWKu5KGw== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-destructuring@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.10.4.tgz#70ddd2b3d1bea83d01509e9bb25ddb3a74fc85e5" @@ -975,6 +1447,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-destructuring@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.16.7.tgz#ca9588ae2d63978a4c29d3f33282d8603f618e23" + integrity sha512-VqAwhTHBnu5xBVDCvrvqJbtLUa++qZaWC0Fgr2mqokBlulZARGyIvZDoqbPlPaKImQ9dKAcCzbv+ul//uqu70A== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-dotall-regex@^7.10.4", "@babel/plugin-transform-dotall-regex@^7.4.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.10.4.tgz#469c2062105c1eb6a040eaf4fac4b488078395ee" @@ -989,6 +1468,14 @@ "@babel/helper-create-regexp-features-plugin" "^7.16.0" "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-dotall-regex@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.16.7.tgz#6b2d67686fab15fb6a7fd4bd895d5982cfc81241" + integrity sha512-Lyttaao2SjZF6Pf4vk1dVKv8YypMpomAbygW+mU5cYP3S5cWTfCJjG8xV6CFdzGFlfWK81IjL9viiTvpb6G7gQ== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-duplicate-keys@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.10.4.tgz#697e50c9fee14380fe843d1f306b295617431e47" @@ -1001,6 +1488,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-duplicate-keys@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.16.7.tgz#2207e9ca8f82a0d36a5a67b6536e7ef8b08823c9" + integrity sha512-03DvpbRfvWIXyK0/6QiR1KMTWeT6OcQ7tbhjrXyFS02kjuX/mu5Bvnh5SDSWHxyawit2g5aWhKwI86EE7GUnTw== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-exponentiation-operator@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.10.4.tgz#5ae338c57f8cf4001bdb35607ae66b92d665af2e" @@ -1015,6 +1509,14 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.16.0" "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-exponentiation-operator@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.16.7.tgz#efa9862ef97e9e9e5f653f6ddc7b665e8536fe9b" + integrity sha512-8UYLSlyLgRixQvlYH3J2ekXFHDFLQutdy7FfFAMm3CPZ6q9wHCwnUyiXpQCe3gVVnQlHc5nsuiEVziteRNTXEA== + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-flow-strip-types@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.10.4.tgz#c497957f09e86e3df7296271e9eb642876bf7788" @@ -1029,6 +1531,14 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-flow" "^7.16.0" +"@babel/plugin-transform-flow-strip-types@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.16.7.tgz#291fb140c78dabbf87f2427e7c7c332b126964b8" + integrity sha512-mzmCq3cNsDpZZu9FADYYyfZJIOrSONmHcop2XEKPdBNMa4PDC4eEvcOvzZaCNcjKu72v0XQlA5y1g58aLRXdYg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-flow" "^7.16.7" + "@babel/plugin-transform-for-of@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.10.4.tgz#c08892e8819d3a5db29031b115af511dbbfebae9" @@ -1041,6 +1551,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-for-of@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.7.tgz#649d639d4617dff502a9a158c479b3b556728d8c" + integrity sha512-/QZm9W92Ptpw7sjI9Nx1mbcsWz33+l8kuMIQnDwgQBG5s3fAfQvkRjQ7NqXhtNcKOnPkdICmUHyCaWW06HCsqg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-function-name@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.10.4.tgz#6a467880e0fc9638514ba369111811ddbe2644b7" @@ -1055,6 +1572,15 @@ "@babel/helper-function-name" "^7.16.0" "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-function-name@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.16.7.tgz#5ab34375c64d61d083d7d2f05c38d90b97ec65cf" + integrity sha512-SU/C68YVwTRxqWj5kgsbKINakGag0KTgq9f2iZEXdStoAbOzLHEBRYzImmA6yFo8YZhJVflvXmIHUO7GWHmxxA== + dependencies: + "@babel/helper-compilation-targets" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-literals@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.10.4.tgz#9f42ba0841100a135f22712d0e391c462f571f3c" @@ -1067,6 +1593,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-literals@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.16.7.tgz#254c9618c5ff749e87cb0c0cef1a0a050c0bdab1" + integrity sha512-6tH8RTpTWI0s2sV6uq3e/C9wPo4PTqqZps4uF0kzQ9/xPLFQtipynvmT1g/dOfEJ+0EQsHhkQ/zyRId8J2b8zQ== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-member-expression-literals@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.10.4.tgz#b1ec44fcf195afcb8db2c62cd8e551c881baf8b7" @@ -1079,6 +1612,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-member-expression-literals@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.16.7.tgz#6e5dcf906ef8a098e630149d14c867dd28f92384" + integrity sha512-mBruRMbktKQwbxaJof32LT9KLy2f3gH+27a5XSuXo6h7R3vqltl0PgZ80C8ZMKw98Bf8bqt6BEVi3svOh2PzMw== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-modules-amd@^7.10.4": version "7.10.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.10.5.tgz#1b9cddaf05d9e88b3aad339cb3e445c4f020a9b1" @@ -1095,6 +1635,15 @@ "@babel/helper-plugin-utils" "^7.14.5" babel-plugin-dynamic-import-node "^2.3.3" +"@babel/plugin-transform-modules-amd@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.16.7.tgz#b28d323016a7daaae8609781d1f8c9da42b13186" + integrity sha512-KaaEtgBL7FKYwjJ/teH63oAmE3lP34N3kshz8mm4VMAw7U3PxjVwwUmxEFksbgsNUaO3wId9R2AVQYSEGRa2+g== + dependencies: + "@babel/helper-module-transforms" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + babel-plugin-dynamic-import-node "^2.3.3" + "@babel/plugin-transform-modules-commonjs@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.10.4.tgz#66667c3eeda1ebf7896d41f1f16b17105a2fbca0" @@ -1104,6 +1653,16 @@ "@babel/helper-simple-access" "^7.10.4" babel-plugin-dynamic-import-node "^2.3.3" +"@babel/plugin-transform-modules-commonjs@^7.13.8", "@babel/plugin-transform-modules-commonjs@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.16.8.tgz#cdee19aae887b16b9d331009aa9a219af7c86afe" + integrity sha512-oflKPvsLT2+uKQopesJt3ApiaIS2HW+hzHFcwRNtyDGieAeC/dIHZX8buJQ2J2X1rxGPy4eRcUijm3qcSPjYcA== + dependencies: + "@babel/helper-module-transforms" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-simple-access" "^7.16.7" + babel-plugin-dynamic-import-node "^2.3.3" + "@babel/plugin-transform-modules-commonjs@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.16.0.tgz#add58e638c8ddc4875bd9a9ecb5c594613f6c922" @@ -1132,6 +1691,17 @@ "@babel/helper-validator-identifier" "^7.15.7" babel-plugin-dynamic-import-node "^2.3.3" +"@babel/plugin-transform-modules-systemjs@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.16.7.tgz#887cefaef88e684d29558c2b13ee0563e287c2d7" + integrity sha512-DuK5E3k+QQmnOqBR9UkusByy5WZWGRxfzV529s9nPra1GE7olmxfqO2FHobEOYSPIjPBTr4p66YDcjQnt8cBmw== + dependencies: + "@babel/helper-hoist-variables" "^7.16.7" + "@babel/helper-module-transforms" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-validator-identifier" "^7.16.7" + babel-plugin-dynamic-import-node "^2.3.3" + "@babel/plugin-transform-modules-umd@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.10.4.tgz#9a8481fe81b824654b3a0b65da3df89f3d21839e" @@ -1146,6 +1716,14 @@ "@babel/helper-module-transforms" "^7.16.0" "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-modules-umd@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.16.7.tgz#23dad479fa585283dbd22215bff12719171e7618" + integrity sha512-EMh7uolsC8O4xhudF2F6wedbSHm1HHZ0C6aJ7K67zcDNidMzVcxWdGr+htW9n21klm+bOn+Rx4CBsAntZd3rEQ== + dependencies: + "@babel/helper-module-transforms" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-named-capturing-groups-regex@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.10.4.tgz#78b4d978810b6f3bcf03f9e318f2fc0ed41aecb6" @@ -1158,6 +1736,13 @@ dependencies: "@babel/helper-create-regexp-features-plugin" "^7.16.0" +"@babel/plugin-transform-named-capturing-groups-regex@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.16.8.tgz#7f860e0e40d844a02c9dcf9d84965e7dfd666252" + integrity sha512-j3Jw+n5PvpmhRR+mrgIh04puSANCk/T/UA3m3P1MjJkhlK906+ApHhDIqBQDdOgL/r1UYpz4GNclTXxyZrYGSw== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.16.7" + "@babel/plugin-transform-new-target@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.10.4.tgz#9097d753cb7b024cb7381a3b2e52e9513a9c6888" @@ -1170,6 +1755,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-new-target@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.16.7.tgz#9967d89a5c243818e0800fdad89db22c5f514244" + integrity sha512-xiLDzWNMfKoGOpc6t3U+etCE2yRnn3SM09BXqWPIZOBpL2gvVrBWUKnsJx0K/ADi5F5YC5f8APFfWrz25TdlGg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-object-super@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.10.4.tgz#d7146c4d139433e7a6526f888c667e314a093894" @@ -1184,6 +1776,14 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/helper-replace-supers" "^7.16.0" +"@babel/plugin-transform-object-super@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.16.7.tgz#ac359cf8d32cf4354d27a46867999490b6c32a94" + integrity sha512-14J1feiQVWaGvRxj2WjyMuXS2jsBkgB3MdSN5HuC2G5nRspa5RK9COcs82Pwy5BuGcjb+fYaUj94mYcOj7rCvw== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-replace-supers" "^7.16.7" + "@babel/plugin-transform-parameters@^7.10.4": version "7.10.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.10.5.tgz#59d339d58d0b1950435f4043e74e2510005e2c4a" @@ -1197,6 +1797,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-parameters@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.16.7.tgz#a1721f55b99b736511cb7e0152f61f17688f331f" + integrity sha512-AT3MufQ7zZEhU2hwOA11axBnExW0Lszu4RL/tAlUJBuNoRak+wehQW8h6KcXOcgjY42fHtDxswuMhMjFEuv/aw== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-property-literals@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.10.4.tgz#f6fe54b6590352298785b83edd815d214c42e3c0" @@ -1209,6 +1816,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-property-literals@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.16.7.tgz#2dadac85155436f22c696c4827730e0fe1057a55" + integrity sha512-z4FGr9NMGdoIl1RqavCqGG+ZuYjfZ/hkCIeuH6Do7tXmSm0ls11nYVSJqFEUOSJbDab5wC6lRE/w6YjVcr6Hqw== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-react-constant-elements@^7.0.0", "@babel/plugin-transform-react-constant-elements@^7.2.0", "@babel/plugin-transform-react-constant-elements@^7.6.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.10.4.tgz#0f485260bf1c29012bb973e7e404749eaac12c9e" @@ -1271,6 +1885,13 @@ dependencies: regenerator-transform "^0.14.2" +"@babel/plugin-transform-regenerator@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.16.7.tgz#9e7576dc476cb89ccc5096fff7af659243b4adeb" + integrity sha512-mF7jOgGYCkSJagJ6XCujSQg+6xC1M77/03K2oBmVJWoFGNUtnVJO4WHKJk3dnPC8HCcj4xBQP1Egm8DWh3Pb3Q== + dependencies: + regenerator-transform "^0.14.2" + "@babel/plugin-transform-reserved-words@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.10.4.tgz#8f2682bcdcef9ed327e1b0861585d7013f8a54dd" @@ -1283,6 +1904,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-reserved-words@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.16.7.tgz#1d798e078f7c5958eec952059c460b220a63f586" + integrity sha512-KQzzDnZ9hWQBjwi5lpY5v9shmm6IVG0U9pB18zvMu2i4H90xpT4gmqwPYsn8rObiadYe2M0gmgsiOIF5A/2rtg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-runtime@7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.2.0.tgz#566bc43f7d0aedc880eaddbd29168d0f248966ea" @@ -1304,6 +1932,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-shorthand-properties@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.7.tgz#e8549ae4afcf8382f711794c0c7b6b934c5fbd2a" + integrity sha512-hah2+FEnoRoATdIb05IOXf+4GzXYTq75TVhIn1PewihbpyrNWUt2JbudKQOETWw6QpLe+AIUpJ5MVLYTQbeeUg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-spread@^7.11.0": version "7.11.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.11.0.tgz#fa84d300f5e4f57752fe41a6d1b3c554f13f17cc" @@ -1318,6 +1953,14 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" +"@babel/plugin-transform-spread@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.16.7.tgz#a303e2122f9f12e0105daeedd0f30fb197d8ff44" + integrity sha512-+pjJpgAngb53L0iaA5gU/1MLXJIfXcYepLgXB3esVRf4fqmj8f2cxM3/FKaHsZms08hFQJkFccEWuIpm429TXg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" + "@babel/plugin-transform-sticky-regex@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.10.4.tgz#8f3889ee8657581130a29d9cc91d7c73b7c4a28d" @@ -1331,6 +1974,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-sticky-regex@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.16.7.tgz#c84741d4f4a38072b9a1e2e3fd56d359552e8660" + integrity sha512-NJa0Bd/87QV5NZZzTuZG5BPJjLYadeSZ9fO6oOUoL4iQx+9EEuw/eEM92SrsT19Yc2jgB1u1hsjqDtH02c3Drw== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-template-literals@^7.10.4": version "7.10.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.10.5.tgz#78bc5d626a6642db3312d9d0f001f5e7639fde8c" @@ -1344,6 +1994,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-template-literals@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.16.7.tgz#f3d1c45d28967c8e80f53666fc9c3e50618217ab" + integrity sha512-VwbkDDUeenlIjmfNeDX/V0aWrQH2QiVyJtwymVQSzItFDTpxfyJh3EVaQiS0rIN/CqbLGr0VcGmuwyTdZtdIsA== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-typeof-symbol@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.10.4.tgz#9509f1a7eec31c4edbffe137c16cc33ff0bc5bfc" @@ -1356,6 +2013,22 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-typeof-symbol@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.16.7.tgz#9cdbe622582c21368bd482b660ba87d5545d4f7e" + integrity sha512-p2rOixCKRJzpg9JB4gjnG4gjWkWa89ZoYUnl9snJ1cWIcTH/hvxZqfO+WjG6T8DRBpctEol5jw1O5rA8gkCokQ== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + +"@babel/plugin-transform-typescript@^7.16.7", "@babel/plugin-transform-typescript@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.16.8.tgz#591ce9b6b83504903fa9dd3652c357c2ba7a1ee0" + integrity sha512-bHdQ9k7YpBDO2d0NVfkj51DpQcvwIzIusJ7mEUaMlbZq3Kt/U47j24inXZHQ5MDiYpCs+oZiwnXyKedE8+q7AQ== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-typescript" "^7.16.7" + "@babel/plugin-transform-unicode-escapes@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.10.4.tgz#feae523391c7651ddac115dae0a9d06857892007" @@ -1368,6 +2041,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-unicode-escapes@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz#da8717de7b3287a2c6d659750c964f302b31ece3" + integrity sha512-TAV5IGahIz3yZ9/Hfv35TV2xEm+kaBDaZQCn2S/hG9/CZ0DktxJv9eKfPc7yYCvOYR4JGx1h8C+jcSOvgaaI/Q== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-transform-unicode-regex@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.10.4.tgz#e56d71f9282fac6db09c82742055576d5e6d80a8" @@ -1382,6 +2062,14 @@ "@babel/helper-create-regexp-features-plugin" "^7.16.0" "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-unicode-regex@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.16.7.tgz#0f7aa4a501198976e25e82702574c34cfebe9ef2" + integrity sha512-oC5tYYKw56HO75KZVLQ+R/Nl3Hro9kf8iG0hXoaHP7tjAyCpvqBiSNe6vGrZni1Z6MggmUOC6A7VP7AVmw225Q== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/polyfill@7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.0.0.tgz#c8ff65c9ec3be6a1ba10113ebd40e8750fb90bff" @@ -1468,6 +2156,86 @@ core-js-compat "^3.19.1" semver "^6.3.0" +"@babel/preset-env@^7.1.6": + version "7.16.11" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.16.11.tgz#5dd88fd885fae36f88fd7c8342475c9f0abe2982" + integrity sha512-qcmWG8R7ZW6WBRPZK//y+E3Cli151B20W1Rv7ln27vuPaXU/8TKms6jFdiJtF7UDTxcrb7mZd88tAeK9LjdT8g== + dependencies: + "@babel/compat-data" "^7.16.8" + "@babel/helper-compilation-targets" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-validator-option" "^7.16.7" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.16.7" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.16.7" + "@babel/plugin-proposal-async-generator-functions" "^7.16.8" + "@babel/plugin-proposal-class-properties" "^7.16.7" + "@babel/plugin-proposal-class-static-block" "^7.16.7" + "@babel/plugin-proposal-dynamic-import" "^7.16.7" + "@babel/plugin-proposal-export-namespace-from" "^7.16.7" + "@babel/plugin-proposal-json-strings" "^7.16.7" + "@babel/plugin-proposal-logical-assignment-operators" "^7.16.7" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.16.7" + "@babel/plugin-proposal-numeric-separator" "^7.16.7" + "@babel/plugin-proposal-object-rest-spread" "^7.16.7" + "@babel/plugin-proposal-optional-catch-binding" "^7.16.7" + "@babel/plugin-proposal-optional-chaining" "^7.16.7" + "@babel/plugin-proposal-private-methods" "^7.16.11" + "@babel/plugin-proposal-private-property-in-object" "^7.16.7" + "@babel/plugin-proposal-unicode-property-regex" "^7.16.7" + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-class-properties" "^7.12.13" + "@babel/plugin-syntax-class-static-block" "^7.14.5" + "@babel/plugin-syntax-dynamic-import" "^7.8.3" + "@babel/plugin-syntax-export-namespace-from" "^7.8.3" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + "@babel/plugin-syntax-top-level-await" "^7.14.5" + "@babel/plugin-transform-arrow-functions" "^7.16.7" + "@babel/plugin-transform-async-to-generator" "^7.16.8" + "@babel/plugin-transform-block-scoped-functions" "^7.16.7" + "@babel/plugin-transform-block-scoping" "^7.16.7" + "@babel/plugin-transform-classes" "^7.16.7" + "@babel/plugin-transform-computed-properties" "^7.16.7" + "@babel/plugin-transform-destructuring" "^7.16.7" + "@babel/plugin-transform-dotall-regex" "^7.16.7" + "@babel/plugin-transform-duplicate-keys" "^7.16.7" + "@babel/plugin-transform-exponentiation-operator" "^7.16.7" + "@babel/plugin-transform-for-of" "^7.16.7" + "@babel/plugin-transform-function-name" "^7.16.7" + "@babel/plugin-transform-literals" "^7.16.7" + "@babel/plugin-transform-member-expression-literals" "^7.16.7" + "@babel/plugin-transform-modules-amd" "^7.16.7" + "@babel/plugin-transform-modules-commonjs" "^7.16.8" + "@babel/plugin-transform-modules-systemjs" "^7.16.7" + "@babel/plugin-transform-modules-umd" "^7.16.7" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.16.8" + "@babel/plugin-transform-new-target" "^7.16.7" + "@babel/plugin-transform-object-super" "^7.16.7" + "@babel/plugin-transform-parameters" "^7.16.7" + "@babel/plugin-transform-property-literals" "^7.16.7" + "@babel/plugin-transform-regenerator" "^7.16.7" + "@babel/plugin-transform-reserved-words" "^7.16.7" + "@babel/plugin-transform-shorthand-properties" "^7.16.7" + "@babel/plugin-transform-spread" "^7.16.7" + "@babel/plugin-transform-sticky-regex" "^7.16.7" + "@babel/plugin-transform-template-literals" "^7.16.7" + "@babel/plugin-transform-typeof-symbol" "^7.16.7" + "@babel/plugin-transform-unicode-escapes" "^7.16.7" + "@babel/plugin-transform-unicode-regex" "^7.16.7" + "@babel/preset-modules" "^0.1.5" + "@babel/types" "^7.16.8" + babel-plugin-polyfill-corejs2 "^0.3.0" + babel-plugin-polyfill-corejs3 "^0.5.0" + babel-plugin-polyfill-regenerator "^0.3.0" + core-js-compat "^3.20.2" + semver "^6.3.0" + "@babel/preset-env@^7.4.5": version "7.11.5" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.11.5.tgz#18cb4b9379e3e92ffea92c07471a99a2914e4272" @@ -1556,6 +2324,15 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-transform-flow-strip-types" "^7.10.4" +"@babel/preset-flow@^7.13.13": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.16.7.tgz#7fd831323ab25eeba6e4b77a589f680e30581cbd" + integrity sha512-6ceP7IyZdUYQ3wUVqyRSQXztd1YmFHWI4Xv11MIqAlE4WqxBSd/FZ61V9k+TS5Gd4mkHOtQtPp9ymRpxH4y1Ug== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-validator-option" "^7.16.7" + "@babel/plugin-transform-flow-strip-types" "^7.16.7" + "@babel/preset-modules@^0.1.3": version "0.1.4" resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.4.tgz#362f2b68c662842970fdb5e254ffc8fc1c2e415e" @@ -1598,6 +2375,15 @@ "@babel/plugin-transform-react-jsx-source" "^7.10.4" "@babel/plugin-transform-react-pure-annotations" "^7.10.4" +"@babel/preset-typescript@^7.1.0", "@babel/preset-typescript@^7.13.0", "@babel/preset-typescript@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.16.7.tgz#ab114d68bb2020afc069cd51b37ff98a046a70b9" + integrity sha512-WbVEmgXdIyvzB77AQjGBEyYPZx+8tTsO50XtfozQrkW8QB2rLJpH2lgx0TRw5EJrBxOZQ+wCcyPVQvS8tjEHpQ== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-validator-option" "^7.16.7" + "@babel/plugin-transform-typescript" "^7.16.7" + "@babel/register@7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.0.0.tgz#fa634bae1bfa429f60615b754fc1f1d745edd827" @@ -1610,6 +2396,17 @@ pirates "^4.0.0" source-map-support "^0.5.9" +"@babel/register@^7.0.0", "@babel/register@^7.13.16": + version "7.16.9" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.16.9.tgz#fcfb23cfdd9ad95c9771e58183de83b513857806" + integrity sha512-jJ72wcghdRIlENfvALcyODhNoGE5j75cYHdC+aQMh6cU/P86tiiXTp9XYZct1UxUMo/4+BgQRyNZEGx0KWGS+g== + dependencies: + clone-deep "^4.0.1" + find-cache-dir "^2.0.0" + make-dir "^2.1.0" + pirates "^4.0.0" + source-map-support "^0.5.16" + "@babel/runtime-corejs3@^7.10.2": version "7.16.3" resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.16.3.tgz#1e25de4fa994c57c18e5fdda6cc810dac70f5590" @@ -1652,6 +2449,15 @@ "@babel/parser" "^7.16.0" "@babel/types" "^7.16.0" +"@babel/template@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155" + integrity sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/parser" "^7.16.7" + "@babel/types" "^7.16.7" + "@babel/traverse@^7.1.0", "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.0", "@babel/traverse@^7.16.3": version "7.16.3" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.16.3.tgz#f63e8a938cc1b780f66d9ed3c54f532ca2d14787" @@ -1680,6 +2486,22 @@ globals "^11.1.0" lodash "^4.17.19" +"@babel/traverse@^7.16.10", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8", "@babel/traverse@^7.7.0": + version "7.16.10" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.16.10.tgz#448f940defbe95b5a8029975b051f75993e8239f" + integrity sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.16.8" + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-hoist-variables" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/parser" "^7.16.10" + "@babel/types" "^7.16.8" + debug "^4.1.0" + globals "^11.1.0" + "@babel/types@^7.0.0", "@babel/types@^7.16.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.16.0.tgz#db3b313804f96aadd0b776c4823e127ad67289ba" @@ -1695,6 +2517,14 @@ lodash "^4.17.19" to-fast-properties "^2.0.0" +"@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.7.0": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.16.8.tgz#0ba5da91dd71e0a4e7781a30f22770831062e3c1" + integrity sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -1716,6 +2546,18 @@ exec-sh "^0.3.2" minimist "^1.2.0" +"@cspotcode/source-map-consumer@0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" + integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg== + +"@cspotcode/source-map-support@0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz#4789840aa859e46d2f3173727ab707c66bf344f5" + integrity sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA== + dependencies: + "@cspotcode/source-map-consumer" "0.8.0" + "@dump247/storybook-state@1.6.1": version "1.6.1" resolved "https://registry.yarnpkg.com/@dump247/storybook-state/-/storybook-state-1.6.1.tgz#ac805dbad22bba380ae4f74e741189ec6c68cd4a" @@ -1860,6 +2702,35 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@eslint/eslintrc@^0.4.3": + version "0.4.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" + integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw== + dependencies: + ajv "^6.12.4" + debug "^4.1.1" + espree "^7.3.0" + globals "^13.9.0" + ignore "^4.0.6" + import-fresh "^3.2.1" + js-yaml "^3.13.1" + minimatch "^3.0.4" + strip-json-comments "^3.1.1" + +"@humanwhocodes/config-array@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" + integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg== + dependencies: + "@humanwhocodes/object-schema" "^1.2.0" + debug "^4.1.1" + minimatch "^3.0.4" + +"@humanwhocodes/object-schema@^1.2.0": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" + integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== + "@icons/material@^0.2.4": version "0.2.4" resolved "https://registry.yarnpkg.com/@icons/material/-/material-0.2.4.tgz#e90c9f71768b3736e76d7dd6783fc6c2afa88bc8" @@ -2402,6 +3273,7 @@ dependencies: "@storybook/client-logger" "5.3.14" "@storybook/theming" "5.3.14" + "@types/react-syntax-highlighter" "11.0.2" "@types/react-textarea-autosize" "^4.3.3" core-js "^3.0.1" global "^4.3.2" @@ -2515,6 +3387,7 @@ version "5.3.14" resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.3.14.tgz#5e4e02585b37754bbebb8810ffb17c8ce706a1f8" dependencies: + "@types/npmlog" "^4.1.2" chalk "^3.0.0" core-js "^3.0.1" npmlog "^4.1.2" @@ -2737,6 +3610,7 @@ dependencies: "@babel/code-frame" "^7.10.4" "@babel/runtime" "^7.12.5" + "@types/aria-query" "^4.2.0" aria-query "^5.0.0" chalk "^4.1.0" dom-accessibility-api "^0.5.9" @@ -2826,6 +3700,48 @@ varuint-bitcoin "^1.1.2" wif "^2.0.6" +"@ts-morph/bootstrap@^0.9.1": + version "0.9.1" + resolved "https://registry.yarnpkg.com/@ts-morph/bootstrap/-/bootstrap-0.9.1.tgz#4761cac8d9e5c7d2d7cdb120f6dda027c2b831cd" + integrity sha512-u3F2vhLm48e6lZUIf9Gj41OXCzAr62avbWdlMZ9K1JCH//XuAgr2u3c+2usGOOIXBaP83LshBTzDgw/tb9tSzg== + dependencies: + "@ts-morph/common" "~0.9.0" + +"@ts-morph/common@~0.9.0": + version "0.9.2" + resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.9.2.tgz#fc63ed4f8d3a45e4ed6849fe20a57f4f2baecc5d" + integrity sha512-IPyg+c3Am0EBoa63W0f/AKeLrJhvzMzQ4BIvD1baxLopmiHOj1HFTXYxC6e8iTZ+UYtN+/WFM9UyGRnoA20b8g== + dependencies: + fast-glob "^3.2.5" + minimatch "^3.0.4" + mkdirp "^1.0.4" + path-browserify "^1.0.1" + +"@tsconfig/node10@^1.0.7": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" + integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg== + +"@tsconfig/node12@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c" + integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw== + +"@tsconfig/node14@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" + integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== + +"@tsconfig/node16@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" + integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== + +"@types/aes-js@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@types/aes-js/-/aes-js-3.1.1.tgz#34b3978122310c135de4b377270d1d65676fae28" + integrity sha512-SDSGgXT3LRCH6qMWk8OHT1vLSVNuHNvCpKCx2/TYtQMbMGGgxJC9fspwSkQjqzRagrWnCrxuLL3jMNXLXHHvSw== + "@types/anymatch@*": version "1.3.1" resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" @@ -2901,7 +3817,7 @@ version "3.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" dependencies: - + "@types/istanbul-lib-report" "*" "@types/jest@*": version "27.0.3" @@ -2914,7 +3830,7 @@ version "7.0.6" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0" -"@types/json-schema@^7.0.7": +"@types/json-schema@^7.0.7", "@types/json-schema@^7.0.9": version "7.0.9" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" @@ -2966,6 +3882,11 @@ version "14.17.4" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.4.tgz#218712242446fc868d0e007af29a4408c7765bc0" +"@types/node@^17.0.13": + version "17.0.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.13.tgz#5ed7ed7c662948335fcad6c412bb42d99ea754e3" + integrity sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw== + "@types/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" @@ -2994,6 +3915,13 @@ version "1.5.4" resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24" +"@types/qrcode.react@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/qrcode.react/-/qrcode.react-1.0.2.tgz#f892432cc41b5dac52e3ca8873b717c8bfea6002" + integrity sha512-I9Oq5Cjlkgy3Tw7krCnCXLw2/zMhizkTere49OOcta23tkvH0xBTP0yInimTh0gstLRtb8Ki9NZVujE5UI6ffQ== + dependencies: + "@types/react" "*" + "@types/reach__router@^1.2.3": version "1.3.6" resolved "https://registry.yarnpkg.com/@types/reach__router/-/reach__router-1.3.6.tgz#413417ce74caab331c70ce6a03a4c825188e4709" @@ -3006,6 +3934,14 @@ resolved "https://registry.yarnpkg.com/@types/react-color/-/react-color-3.0.4.tgz#c63daf012ad067ac0127bdd86725f079d02082bd" dependencies: "@types/react" "*" + "@types/reactcss" "*" + +"@types/react-svg-inline@^2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@types/react-svg-inline/-/react-svg-inline-2.1.3.tgz#e76f2141de6a92c66597b81475255d86efd99d76" + integrity sha512-scD7jZaLmLrjwnHzfKdYG3omgETHMh3WKYqkNpLP8peBaviBIcdhvWWQFv/0jQOenB4U8ncKD5l8cL6gb4ZKxQ== + dependencies: + "@types/react" "*" "@types/react-textarea-autosize@^4.3.3": version "4.3.5" @@ -3020,12 +3956,26 @@ "@types/prop-types" "*" csstype "^3.0.2" +"@types/react@^17.0.38": + version "17.0.38" + resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.38.tgz#f24249fefd89357d5fa71f739a686b8d7c7202bd" + integrity sha512-SI92X1IA+FMnP3qM5m4QReluXzhcmovhZnLNm3pyeQlooi02qI7sLiepEYqT678uNiyc25XfCqxREFpy3W7YhQ== + dependencies: + "@types/prop-types" "*" + "@types/scheduler" "*" + csstype "^3.0.2" + "@types/responselike@*", "@types/responselike@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz#251f4fe7d154d2bad125abe1b429b23afd262e29" dependencies: "@types/node" "*" +"@types/scheduler@*": + version "0.16.2" + resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" + integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew== + "@types/source-list-map@*": version "0.1.2" resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" @@ -3067,6 +4017,7 @@ "@types/anymatch" "*" "@types/node" "*" "@types/tapable" "*" + "@types/uglify-js" "*" "@types/webpack-sources" "*" source-map "^0.6.0" @@ -3102,6 +4053,21 @@ dependencies: "@types/node" "*" +"@typescript-eslint/eslint-plugin@^5.10.1": + version "5.10.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.1.tgz#870195d0f2146b36d11fc71131b75aba52354c69" + integrity sha512-xN3CYqFlyE/qOcy978/L0xLR2HlcAGIyIK5sMOasxaaAPfQRj/MmMV6OC3I7NZO84oEUdWCOju34Z9W8E0pFDQ== + dependencies: + "@typescript-eslint/scope-manager" "5.10.1" + "@typescript-eslint/type-utils" "5.10.1" + "@typescript-eslint/utils" "5.10.1" + debug "^4.3.2" + functional-red-black-tree "^1.0.1" + ignore "^5.1.8" + regexpp "^3.2.0" + semver "^7.3.5" + tsutils "^3.21.0" + "@typescript-eslint/experimental-utils@^4.0.1": version "4.33.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz#6f2a786a4209fa2222989e9380b5331b2810f7fd" @@ -3113,6 +4079,16 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" +"@typescript-eslint/parser@^5.10.1": + version "5.10.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.10.1.tgz#4ce9633cc33fc70bc13786cb793c1a76fe5ad6bd" + integrity sha512-GReo3tjNBwR5RnRO0K2wDIDN31cM3MmDtgyQ85oAxAmC5K3j/g85IjP+cDfcqDsDDBf1HNKQAD0WqOYL8jXqUA== + dependencies: + "@typescript-eslint/scope-manager" "5.10.1" + "@typescript-eslint/types" "5.10.1" + "@typescript-eslint/typescript-estree" "5.10.1" + debug "^4.3.2" + "@typescript-eslint/scope-manager@4.33.0": version "4.33.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz#d38e49280d983e8772e29121cf8c6e9221f280a3" @@ -3120,10 +4096,32 @@ "@typescript-eslint/types" "4.33.0" "@typescript-eslint/visitor-keys" "4.33.0" +"@typescript-eslint/scope-manager@5.10.1": + version "5.10.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.10.1.tgz#f0539c73804d2423506db2475352a4dec36cd809" + integrity sha512-Lyvi559Gvpn94k7+ElXNMEnXu/iundV5uFmCUNnftbFrUbAJ1WBoaGgkbOBm07jVZa682oaBU37ao/NGGX4ZDg== + dependencies: + "@typescript-eslint/types" "5.10.1" + "@typescript-eslint/visitor-keys" "5.10.1" + +"@typescript-eslint/type-utils@5.10.1": + version "5.10.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.10.1.tgz#5e526c00142585e40ab1503e83f1ff608c367405" + integrity sha512-AfVJkV8uck/UIoDqhu+ptEdBoQATON9GXnhOpPLzkQRJcSChkvD//qsz9JVffl2goxX+ybs5klvacE9vmrQyCw== + dependencies: + "@typescript-eslint/utils" "5.10.1" + debug "^4.3.2" + tsutils "^3.21.0" + "@typescript-eslint/types@4.33.0": version "4.33.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72" +"@typescript-eslint/types@5.10.1": + version "5.10.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.1.tgz#dca9bd4cb8c067fc85304a31f38ec4766ba2d1ea" + integrity sha512-ZvxQ2QMy49bIIBpTqFiOenucqUyjTQ0WNLhBM6X1fh1NNlYAC6Kxsx8bRTY3jdYsYg44a0Z/uEgQkohbR0H87Q== + "@typescript-eslint/typescript-estree@4.33.0": version "4.33.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz#0dfb51c2908f68c5c08d82aefeaf166a17c24609" @@ -3136,6 +4134,31 @@ semver "^7.3.5" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.10.1": + version "5.10.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.1.tgz#b268e67be0553f8790ba3fe87113282977adda15" + integrity sha512-PwIGnH7jIueXv4opcwEbVGDATjGPO1dx9RkUl5LlHDSe+FXxPwFL5W/qYd5/NHr7f6lo/vvTrAzd0KlQtRusJQ== + dependencies: + "@typescript-eslint/types" "5.10.1" + "@typescript-eslint/visitor-keys" "5.10.1" + debug "^4.3.2" + globby "^11.0.4" + is-glob "^4.0.3" + semver "^7.3.5" + tsutils "^3.21.0" + +"@typescript-eslint/utils@5.10.1": + version "5.10.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.10.1.tgz#fa682a33af47080ba2c4368ee0ad2128213a1196" + integrity sha512-RRmlITiUbLuTRtn/gcPRi4202niF+q7ylFLCKu4c+O/PcpRvZ/nAUwQ2G00bZgpWkhrNLNnvhZLbDn8Ml0qsQw== + dependencies: + "@types/json-schema" "^7.0.9" + "@typescript-eslint/scope-manager" "5.10.1" + "@typescript-eslint/types" "5.10.1" + "@typescript-eslint/typescript-estree" "5.10.1" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + "@typescript-eslint/visitor-keys@4.33.0": version "4.33.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz#2a22f77a41604289b7a186586e9ec48ca92ef1dd" @@ -3143,6 +4166,14 @@ "@typescript-eslint/types" "4.33.0" eslint-visitor-keys "^2.0.0" +"@typescript-eslint/visitor-keys@5.10.1": + version "5.10.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.1.tgz#29102de692f59d7d34ecc457ed59ab5fc558010b" + integrity sha512-NjQ0Xinhy9IL979tpoTRuLKxMc0zJC7QVSdeerXs2/QvOy2yRkzX5dRb10X5woNUdJgU8G3nYRDlI33sq1K4YQ== + dependencies: + "@typescript-eslint/types" "5.10.1" + eslint-visitor-keys "^3.0.0" + "@wdio/config@5.18.4": version "5.18.4" resolved "https://registry.yarnpkg.com/@wdio/config/-/config-5.18.4.tgz#cabbac2f42bb1f8ac768f79d0e7671976d97d30e" @@ -3385,6 +4416,11 @@ acorn-jsx@^5.2.0: version "5.3.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" +acorn-jsx@^5.3.1: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + acorn-node@^1.3.0: version "1.8.2" resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.8.2.tgz#114c95d64539e53dede23de8b9d96df7c7ae2af8" @@ -3397,7 +4433,12 @@ acorn-walk@^7.0.0, acorn-walk@^7.1.1: version "7.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" -acorn@6.4.2, acorn@^4.0.4, acorn@^6.4.1, acorn@^7.0.0, acorn@^7.1.1, acorn@^7.4.0, acorn@^8.2.4: +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + +acorn@6.4.2, acorn@^4.0.4, acorn@^6.4.1, acorn@^7.0.0, acorn@^7.1.1, acorn@^7.4.0, acorn@^8.2.4, acorn@^8.4.1: version "6.4.2" resolved "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" @@ -3484,6 +4525,16 @@ ajv@^8.0.0: require-from-string "^2.0.2" uri-js "^4.2.2" +ajv@^8.0.1: + version "8.9.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.9.0.tgz#738019146638824dea25edcf299dcba1b0e7eb18" + integrity sha512-qOKJyNj/h+OWx7s5DePL6Zu1KeM9jPZhwBqs+7DzP6bGOvqzVCSf0xueYmVuaC/oQ/VtS2zLMLHdQFbkka+XDQ== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + ajv@^8.6.3: version "8.8.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.8.2.tgz#01b4fef2007a28bf75f0b7fc009f62679de4abbb" @@ -3693,6 +4744,11 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -3964,6 +5020,18 @@ ast-types@0.11.3: version "0.11.3" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.3.tgz#c20757fe72ee71278ea0ff3d87e5c2ca30d9edf8" +ast-types@0.11.7: + version "0.11.7" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.7.tgz#f318bf44e339db6a320be0009ded64ec1471f46c" + integrity sha512-2mP3TwtkY/aTv5X3ZsMpNAbOnyoC/aMJwJSoaELPkHId0nSQgFcnU4dRW3isxiz7+zBexk0ym3WNVjMiQBnJSw== + +ast-types@0.14.2: + version "0.14.2" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.14.2.tgz#600b882df8583e3cd4f2df5fa20fa83759d4bdfd" + integrity sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA== + dependencies: + tslib "^2.0.1" + ast-types@0.9.6: version "0.9.6" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9" @@ -4124,6 +5192,23 @@ babel-core@^6.0.0, babel-core@^6.26.0: slash "^1.0.0" source-map "^0.5.7" +babel-core@^7.0.0-bridge.0: + version "7.0.0-bridge.0" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" + integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== + +babel-eslint@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" + integrity sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.7.0" + "@babel/traverse" "^7.7.0" + "@babel/types" "^7.7.0" + eslint-visitor-keys "^1.0.0" + resolve "^1.12.0" + babel-generator@^6.18.0, babel-generator@^6.26.0: version "6.26.1" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" @@ -4357,6 +5442,14 @@ babel-plugin-polyfill-corejs3@^0.4.0: "@babel/helper-define-polyfill-provider" "^0.3.0" core-js-compat "^3.18.0" +babel-plugin-polyfill-corejs3@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.1.tgz#d66183bf10976ea677f4149a7fcc4d8df43d4060" + integrity sha512-TihqEe4sQcb/QcPJvxe94/9RZuLQuF1+To4WqQcRvc+3J3gLCPIPgDKzGLG6zmQLfH3nn25heRuDNkS2KR4I8A== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.3.1" + core-js-compat "^3.20.0" + babel-plugin-polyfill-regenerator@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.0.tgz#9ebbcd7186e1a33e21c5e20cae4e7983949533be" @@ -4947,6 +6040,17 @@ browserslist@^4.17.5, browserslist@^4.18.1: node-releases "^2.0.1" picocolors "^1.0.0" +browserslist@^4.19.1: + version "4.19.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.19.1.tgz#4ac0435b35ab655896c31d53018b6dd5e9e4c9a3" + integrity sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A== + dependencies: + caniuse-lite "^1.0.30001286" + electron-to-chromium "^1.4.17" + escalade "^3.1.1" + node-releases "^2.0.1" + picocolors "^1.0.0" + bs58@4.0.1, bs58@^4.0.0, bs58@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" @@ -5253,6 +6357,11 @@ caniuse-lite@^1.0.30001280: version "1.0.30001283" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001283.tgz#8573685bdae4d733ef18f78d44ba0ca5fe9e896b" +caniuse-lite@^1.0.30001286: + version "1.0.30001304" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001304.tgz#38af55ed3fc8220cb13e35e6e7309c8c65a05559" + integrity sha512-bdsfZd6K6ap87AGqSHJP/s1V+U6Z5lyrcbBu3ovbCCf8cSYpwTtGrCBObMpJqwxfTbLW6YTIdbb1jEeTelcpYQ== + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -5355,7 +6464,7 @@ chalk@4.1.0, chalk@^4.0.0, chalk@^4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@4.1.2: +chalk@4.1.2, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" dependencies: @@ -5632,6 +6741,15 @@ clone-deep@^2.0.1: kind-of "^6.0.0" shallow-clone "^1.0.0" +clone-deep@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" + clone-regexp@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clone-regexp/-/clone-regexp-2.2.0.tgz#7d65e00885cd8796405c35a737e7a86b7429e36f" @@ -5968,6 +7086,14 @@ core-js-compat@^3.18.0, core-js-compat@^3.19.1: browserslist "^4.18.1" semver "7.0.0" +core-js-compat@^3.20.0, core-js-compat@^3.20.2: + version "3.20.3" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.20.3.tgz#d71f85f94eb5e4bea3407412e549daa083d23bd6" + integrity sha512-c8M5h0IkNZ+I92QhIpuSijOxGAcj3lgpsWdkCqmUTZNwidujF4r3pi6x1DCN+Vcs5qTS2XWWMfWSuCqyupX8gw== + dependencies: + browserslist "^4.19.1" + semver "7.0.0" + core-js-compat@^3.6.2: version "3.6.5" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.5.tgz#2a51d9a4e25dfd6e690251aa81f99e3c05481f1c" @@ -6019,6 +7145,7 @@ cosmiconfig@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982" dependencies: + "@types/parse-json" "^4.0.0" import-fresh "^3.1.0" parse-json "^5.0.0" path-type "^4.0.0" @@ -6028,6 +7155,7 @@ cosmiconfig@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3" dependencies: + "@types/parse-json" "^4.0.0" import-fresh "^3.2.1" parse-json "^5.0.0" path-type "^4.0.0" @@ -6088,6 +7216,15 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" +create-jest-runner@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/create-jest-runner/-/create-jest-runner-0.5.3.tgz#1387e2ce70b08e4c989ae55f677005b64f9ba97b" + integrity sha512-a9VY2doMBmzRollJB3Ft3/Y5fBceSWJ4gdyVsg4/d7nP1S4715VG939s2VnITDj79YBmRgKhjGjNRv1c+Kre1g== + dependencies: + chalk "^2.4.2" + jest-worker "^24.0.0" + throat "^4.1.0" + create-react-context@0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/create-react-context/-/create-react-context-0.2.2.tgz#9836542f9aaa22868cd7d4a6f82667df38019dca" @@ -6102,6 +7239,11 @@ create-react-context@0.3.0, create-react-context@^0.3.0: gud "^1.0.0" warning "^4.0.3" +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + cross-env@7.0.2: version "7.0.2" resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.2.tgz#bd5ed31339a93a3418ac4f3ca9ca3403082ae5f9" @@ -6543,7 +7685,7 @@ debug@^3.2.7: dependencies: ms "^2.1.1" -debug@^4.3.1: +debug@^4.3.1, debug@^4.3.2: version "4.3.3" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" dependencies: @@ -7180,6 +8322,11 @@ electron-to-chromium@^1.3.896: version "1.4.4" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.4.tgz#57311918524c1a26878c330537f967804d43788a" +electron-to-chromium@^1.4.17: + version "1.4.57" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.57.tgz#2b2766df76ac8dbc0a1d41249bc5684a31849892" + integrity sha512-FNC+P5K1n6pF+M0zIK+gFCoXcJhhzDViL3DRIGy2Fv5PohuSES1JHR7T+GlwxSxlzx4yYbsuzCZvHxcBSRCIOw== + electron@13.6.3: version "13.6.3" resolved "https://registry.yarnpkg.com/electron/-/electron-13.6.3.tgz#c0217178807d3e0b2175c49dbe33ea8dac447e73" @@ -7705,7 +8852,7 @@ eslint-utils@^3.0.0: dependencies: eslint-visitor-keys "^2.0.0" -eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: +eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" @@ -7713,6 +8860,11 @@ eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" +eslint-visitor-keys@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz#6fbb166a6798ee5991358bc2daa1ba76cc1254a1" + integrity sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ== + eslint@7.10.0: version "7.10.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.10.0.tgz#494edb3e4750fb791133ca379e786a8f648c72b9" @@ -7755,6 +8907,52 @@ eslint@7.10.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" +eslint@^7.14.0: + version "7.32.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" + integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== + dependencies: + "@babel/code-frame" "7.12.11" + "@eslint/eslintrc" "^0.4.3" + "@humanwhocodes/config-array" "^0.5.0" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.0.1" + doctrine "^3.0.0" + enquirer "^2.3.5" + escape-string-regexp "^4.0.0" + eslint-scope "^5.1.1" + eslint-utils "^2.1.0" + eslint-visitor-keys "^2.0.0" + espree "^7.3.1" + esquery "^1.4.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.1.2" + globals "^13.6.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.0.4" + natural-compare "^1.4.0" + optionator "^0.9.1" + progress "^2.0.0" + regexpp "^3.1.0" + semver "^7.2.1" + strip-ansi "^6.0.0" + strip-json-comments "^3.1.0" + table "^6.0.9" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + esm@3.2.25, esm@^3.2.25: version "3.2.25" resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" @@ -7767,6 +8965,15 @@ espree@^7.3.0: acorn-jsx "^5.2.0" eslint-visitor-keys "^1.3.0" +espree@^7.3.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" + integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== + dependencies: + acorn "^7.4.0" + acorn-jsx "^5.3.1" + eslint-visitor-keys "^1.3.0" + esprima@^3.1.3, esprima@~3.1.0: version "3.1.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" @@ -7785,6 +8992,13 @@ esquery@^1.2.0: dependencies: estraverse "^5.1.0" +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== + dependencies: + estraverse "^5.1.0" + esrecurse@^4.1.0, esrecurse@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" @@ -8082,7 +9296,7 @@ fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" -fast-deep-equal@^3.1.1: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -8108,6 +9322,17 @@ fast-glob@^3.1.1, fast-glob@^3.2.4: micromatch "^4.0.2" picomatch "^2.2.1" +fast-glob@^3.2.5, fast-glob@^3.2.9: + version "3.2.11" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" + integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -8234,6 +9459,13 @@ file-entry-cache@^5.0.1: dependencies: flat-cache "^2.0.1" +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + file-loader@4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-4.2.0.tgz#5fb124d2369d7075d70a9a5abecd12e60a95215e" @@ -8320,7 +9552,7 @@ find-cache-dir@^1.0.0: make-dir "^1.0.0" pkg-dir "^2.0.0" -find-cache-dir@^2.1.0: +find-cache-dir@^2.0.0, find-cache-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" dependencies: @@ -8438,10 +9670,23 @@ flat-cache@^2.0.1: rimraf "2.6.3" write "1.0.3" +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + dependencies: + flatted "^3.1.0" + rimraf "^3.0.2" + flatted@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" +flatted@^3.1.0: + version "3.2.5" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3" + integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== + flora-colossus@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/flora-colossus/-/flora-colossus-1.0.1.tgz#aba198425a8185341e64f9d2a6a96fd9a3cbdb93" @@ -8453,6 +9698,11 @@ flow-bin@0.119.1: version "0.119.1" resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.119.1.tgz#b6d763b386ec9f1085848ca7df98909d80a16bd0" +flow-parser@0.*: + version "0.170.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.170.0.tgz#52cac19fd884c41894f39368bdf384183a597b3b" + integrity sha512-H1Fu8EM/F6MtOpHYpsFXPyySatowrXMWENxRmmKAfirfBr8kjHrms3YDuv82Nhn0xWaXV7Hhynp2tEaZsLhHLw== + flow-remove-types@^1.2.1: version "1.2.3" resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-1.2.3.tgz#6131aefc7da43364bb8b479758c9dec7735d1a18" @@ -8890,7 +10140,7 @@ glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@~5.1.0: dependencies: is-glob "^4.0.1" -glob-parent@~5.1.2: +glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" dependencies: @@ -9065,6 +10315,13 @@ globals@^12.1.0: dependencies: type-fest "^0.8.1" +globals@^13.6.0, globals@^13.9.0: + version "13.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.12.0.tgz#4d733760304230a0082ed96e21e5c565f898089e" + integrity sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg== + dependencies: + type-fest "^0.20.2" + globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -9109,6 +10366,18 @@ globby@^11.0.3: merge2 "^1.3.0" slash "^3.0.0" +globby@^11.0.4: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + globby@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" @@ -9598,6 +10867,7 @@ html-webpack-plugin@^4.0.0-beta.2: version "4.5.0" resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.5.0.tgz#625097650886b97ea5dae331c320e3238f6c121c" dependencies: + "@types/html-minifier-terser" "^5.0.0" "@types/tapable" "^1.0.5" "@types/webpack" "^4.41.8" html-minifier-terser "^5.0.1" @@ -9773,6 +11043,11 @@ ignore@^5.1.4, ignore@^5.1.8: version "5.1.8" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" +ignore@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" + integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== + immediate@~3.0.5: version "3.0.6" resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" @@ -10219,6 +11494,13 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: dependencies: is-extglob "^2.1.1" +is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + is-hexadecimal@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz#cc35c97588da4bd49a8eedd6bc4082d44dcb23a7" @@ -11177,6 +12459,14 @@ jest-watcher@^26.6.2: jest-util "^26.6.2" string-length "^4.0.1" +jest-worker@^24.0.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" + integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== + dependencies: + merge-stream "^2.0.0" + supports-color "^6.1.0" + jest-worker@^25.4.0: version "25.5.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-25.5.0.tgz#2611d071b79cea0f43ee57a3d118593ac1547db1" @@ -11233,6 +12523,55 @@ jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" +jscodeshift@^0.13.0: + version "0.13.1" + resolved "https://registry.yarnpkg.com/jscodeshift/-/jscodeshift-0.13.1.tgz#69bfe51e54c831296380585c6d9e733512aecdef" + integrity sha512-lGyiEbGOvmMRKgWk4vf+lUrCWO/8YR8sUR3FKF1Cq5fovjZDlIcw3Hu5ppLHAnEXshVffvaM0eyuY/AbOeYpnQ== + dependencies: + "@babel/core" "^7.13.16" + "@babel/parser" "^7.13.16" + "@babel/plugin-proposal-class-properties" "^7.13.0" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.13.8" + "@babel/plugin-proposal-optional-chaining" "^7.13.12" + "@babel/plugin-transform-modules-commonjs" "^7.13.8" + "@babel/preset-flow" "^7.13.13" + "@babel/preset-typescript" "^7.13.0" + "@babel/register" "^7.13.16" + babel-core "^7.0.0-bridge.0" + chalk "^4.1.2" + flow-parser "0.*" + graceful-fs "^4.2.4" + micromatch "^3.1.10" + neo-async "^2.5.0" + node-dir "^0.1.17" + recast "^0.20.4" + temp "^0.8.4" + write-file-atomic "^2.3.0" + +jscodeshift@^0.6.3: + version "0.6.4" + resolved "https://registry.yarnpkg.com/jscodeshift/-/jscodeshift-0.6.4.tgz#e19ab86214edac86a75c4557fc88b3937d558a8e" + integrity sha512-+NF/tlNbc2WEhXUuc4WEJLsJumF84tnaMUZW2hyJw3jThKKRvsPX4sPJVgO1lPE28z0gNL+gwniLG9d8mYvQCQ== + dependencies: + "@babel/core" "^7.1.6" + "@babel/parser" "^7.1.6" + "@babel/plugin-proposal-class-properties" "^7.1.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/preset-env" "^7.1.6" + "@babel/preset-flow" "^7.0.0" + "@babel/preset-typescript" "^7.1.0" + "@babel/register" "^7.0.0" + babel-core "^7.0.0-bridge.0" + colors "^1.1.2" + flow-parser "0.*" + graceful-fs "^4.1.11" + micromatch "^3.1.10" + neo-async "^2.5.0" + node-dir "^0.1.17" + recast "^0.16.1" + temp "^0.8.1" + write-file-atomic "^2.3.0" + jsdom@^16.4.0: version "16.7.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.7.0.tgz#918ae71965424b197c819f8183a754e18977b710" @@ -11339,6 +12678,11 @@ json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" +json-schema@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.3.0.tgz#90a9c5054bd065422c00241851ce8d59475b701b" + integrity sha512-TYfxx36xfl52Rf1LU9HyWSLGPdYLL+SQ8/E/0yVyKG8wCCDaSrhPap0vEdlsZWRaS6tnKKLPGiEJGiREVC8kxQ== + json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" @@ -11369,6 +12713,13 @@ json3@^3.3.2: version "3.3.3" resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81" +json5-writer@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/json5-writer/-/json5-writer-0.1.8.tgz#98e1934ef6002f8ac12f36438e2b39c49af213fd" + integrity sha512-h5sqkk/vSKvESOUTBniGWs8p8nTzHsoDrxPS9enJfQVINqXv3lm+FAyizLwbrCwCn0q7NXqDBb+r8AdUdK3XZw== + dependencies: + jscodeshift "^0.6.3" + json5@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" @@ -11862,7 +13213,7 @@ lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" -lodash.merge@^4.6.1: +lodash.merge@^4.6.1, lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" @@ -11920,6 +13271,11 @@ lodash.toarray@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561" +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" + integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= + lodash.union@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88" @@ -11945,6 +13301,15 @@ log-symbols@^4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" +log-update@^3.3.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-3.4.0.tgz#3b9a71e00ac5b1185cc193a36d654581c48f97b9" + integrity sha512-ILKe88NeMt4gmDvk/eb615U/IVn7K9KWGkoYbdatQ69Z65nj1ZzjM6fHXfcs0Uge+e+EGnMW7DY4T9yko8vWFg== + dependencies: + ansi-escapes "^3.2.0" + cli-cursor "^2.1.0" + wrap-ansi "^5.0.0" + loglevel-plugin-prefix@^0.8.4: version "0.8.4" resolved "https://registry.yarnpkg.com/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.8.4.tgz#2fe0e05f1a820317d98d8c123e634c1bd84ff644" @@ -12068,6 +13433,11 @@ make-dir@^3.0.0, make-dir@^3.0.2: dependencies: semver "^6.0.0" +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + make-iterator@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" @@ -12246,6 +13616,7 @@ meow@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/meow/-/meow-7.1.1.tgz#7c01595e3d337fcb0ec4e8eed1666ea95903d306" dependencies: + "@types/minimist" "^1.2.0" camelcase-keys "^6.2.2" decamelize-keys "^1.1.0" hard-rejection "^2.1.0" @@ -12279,7 +13650,7 @@ merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" -merge2@^1.2.3, merge2@^1.3.0: +merge2@^1.2.3, merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" @@ -12338,6 +13709,14 @@ micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" +micromatch@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" + integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== + dependencies: + braces "^3.0.1" + picomatch "^2.2.3" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" @@ -12518,7 +13897,7 @@ mkdirp@0.5.5, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkd dependencies: minimist "^1.2.5" -mkdirp@1.0.4, mkdirp@^1.0.3: +mkdirp@1.0.4, mkdirp@^1.0.3, mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" @@ -12724,7 +14103,7 @@ node-addon-api@^3.0.0, node-addon-api@^3.0.2: version "3.2.1" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" -node-dir@^0.1.10: +node-dir@^0.1.10, node-dir@^0.1.17: version "0.1.17" resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5" dependencies: @@ -13511,6 +14890,11 @@ parse-json@^5.0.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" +parse-ms@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/parse-ms/-/parse-ms-2.1.0.tgz#348565a753d4391fa524029956b172cb7753097d" + integrity sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA== + parse-node-version@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b" @@ -13550,6 +14934,11 @@ path-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" +path-browserify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" + integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== + path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" @@ -13688,6 +15077,11 @@ picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" +picomatch@^2.2.3: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -14119,6 +15513,13 @@ pretty-hrtime@^1.0.0, pretty-hrtime@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" +pretty-ms@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-7.0.1.tgz#7d903eaab281f7d8e03c66f867e239dc32fb73e8" + integrity sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q== + dependencies: + parse-ms "^2.1.0" + pretty-quick@3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-3.0.2.tgz#7ed460f7e43a647b1044ad8b7f41a0c8a7f1c51c" @@ -15118,6 +16519,26 @@ recast@^0.14.7: private "~0.1.5" source-map "~0.6.1" +recast@^0.16.1: + version "0.16.2" + resolved "https://registry.yarnpkg.com/recast/-/recast-0.16.2.tgz#3796ebad5fe49ed85473b479cd6df554ad725dc2" + integrity sha512-O/7qXi51DPjRVdbrpNzoBQH5dnAPQNbfoOFyRiUwreTMJfIHYOEBzwuH+c0+/BTSJ3CQyKs6ILSWXhESH6Op3A== + dependencies: + ast-types "0.11.7" + esprima "~4.0.0" + private "~0.1.5" + source-map "~0.6.1" + +recast@^0.20.4: + version "0.20.5" + resolved "https://registry.yarnpkg.com/recast/-/recast-0.20.5.tgz#8e2c6c96827a1b339c634dd232957d230553ceae" + integrity sha512-E5qICoPoNL4yU0H0NoBDntNB0Q5oMSNh9usFctYniLBluTthi3RsQVBXIJNbApOlvSwW/RGxIuokPcAc59J5fQ== + dependencies: + ast-types "0.14.2" + esprima "~4.0.0" + source-map "~0.6.1" + tslib "^2.0.1" + recast@~0.11.12: version "0.11.23" resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.23.tgz#451fd3004ab1e4df9b4e4b66376b2a21912462d3" @@ -15263,6 +16684,11 @@ regexpp@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" +regexpp@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== + regexpu-core@^4.7.0: version "4.7.1" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.7.1.tgz#2dea5a9a07233298fbf0db91fa9abc4c6e0f8ad6" @@ -15629,7 +17055,7 @@ rimraf@2, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3, rimraf@^2. dependencies: glob "^7.1.3" -rimraf@2.6.3: +rimraf@2.6.3, rimraf@~2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" dependencies: @@ -16069,6 +17495,13 @@ shallow-clone@^1.0.0: kind-of "^5.0.0" mixin-object "^2.0.1" +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + shallow-copy@~0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/shallow-copy/-/shallow-copy-0.0.1.tgz#415f42702d73d810330292cc5ee86eae1a11a170" @@ -16295,7 +17728,7 @@ source-map-support@^0.4.15: dependencies: source-map "^0.5.6" -source-map-support@^0.5.6: +source-map-support@^0.5.16, source-map-support@^0.5.6: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" dependencies: @@ -16657,6 +18090,15 @@ string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + "string.prototype.matchall@^4.0.0 || ^3.0.1", string.prototype.matchall@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.2.tgz#48bb510326fb9fdeb6a33ceaa81a6ea04ef7648e" @@ -16760,6 +18202,13 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-bom@3.0.0, strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" @@ -17011,6 +18460,17 @@ table@^6.0.1: slice-ansi "^4.0.0" string-width "^4.2.0" +table@^6.0.9: + version "6.8.0" + resolved "https://registry.yarnpkg.com/table/-/table-6.8.0.tgz#87e28f14fa4321c3377ba286f07b79b281a3b3ca" + integrity sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA== + dependencies: + ajv "^8.0.1" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + tapable@^0.1.8: version "0.1.10" resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.1.10.tgz#29c35707c2b70e50d07482b5d202e8ed446dafd4" @@ -17087,6 +18547,13 @@ telejson@^3.2.0: lodash "^4.17.15" memoizerific "^1.11.3" +temp@^0.8.1, temp@^0.8.4: + version "0.8.4" + resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.4.tgz#8c97a33a4770072e0a05f919396c7665a7dd59f2" + integrity sha512-s0ZZzd0BzYv5tLSptZooSjK8oj6C+c19p7Vqta9+6NPOf7r+fxq0cJe6/oN4LTC79sy5NY8ucOJNgwsKCSbfqg== + dependencies: + rimraf "~2.6.2" + term-size@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.2.0.tgz#1f16adedfe9bdc18800e1776821734086fcc6753" @@ -17180,6 +18647,11 @@ throat@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/throat/-/throat-3.2.0.tgz#50cb0670edbc40237b9e347d7e1f88e4620af836" +throat@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= + throat@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" @@ -17509,6 +18981,56 @@ ts-essentials@^2.0.3: version "2.0.12" resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-2.0.12.tgz#c9303f3d74f75fa7528c3d49b80e089ab09d8745" +ts-migrate-plugins@^0.1.27: + version "0.1.27" + resolved "https://registry.yarnpkg.com/ts-migrate-plugins/-/ts-migrate-plugins-0.1.27.tgz#e7244d1d56661e51b07258944cede065bd0605f4" + integrity sha512-+pDSRA2lCS7k0wvSB0oDDO+FMqGrsXMKkYYAvK2HuLpzsO1EwVZ5mPjZpidr2yCfXOxkkT87zjiBf7uEXqfB0w== + dependencies: + eslint "^7.14.0" + jscodeshift "^0.13.0" + json-schema "^0.3.0" + ts-migrate-server "^0.1.27" + +ts-migrate-server@^0.1.27: + version "0.1.27" + resolved "https://registry.yarnpkg.com/ts-migrate-server/-/ts-migrate-server-0.1.27.tgz#daa95b01634a651f4dd5ff90d35b93791e564905" + integrity sha512-sDcrBx2oUL/Ycs3YNwqMz5KxPtNjwMIDGpVbvuxDkVXDG+ly4tyF+tc5byQzKpVGx2mI+ccxrX8VG74wICTJlg== + dependencies: + "@ts-morph/bootstrap" "^0.9.1" + pretty-ms "^7.0.1" + updatable-log "^0.2.0" + +ts-migrate@^0.1.27: + version "0.1.27" + resolved "https://registry.yarnpkg.com/ts-migrate/-/ts-migrate-0.1.27.tgz#4b21f6eedcb33734579afd29df781cab994387c0" + integrity sha512-nwZwLfCX635Fiaw5JKB0bQjNvbLfeA+010+n00KnIu5/I9s8CbypJ6b49wFyTdZCnIYklh8n/JxcTQIodTHAqQ== + dependencies: + create-jest-runner "^0.5.3" + json5 "^2.1.1" + json5-writer "^0.1.8" + ts-migrate-plugins "^0.1.27" + ts-migrate-server "^0.1.27" + updatable-log "^0.2.0" + yargs "^15.0.2" + +ts-node@^10.4.0: + version "10.4.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.4.0.tgz#680f88945885f4e6cf450e7f0d6223dd404895f7" + integrity sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A== + dependencies: + "@cspotcode/source-map-support" "0.7.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + yn "3.1.1" + ts-pnp@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" @@ -17645,6 +19167,11 @@ typeforce@^1.18.0: version "1.18.0" resolved "https://registry.yarnpkg.com/typeforce/-/typeforce-1.18.0.tgz#d7416a2c5845e085034d70fcc5b6cc4a90edbfdc" +typescript@^4.5.5: + version "4.5.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" + integrity sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA== + ua-parser-js@^0.7.18: version "0.7.27" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.27.tgz#b54f8ce9eb6c7abf3584edeaf9a3d8b3bd92edba" @@ -17950,6 +19477,15 @@ upath@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" +updatable-log@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/updatable-log/-/updatable-log-0.2.0.tgz#8adfe35dd744bd87e8bf217425e4e8bb81b6f3c6" + integrity sha512-gR48/mTR6YFB+B1sNoap3nx8HFbEvDl0ej9KhlQTFZdmP8yL5fzFiCUfeHCUf1QvNnXowY1pM9iiGkPKrd0XyQ== + dependencies: + chalk "^2.4.2" + figures "^3.0.0" + log-update "^3.3.0" + update-notifier@^4.0.0: version "4.1.3" resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-4.1.3.tgz#be86ee13e8ce48fb50043ff72057b5bd598e1ea3" @@ -18676,7 +20212,7 @@ wrap-ansi@^2.0.0: string-width "^1.0.1" strip-ansi "^3.0.1" -wrap-ansi@^5.1.0: +wrap-ansi@^5.0.0, wrap-ansi@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" dependencies: @@ -18696,6 +20232,15 @@ wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" +write-file-atomic@^2.3.0: + version "2.4.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" + integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + write-file-atomic@^3.0.0, write-file-atomic@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" @@ -18819,7 +20364,7 @@ yargs@^13.3.0, yargs@^13.3.2: y18n "^4.0.0" yargs-parser "^13.1.2" -yargs@^15.4.1: +yargs@^15.0.2, yargs@^15.4.1: version "15.4.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" dependencies: @@ -18866,6 +20411,11 @@ yauzl@^2.10.0: buffer-crc32 "~0.2.3" fd-slicer "~1.1.0" +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + zip-stream@^2.1.2: version "2.1.3" resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-2.1.3.tgz#26cc4bdb93641a8590dd07112e1f77af1758865b" From e200b09ad5e73beefdbea6baccd0ab569effe300 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:34:46 +0000 Subject: [PATCH 12/42] [DDW-827] converted all javascript files to typescript files --- .../app/actions/{wallets-actions.js => wallets-actions.js.ts} | 0 source/renderer/app/api/{api.js => api.js.ts} | 0 source/renderer/app/api/{errors.js => errors.js.ts} | 0 source/renderer/app/api/transactions/{types.js => types.js.ts} | 0 source/renderer/app/api/utils/{apiHelpers.js => apiHelpers.js.ts} | 0 .../app/api/utils/{apiHelpers.spec.js => apiHelpers.spec.js.ts} | 0 ...irmationDialog.js => WalletSendAssetsConfirmationDialog.js.ts} | 0 ...ndConfirmationDialog.js => WalletSendConfirmationDialog.js.ts} | 0 .../renderer/app/stores/{WalletsStore.js => WalletsStore.js.ts} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename source/renderer/app/actions/{wallets-actions.js => wallets-actions.js.ts} (100%) rename source/renderer/app/api/{api.js => api.js.ts} (100%) rename source/renderer/app/api/{errors.js => errors.js.ts} (100%) rename source/renderer/app/api/transactions/{types.js => types.js.ts} (100%) rename source/renderer/app/api/utils/{apiHelpers.js => apiHelpers.js.ts} (100%) rename source/renderer/app/api/utils/{apiHelpers.spec.js => apiHelpers.spec.js.ts} (100%) rename source/renderer/app/components/wallet/send-form/{WalletSendAssetsConfirmationDialog.js => WalletSendAssetsConfirmationDialog.js.ts} (100%) rename source/renderer/app/components/wallet/send-form/{WalletSendConfirmationDialog.js => WalletSendConfirmationDialog.js.ts} (100%) rename source/renderer/app/stores/{WalletsStore.js => WalletsStore.js.ts} (100%) diff --git a/source/renderer/app/actions/wallets-actions.js b/source/renderer/app/actions/wallets-actions.js.ts similarity index 100% rename from source/renderer/app/actions/wallets-actions.js rename to source/renderer/app/actions/wallets-actions.js.ts diff --git a/source/renderer/app/api/api.js b/source/renderer/app/api/api.js.ts similarity index 100% rename from source/renderer/app/api/api.js rename to source/renderer/app/api/api.js.ts diff --git a/source/renderer/app/api/errors.js b/source/renderer/app/api/errors.js.ts similarity index 100% rename from source/renderer/app/api/errors.js rename to source/renderer/app/api/errors.js.ts diff --git a/source/renderer/app/api/transactions/types.js b/source/renderer/app/api/transactions/types.js.ts similarity index 100% rename from source/renderer/app/api/transactions/types.js rename to source/renderer/app/api/transactions/types.js.ts diff --git a/source/renderer/app/api/utils/apiHelpers.js b/source/renderer/app/api/utils/apiHelpers.js.ts similarity index 100% rename from source/renderer/app/api/utils/apiHelpers.js rename to source/renderer/app/api/utils/apiHelpers.js.ts diff --git a/source/renderer/app/api/utils/apiHelpers.spec.js b/source/renderer/app/api/utils/apiHelpers.spec.js.ts similarity index 100% rename from source/renderer/app/api/utils/apiHelpers.spec.js rename to source/renderer/app/api/utils/apiHelpers.spec.js.ts diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.ts similarity index 100% rename from source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js rename to source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.ts diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.ts similarity index 100% rename from source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js rename to source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.ts diff --git a/source/renderer/app/stores/WalletsStore.js b/source/renderer/app/stores/WalletsStore.js.ts similarity index 100% rename from source/renderer/app/stores/WalletsStore.js rename to source/renderer/app/stores/WalletsStore.js.ts From 66d4797ec72fc7e52449e3b41f6add9c47f26a6f Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:34:48 +0000 Subject: [PATCH 13/42] [DDW-827] converted files returning react components to tsx extension --- ...tionDialog.js.ts => WalletSendAssetsConfirmationDialog.js.tsx} | 0 ...nfirmationDialog.js.ts => WalletSendConfirmationDialog.js.tsx} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename source/renderer/app/components/wallet/send-form/{WalletSendAssetsConfirmationDialog.js.ts => WalletSendAssetsConfirmationDialog.js.tsx} (100%) rename source/renderer/app/components/wallet/send-form/{WalletSendConfirmationDialog.js.ts => WalletSendConfirmationDialog.js.tsx} (100%) diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.ts b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx similarity index 100% rename from source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.ts rename to source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.ts b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx similarity index 100% rename from source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.ts rename to source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx From a93fb92f1031d142c46d557ca3bbcaf780b86a68 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:34:50 +0000 Subject: [PATCH 14/42] [DDW-827] made global replacements in all folders --- .../send-form/WalletSendAssetsConfirmationDialog.js.tsx | 4 +++- .../wallet/send-form/WalletSendConfirmationDialog.js.tsx | 4 +++- source/renderer/app/stores/WalletsStore.js.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx index 97c7fe185d..2fffa265a6 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx @@ -67,7 +67,7 @@ type State = { const messages = getMessages(); @observer -export default class WalletSendAssetsConfirmationDialog extends Component< +class WalletSendAssetsConfirmationDialog extends Component< Props, State > { @@ -481,3 +481,5 @@ export default class WalletSendAssetsConfirmationDialog extends Component< ); } } + +export default WalletSendAssetsConfirmationDialog \ No newline at end of file diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx index 4c17efed80..a63bbe980e 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx @@ -53,7 +53,7 @@ type State = { const messages = getMessages(); @observer -export default class WalletSendConfirmationDialog extends Component< +class WalletSendConfirmationDialog extends Component< Props, State > { @@ -324,3 +324,5 @@ export default class WalletSendConfirmationDialog extends Component< ); } } + +export default WalletSendConfirmationDialog \ No newline at end of file diff --git a/source/renderer/app/stores/WalletsStore.js.ts b/source/renderer/app/stores/WalletsStore.js.ts index cc2f3a7111..f775980c54 100644 --- a/source/renderer/app/stores/WalletsStore.js.ts +++ b/source/renderer/app/stores/WalletsStore.js.ts @@ -668,7 +668,7 @@ export default class WalletsStore extends Store { this.getWalletRecoveryPhraseFromCertificateRequest.reset(); - // $FlowFixMe + // @ts-ignore return unscrambledRecoveryPhrase; }; From d6b1f70bf1051a0b1c93617800c315a15b9f2ba9 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:35:20 +0000 Subject: [PATCH 15/42] [DDW-827] converted flow style code in typescript files to typescript syntax --- .../app/actions/wallets-actions.js.ts | 137 +- source/renderer/app/api/api.js.ts | 3253 ++++++++--------- source/renderer/app/api/errors.js.ts | 78 +- .../renderer/app/api/transactions/types.js.ts | 418 +-- .../renderer/app/api/utils/apiHelpers.js.ts | 52 +- .../app/api/utils/apiHelpers.spec.js.ts | 70 +- .../WalletSendAssetsConfirmationDialog.js.tsx | 494 +-- .../WalletSendConfirmationDialog.js.tsx | 355 +- source/renderer/app/stores/WalletsStore.js.ts | 1307 ++++--- 9 files changed, 2862 insertions(+), 3302 deletions(-) diff --git a/source/renderer/app/actions/wallets-actions.js.ts b/source/renderer/app/actions/wallets-actions.js.ts index cc60f6f164..10186eb73d 100644 --- a/source/renderer/app/actions/wallets-actions.js.ts +++ b/source/renderer/app/actions/wallets-actions.js.ts @@ -1,28 +1,22 @@ -// @flow -import Action from './lib/Action'; -import type { WalletExportTypeChoices } from '../types/walletExportTypes'; -import type { - TransportDevice, - HardwareWalletExtendedPublicKeyResponse, -} from '../../../common/types/hardware-wallets.types'; -import type { CsvFileContent } from '../../../common/types/csv-request.types'; -import type { QuitStakePoolRequest } from '../api/staking/types'; -import type { AssetToken } from '../api/assets/types'; - +import Action from "./lib/Action"; +import type { WalletExportTypeChoices } from "../types/walletExportTypes"; +import type { TransportDevice, HardwareWalletExtendedPublicKeyResponse } from "../../../common/types/hardware-wallets.types"; +import type { CsvFileContent } from "../../../common/types/csv-request.types"; +import type { QuitStakePoolRequest } from "../api/staking/types"; +import type { AssetToken } from "../api/assets/types"; export type WalletImportFromFileParams = { - filePath: string, - walletName: ?string, - spendingPassword: string, -}; - -// ======= WALLET ACTIONS ======= + filePath: string; + walletName: string | null | undefined; + spendingPassword: string; +}; // ======= WALLET ACTIONS ======= export default class WalletsActions { refreshWalletsDataSuccess: Action = new Action(); + /* ---------- Create Wallet ---------- */ createWallet: Action<{ - name: string, - spendingPassword: string, + name: string; + spendingPassword: string; }> = new Action(); createWalletBegin: Action = new Action(); createWalletChangeStep: Action = new Action(); @@ -35,58 +29,81 @@ export default class WalletsActions { restoreWalletChangeStep: Action = new Action(); restoreWalletClose: Action = new Action(); restoreWalletCancelClose: Action = new Action(); - restoreWalletSetKind: Action<{ param?: string, kind: string }> = new Action(); + restoreWalletSetKind: Action<{ + param?: string; + kind: string; + }> = new Action(); restoreWalletSetMnemonics: Action<{ - mnemonics: Array, + mnemonics: Array; }> = new Action(); restoreWalletSetConfig: Action<{ - param: string, - value: string, + param: string; + value: string; }> = new Action(); - restoreWallet: Action = new Action(); importWalletFromFile: Action = new Action(); - deleteWallet: Action<{ walletId: string, isLegacy: boolean }> = new Action(); + deleteWallet: Action<{ + walletId: string; + isLegacy: boolean; + }> = new Action(); undelegateWallet: Action = new Action(); setUndelegateWalletSubmissionSuccess: Action<{ - result: boolean, + result: boolean; }> = new Action(); sendMoney: Action<{ - receiver: string, - amount: string, - passphrase: string, - assets?: Array, - assetsAmounts?: Array, - hasAssetsRemainingAfterTransaction?: boolean, + receiver: string; + amount: string; + passphrase: string; + assets?: Array; + assetsAmounts?: Array; + hasAssetsRemainingAfterTransaction?: boolean; }> = new Action(); chooseWalletExportType: Action<{ - walletExportType: WalletExportTypeChoices, + walletExportType: WalletExportTypeChoices; + }> = new Action(); + generateCertificate: Action<{ + filePath: string; }> = new Action(); - generateCertificate: Action<{ filePath: string }> = new Action(); generateCsv: Action<{ - filePath: string, - fileContent: CsvFileContent, + filePath: string; + fileContent: CsvFileContent; }> = new Action(); generateAddressPDF: Action<{ - note: string, - address: string, - filePath: string, + note: string; + address: string; + filePath: string; + }> = new Action(); + generateAddressPDFSuccess: Action<{ + walletAddress: string; }> = new Action(); - generateAddressPDFSuccess: Action<{ walletAddress: string }> = new Action(); saveQRCodeImage: Action<{ - address: string, - filePath: string, - }> = new Action(); - saveQRCodeImageSuccess: Action<{ walletAddress: string }> = new Action(); - getAccountPublicKey: Action<{ spendingPassword: string }> = new Action(); - getICOPublicKey: Action<{ spendingPassword: string }> = new Action(); - copyWalletPublicKey: Action<{ publicKey: string }> = new Action(); - copyICOPublicKey: Action<{ publicKey: string }> = new Action(); - copyAddress: Action<{ address: string }> = new Action(); + address: string; + filePath: string; + }> = new Action(); + saveQRCodeImageSuccess: Action<{ + walletAddress: string; + }> = new Action(); + getAccountPublicKey: Action<{ + spendingPassword: string; + }> = new Action(); + getICOPublicKey: Action<{ + spendingPassword: string; + }> = new Action(); + copyWalletPublicKey: Action<{ + publicKey: string; + }> = new Action(); + copyICOPublicKey: Action<{ + publicKey: string; + }> = new Action(); + copyAddress: Action<{ + address: string; + }> = new Action(); updateCertificateStep: Action = new Action(); closeCertificateGeneration: Action = new Action(); closeRewardsCsvGeneration: Action = new Action(); - setCertificateTemplate: Action<{ selectedTemplate: string }> = new Action(); + setCertificateTemplate: Action<{ + selectedTemplate: string; + }> = new Action(); finishCertificate: Action = new Action(); finishRewardsCsv: Action = new Action(); @@ -96,18 +113,22 @@ export default class WalletsActions { transferFundsNextStep: Action = new Action(); transferFundsPrevStep: Action = new Action(); transferFundsSetSourceWalletId: Action<{ - sourceWalletId: string, + sourceWalletId: string; }> = new Action(); transferFundsSetTargetWalletId: Action<{ - targetWalletId: string, + targetWalletId: string; }> = new Action(); transferFundsRedeem: Action = new Action(); transferFundsClose: Action = new Action(); - transferFundsCalculateFee: Action<{ sourceWalletId: string }> = new Action(); - transferFunds: Action<{ spendingPassword: string }> = new Action(); + transferFundsCalculateFee: Action<{ + sourceWalletId: string; + }> = new Action(); + transferFunds: Action<{ + spendingPassword: string; + }> = new Action(); createHardwareWallet: Action<{ - walletName: string, - extendedPublicKey: HardwareWalletExtendedPublicKeyResponse, - device: TransportDevice, + walletName: string; + extendedPublicKey: HardwareWalletExtendedPublicKeyResponse; + device: TransportDevice; }> = new Action(); -} +} \ No newline at end of file diff --git a/source/renderer/app/api/api.js.ts b/source/renderer/app/api/api.js.ts index 105c48748f..99b3e452da 100644 --- a/source/renderer/app/api/api.js.ts +++ b/source/renderer/app/api/api.js.ts @@ -1,255 +1,124 @@ -// @flow -import { split, get, map, last, size, concat, flatten } from 'lodash'; -import { action } from 'mobx'; -import BigNumber from 'bignumber.js'; -import moment from 'moment'; +import { split, get, map, last, size, concat, flatten } from "lodash"; +import { action } from "mobx"; +import BigNumber from "bignumber.js"; +import moment from "moment"; // domains -import Wallet, { - WalletDelegationStatuses, - WalletUnits, -} from '../domains/Wallet'; -import { - WalletTransaction, - TransactionTypes, - TransactionStates, - TransactionWithdrawal, -} from '../domains/WalletTransaction'; -import WalletAddress from '../domains/WalletAddress'; - +import Wallet, { WalletDelegationStatuses, WalletUnits } from "../domains/Wallet"; +import { WalletTransaction, TransactionTypes, TransactionStates, TransactionWithdrawal } from "../domains/WalletTransaction"; +import WalletAddress from "../domains/WalletAddress"; // Addresses requests -import { getAddresses } from './addresses/requests/getAddresses'; -import { getByronWalletAddresses } from './addresses/requests/getByronWalletAddresses'; -import { createByronWalletAddress } from './addresses/requests/createByronWalletAddress'; -import { constructAddress } from './addresses/requests/constructAddress'; -import { inspectAddress } from './addresses/requests/inspectAddress'; - +import { getAddresses } from "./addresses/requests/getAddresses"; +import { getByronWalletAddresses } from "./addresses/requests/getByronWalletAddresses"; +import { createByronWalletAddress } from "./addresses/requests/createByronWalletAddress"; +import { constructAddress } from "./addresses/requests/constructAddress"; +import { inspectAddress } from "./addresses/requests/inspectAddress"; // Network requests -import { getNetworkInfo } from './network/requests/getNetworkInfo'; -import { getNetworkClock } from './network/requests/getNetworkClock'; -import { getNetworkParameters } from './network/requests/getNetworkParameters'; - +import { getNetworkInfo } from "./network/requests/getNetworkInfo"; +import { getNetworkClock } from "./network/requests/getNetworkClock"; +import { getNetworkParameters } from "./network/requests/getNetworkParameters"; // Transactions requests -import { getTransactionFee } from './transactions/requests/getTransactionFee'; -import { getByronWalletTransactionFee } from './transactions/requests/getByronWalletTransactionFee'; -import { getTransaction } from './transactions/requests/getTransaction'; -import { getTransactionHistory } from './transactions/requests/getTransactionHistory'; -import { getLegacyWalletTransactionHistory } from './transactions/requests/getLegacyWalletTransactionHistory'; -import { getWithdrawalHistory } from './transactions/requests/getWithdrawalHistory'; -import { createTransaction } from './transactions/requests/createTransaction'; -import { createByronWalletTransaction } from './transactions/requests/createByronWalletTransaction'; -import { deleteLegacyTransaction } from './transactions/requests/deleteLegacyTransaction'; -import { selectCoins } from './transactions/requests/selectCoins'; -import { createExternalTransaction } from './transactions/requests/createExternalTransaction'; -import { getPublicKey } from './transactions/requests/getPublicKey'; -import { getICOPublicKey } from './transactions/requests/getICOPublicKey'; - +import { getTransactionFee } from "./transactions/requests/getTransactionFee"; +import { getByronWalletTransactionFee } from "./transactions/requests/getByronWalletTransactionFee"; +import { getTransaction } from "./transactions/requests/getTransaction"; +import { getTransactionHistory } from "./transactions/requests/getTransactionHistory"; +import { getLegacyWalletTransactionHistory } from "./transactions/requests/getLegacyWalletTransactionHistory"; +import { getWithdrawalHistory } from "./transactions/requests/getWithdrawalHistory"; +import { createTransaction } from "./transactions/requests/createTransaction"; +import { createByronWalletTransaction } from "./transactions/requests/createByronWalletTransaction"; +import { deleteLegacyTransaction } from "./transactions/requests/deleteLegacyTransaction"; +import { selectCoins } from "./transactions/requests/selectCoins"; +import { createExternalTransaction } from "./transactions/requests/createExternalTransaction"; +import { getPublicKey } from "./transactions/requests/getPublicKey"; +import { getICOPublicKey } from "./transactions/requests/getICOPublicKey"; // Voting requests -import { createWalletSignature } from './voting/requests/createWalletSignature'; - +import { createWalletSignature } from "./voting/requests/createWalletSignature"; // Wallets requests -import { updateSpendingPassword } from './wallets/requests/updateSpendingPassword'; -import { updateByronSpendingPassword } from './wallets/requests/updateByronSpendingPassword'; -import { deleteWallet } from './wallets/requests/deleteWallet'; -import { deleteLegacyWallet } from './wallets/requests/deleteLegacyWallet'; -import { exportWalletAsJSON } from './wallets/requests/exportWalletAsJSON'; -import { importWalletAsJSON } from './wallets/requests/importWalletAsJSON'; -import { getWallets } from './wallets/requests/getWallets'; -import { getLegacyWallets } from './wallets/requests/getLegacyWallets'; -import { importWalletAsKey } from './wallets/requests/importWalletAsKey'; -import { createWallet } from './wallets/requests/createWallet'; -import { restoreWallet } from './wallets/requests/restoreWallet'; -import { restoreLegacyWallet } from './wallets/requests/restoreLegacyWallet'; -import { restoreByronWallet } from './wallets/requests/restoreByronWallet'; -import { restoreExportedByronWallet } from './wallets/requests/restoreExportedByronWallet'; -import { updateWallet } from './wallets/requests/updateWallet'; -import { updateByronWallet } from './wallets/requests/updateByronWallet'; -import { getWalletUtxos } from './wallets/requests/getWalletUtxos'; -import { getByronWalletUtxos } from './wallets/requests/getByronWalletUtxos'; -import { getWallet } from './wallets/requests/getWallet'; -import { getWalletPublicKey } from './wallets/requests/getWalletPublicKey'; -import { getLegacyWallet } from './wallets/requests/getLegacyWallet'; -import { transferFundsCalculateFee } from './wallets/requests/transferFundsCalculateFee'; -import { transferFunds } from './wallets/requests/transferFunds'; -import { createHardwareWallet } from './wallets/requests/createHardwareWallet'; -import { getCurrencyList } from './wallets/requests/getCurrencyList'; -import { getCurrencyRate } from './wallets/requests/getCurrencyRate'; - +import { updateSpendingPassword } from "./wallets/requests/updateSpendingPassword"; +import { updateByronSpendingPassword } from "./wallets/requests/updateByronSpendingPassword"; +import { deleteWallet } from "./wallets/requests/deleteWallet"; +import { deleteLegacyWallet } from "./wallets/requests/deleteLegacyWallet"; +import { exportWalletAsJSON } from "./wallets/requests/exportWalletAsJSON"; +import { importWalletAsJSON } from "./wallets/requests/importWalletAsJSON"; +import { getWallets } from "./wallets/requests/getWallets"; +import { getLegacyWallets } from "./wallets/requests/getLegacyWallets"; +import { importWalletAsKey } from "./wallets/requests/importWalletAsKey"; +import { createWallet } from "./wallets/requests/createWallet"; +import { restoreWallet } from "./wallets/requests/restoreWallet"; +import { restoreLegacyWallet } from "./wallets/requests/restoreLegacyWallet"; +import { restoreByronWallet } from "./wallets/requests/restoreByronWallet"; +import { restoreExportedByronWallet } from "./wallets/requests/restoreExportedByronWallet"; +import { updateWallet } from "./wallets/requests/updateWallet"; +import { updateByronWallet } from "./wallets/requests/updateByronWallet"; +import { getWalletUtxos } from "./wallets/requests/getWalletUtxos"; +import { getByronWalletUtxos } from "./wallets/requests/getByronWalletUtxos"; +import { getWallet } from "./wallets/requests/getWallet"; +import { getWalletPublicKey } from "./wallets/requests/getWalletPublicKey"; +import { getLegacyWallet } from "./wallets/requests/getLegacyWallet"; +import { transferFundsCalculateFee } from "./wallets/requests/transferFundsCalculateFee"; +import { transferFunds } from "./wallets/requests/transferFunds"; +import { createHardwareWallet } from "./wallets/requests/createHardwareWallet"; +import { getCurrencyList } from "./wallets/requests/getCurrencyList"; +import { getCurrencyRate } from "./wallets/requests/getCurrencyRate"; // Staking -import StakePool from '../domains/StakePool'; - +import StakePool from "../domains/StakePool"; // News requests -import { getNews } from './news/requests/getNews'; - +import { getNews } from "./news/requests/getNews"; // Stake Pools request -import { getStakePools } from './staking/requests/getStakePools'; -import { getDelegationFee } from './staking/requests/getDelegationFee'; -import { joinStakePool } from './staking/requests/joinStakePool'; -import { quitStakePool } from './staking/requests/quitStakePool'; -import { getSmashSettings } from './staking/requests/getSmashSettings'; -import { checkSmashServerHealth } from './staking/requests/checkSmashServerHealth'; -import { updateSmashSettings } from './staking/requests/updateSmashSettings'; - +import { getStakePools } from "./staking/requests/getStakePools"; +import { getDelegationFee } from "./staking/requests/getDelegationFee"; +import { joinStakePool } from "./staking/requests/joinStakePool"; +import { quitStakePool } from "./staking/requests/quitStakePool"; +import { getSmashSettings } from "./staking/requests/getSmashSettings"; +import { checkSmashServerHealth } from "./staking/requests/checkSmashServerHealth"; +import { updateSmashSettings } from "./staking/requests/updateSmashSettings"; // Utility functions -import { cardanoFaultInjectionChannel } from '../ipc/cardano.ipc'; -import patchAdaApi from './utils/patchAdaApi'; -import { getLegacyWalletId, utcStringToDate } from './utils'; -import { logger } from '../utils/logging'; -import { hexToString } from '../utils/strings'; -import { - unscrambleMnemonics, - scrambleMnemonics, - generateAccountMnemonics, - generateAdditionalMnemonics, -} from './utils/mnemonics'; -import { filterLogData } from '../../../common/utils/logging'; -import { derivationPathToAddressPath } from '../utils/hardwareWalletUtils'; - +import { cardanoFaultInjectionChannel } from "../ipc/cardano.ipc"; +import patchAdaApi from "./utils/patchAdaApi"; +import { getLegacyWalletId, utcStringToDate } from "./utils"; +import { logger } from "../utils/logging"; +import { hexToString } from "../utils/strings"; +import { unscrambleMnemonics, scrambleMnemonics, generateAccountMnemonics, generateAdditionalMnemonics } from "./utils/mnemonics"; +import { filterLogData } from "../../../common/utils/logging"; +import { derivationPathToAddressPath } from "../utils/hardwareWalletUtils"; // Config constants -import { LOVELACES_PER_ADA } from '../config/numbersConfig'; -import { - SMASH_SERVER_STATUSES, - SMASH_SERVERS_LIST, - MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE, - REWARDS_REDEMPTION_FEE_CALCULATION_AMOUNT, - DELEGATION_DEPOSIT, - DELEGATION_ACTIONS, -} from '../config/stakingConfig'; -import { - ADA_CERTIFICATE_MNEMONIC_LENGTH, - WALLET_RECOVERY_PHRASE_WORD_COUNT, -} from '../config/cryptoConfig'; -import { currencyConfig } from '../config/currencyConfig'; - +import { LOVELACES_PER_ADA } from "../config/numbersConfig"; +import { SMASH_SERVER_STATUSES, SMASH_SERVERS_LIST, MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE, REWARDS_REDEMPTION_FEE_CALCULATION_AMOUNT, DELEGATION_DEPOSIT, DELEGATION_ACTIONS } from "../config/stakingConfig"; +import { ADA_CERTIFICATE_MNEMONIC_LENGTH, WALLET_RECOVERY_PHRASE_WORD_COUNT } from "../config/cryptoConfig"; +import { currencyConfig } from "../config/currencyConfig"; // Addresses Types -import type { - Address, - GetAddressesRequest, - CreateByronWalletAddressRequest, - InspectAddressResponse, -} from './addresses/types'; - +import type { Address, GetAddressesRequest, CreateByronWalletAddressRequest, InspectAddressResponse } from "./addresses/types"; // Common Types -import type { RequestConfig } from './common/types'; - +import type { RequestConfig } from "./common/types"; // Network Types -import type { - GetNetworkInfoResponse, - NetworkInfoResponse, - GetNetworkClockResponse, - NetworkClockResponse, - GetNetworkParametersResponse, - GetNetworkParametersApiResponse, -} from './network/types'; - +import type { GetNetworkInfoResponse, NetworkInfoResponse, GetNetworkClockResponse, NetworkClockResponse, GetNetworkParametersResponse, GetNetworkParametersApiResponse } from "./network/types"; // Transactions Types -import type { - Transaction, - TransactionFee, - TransactionWithdrawals, - GetTransactionFeeRequest, - GetTransactionFeeResponse, - CreateTransactionRequest, - DeleteTransactionRequest, - GetTransactionRequest, - GetTransactionsRequest, - GetTransactionsResponse, - CoinSelectionsPaymentRequestType, - CoinSelectionsDelegationRequestType, - CoinSelectionsResponse, - CreateExternalTransactionRequest, - CreateExternalTransactionResponse, - GetWithdrawalsRequest, - GetWithdrawalsResponse, - VotingMetadataType, - ICOPublicKeyParams, -} from './transactions/types'; - +import type { Transaction, TransactionFee, TransactionWithdrawals, GetTransactionFeeRequest, GetTransactionFeeResponse, CreateTransactionRequest, DeleteTransactionRequest, GetTransactionRequest, GetTransactionsRequest, GetTransactionsResponse, CoinSelectionsPaymentRequestType, CoinSelectionsDelegationRequestType, CoinSelectionsResponse, CreateExternalTransactionRequest, CreateExternalTransactionResponse, GetWithdrawalsRequest, GetWithdrawalsResponse, VotingMetadataType, ICOPublicKeyParams } from "./transactions/types"; // Wallets Types -import type { - AdaWallet, - AdaWallets, - CreateHardwareWalletRequest, - LegacyAdaWallet, - LegacyAdaWallets, - WalletUtxos, - CreateWalletRequest, - DeleteWalletRequest, - RestoreWalletRequest, - RestoreLegacyWalletRequest, - RestoreExportedByronWalletRequest, - UpdateSpendingPasswordRequest, - ExportWalletToFileRequest, - GetWalletCertificateRecoveryPhraseRequest, - GetWalletRecoveryPhraseFromCertificateRequest, - ImportWalletFromKeyRequest, - ImportWalletFromFileRequest, - GetWalletUtxosRequest, - GetWalletRequest, - GetWalletPublicKeyRequest, - TransferFundsCalculateFeeRequest, - TransferFundsCalculateFeeApiResponse, - TransferFundsCalculateFeeResponse, - TransferFundsRequest, - TransferFundsResponse, - UpdateWalletRequest, - GetCurrencyListResponse, - GetCurrencyRateRequest, - GetCurrencyRateResponse, - GetAccountPublicKeyRequest, -} from './wallets/types'; -import type { WalletProps } from '../domains/Wallet'; - +import type { AdaWallet, AdaWallets, CreateHardwareWalletRequest, LegacyAdaWallet, LegacyAdaWallets, WalletUtxos, CreateWalletRequest, DeleteWalletRequest, RestoreWalletRequest, RestoreLegacyWalletRequest, RestoreExportedByronWalletRequest, UpdateSpendingPasswordRequest, ExportWalletToFileRequest, GetWalletCertificateRecoveryPhraseRequest, GetWalletRecoveryPhraseFromCertificateRequest, ImportWalletFromKeyRequest, ImportWalletFromFileRequest, GetWalletUtxosRequest, GetWalletRequest, GetWalletPublicKeyRequest, TransferFundsCalculateFeeRequest, TransferFundsCalculateFeeApiResponse, TransferFundsCalculateFeeResponse, TransferFundsRequest, TransferFundsResponse, UpdateWalletRequest, GetCurrencyListResponse, GetCurrencyRateRequest, GetCurrencyRateResponse, GetAccountPublicKeyRequest } from "./wallets/types"; +import type { WalletProps } from "../domains/Wallet"; // News Types -import type { GetNewsResponse } from './news/types'; - +import type { GetNewsResponse } from "./news/types"; // Staking Types -import type { - JoinStakePoolRequest, - GetDelegationFeeRequest, - DelegationCalculateFeeResponse, - AdaApiStakePools, - AdaApiStakePool, - QuitStakePoolRequest, - GetRedeemItnRewardsFeeRequest, - GetRedeemItnRewardsFeeResponse, - RequestRedeemItnRewardsRequest, - RequestRedeemItnRewardsResponse, - GetSmashSettingsApiResponse, - CheckSmashServerHealthApiResponse, - PoolMetadataSource, -} from './staking/types'; - +import type { JoinStakePoolRequest, GetDelegationFeeRequest, DelegationCalculateFeeResponse, AdaApiStakePools, AdaApiStakePool, QuitStakePoolRequest, GetRedeemItnRewardsFeeRequest, GetRedeemItnRewardsFeeResponse, RequestRedeemItnRewardsRequest, RequestRedeemItnRewardsResponse, GetSmashSettingsApiResponse, CheckSmashServerHealthApiResponse, PoolMetadataSource } from "./staking/types"; // Voting Types -import type { - CreateVotingRegistrationRequest, - CreateWalletSignatureRequest, -} from './voting/types'; - -import type { StakePoolProps } from '../domains/StakePool'; -import type { FaultInjectionIpcRequest } from '../../../common/types/cardano-node.types'; - -import { TlsCertificateNotValidError } from './nodes/errors'; -import { getSHA256HexForString } from './utils/hashing'; -import { getNewsHash } from './news/requests/getNewsHash'; -import { deleteTransaction } from './transactions/requests/deleteTransaction'; -import { WALLET_BYRON_KINDS } from '../config/walletRestoreConfig'; -import ApiError from '../domains/ApiError'; -import { formattedAmountToLovelace } from '../utils/formatters'; -import type { - GetAssetsRequest, - GetAssetsResponse, - ApiAsset, - StoredAssetMetadata, -} from './assets/types'; -import type { AssetLocalData } from './utils/localStorage'; -import Asset from '../domains/Asset'; -import { getAssets } from './assets/requests/getAssets'; -import { getAccountPublicKey } from './wallets/requests/getAccountPublicKey'; -import { throwErrorIfNotEnoughAdaToSupportTokens } from './utils/apiHelpers'; - +import type { CreateVotingRegistrationRequest, CreateWalletSignatureRequest } from "./voting/types"; +import type { StakePoolProps } from "../domains/StakePool"; +import type { FaultInjectionIpcRequest } from "../../../common/types/cardano-node.types"; +import { TlsCertificateNotValidError } from "./nodes/errors"; +import { getSHA256HexForString } from "./utils/hashing"; +import { getNewsHash } from "./news/requests/getNewsHash"; +import { deleteTransaction } from "./transactions/requests/deleteTransaction"; +import { WALLET_BYRON_KINDS } from "../config/walletRestoreConfig"; +import ApiError from "../domains/ApiError"; +import { formattedAmountToLovelace } from "../utils/formatters"; +import type { GetAssetsRequest, GetAssetsResponse, ApiAsset, StoredAssetMetadata } from "./assets/types"; +import type { AssetLocalData } from "./utils/localStorage"; +import Asset from "../domains/Asset"; +import { getAssets } from "./assets/requests/getAssets"; +import { getAccountPublicKey } from "./wallets/requests/getAccountPublicKey"; +import { throwErrorIfNotEnoughAdaToSupportTokens } from "./utils/apiHelpers"; export default class AdaApi { config: RequestConfig; - // We need to preserve all asset metadata during single runtime in order // to avoid losing it in case of Token Metadata Registry server unvailability storedAssetMetadata: StoredAssetMetadata = {}; @@ -267,227 +136,245 @@ export default class AdaApi { logger.debug('AdaApi::getWallets called'); const { getHardwareWalletLocalData, - getHardwareWalletsLocalData, + getHardwareWalletsLocalData } = global.daedalus.api.localStorage; + try { const wallets: AdaWallets = await getWallets(this.config); - const legacyWallets: LegacyAdaWallets = await getLegacyWallets( - this.config - ); + const legacyWallets: LegacyAdaWallets = await getLegacyWallets(this.config); const hwLocalData = await getHardwareWalletsLocalData(); logger.debug('AdaApi::getWallets success', { wallets, legacyWallets, - hwLocalData: filterLogData(hwLocalData), + hwLocalData: filterLogData(hwLocalData) }); - map(legacyWallets, (legacyAdaWallet) => { + map(legacyWallets, legacyAdaWallet => { const extraLegacyWalletProps = { - address_pool_gap: 0, // Not needed for legacy wallets + address_pool_gap: 0, + // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING, - }, + status: WalletDelegationStatuses.NOT_DELEGATING + } }, - isLegacy: true, + isLegacy: true }; - wallets.push({ - ...legacyAdaWallet, - ...extraLegacyWalletProps, + wallets.push({ ...legacyAdaWallet, + ...extraLegacyWalletProps }); }); - // @TODO - Remove this once we get hardware wallet flag from WBE - return await Promise.all( - wallets.map(async (wallet) => { - const { id } = wallet; - const walletData = await getHardwareWalletLocalData(id); - return _createWalletFromServerData({ - ...wallet, - isHardwareWallet: - walletData && walletData.device && size(walletData.device) > 0, - }); - }) - ); + return await Promise.all(wallets.map(async wallet => { + const { + id + } = wallet; + const walletData = await getHardwareWalletLocalData(id); + return _createWalletFromServerData({ ...wallet, + isHardwareWallet: walletData && walletData.device && size(walletData.device) > 0 + }); + })); } catch (error) { - logger.error('AdaApi::getWallets error', { error }); + logger.error('AdaApi::getWallets error', { + error + }); throw new ApiError(error); } }; - getWallet = async (request: GetWalletRequest): Promise => { logger.debug('AdaApi::getWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); + try { - const { walletId, isLegacy } = request; + const { + walletId, + isLegacy + } = request; let wallet; + if (isLegacy) { - const legacyWallet: LegacyAdaWallet = await getLegacyWallet( - this.config, - { walletId } - ); + const legacyWallet: LegacyAdaWallet = await getLegacyWallet(this.config, { + walletId + }); const extraLegacyWalletProps = { - address_pool_gap: 0, // Not needed for legacy wallets + address_pool_gap: 0, + // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING, - }, + status: WalletDelegationStatuses.NOT_DELEGATING + } }, - isLegacy: true, + isLegacy: true }; - wallet = { - ...legacyWallet, - ...extraLegacyWalletProps, + wallet = { ...legacyWallet, + ...extraLegacyWalletProps }; } else { - wallet = await getWallet(this.config, { walletId }); + wallet = await getWallet(this.config, { + walletId + }); } - logger.debug('AdaApi::getWallet success', { wallet }); + + logger.debug('AdaApi::getWallet success', { + wallet + }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::getWallet error', { error }); + logger.error('AdaApi::getWallet error', { + error + }); throw new ApiError(error); } }; - - getWalletPublicKey = async ( - request: GetWalletPublicKeyRequest - ): Promise => { + getWalletPublicKey = async (request: GetWalletPublicKeyRequest): Promise => { logger.debug('AdaApi::getWalletPublicKey called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); + try { - const { walletId, role, index } = request; + const { + walletId, + role, + index + } = request; const walletPublicKey: string = await getWalletPublicKey(this.config, { walletId, role, - index, + index + }); + logger.debug('AdaApi::getWalletPublicKey success', { + walletPublicKey }); - logger.debug('AdaApi::getWalletPublicKey success', { walletPublicKey }); return walletPublicKey; } catch (error) { - logger.error('AdaApi::getWalletPublicKey error', { error }); + logger.error('AdaApi::getWalletPublicKey error', { + error + }); throw new ApiError(error); } }; - - getAccountPublicKey = async ( - request: GetAccountPublicKeyRequest - ): Promise => { + getAccountPublicKey = async (request: GetAccountPublicKeyRequest): Promise => { logger.debug('AdaApi::getAccountPublicKey called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); + try { - const { walletId, index, passphrase, extended } = request; + const { + walletId, + index, + passphrase, + extended + } = request; const accountPublicKey: string = await getAccountPublicKey(this.config, { walletId, index, passphrase, - extended, + extended + }); + logger.debug('AdaApi::getAccountPublicKey success', { + accountPublicKey }); - logger.debug('AdaApi::getAccountPublicKey success', { accountPublicKey }); return accountPublicKey; } catch (error) { - logger.error('AdaApi::getAccountPublicKey error', { error }); - throw new ApiError(error) - .set('wrongEncryptionPassphrase') - .where('code', 'bad_request') - .inc('message', 'passphrase is too short') - .result(); + logger.error('AdaApi::getAccountPublicKey error', { + error + }); + throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; - - getAddresses = async ( - request: GetAddressesRequest - ): Promise> => { + getAddresses = async (request: GetAddressesRequest): Promise> => { logger.debug('AdaApi::getAddresses called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { walletId, queryParams, isLegacy } = request; + const { + walletId, + queryParams, + isLegacy + } = request; try { let response = []; + if (isLegacy) { - response = await getByronWalletAddresses( - this.config, - walletId, - queryParams - ); + response = await getByronWalletAddresses(this.config, walletId, queryParams); } else { response = await getAddresses(this.config, walletId, queryParams); response.reverse(); } - logger.debug('AdaApi::getAddresses success', { addresses: response }); + + logger.debug('AdaApi::getAddresses success', { + addresses: response + }); return response.map(_createAddressFromServerData); } catch (error) { - logger.error('AdaApi::getAddresses error', { error }); + logger.error('AdaApi::getAddresses error', { + error + }); throw new ApiError(error); } }; - - getTransaction = async ( - request: GetTransactionRequest - ): Promise => { - logger.debug('AdaApi::getTransaction called', { parameters: request }); - const { walletId, transactionId } = request; + getTransaction = async (request: GetTransactionRequest): Promise => { + logger.debug('AdaApi::getTransaction called', { + parameters: request + }); + const { + walletId, + transactionId + } = request; try { - const response = await getTransaction( - this.config, - walletId, - transactionId - ); - logger.debug('AdaApi::getTransaction success', { response }); + const response = await getTransaction(this.config, walletId, transactionId); + logger.debug('AdaApi::getTransaction success', { + response + }); return _createTransactionFromServerData(response); } catch (error) { - logger.error('AdaApi::getTransaction error', { error }); + logger.error('AdaApi::getTransaction error', { + error + }); throw new ApiError(error); } }; - - getTransactions = async ( - request: GetTransactionsRequest - ): Promise => { - logger.debug('AdaApi::getTransactions called', { parameters: request }); - const { walletId, order, fromDate, toDate, isLegacy } = request; - - const params = Object.assign( - {}, - { - order: order || 'descending', - } - ); - if (fromDate) - params.start = `${moment.utc(fromDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; - if (toDate) - params.end = `${moment.utc(toDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; + getTransactions = async (request: GetTransactionsRequest): Promise => { + logger.debug('AdaApi::getTransactions called', { + parameters: request + }); + const { + walletId, + order, + fromDate, + toDate, + isLegacy + } = request; + const params = Object.assign({}, { + order: order || 'descending' + }); + if (fromDate) params.start = `${moment.utc(fromDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; + if (toDate) params.end = `${moment.utc(toDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; try { let response; + if (isLegacy) { - response = await getLegacyWalletTransactionHistory( - this.config, - walletId, - params - ); + response = await getLegacyWalletTransactionHistory(this.config, walletId, params); } else { response = await getTransactionHistory(this.config, walletId, params); } logger.debug('AdaApi::getTransactions success', { - transactions: response, + transactions: response + }); + const transactions = response.map(tx => _createTransactionFromServerData(tx)); + return Promise.resolve({ + transactions, + total: response.length }); - const transactions = response.map((tx) => - _createTransactionFromServerData(tx) - ); - return Promise.resolve({ transactions, total: response.length }); } catch (error) { - logger.error('AdaApi::getTransactions error', { error }); + logger.error('AdaApi::getTransactions error', { + error + }); throw new ApiError(error); - } - - // @API TODO - Filter / Search fine tuning "pending" for V2 - + } // @API TODO - Filter / Search fine tuning "pending" for V2 // const requestStats = Object.assign({}, request, { // cachedTransactions: request.cachedTransactions.length, // }); @@ -635,163 +522,194 @@ export default class AdaApi { // logger.error('AdaApi::searchHistory error', { error }); // throw new GenericApiError(error); // } - }; + }; getAssets = async (request: GetAssetsRequest): Promise => { - logger.debug('AdaApi::getAssets called', { parameters: request }); - const { walletId } = request; + logger.debug('AdaApi::getAssets called', { + parameters: request + }); + const { + walletId + } = request; + try { - const response = await getAssets(this.config, { walletId }); + const response = await getAssets(this.config, { + walletId + }); logger.debug('AdaApi::getAssets success', { - assets: response, + assets: response }); const assetsLocaldata = await global.daedalus.api.localStorage.getAssetsLocalData(); logger.debug('AdaApi::getAssetsLocalData success', { - assetsLocaldata, - }); - const assets = response.map((asset) => - _createAssetFromServerData( - asset, - assetsLocaldata[asset.policy_id + asset.asset_name] || {}, - this.storedAssetMetadata - ) - ); - return new Promise((resolve) => - resolve({ assets, total: response.length }) - ); + assetsLocaldata + }); + const assets = response.map(asset => _createAssetFromServerData(asset, assetsLocaldata[asset.policy_id + asset.asset_name] || {}, this.storedAssetMetadata)); + return new Promise(resolve => resolve({ + assets, + total: response.length + })); } catch (error) { - logger.error('AdaApi::getAssets error', { error }); + logger.error('AdaApi::getAssets error', { + error + }); throw new ApiError(error); } }; + getWithdrawals = async (request: GetWithdrawalsRequest): Promise => { + logger.debug('AdaApi::getWithdrawals called', { + parameters: request + }); + const { + walletId + } = request; - getWithdrawals = async ( - request: GetWithdrawalsRequest - ): Promise => { - logger.debug('AdaApi::getWithdrawals called', { parameters: request }); - const { walletId } = request; try { const response = await getWithdrawalHistory(this.config, walletId); logger.debug('AdaApi::getWithdrawals success', { - transactions: response, + transactions: response }); let withdrawals = new BigNumber(0); - const outgoingTransactions = response.filter( - (tx: Transaction) => - tx.direction === 'outgoing' && tx.status === 'in_ledger' - ); + const outgoingTransactions = response.filter((tx: Transaction) => tx.direction === 'outgoing' && tx.status === 'in_ledger'); outgoingTransactions.forEach((tx: Transaction) => { tx.withdrawals.forEach((w: TransactionWithdrawals) => { - const withdrawal = new BigNumber( - w.amount.quantity.toString() - ).dividedBy(LOVELACES_PER_ADA); + const withdrawal = new BigNumber(w.amount.quantity.toString()).dividedBy(LOVELACES_PER_ADA); withdrawals = withdrawals.plus(withdrawal); }); }); - return { withdrawals }; + return { + withdrawals + }; } catch (error) { - logger.error('AdaApi::getWithdrawals error', { error }); + logger.error('AdaApi::getWithdrawals error', { + error + }); throw new ApiError(error); } }; - createWallet = async (request: CreateWalletRequest): Promise => { logger.debug('AdaApi::createWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { name, mnemonic, spendingPassword } = request; + const { + name, + mnemonic, + spendingPassword + } = request; + try { const walletInitData = { name, mnemonic_sentence: split(mnemonic, ' '), - passphrase: spendingPassword, + passphrase: spendingPassword }; const wallet: AdaWallet = await createWallet(this.config, { - walletInitData, + walletInitData + }); + logger.debug('AdaApi::createWallet success', { + wallet }); - logger.debug('AdaApi::createWallet success', { wallet }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::createWallet error', { error }); + logger.error('AdaApi::createWallet error', { + error + }); throw new ApiError(error); } }; - - createLegacyWallet = async ( - request: CreateWalletRequest - ): Promise => { + createLegacyWallet = async (request: CreateWalletRequest): Promise => { logger.debug('AdaApi::createLegacyWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { name, mnemonic, spendingPassword } = request; + const { + name, + mnemonic, + spendingPassword + } = request; + try { const walletInitData = { name, mnemonic_sentence: split(mnemonic, ' '), - passphrase: spendingPassword, + passphrase: spendingPassword }; - const legacyWallet: LegacyAdaWallet = await restoreByronWallet( - this.config, - { walletInitData }, - 'random' - ); + const legacyWallet: LegacyAdaWallet = await restoreByronWallet(this.config, { + walletInitData + }, 'random'); // Generate address for the newly created Byron wallet - const { id: walletId } = legacyWallet; + const { + id: walletId + } = legacyWallet; const address: Address = await createByronWalletAddress(this.config, { passphrase: spendingPassword, - walletId, + walletId + }); + logger.debug('AdaApi::createByronWalletAddress success', { + address }); - logger.debug('AdaApi::createByronWalletAddress success', { address }); const extraLegacyWalletProps = { - address_pool_gap: 0, // Not needed for legacy wallets + address_pool_gap: 0, + // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING, - }, + status: WalletDelegationStatuses.NOT_DELEGATING + } }, isLegacy: true, assets: { available: [], - total: [], - }, + total: [] + } }; - const wallet: AdaWallet = { - ...legacyWallet, - ...extraLegacyWalletProps, + const wallet: AdaWallet = { ...legacyWallet, + ...extraLegacyWalletProps }; - logger.debug('AdaApi::createLegacyWallet success', { wallet }); + logger.debug('AdaApi::createLegacyWallet success', { + wallet + }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::createLegacyWallet error', { error }); + logger.error('AdaApi::createLegacyWallet error', { + error + }); throw new ApiError(error); } }; - deleteWallet = async (request: DeleteWalletRequest): Promise => { logger.debug('AdaApi::deleteWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); + try { - const { walletId, isLegacy } = request; + const { + walletId, + isLegacy + } = request; let response; + if (isLegacy) { - response = await deleteLegacyWallet(this.config, { walletId }); + response = await deleteLegacyWallet(this.config, { + walletId + }); } else { - response = await deleteWallet(this.config, { walletId }); + response = await deleteWallet(this.config, { + walletId + }); } - logger.debug('AdaApi::deleteWallet success', { response }); + + logger.debug('AdaApi::deleteWallet success', { + response + }); return true; } catch (error) { - logger.error('AdaApi::deleteWallet error', { error }); + logger.error('AdaApi::deleteWallet error', { + error + }); throw new ApiError(error); } }; - - createTransaction = async ( - request: CreateTransactionRequest - ): Promise => { + createTransaction = async (request: CreateTransactionRequest): Promise => { logger.debug('AdaApi::createTransaction called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); const { walletId, @@ -801,67 +719,57 @@ export default class AdaApi { isLegacy, assets, withdrawal = TransactionWithdrawal, - hasAssetsRemainingAfterTransaction, + hasAssetsRemainingAfterTransaction } = request; try { const data = { - payments: [ - { - address, - amount: { - quantity: amount, - unit: WalletUnits.LOVELACE, - }, - assets, + payments: [{ + address, + amount: { + quantity: amount, + unit: WalletUnits.LOVELACE }, - ], - passphrase, + assets + }], + passphrase }; - let response: Transaction; + if (isLegacy) { response = await createByronWalletTransaction(this.config, { walletId, - data, + data }); } else { response = await createTransaction(this.config, { walletId, - data: { ...data, withdrawal }, + data: { ...data, + withdrawal + } }); } logger.debug('AdaApi::createTransaction success', { - transaction: response, + transaction: response }); - return _createTransactionFromServerData(response); } catch (error) { - logger.error('AdaApi::createTransaction error', { error }); - throwErrorIfNotEnoughAdaToSupportTokens( - error, - hasAssetsRemainingAfterTransaction - ); - - throw new ApiError(error) - .set('wrongEncryptionPassphrase') - .where('code', 'bad_request') - .inc('message', 'passphrase is too short') - .set('transactionIsTooBig', true, { - linkLabel: 'tooBigTransactionErrorLinkLabel', - linkURL: 'tooBigTransactionErrorLinkURL', - }) - .where('code', 'transaction_is_too_big') - .result(); + logger.error('AdaApi::createTransaction error', { + error + }); + throwErrorIfNotEnoughAdaToSupportTokens(error, hasAssetsRemainingAfterTransaction); + throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').set('transactionIsTooBig', true, { + linkLabel: 'tooBigTransactionErrorLinkLabel', + linkURL: 'tooBigTransactionErrorLinkURL' + }).where('code', 'transaction_is_too_big').result(); } }; - // For testing purpose ONLY - createExpiredTransaction = async (request: any): Promise<*> => { + createExpiredTransaction = async (request: any): Promise => { if (global.environment.isDev) { logger.debug('AdaApi::createTransaction called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); const { walletId, @@ -870,66 +778,60 @@ export default class AdaApi { passphrase, isLegacy, withdrawal = TransactionWithdrawal, - ttl, + ttl } = request; + try { const data = { - payments: [ - { - address, - amount: { - quantity: amount, - unit: WalletUnits.LOVELACE, - }, - }, - ], + payments: [{ + address, + amount: { + quantity: amount, + unit: WalletUnits.LOVELACE + } + }], passphrase, time_to_live: { quantity: ttl, - unit: 'second', - }, + unit: 'second' + } }; - let response: Transaction; + if (isLegacy) { response = await createByronWalletTransaction(this.config, { walletId, - data, + data }); } else { response = await createTransaction(this.config, { walletId, - data: { ...data, withdrawal }, + data: { ...data, + withdrawal + } }); } logger.debug('AdaApi::createTransaction success', { - transaction: response, + transaction: response }); - return _createTransactionFromServerData(response); } catch (error) { - logger.error('AdaApi::createTransaction error', { error }); - throw new ApiError(error) - .set('wrongEncryptionPassphrase') - .where('code', 'bad_request') - .inc('message', 'passphrase is too short') - .set('transactionIsTooBig', true, { - linkLabel: 'tooBigTransactionErrorLinkLabel', - linkURL: 'tooBigTransactionErrorLinkURL', - }) - .where('code', 'transaction_is_too_big') - .result(); + logger.error('AdaApi::createTransaction error', { + error + }); + throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').set('transactionIsTooBig', true, { + linkLabel: 'tooBigTransactionErrorLinkLabel', + linkURL: 'tooBigTransactionErrorLinkURL' + }).where('code', 'transaction_is_too_big').result(); } } + return null; }; - - calculateTransactionFee = async ( - request: GetTransactionFeeRequest - ): Promise => { + calculateTransactionFee = async (request: GetTransactionFeeRequest): Promise => { logger.debug('AdaApi::calculateTransactionFee called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); const { walletId, @@ -940,62 +842,68 @@ export default class AdaApi { availableBalance, rewardsBalance, isLegacy, - withdrawal = TransactionWithdrawal, + withdrawal = TransactionWithdrawal } = request; try { const data = { - payments: [ - { - address, - amount: { - quantity: amount, - unit: WalletUnits.LOVELACE, - }, - assets, + payments: [{ + address, + amount: { + quantity: amount, + unit: WalletUnits.LOVELACE }, - ], + assets + }] }; - let response: TransactionFee; + if (isLegacy) { response = await getByronWalletTransactionFee(this.config, { walletId, - data, + data }); } else { response = await getTransactionFee(this.config, { walletId, - data: { ...data, withdrawal }, + data: { ...data, + withdrawal + } }); } - const formattedTxAmount = new BigNumber(amount.toString()).dividedBy( - LOVELACES_PER_ADA - ); - const { fee, minimumAda } = _createTransactionFeeFromServerData(response); + const formattedTxAmount = new BigNumber(amount.toString()).dividedBy(LOVELACES_PER_ADA); + + const { + fee, + minimumAda + } = _createTransactionFeeFromServerData(response); + const amountWithFee = formattedTxAmount.plus(fee); const isRewardsRedemptionRequest = Array.isArray(withdrawal); + if (!isRewardsRedemptionRequest && amountWithFee.gt(walletBalance)) { // Amount + fees exceeds walletBalance: // = show "Not enough Ada for fees. Try sending a smaller amount." throw new ApiError().result('cannotCoverFee'); } + logger.debug('AdaApi::calculateTransactionFee success', { - transactionFee: response, + transactionFee: response }); - return { fee, minimumAda }; + return { + fee, + minimumAda + }; } catch (error) { let notEnoughMoneyError; + if (walletBalance.gt(availableBalance)) { // 1. Amount exceeds availableBalance due to pending transactions: // - walletBalance > availableBalance // = show "Cannot calculate fees while there are pending transactions." notEnoughMoneyError = 'canNotCalculateTransactionFees'; - } else if ( - !walletBalance.isZero() && - walletBalance.isEqualTo(rewardsBalance) - ) { + } else if (!walletBalance.isZero() && walletBalance.isEqualTo(rewardsBalance)) { // 2. Wallet contains only rewards: // - walletBalance === rewardsBalance // = show "Cannot send from a wallet that contains only rewards balances." @@ -1010,36 +918,23 @@ export default class AdaApi { // ApiError with logging showcase throw new ApiError(error, { logError: true, - msg: 'AdaApi::calculateTransactionFee error', - }) - .set(notEnoughMoneyError, true) - .where('code', 'not_enough_money') - .set('utxoTooSmall', true, { - minimumAda: get( - /(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), - 2, - 0 - ), - }) - .where('code', 'utxo_too_small') - .set('invalidAddress') - .where('code', 'bad_request') - .inc('message', 'Unable to decode Address') - .result(); + msg: 'AdaApi::calculateTransactionFee error' + }).set(notEnoughMoneyError, true).where('code', 'not_enough_money').set('utxoTooSmall', true, { + minimumAda: get(/(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), 2, 0) + }).where('code', 'utxo_too_small').set('invalidAddress').where('code', 'bad_request').inc('message', 'Unable to decode Address').result(); } }; - selectCoins = async (request: { - walletId: string, - walletBalance: BigNumber, - availableBalance: BigNumber, - rewardsBalance: BigNumber, - payments?: CoinSelectionsPaymentRequestType, - delegation?: CoinSelectionsDelegationRequestType, - metadata?: VotingMetadataType, + walletId: string; + walletBalance: BigNumber; + availableBalance: BigNumber; + rewardsBalance: BigNumber; + payments?: CoinSelectionsPaymentRequestType; + delegation?: CoinSelectionsDelegationRequestType; + metadata?: VotingMetadataType; }): Promise => { logger.debug('AdaApi::selectCoins called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); const { walletId, @@ -1048,56 +943,54 @@ export default class AdaApi { walletBalance, availableBalance, rewardsBalance, - metadata, + metadata } = request; + try { let data; + if (delegation) { data = { delegation_action: { action: delegation.delegationAction, - pool: delegation.poolId, - }, + pool: delegation.poolId + } }; } else if (payments) { data = { - payments: [ - { - address: payments.address, - amount: { - quantity: payments.amount, - unit: WalletUnits.LOVELACE, - }, - assets: payments.assets, + payments: [{ + address: payments.address, + amount: { + quantity: payments.amount, + unit: WalletUnits.LOVELACE }, - ], + assets: payments.assets + }], withdrawal: TransactionWithdrawal, - metadata: metadata || null, + metadata: metadata || null }; } else { throw new Error('Missing parameters!'); } + const response = await selectCoins(this.config, { walletId, - data, + data }); - // @TODO - handle CHANGE paramete on smarter way and change corresponding downstream logic const outputs = concat(response.outputs, response.change); - // Calculate fee from inputs and outputs const inputsData = []; const outputsData = []; const certificatesData = []; let totalInputs = new BigNumber(0); let totalOutputs = new BigNumber(0); - - map(response.inputs, (input) => { + map(response.inputs, input => { const inputAmount = new BigNumber(input.amount.quantity.toString()); - const inputAssets = map(input.assets, (asset) => ({ + const inputAssets = map(input.assets, asset => ({ policyId: asset.policy_id, assetName: asset.asset_name, - quantity: asset.quantity, + quantity: asset.quantity })); totalInputs = totalInputs.plus(inputAmount); const inputData = { @@ -1106,73 +999,55 @@ export default class AdaApi { id: input.id, index: input.index, derivationPath: input.derivation_path, - assets: inputAssets, + assets: inputAssets }; inputsData.push(inputData); }); - - map(outputs, (output) => { + map(outputs, output => { const outputAmount = new BigNumber(output.amount.quantity.toString()); - const outputAssets = map(output.assets, (asset) => ({ + const outputAssets = map(output.assets, asset => ({ policyId: asset.policy_id, assetName: asset.asset_name, - quantity: asset.quantity, + quantity: asset.quantity })); totalOutputs = totalOutputs.plus(outputAmount); const outputData = { address: output.address, amount: output.amount, derivationPath: output.derivation_path || null, - assets: outputAssets, + assets: outputAssets }; outputsData.push(outputData); }); if (response.certificates) { - map(response.certificates, (certificate) => { + map(response.certificates, certificate => { const certificateData = { certificateType: certificate.certificate_type, rewardAccountPath: certificate.reward_account_path, - pool: certificate.pool || null, + pool: certificate.pool || null }; certificatesData.push(certificateData); }); } - const withdrawalsData = map(response.withdrawals, (withdrawal) => ({ + const withdrawalsData = map(response.withdrawals, withdrawal => ({ stakeAddress: withdrawal.stake_address, derivationPath: withdrawal.derivation_path, - amount: withdrawal.amount, + amount: withdrawal.amount })); - - const depositsArray = map(response.deposits, (deposit) => - deposit.quantity.toString() - ); - const deposits = depositsArray.length - ? BigNumber.sum.apply(null, depositsArray) - : new BigNumber(0); + const depositsArray = map(response.deposits, deposit => deposit.quantity.toString()); + const deposits = depositsArray.length ? BigNumber.sum.apply(null, depositsArray) : new BigNumber(0); // @TODO - Use api response when api is ready - const depositsReclaimed = - delegation && delegation.delegationAction === DELEGATION_ACTIONS.QUIT - ? new BigNumber(DELEGATION_DEPOSIT).multipliedBy(LOVELACES_PER_ADA) - : new BigNumber(0); - - const withdrawalsArray = map(response.withdrawals, (withdrawal) => - withdrawal.amount.quantity.toString() - ); - const withdrawals = withdrawalsArray.length - ? BigNumber.sum.apply(null, withdrawalsArray) - : new BigNumber(0); + const depositsReclaimed = delegation && delegation.delegationAction === DELEGATION_ACTIONS.QUIT ? new BigNumber(DELEGATION_DEPOSIT).multipliedBy(LOVELACES_PER_ADA) : new BigNumber(0); + const withdrawalsArray = map(response.withdrawals, withdrawal => withdrawal.amount.quantity.toString()); + const withdrawals = withdrawalsArray.length ? BigNumber.sum.apply(null, withdrawalsArray) : new BigNumber(0); if (withdrawals) { totalOutputs = totalOutputs.minus(withdrawals); } - const fee = - delegation && delegation.delegationAction === DELEGATION_ACTIONS.QUIT - ? totalInputs.minus(totalOutputs).plus(depositsReclaimed) - : totalInputs.minus(totalOutputs).minus(deposits); - + const fee = delegation && delegation.delegationAction === DELEGATION_ACTIONS.QUIT ? totalInputs.minus(totalOutputs).plus(depositsReclaimed) : totalInputs.minus(totalOutputs).minus(deposits); const extendedResponse = { inputs: inputsData, outputs: outputsData, @@ -1181,24 +1056,24 @@ export default class AdaApi { fee: fee.dividedBy(LOVELACES_PER_ADA), deposits: deposits.dividedBy(LOVELACES_PER_ADA), depositsReclaimed: depositsReclaimed.dividedBy(LOVELACES_PER_ADA), - metadata: response.metadata || null, + metadata: response.metadata || null }; - - logger.debug('AdaApi::selectCoins success', { extendedResponse }); + logger.debug('AdaApi::selectCoins success', { + extendedResponse + }); return extendedResponse; } catch (error) { - logger.error('AdaApi::selectCoins error', { error }); - + logger.error('AdaApi::selectCoins error', { + error + }); let notEnoughMoneyError; + if (walletBalance.gt(availableBalance)) { // 1. Amount exceeds availableBalance due to pending transactions: // - walletBalance > availableBalance // = show "Cannot calculate fees while there are pending transactions." notEnoughMoneyError = 'canNotCalculateTransactionFees'; - } else if ( - !walletBalance.isZero() && - walletBalance.isEqualTo(rewardsBalance) - ) { + } else if (!walletBalance.isZero() && walletBalance.isEqualTo(rewardsBalance)) { // 2. Wallet contains only rewards: // - walletBalance === rewardsBalance // = show "Cannot send from a wallet that contains only rewards balances." @@ -1213,862 +1088,878 @@ export default class AdaApi { // ApiError with logging showcase throw new ApiError(error, { logError: true, - msg: 'AdaApi::calculateTransactionFee error', - }) - .set(notEnoughMoneyError, true) - .where('code', 'not_enough_money') - .set('utxoTooSmall', true, { - minimumAda: get( - /(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), - 2, - 0 - ), - }) - .where('code', 'utxo_too_small') - .set('invalidAddress') - .where('code', 'bad_request') - .inc('message', 'Unable to decode Address') - .result(); + msg: 'AdaApi::calculateTransactionFee error' + }).set(notEnoughMoneyError, true).where('code', 'not_enough_money').set('utxoTooSmall', true, { + minimumAda: get(/(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), 2, 0) + }).where('code', 'utxo_too_small').set('invalidAddress').where('code', 'bad_request').inc('message', 'Unable to decode Address').result(); } }; + createExternalTransaction = async (request: CreateExternalTransactionRequest): Promise => { + const { + signedTransactionBlob + } = request; - createExternalTransaction = async ( - request: CreateExternalTransactionRequest - ): Promise => { - const { signedTransactionBlob } = request; try { const response = await createExternalTransaction(this.config, { - signedTransactionBlob, + signedTransactionBlob }); return response; } catch (error) { - logger.error('AdaApi::createExternalTransaction error', { error }); + logger.error('AdaApi::createExternalTransaction error', { + error + }); throw new ApiError(error); } }; - inspectAddress = async (request: { - addressId: string, + addressId: string; }): Promise => { logger.debug('AdaApi::inspectAddress called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { addressId } = request; + const { + addressId + } = request; + try { const response = await inspectAddress(this.config, { - addressId, + addressId + }); + logger.debug('AdaApi::inspectAddress success', { + response }); - logger.debug('AdaApi::inspectAddress success', { response }); return response; } catch (error) { - logger.error('AdaApi::inspectAddress error', { error }); + logger.error('AdaApi::inspectAddress error', { + error + }); throw new ApiError(error); } }; - - getPublicKey = async ( - request: any // @TODO - ): Promise => { + getPublicKey = async (request: any): Promise => { logger.debug('AdaApi::getPublicKey called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { walletId, role, index } = request; + const { + walletId, + role, + index + } = request; + try { const response = await getPublicKey(this.config, { walletId, role, - index, + index + }); + logger.debug('AdaApi::getPublicKey success', { + response }); - logger.debug('AdaApi::getPublicKey success', { response }); return response; } catch (error) { - logger.error('AdaApi::getPublicKey error', { error }); + logger.error('AdaApi::getPublicKey error', { + error + }); throw new ApiError(error); } }; - getICOPublicKey = async (request: ICOPublicKeyParams): Promise => { logger.debug('AdaApi::getICOPublicKey called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); + try { const response = await getICOPublicKey(this.config, request); logger.debug('AdaApi::getICOPublicKey success', { - icoPublicKey: response, + icoPublicKey: response }); return response; } catch (error) { - logger.error('AdaApi::getICOPublicKey error', { error }); - throw new ApiError(error) - .set('wrongEncryptionPassphrase') - .where('code', 'bad_request') - .inc('message', 'passphrase is too short') - .result(); + logger.error('AdaApi::getICOPublicKey error', { + error + }); + throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; + constructAddress = async (request: any): Promise => { + const { + data + } = request; - constructAddress = async ( - request: any // @TODO - ): Promise => { - const { data } = request; try { const response = await constructAddress(this.config, { - data, + data + }); + logger.debug('AdaApi::constructAddress success', { + response }); - logger.debug('AdaApi::constructAddress success', { response }); return response; } catch (error) { - logger.error('AdaApi::constructAddress error', { error }); + logger.error('AdaApi::constructAddress error', { + error + }); throw new ApiError(error); } }; - - createAddress = async ( - request: CreateByronWalletAddressRequest - ): Promise => { + createAddress = async (request: CreateByronWalletAddressRequest): Promise => { logger.debug('AdaApi::createAddress called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { addressIndex, walletId, passphrase: passwordString } = request; + const { + addressIndex, + walletId, + passphrase: passwordString + } = request; const passphrase = passwordString || ''; + try { const address: Address = await createByronWalletAddress(this.config, { passphrase, walletId, - addressIndex, + addressIndex + }); + logger.debug('AdaApi::createAddress success', { + address }); - logger.debug('AdaApi::createAddress success', { address }); return _createAddressFromServerData(address); } catch (error) { - logger.error('AdaApi::createAddress error', { error }); - throw new ApiError(error) - .set('wrongEncryptionPassphrase') - .where('code', 'bad_request') - .inc('message', 'passphrase is too short') - .result(); + logger.error('AdaApi::createAddress error', { + error + }); + throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; + deleteTransaction = async (request: DeleteTransactionRequest): Promise => { + logger.debug('AdaApi::deleteTransaction called', { + parameters: request + }); + const { + walletId, + transactionId, + isLegacy + } = request; - deleteTransaction = async ( - request: DeleteTransactionRequest - ): Promise => { - logger.debug('AdaApi::deleteTransaction called', { parameters: request }); - const { walletId, transactionId, isLegacy } = request; try { let response; + if (isLegacy) { response = await deleteLegacyTransaction(this.config, { walletId, - transactionId, + transactionId }); } else { response = await deleteTransaction(this.config, { walletId, - transactionId, + transactionId }); } + logger.debug('AdaApi::deleteTransaction success', response); } catch (error) { - logger.error('AdaApi::deleteTransaction error', { error }); - // In this particular call we don't need to handle the error in the UI + logger.error('AdaApi::deleteTransaction error', { + error + }); // In this particular call we don't need to handle the error in the UI // The only reason transaction canceling would fail is if the transaction // is no longer pending - in which case there is nothing we can do. } }; - - isValidCertificateMnemonic = (mnemonic: string): boolean => - mnemonic.split(' ').length === ADA_CERTIFICATE_MNEMONIC_LENGTH; + isValidCertificateMnemonic = (mnemonic: string): boolean => mnemonic.split(' ').length === ADA_CERTIFICATE_MNEMONIC_LENGTH; getWalletRecoveryPhrase(): Promise> { logger.debug('AdaApi::getWalletRecoveryPhrase called'); + try { - const response: Promise> = new Promise((resolve) => - resolve(generateAccountMnemonics(WALLET_RECOVERY_PHRASE_WORD_COUNT)) - ); + const response: Promise> = new Promise(resolve => resolve(generateAccountMnemonics(WALLET_RECOVERY_PHRASE_WORD_COUNT))); logger.debug('AdaApi::getWalletRecoveryPhrase success'); return response; } catch (error) { - logger.error('AdaApi::getWalletRecoveryPhrase error', { error }); + logger.error('AdaApi::getWalletRecoveryPhrase error', { + error + }); throw new ApiError(error); } } getWalletCertificateAdditionalMnemonics(): Promise> { logger.debug('AdaApi::getWalletCertificateAdditionalMnemonics called'); + try { - const response: Promise> = new Promise((resolve) => - resolve(generateAdditionalMnemonics()) - ); + const response: Promise> = new Promise(resolve => resolve(generateAdditionalMnemonics())); logger.debug('AdaApi::getWalletCertificateAdditionalMnemonics success'); return response; } catch (error) { logger.error('AdaApi::getWalletCertificateAdditionalMnemonics error', { - error, + error }); throw new ApiError(error); } } - getWalletCertificateRecoveryPhrase( - request: GetWalletCertificateRecoveryPhraseRequest - ): Promise> { + getWalletCertificateRecoveryPhrase(request: GetWalletCertificateRecoveryPhraseRequest): Promise> { logger.debug('AdaApi::getWalletCertificateRecoveryPhrase called'); - const { passphrase, input: scrambledInput } = request; + const { + passphrase, + input: scrambledInput + } = request; + try { - const response: Promise> = new Promise((resolve) => - resolve(scrambleMnemonics({ passphrase, scrambledInput })) - ); + const response: Promise> = new Promise(resolve => resolve(scrambleMnemonics({ + passphrase, + scrambledInput + }))); logger.debug('AdaApi::getWalletCertificateRecoveryPhrase success'); return response; } catch (error) { logger.error('AdaApi::getWalletCertificateRecoveryPhrase error', { - error, + error }); throw new ApiError(error); } } - getWalletRecoveryPhraseFromCertificate( - request: GetWalletRecoveryPhraseFromCertificateRequest - ): Promise> { + getWalletRecoveryPhraseFromCertificate(request: GetWalletRecoveryPhraseFromCertificateRequest): Promise> { logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate called'); - const { passphrase, scrambledInput } = request; + const { + passphrase, + scrambledInput + } = request; + try { - const response = unscrambleMnemonics({ passphrase, scrambledInput }); - logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate success'); + const response = unscrambleMnemonics({ + passphrase, + scrambledInput + }); + logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate success'); return Promise.resolve(response); } catch (error) { logger.error('AdaApi::getWalletRecoveryPhraseFromCertificate error', { - error, + error }); - const errorRejection = new ApiError(error) - .set('invalidMnemonic', true) - .result(); + const errorRejection = new ApiError(error).set('invalidMnemonic', true).result(); return Promise.reject(errorRejection); } } restoreWallet = async (request: RestoreWalletRequest): Promise => { logger.debug('AdaApi::restoreWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { recoveryPhrase, walletName, spendingPassword } = request; + const { + recoveryPhrase, + walletName, + spendingPassword + } = request; const walletInitData = { name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword, + passphrase: spendingPassword }; + try { const wallet: AdaWallet = await restoreWallet(this.config, { - walletInitData, + walletInitData + }); + logger.debug('AdaApi::restoreWallet success', { + wallet }); - logger.debug('AdaApi::restoreWallet success', { wallet }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::restoreWallet error', { error }); - throw new ApiError(error) - .set('forbiddenMnemonic') - .where('message', 'JSONValidationFailed') - .inc( - 'diagnostic.validationError', - 'Forbidden Mnemonic: an example Mnemonic has been submitted' - ) - .set('forbiddenMnemonic') - .where('code', 'invalid_restoration_parameters') - .result(); + logger.error('AdaApi::restoreWallet error', { + error + }); + throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; - - createHardwareWallet = async ( - request: CreateHardwareWalletRequest - ): Promise => { + createHardwareWallet = async (request: CreateHardwareWalletRequest): Promise => { logger.debug('AdaApi::createHardwareWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { walletName, accountPublicKey } = request; + const { + walletName, + accountPublicKey + } = request; const walletInitData = { name: walletName, - account_public_key: accountPublicKey, + account_public_key: accountPublicKey }; try { - const hardwareWallet: AdaWallet = await createHardwareWallet( - this.config, - { - walletInitData, - } - ); - const wallet = { - ...hardwareWallet, - isHardwareWallet: true, + const hardwareWallet: AdaWallet = await createHardwareWallet(this.config, { + walletInitData + }); + const wallet = { ...hardwareWallet, + isHardwareWallet: true }; - logger.debug('AdaApi::createHardwareWallet success', { wallet }); + logger.debug('AdaApi::createHardwareWallet success', { + wallet + }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::createHardwareWallet error', { error }); + logger.error('AdaApi::createHardwareWallet error', { + error + }); throw new ApiError(error); } }; - getCurrencyList = async (): Promise => { try { const apiResponse = await getCurrencyList(); - const response: GetCurrencyListResponse = currencyConfig.responses.list( - apiResponse - ); - logger.debug('AdaApi::getCurrencyList success', { response }); + const response: GetCurrencyListResponse = currencyConfig.responses.list(apiResponse); + logger.debug('AdaApi::getCurrencyList success', { + response + }); return response; } catch (error) { - logger.error('AdaApi::getCurrencyList error', { error }); + logger.error('AdaApi::getCurrencyList error', { + error + }); throw new ApiError(error); } }; - - getCurrencyRate = async ( - currency: GetCurrencyRateRequest - ): Promise => { + getCurrencyRate = async (currency: GetCurrencyRateRequest): Promise => { try { const apiResponse = await getCurrencyRate(currency); - const response: GetCurrencyRateResponse = currencyConfig.responses.rate( - apiResponse - ); - logger.debug('AdaApi::getCurrencyRate success', { response }); + const response: GetCurrencyRateResponse = currencyConfig.responses.rate(apiResponse); + logger.debug('AdaApi::getCurrencyRate success', { + response + }); return response; } catch (error) { - logger.error('AdaApi::getCurrencyRate error', { error }); + logger.error('AdaApi::getCurrencyRate error', { + error + }); throw new ApiError(error); } }; - - restoreLegacyWallet = async ( - request: RestoreLegacyWalletRequest - ): Promise => { + restoreLegacyWallet = async (request: RestoreLegacyWalletRequest): Promise => { logger.debug('AdaApi::restoreLegacyWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { recoveryPhrase, walletName, spendingPassword } = request; + const { + recoveryPhrase, + walletName, + spendingPassword + } = request; const walletInitData = { style: 'random', name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword, + passphrase: spendingPassword }; + try { - const legacyWallet: LegacyAdaWallet = await restoreLegacyWallet( - this.config, - { walletInitData } - ); + const legacyWallet: LegacyAdaWallet = await restoreLegacyWallet(this.config, { + walletInitData + }); const extraLegacyWalletProps = { - address_pool_gap: 0, // Not needed for legacy wallets + address_pool_gap: 0, + // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING, - }, + status: WalletDelegationStatuses.NOT_DELEGATING + } }, - isLegacy: true, + isLegacy: true }; - const wallet = { - ...legacyWallet, - ...extraLegacyWalletProps, + const wallet = { ...legacyWallet, + ...extraLegacyWalletProps }; - logger.debug('AdaApi::restoreLegacyWallet success', { wallet }); + logger.debug('AdaApi::restoreLegacyWallet success', { + wallet + }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::restoreLegacyWallet error', { error }); - throw new ApiError(error) - .set('forbiddenMnemonic') - .where('message', 'JSONValidationFailed') - .inc( - 'diagnostic.validationError', - 'Forbidden Mnemonic: an example Mnemonic has been submitted' - ) - .set('forbiddenMnemonic') - .where('code', 'invalid_restoration_parameters') - .result(); + logger.error('AdaApi::restoreLegacyWallet error', { + error + }); + throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; - - restoreByronRandomWallet = async ( - request: RestoreLegacyWalletRequest - ): Promise => { + restoreByronRandomWallet = async (request: RestoreLegacyWalletRequest): Promise => { logger.debug('AdaApi::restoreByronRandomWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { recoveryPhrase, walletName, spendingPassword } = request; + const { + recoveryPhrase, + walletName, + spendingPassword + } = request; const walletInitData = { name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword, + passphrase: spendingPassword }; const type = WALLET_BYRON_KINDS.RANDOM; - try { - const legacyWallet: LegacyAdaWallet = await restoreByronWallet( - this.config, - { walletInitData }, - type - ); + try { + const legacyWallet: LegacyAdaWallet = await restoreByronWallet(this.config, { + walletInitData + }, type); // Generate address for the newly restored Byron wallet - const { id: walletId } = legacyWallet; + const { + id: walletId + } = legacyWallet; const address: Address = await createByronWalletAddress(this.config, { passphrase: spendingPassword, - walletId, + walletId + }); + logger.debug('AdaApi::createAddress (Byron) success', { + address }); - logger.debug('AdaApi::createAddress (Byron) success', { address }); - const extraLegacyWalletProps = { - address_pool_gap: 0, // Not needed for legacy wallets + address_pool_gap: 0, + // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING, - }, + status: WalletDelegationStatuses.NOT_DELEGATING + } }, - isLegacy: true, + isLegacy: true }; - const wallet = { - ...legacyWallet, - ...extraLegacyWalletProps, + const wallet = { ...legacyWallet, + ...extraLegacyWalletProps }; - logger.debug('AdaApi::restoreByronRandomWallet success', { wallet }); + logger.debug('AdaApi::restoreByronRandomWallet success', { + wallet + }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::restoreByronRandomWallet error', { error }); - throw new ApiError(error) - .set('forbiddenMnemonic') - .where('message', 'JSONValidationFailed') - .inc( - 'diagnostic.validationError', - 'Forbidden Mnemonic: an example Mnemonic has been submitted' - ) - .set('forbiddenMnemonic') - .where('code', 'invalid_restoration_parameters') - .result(); + logger.error('AdaApi::restoreByronRandomWallet error', { + error + }); + throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; - - restoreByronIcarusWallet = async ( - request: RestoreLegacyWalletRequest - ): Promise => { + restoreByronIcarusWallet = async (request: RestoreLegacyWalletRequest): Promise => { logger.debug('AdaApi::restoreByronIcarusWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { recoveryPhrase, walletName, spendingPassword } = request; + const { + recoveryPhrase, + walletName, + spendingPassword + } = request; const walletInitData = { name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword, + passphrase: spendingPassword }; const type = WALLET_BYRON_KINDS.ICARUS; + try { - const legacyWallet: LegacyAdaWallet = await restoreByronWallet( - this.config, - { walletInitData }, - type - ); + const legacyWallet: LegacyAdaWallet = await restoreByronWallet(this.config, { + walletInitData + }, type); const extraLegacyWalletProps = { - address_pool_gap: 0, // Not needed for legacy wallets + address_pool_gap: 0, + // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING, - }, + status: WalletDelegationStatuses.NOT_DELEGATING + } }, - isLegacy: true, + isLegacy: true }; - const wallet = { - ...legacyWallet, - ...extraLegacyWalletProps, + const wallet = { ...legacyWallet, + ...extraLegacyWalletProps }; - logger.debug('AdaApi::restoreByronIcarusWallet success', { wallet }); + logger.debug('AdaApi::restoreByronIcarusWallet success', { + wallet + }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::restoreByronIcarusWallet error', { error }); - throw new ApiError(error) - .set('forbiddenMnemonic') - .where('message', 'JSONValidationFailed') - .inc( - 'diagnostic.validationError', - 'Forbidden Mnemonic: an example Mnemonic has been submitted' - ) - .set('forbiddenMnemonic') - .where('code', 'invalid_restoration_parameters') - .result(); + logger.error('AdaApi::restoreByronIcarusWallet error', { + error + }); + throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; - - restoreByronTrezorWallet = async ( - request: RestoreLegacyWalletRequest - ): Promise => { + restoreByronTrezorWallet = async (request: RestoreLegacyWalletRequest): Promise => { logger.debug('AdaApi::restoreByronTrezorWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { recoveryPhrase, walletName, spendingPassword } = request; + const { + recoveryPhrase, + walletName, + spendingPassword + } = request; const walletInitData = { name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword, + passphrase: spendingPassword }; const type = WALLET_BYRON_KINDS.TREZOR; + try { - const legacyWallet: LegacyAdaWallet = await restoreByronWallet( - this.config, - { walletInitData }, - type - ); + const legacyWallet: LegacyAdaWallet = await restoreByronWallet(this.config, { + walletInitData + }, type); const extraLegacyWalletProps = { - address_pool_gap: 0, // Not needed for legacy wallets + address_pool_gap: 0, + // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING, - }, + status: WalletDelegationStatuses.NOT_DELEGATING + } }, - isLegacy: true, + isLegacy: true }; - const wallet = { - ...legacyWallet, - ...extraLegacyWalletProps, + const wallet = { ...legacyWallet, + ...extraLegacyWalletProps }; - logger.debug('AdaApi::restoreByronTrezorWallet success', { wallet }); + logger.debug('AdaApi::restoreByronTrezorWallet success', { + wallet + }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::restoreByronTrezorWallet error', { error }); - throw new ApiError(error) - .set('forbiddenMnemonic') - .where('message', 'JSONValidationFailed') - .inc( - 'diagnostic.validationError', - 'Forbidden Mnemonic: an example Mnemonic has been submitted' - ) - .set('forbiddenMnemonic') - .where('code', 'invalid_restoration_parameters') - .result(); + logger.error('AdaApi::restoreByronTrezorWallet error', { + error + }); + throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; - - restoreByronLedgerWallet = async ( - request: RestoreLegacyWalletRequest - ): Promise => { + restoreByronLedgerWallet = async (request: RestoreLegacyWalletRequest): Promise => { logger.debug('AdaApi::restoreByronLedgerWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { recoveryPhrase, walletName, spendingPassword } = request; + const { + recoveryPhrase, + walletName, + spendingPassword + } = request; const walletInitData = { name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword, + passphrase: spendingPassword }; const type = WALLET_BYRON_KINDS.LEDGER; + try { - const legacyWallet: LegacyAdaWallet = await restoreByronWallet( - this.config, - { walletInitData }, - type - ); + const legacyWallet: LegacyAdaWallet = await restoreByronWallet(this.config, { + walletInitData + }, type); const extraLegacyWalletProps = { - address_pool_gap: 0, // Not needed for legacy wallets + address_pool_gap: 0, + // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING, - }, + status: WalletDelegationStatuses.NOT_DELEGATING + } }, - isLegacy: true, + isLegacy: true }; - const wallet = { - ...legacyWallet, - ...extraLegacyWalletProps, + const wallet = { ...legacyWallet, + ...extraLegacyWalletProps }; - logger.debug('AdaApi::restoreByronLedgerWallet success', { wallet }); + logger.debug('AdaApi::restoreByronLedgerWallet success', { + wallet + }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::restoreByronLedgerWallet error', { error }); - throw new ApiError(error) - .set('forbiddenMnemonic') - .where('message', 'JSONValidationFailed') - .inc( - 'diagnostic.validationError', - 'Forbidden Mnemonic: an example Mnemonic has been submitted' - ) - .set('forbiddenMnemonic') - .where('code', 'invalid_restoration_parameters') - .result(); + logger.error('AdaApi::restoreByronLedgerWallet error', { + error + }); + throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; - - restoreExportedByronWallet = async ( - request: RestoreExportedByronWalletRequest - ): Promise => { + restoreExportedByronWallet = async (request: RestoreExportedByronWalletRequest): Promise => { logger.debug('AdaApi::restoreExportedByronWallet called', { - name: request.name, + name: request.name }); + try { - const legacyWallet: LegacyAdaWallet = await restoreExportedByronWallet( - this.config, - { walletInitData: request } - ); + const legacyWallet: LegacyAdaWallet = await restoreExportedByronWallet(this.config, { + walletInitData: request + }); const extraLegacyWalletProps = { - address_pool_gap: 0, // Not needed for legacy wallets + address_pool_gap: 0, + // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING, - }, + status: WalletDelegationStatuses.NOT_DELEGATING + } }, - isLegacy: true, + isLegacy: true }; - const wallet = { - ...legacyWallet, - ...extraLegacyWalletProps, + const wallet = { ...legacyWallet, + ...extraLegacyWalletProps }; - logger.debug('AdaApi::restoreExportedByronWallet success', { wallet }); + logger.debug('AdaApi::restoreExportedByronWallet success', { + wallet + }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::restoreExportedByronWallet error', { error }); + logger.error('AdaApi::restoreExportedByronWallet error', { + error + }); throw new ApiError(error); } }; - - importWalletFromKey = async ( - request: ImportWalletFromKeyRequest - ): Promise => { + importWalletFromKey = async (request: ImportWalletFromKeyRequest): Promise => { logger.debug('AdaApi::importWalletFromKey called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { filePath, spendingPassword } = request; + const { + filePath, + spendingPassword + } = request; + try { const importedWallet: AdaWallet = await importWalletAsKey(this.config, { filePath, - spendingPassword: spendingPassword || '', + spendingPassword: spendingPassword || '' + }); + logger.debug('AdaApi::importWalletFromKey success', { + importedWallet }); - logger.debug('AdaApi::importWalletFromKey success', { importedWallet }); return _createWalletFromServerData(importedWallet); } catch (error) { - logger.error('AdaApi::importWalletFromKey error', { error }); - throw new ApiError(error) - .set('walletAlreadyImported', true) - .where('code', 'wallet_already_exists') - .result('walletFileImportError'); + logger.error('AdaApi::importWalletFromKey error', { + error + }); + throw new ApiError(error).set('walletAlreadyImported', true).where('code', 'wallet_already_exists').result('walletFileImportError'); } }; - - importWalletFromFile = async ( - request: ImportWalletFromFileRequest - ): Promise => { + importWalletFromFile = async (request: ImportWalletFromFileRequest): Promise => { logger.debug('AdaApi::importWalletFromFile called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { filePath, spendingPassword } = request; + const { + filePath, + spendingPassword + } = request; const isKeyFile = filePath.split('.').pop().toLowerCase() === 'key'; + try { - const importedWallet: AdaWallet = isKeyFile - ? await importWalletAsKey(this.config, { - filePath, - spendingPassword, - }) - : await importWalletAsJSON(this.config, filePath); - logger.debug('AdaApi::importWalletFromFile success', { importedWallet }); + const importedWallet: AdaWallet = isKeyFile ? await importWalletAsKey(this.config, { + filePath, + spendingPassword + }) : await importWalletAsJSON(this.config, filePath); + logger.debug('AdaApi::importWalletFromFile success', { + importedWallet + }); return _createWalletFromServerData(importedWallet); } catch (error) { - logger.error('AdaApi::importWalletFromFile error', { error }); - throw new ApiError(error) - .set('walletAlreadyImported', true) - .where('code', 'wallet_already_exists') - .result('walletFileImportError'); + logger.error('AdaApi::importWalletFromFile error', { + error + }); + throw new ApiError(error).set('walletAlreadyImported', true).where('code', 'wallet_already_exists').result('walletFileImportError'); } }; - updateWallet = async (request: UpdateWalletRequest): Promise => { logger.debug('AdaApi::updateWallet called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { walletId, name, isLegacy } = request; + const { + walletId, + name, + isLegacy + } = request; try { let wallet: AdaWallet; + if (isLegacy) { const response = await updateByronWallet(this.config, { walletId, - name, + name }); - wallet = { - ...response, - address_pool_gap: 0, // Not needed for legacy wallets + wallet = { ...response, + address_pool_gap: 0, + // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING, - }, + status: WalletDelegationStatuses.NOT_DELEGATING + } }, - isLegacy: true, + isLegacy: true }; } else { - wallet = await updateWallet(this.config, { walletId, name }); + wallet = await updateWallet(this.config, { + walletId, + name + }); } - logger.debug('AdaApi::updateWallet success', { wallet }); + + logger.debug('AdaApi::updateWallet success', { + wallet + }); return _createWalletFromServerData(wallet); } catch (error) { - logger.error('AdaApi::updateWallet error', { error }); + logger.error('AdaApi::updateWallet error', { + error + }); throw new ApiError(error); } }; - - updateSpendingPassword = async ( - request: UpdateSpendingPasswordRequest - ): Promise => { + updateSpendingPassword = async (request: UpdateSpendingPasswordRequest): Promise => { logger.debug('AdaApi::updateSpendingPassword called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { walletId, oldPassword, newPassword, isLegacy } = request; + const { + walletId, + oldPassword, + newPassword, + isLegacy + } = request; + try { if (isLegacy) { await updateByronSpendingPassword(this.config, { walletId, oldPassword, - newPassword, + newPassword }); if (!oldPassword) { // Generate address for the Byron wallet for which password was set for the 1st time const address: Address = await createByronWalletAddress(this.config, { passphrase: newPassword, - walletId, + walletId + }); + logger.debug('AdaApi::createAddress (Byron) success', { + address }); - logger.debug('AdaApi::createAddress (Byron) success', { address }); } } else { await updateSpendingPassword(this.config, { walletId, oldPassword, - newPassword, + newPassword }); } + logger.debug('AdaApi::updateSpendingPassword success'); return true; } catch (error) { - logger.error('AdaApi::updateSpendingPassword error', { error }); - throw new ApiError(error) - .set('wrongEncryptionPassphrase') - .where('code', 'bad_request') - .inc('message', 'passphrase is too short') - .result(); + logger.error('AdaApi::updateSpendingPassword error', { + error + }); + throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; - - quitStakePool = async ( - request: QuitStakePoolRequest - ): Promise => { + quitStakePool = async (request: QuitStakePoolRequest): Promise => { logger.debug('AdaApi::quitStakePool called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { walletId, passphrase } = request; + const { + walletId, + passphrase + } = request; + try { const result = await quitStakePool(this.config, { walletId, - passphrase, + passphrase + }); + logger.debug('AdaApi::quitStakePool success', { + result }); - logger.debug('AdaApi::quitStakePool success', { result }); return result; } catch (error) { - logger.error('AdaApi::quitStakePool error', { error }); - throw new ApiError(error) - .set('wrongEncryptionPassphrase') - .where('code', 'bad_request') - .inc('message', 'passphrase is too short') - .result(); + logger.error('AdaApi::quitStakePool error', { + error + }); + throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; - getSmashSettings = async (): Promise => { logger.debug('AdaApi::getSmashSettings called'); + try { const { - pool_metadata_source: poolMetadataSource, + pool_metadata_source: poolMetadataSource } = await getSmashSettings(this.config); - logger.debug('AdaApi::getSmashSettings success', { poolMetadataSource }); + logger.debug('AdaApi::getSmashSettings success', { + poolMetadataSource + }); return poolMetadataSource; } catch (error) { - logger.error('AdaApi::getSmashSettings error', { error }); + logger.error('AdaApi::getSmashSettings error', { + error + }); throw new ApiError(error); } }; - checkSmashServerIsValid = async (url: string): Promise => { logger.debug('AdaApi::checkSmashServerIsValid called', { - parameters: { url }, + parameters: { + url + } }); + try { if (url === SMASH_SERVERS_LIST.direct.url) { return true; } + const { - health, - }: CheckSmashServerHealthApiResponse = await checkSmashServerHealth( - this.config, - url - ); + health + }: CheckSmashServerHealthApiResponse = await checkSmashServerHealth(this.config, url); const isValid = health === SMASH_SERVER_STATUSES.AVAILABLE; - logger.debug('AdaApi::checkSmashServerIsValid success', { isValid }); + logger.debug('AdaApi::checkSmashServerIsValid success', { + isValid + }); return isValid; } catch (error) { - logger.error('AdaApi::checkSmashServerIsValid error', { error }); + logger.error('AdaApi::checkSmashServerIsValid error', { + error + }); throw new ApiError(error); } }; - - updateSmashSettings = async ( - poolMetadataSource: PoolMetadataSource - ): Promise => { + updateSmashSettings = async (poolMetadataSource: PoolMetadataSource): Promise => { logger.debug('AdaApi::updateSmashSettings called', { - parameters: { poolMetadataSource }, + parameters: { + poolMetadataSource + } }); + try { - const isSmashServerValid = await this.checkSmashServerIsValid( - poolMetadataSource - ); + const isSmashServerValid = await this.checkSmashServerIsValid(poolMetadataSource); + if (!isSmashServerValid) { const error = { - code: 'invalid_smash_server', + code: 'invalid_smash_server' }; throw new ApiError(error); } + await updateSmashSettings(this.config, poolMetadataSource); logger.debug('AdaApi::updateSmashSettings success', { - poolMetadataSource, + poolMetadataSource }); } catch (error) { const id = get(error, 'id'); const message = get(error, 'values.message'); - if ( - id === 'api.errors.GenericApiError' && - message === - 'Error parsing query parameter url failed: URI must not contain a path/query/fragment.' - ) { + + if (id === 'api.errors.GenericApiError' && message === 'Error parsing query parameter url failed: URI must not contain a path/query/fragment.') { throw new ApiError({ - code: 'invalid_smash_server', + code: 'invalid_smash_server' }); } - logger.error('AdaApi::updateSmashSettings error', { error }); + + logger.error('AdaApi::updateSmashSettings error', { + error + }); throw new ApiError(error); } }; - - getRedeemItnRewardsFee = async ( - request: GetRedeemItnRewardsFeeRequest - ): Promise => { - const { address, wallet, recoveryPhrase: withdrawal } = request; + getRedeemItnRewardsFee = async (request: GetRedeemItnRewardsFeeRequest): Promise => { + const { + address, + wallet, + recoveryPhrase: withdrawal + } = request; const { id: walletId, amount: walletBalance, availableAmount, - reward: rewardsBalance, + reward: rewardsBalance } = wallet; - const minRewardsReceiverBalance = new BigNumber( - MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE - ); + const minRewardsReceiverBalance = new BigNumber(MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE); // Amount is set to either wallet's balance in case balance is less than 3 ADA or 1 ADA in order to avoid min UTXO affecting transaction fees calculation - const amount = walletBalance.isLessThan( - minRewardsReceiverBalance.times( - MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE * 3 - ) - ) - ? formattedAmountToLovelace(walletBalance.toString()) - : REWARDS_REDEMPTION_FEE_CALCULATION_AMOUNT; + const amount = walletBalance.isLessThan(minRewardsReceiverBalance.times(MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE * 3)) ? formattedAmountToLovelace(walletBalance.toString()) : REWARDS_REDEMPTION_FEE_CALCULATION_AMOUNT; const payload = { address, walletId, @@ -2077,133 +1968,163 @@ export default class AdaApi { rewardsBalance, amount, withdrawal, - isLegacy: false, + isLegacy: false }; + try { - const { fee } = await this.calculateTransactionFee(payload); - logger.debug('AdaApi::getRedeemItnRewardsFee success', { fee }); + const { + fee + } = await this.calculateTransactionFee(payload); + logger.debug('AdaApi::getRedeemItnRewardsFee success', { + fee + }); return fee; } catch (error) { - logger.error('AdaApi::getRedeemItnRewardsFee error', { error }); + logger.error('AdaApi::getRedeemItnRewardsFee error', { + error + }); throw new ApiError(error); } }; - - requestRedeemItnRewards = async ( - request: RequestRedeemItnRewardsRequest - ): Promise => { + requestRedeemItnRewards = async (request: RequestRedeemItnRewardsRequest): Promise => { const { address, walletId, spendingPassword: passphrase, - recoveryPhrase: withdrawal, + recoveryPhrase: withdrawal } = request; const amount = REWARDS_REDEMPTION_FEE_CALCULATION_AMOUNT; + try { const data = { - payments: [ - { - address, - amount: { - quantity: amount, - unit: WalletUnits.LOVELACE, - }, - }, - ], + payments: [{ + address, + amount: { + quantity: amount, + unit: WalletUnits.LOVELACE + } + }], passphrase, - withdrawal, + withdrawal }; const transaction = await createTransaction(this.config, { walletId, - data, + data }); + const response = _createRedeemItnRewardsFromServerData(transaction); + logger.debug('AdaApi::requestRedeemItnRewards success', { - response, + response }); return response; } catch (error) { - logger.error('AdaApi::requestRedeemItnRewards error', { error }); + logger.error('AdaApi::requestRedeemItnRewards error', { + error + }); throw new ApiError(error); } }; - - exportWalletToFile = async ( - request: ExportWalletToFileRequest - ): Promise<[]> => { - const { walletId, filePath } = request; + exportWalletToFile = async (request: ExportWalletToFileRequest): Promise<[]> => { + const { + walletId, + filePath + } = request; logger.debug('AdaApi::exportWalletToFile called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); + try { const response: Promise<[]> = await exportWalletAsJSON(this.config, { walletId, - filePath, + filePath + }); + logger.debug('AdaApi::exportWalletToFile success', { + response }); - logger.debug('AdaApi::exportWalletToFile success', { response }); return response; } catch (error) { - logger.error('AdaApi::exportWalletToFile error', { error }); + logger.error('AdaApi::exportWalletToFile error', { + error + }); throw new ApiError(error); } }; - - getWalletUtxos = async ( - request: GetWalletUtxosRequest - ): Promise => { - const { walletId, isLegacy } = request; + getWalletUtxos = async (request: GetWalletUtxosRequest): Promise => { + const { + walletId, + isLegacy + } = request; logger.debug('AdaApi::getWalletUtxos called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); + try { let response: WalletUtxos; + if (isLegacy) { - response = await getByronWalletUtxos(this.config, { walletId }); + response = await getByronWalletUtxos(this.config, { + walletId + }); } else { - response = await getWalletUtxos(this.config, { walletId }); + response = await getWalletUtxos(this.config, { + walletId + }); } - logger.debug('AdaApi::getWalletUtxos success', { response }); + + logger.debug('AdaApi::getWalletUtxos success', { + response + }); return response; } catch (error) { - logger.error('AdaApi::getWalletUtxos error', { error }); + logger.error('AdaApi::getWalletUtxos error', { + error + }); throw new ApiError(error); } }; - - transferFundsCalculateFee = async ( - request: TransferFundsCalculateFeeRequest - ): Promise => { - const { sourceWalletId } = request; + transferFundsCalculateFee = async (request: TransferFundsCalculateFeeRequest): Promise => { + const { + sourceWalletId + } = request; logger.debug('AdaApi::transferFundsCalculateFee called', { - parameters: { sourceWalletId }, + parameters: { + sourceWalletId + } }); + try { - const response: TransferFundsCalculateFeeApiResponse = await transferFundsCalculateFee( - this.config, - { - sourceWalletId, - } - ); - logger.debug('AdaApi::transferFundsCalculateFee success', { response }); + const response: TransferFundsCalculateFeeApiResponse = await transferFundsCalculateFee(this.config, { + sourceWalletId + }); + logger.debug('AdaApi::transferFundsCalculateFee success', { + response + }); return _createMigrationFeeFromServerData(response); } catch (error) { - logger.error('AdaApi::transferFundsCalculateFee error', { error }); + logger.error('AdaApi::transferFundsCalculateFee error', { + error + }); throw new ApiError(error); } }; - - transferFunds = async ( - request: TransferFundsRequest - ): Promise => { - const { sourceWalletId, targetWalletAddresses, passphrase } = request; + transferFunds = async (request: TransferFundsRequest): Promise => { + const { + sourceWalletId, + targetWalletAddresses, + passphrase + } = request; logger.debug('AdaApi::transferFunds called', { - parameters: { sourceWalletId, targetWalletAddresses }, + parameters: { + sourceWalletId, + targetWalletAddresses + } }); if (!targetWalletAddresses) { throw new ApiError({ code: 'no_such_wallet', - message: 'Target wallet does not exist', + message: 'Target wallet does not exist' }).result(); } @@ -2211,87 +2132,81 @@ export default class AdaApi { const response: TransferFundsResponse = await transferFunds(this.config, { sourceWalletId, targetWalletAddresses, - passphrase, + passphrase + }); + logger.debug('AdaApi::transferFunds success', { + response }); - logger.debug('AdaApi::transferFunds success', { response }); return response; } catch (error) { - logger.error('AdaApi::transferFunds error', { error }); - throw new ApiError(error) - .set('wrongEncryptionPassphrase') - .where('code', 'bad_request') - .inc('message', 'passphrase is too short') - .result(); + logger.error('AdaApi::transferFunds error', { + error + }); + throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; - getStakePools = async (stake: number = 0): Promise> => { logger.debug('AdaApi::getStakePools called', { - parameters: { stake }, + parameters: { + stake + } }); + try { - const response: AdaApiStakePools = await getStakePools( - this.config, - stake - ); - const stakePools = response - .filter(({ metadata }: AdaApiStakePool) => metadata !== undefined) - .filter(({ flags }: AdaApiStakePool) => !flags.includes('delisted')) - .filter( - ({ margin }: AdaApiStakePool) => - margin !== undefined && margin.quantity < 100 - ) - .map(_createStakePoolFromServerData); + const response: AdaApiStakePools = await getStakePools(this.config, stake); + const stakePools = response.filter(({ + metadata + }: AdaApiStakePool) => metadata !== undefined).filter(({ + flags + }: AdaApiStakePool) => !flags.includes('delisted')).filter(({ + margin + }: AdaApiStakePool) => margin !== undefined && margin.quantity < 100).map(_createStakePoolFromServerData); logger.debug('AdaApi::getStakePools success', { stakePoolsTotal: response.length, stakePoolsWithMetadata: stakePools.length, - unfilteredStakePools: response, + unfilteredStakePools: response }); return stakePools; } catch (error) { - logger.error('AdaApi::getStakePools error', { error }); + logger.error('AdaApi::getStakePools error', { + error + }); throw new ApiError(error); } }; - testReset = async (): Promise => { logger.debug('AdaApi::testReset called'); + try { const wallets = await this.getWallets(); - await Promise.all( - wallets.map((wallet) => - this.deleteWallet({ - walletId: wallet.id, - isLegacy: wallet.isLegacy, - isHardwareWallet: wallet.isHardwareWallet, - }) - ) - ); + await Promise.all(wallets.map(wallet => this.deleteWallet({ + walletId: wallet.id, + isLegacy: wallet.isLegacy, + isHardwareWallet: wallet.isHardwareWallet + }))); logger.debug('AdaApi::testReset success'); } catch (error) { - logger.error('AdaApi::testReset error', { error }); + logger.error('AdaApi::testReset error', { + error + }); throw new ApiError(error); } }; - getNetworkInfo = async (): Promise => { logger.debug('AdaApi::getNetworkInfo called'); + try { - const networkInfo: NetworkInfoResponse = await getNetworkInfo( - this.config - ); - logger.debug('AdaApi::getNetworkInfo success', { networkInfo }); + const networkInfo: NetworkInfoResponse = await getNetworkInfo(this.config); + logger.debug('AdaApi::getNetworkInfo success', { + networkInfo + }); const { sync_progress: syncProgressRaw, node_tip: nodeTip, network_tip: networkTip, - next_epoch: nextEpoch, + next_epoch: nextEpoch } = networkInfo; - - const syncProgress = - get(syncProgressRaw, 'status') === 'ready' - ? 100 - : get(syncProgressRaw, 'progress.quantity', 0); + const syncProgress = get(syncProgressRaw, 'status') === 'ready' ? 100 : get(syncProgressRaw, 'progress.quantity', 0); const nextEpochNumber = get(nextEpoch, 'epoch_number', null); const nextEpochStartTime = get(nextEpoch, 'epoch_start_time', ''); // extract relevant data before sending to NetworkStatusStore @@ -2300,72 +2215,67 @@ export default class AdaApi { localTip: { epoch: get(nodeTip, 'epoch_number', 0), slot: get(nodeTip, 'slot_number', 0), - absoluteSlotNumber: get(nodeTip, 'absolute_slot_number', 0), + absoluteSlotNumber: get(nodeTip, 'absolute_slot_number', 0) }, - networkTip: networkTip - ? { - epoch: get(networkTip, 'epoch_number', 0), - slot: get(networkTip, 'slot_number', 0), - absoluteSlotNumber: get(networkTip, 'absolute_slot_number', 0), - } - : null, - nextEpoch: nextEpoch - ? { - // N+1 epoch - epochNumber: nextEpochNumber, - epochStart: nextEpochStartTime, - } - : null, + networkTip: networkTip ? { + epoch: get(networkTip, 'epoch_number', 0), + slot: get(networkTip, 'slot_number', 0), + absoluteSlotNumber: get(networkTip, 'absolute_slot_number', 0) + } : null, + nextEpoch: nextEpoch ? { + // N+1 epoch + epochNumber: nextEpochNumber, + epochStart: nextEpochStartTime + } : null }; } catch (error) { - logger.error('AdaApi::getNetworkInfo error', { error }); + logger.error('AdaApi::getNetworkInfo error', { + error + }); + // Special Error case - if ( - error.code === TlsCertificateNotValidError.API_ERROR || - error.code === 'EPROTO' - ) { + if (error.code === TlsCertificateNotValidError.API_ERROR || error.code === 'EPROTO') { throw new TlsCertificateNotValidError(); } + throw new ApiError(error); } }; + getNetworkClock = async (isForceCheck: boolean): Promise => { + logger.debug('AdaApi::getNetworkClock called', { + isForceCheck + }); - getNetworkClock = async ( - isForceCheck: boolean - ): Promise => { - logger.debug('AdaApi::getNetworkClock called', { isForceCheck }); try { - const networkClock: NetworkClockResponse = await getNetworkClock( - this.config, - isForceCheck - ); + const networkClock: NetworkClockResponse = await getNetworkClock(this.config, isForceCheck); logger.debug('AdaApi::getNetworkClock success', { networkClock, - isForceCheck, + isForceCheck }); return { status: networkClock.status, - offset: get(networkClock, 'offset.quantity', null), + offset: get(networkClock, 'offset.quantity', null) }; } catch (error) { - logger.error('AdaApi::getNetworkClock error', { error, isForceCheck }); + logger.error('AdaApi::getNetworkClock error', { + error, + isForceCheck + }); throw new ApiError(error); } }; - getNetworkParameters = async (): Promise => { logger.debug('AdaApi::getNetworkParameters called'); + try { - const networkParameters: GetNetworkParametersApiResponse = await getNetworkParameters( - this.config - ); + const networkParameters: GetNetworkParametersApiResponse = await getNetworkParameters(this.config); logger.debug('AdaApi::getNetworkParameters success', { - networkParameters, + networkParameters }); - const { genesis_block_hash: genesisBlockHash, - blockchain_start_time, // eslint-disable-line + blockchain_start_time, + // eslint-disable-line slot_length: slotLength, epoch_length: epochLength, security_parameter: securityParameter, @@ -2373,10 +2283,9 @@ export default class AdaApi { decentralization_level: decentralizationLevel, desired_pool_number: desiredPoolNumber, minimum_utxo_value: minimumUtxoValue, - eras, + eras } = networkParameters; const blockchainStartTime = moment(blockchain_start_time).valueOf(); - return { genesisBlockHash, blockchainStartTime, @@ -2387,36 +2296,42 @@ export default class AdaApi { decentralizationLevel, desiredPoolNumber, minimumUtxoValue, - eras, + eras }; } catch (error) { - logger.error('AdaApi::getNetworkParameters error', { error }); + logger.error('AdaApi::getNetworkParameters error', { + error + }); throw new ApiError(error); } }; - getNews = async (): Promise => { logger.debug('AdaApi::getNews called'); - // Fetch news json let rawNews: string; let news: GetNewsResponse; + try { rawNews = await getNews(); news = JSON.parse(rawNews); } catch (error) { - logger.error('AdaApi::getNews error', { error }); + logger.error('AdaApi::getNews error', { + error + }); throw new Error('Unable to fetch news'); } // Fetch news verification hash let newsHash: string; let expectedNewsHash: string; + try { newsHash = await getSHA256HexForString(rawNews); expectedNewsHash = await getNewsHash(news.updatedAt); } catch (error) { - logger.error('AdaApi::getNews (hash) error', { error }); + logger.error('AdaApi::getNews (hash) error', { + error + }); throw new Error('Unable to fetch news hash'); } @@ -2426,61 +2341,60 @@ export default class AdaApi { logger.debug('AdaApi::getNews success', { updatedAt: news.updatedAt, - items: news.items.length, + items: news.items.length }); return news; }; - - calculateDelegationFee = async ( - request: GetDelegationFeeRequest - ): Promise => { + calculateDelegationFee = async (request: GetDelegationFeeRequest): Promise => { logger.debug('AdaApi::calculateDelegationFee called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); + try { const response: TransactionFee = await getDelegationFee(this.config, { - walletId: request.walletId, + walletId: request.walletId + }); + logger.debug('AdaApi::calculateDelegationFee success', { + response }); - logger.debug('AdaApi::calculateDelegationFee success', { response }); return _createDelegationFeeFromServerData(response); } catch (error) { - logger.error('AdaApi::calculateDelegationFee error', { error }); + logger.error('AdaApi::calculateDelegationFee error', { + error + }); throw new ApiError(error); } }; - - joinStakePool = async ( - request: JoinStakePoolRequest - ): Promise => { + joinStakePool = async (request: JoinStakePoolRequest): Promise => { logger.debug('AdaApi::joinStakePool called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); - const { walletId, stakePoolId, passphrase } = request; + const { + walletId, + stakePoolId, + passphrase + } = request; + try { const response = await joinStakePool(this.config, { walletId, stakePoolId, - passphrase, + passphrase }); logger.debug('AdaApi::joinStakePool success', { - stakePool: response, + stakePool: response }); return response; } catch (error) { - logger.error('AdaApi::joinStakePool error', { error }); - throw new ApiError(error) - .set('wrongEncryptionPassphrase') - .where('code', 'bad_request') - .inc('message', 'passphrase is too short') - .result(); + logger.error('AdaApi::joinStakePool error', { + error + }); + throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; - - createWalletSignature = async ( - request: CreateWalletSignatureRequest - ): Promise => { + createWalletSignature = async (request: CreateWalletSignatureRequest): Promise => { logger.debug('AdaApi::createWalletSignature called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); const { walletId, @@ -2490,7 +2404,7 @@ export default class AdaApi { votingKey, stakeKey, addressHex, - absoluteSlotNumber, + absoluteSlotNumber } = request; try { @@ -2498,62 +2412,58 @@ export default class AdaApi { passphrase, metadata: { [61284]: { - map: [ - { - k: { - int: 1, - }, - v: { - bytes: votingKey, - }, + map: [{ + k: { + int: 1 }, - { - k: { - int: 2, - }, - v: { - bytes: stakeKey, - }, + v: { + bytes: votingKey + } + }, { + k: { + int: 2 }, - { - k: { - int: 3, - }, - v: { - bytes: addressHex, - }, + v: { + bytes: stakeKey + } + }, { + k: { + int: 3 }, - { - k: { - int: 4, - }, - v: { - int: absoluteSlotNumber, - }, + v: { + bytes: addressHex + } + }, { + k: { + int: 4 }, - ], - }, - }, + v: { + int: absoluteSlotNumber + } + }] + } + } }; const response = await createWalletSignature(this.config, { walletId, role, index, - data, + data + }); + logger.debug('AdaApi::createWalletSignature success', { + response }); - logger.debug('AdaApi::createWalletSignature success', { response }); return response; } catch (error) { - logger.error('AdaApi::createWalletSignature error', { error }); + logger.error('AdaApi::createWalletSignature error', { + error + }); throw new ApiError(error); } }; - - createVotingRegistrationTransaction = async ( - request: CreateVotingRegistrationRequest - ): Promise => { + createVotingRegistrationTransaction = async (request: CreateVotingRegistrationRequest): Promise => { logger.debug('AdaApi::createVotingRegistrationTransaction called', { - parameters: filterLogData(request), + parameters: filterLogData(request) }); const { walletId, @@ -2564,469 +2474,414 @@ export default class AdaApi { votingKey, stakeKey, signature, - absoluteSlotNumber, + absoluteSlotNumber } = request; try { const data = { - payments: [ - { - address, - amount: { - quantity: amount, - unit: WalletUnits.LOVELACE, - }, - }, - ], + payments: [{ + address, + amount: { + quantity: amount, + unit: WalletUnits.LOVELACE + } + }], passphrase, metadata: { [61284]: { - map: [ - { - k: { - int: 1, - }, - v: { - bytes: votingKey, - }, + map: [{ + k: { + int: 1 }, - { - k: { - int: 2, - }, - v: { - bytes: stakeKey, - }, + v: { + bytes: votingKey + } + }, { + k: { + int: 2 }, - { - k: { - int: 3, - }, - v: { - bytes: addressHex, - }, + v: { + bytes: stakeKey + } + }, { + k: { + int: 3 }, - { - k: { - int: 4, - }, - v: { - int: absoluteSlotNumber, - }, + v: { + bytes: addressHex + } + }, { + k: { + int: 4 }, - ], + v: { + int: absoluteSlotNumber + } + }] }, [61285]: { - map: [ - { - k: { - int: 1, - }, - v: { - bytes: signature, - }, + map: [{ + k: { + int: 1 }, - ], - }, - }, + v: { + bytes: signature + } + }] + } + } }; const response: Transaction = await createTransaction(this.config, { walletId, - data: { ...data }, + data: { ...data + } }); - logger.debug('AdaApi::createVotingRegistrationTransaction success', { - transaction: response, + transaction: response }); - return _createTransactionFromServerData(response); } catch (error) { logger.error('AdaApi::createVotingRegistrationTransaction error', { - error, + error }); - throw new ApiError(error) - .set('wrongEncryptionPassphrase') - .where('code', 'bad_request') - .inc('message', 'passphrase is too short') - .set('transactionIsTooBig', true, { - linkLabel: 'tooBigTransactionErrorLinkLabel', - linkURL: 'tooBigTransactionErrorLinkURL', - }) - .where('code', 'transaction_is_too_big') - .result(); + throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').set('transactionIsTooBig', true, { + linkLabel: 'tooBigTransactionErrorLinkLabel', + linkURL: 'tooBigTransactionErrorLinkURL' + }).where('code', 'transaction_is_too_big').result(); } }; - setCardanoNodeFault = async (fault: FaultInjectionIpcRequest) => { await cardanoFaultInjectionChannel.send(fault); }; - // No implementation here but can be overwritten - setLocalTimeDifference: Function; - setSyncProgress: Function; + setLocalTimeDifference: (...args: Array) => any; + setSyncProgress: (...args: Array) => any; setFaultyNodeSettingsApi: boolean; - resetTestOverrides: Function; - + resetTestOverrides: (...args: Array) => any; // Newsfeed testing utility setTestingNewsFeed: (testingNewsFeedData: GetNewsResponse) => void; setTestingStakePools: (testingStakePoolsData: Array) => void; setTestingWallets: (testingWalletsData: Array) => void; - setTestingWallet: (testingWalletData: Object, walletIndex?: number) => void; - + setTestingWallet: (testingWalletData: Record, walletIndex?: number) => void; // Stake pools testing utility - setFakeStakePoolsJsonForTesting: ( - fakeStakePoolsJson: Array - ) => void; + setFakeStakePoolsJsonForTesting: (fakeStakePoolsJson: Array) => void; setStakePoolsFetchingFailed: () => void; -} - -// ========== TRANSFORM SERVER DATA INTO FRONTEND MODELS ========= - -const _createWalletFromServerData = action( - 'AdaApi::_createWalletFromServerData', - (wallet: AdaWallet) => { - const { - id: rawWalletId, - address_pool_gap: addressPoolGap, - balance, - name, - assets, - passphrase, - delegation, - state: syncState, - isLegacy = false, - discovery, - isHardwareWallet = false, - } = wallet; - - const id = isLegacy ? getLegacyWalletId(rawWalletId) : rawWalletId; - const passphraseLastUpdatedAt = get(passphrase, 'last_updated_at', null); - const walletTotalAmount = - balance.total.unit === WalletUnits.LOVELACE - ? new BigNumber(balance.total.quantity.toString()).dividedBy( - LOVELACES_PER_ADA - ) - : new BigNumber(balance.total.quantity.toString()); - const walletAvailableAmount = - balance.available.unit === WalletUnits.LOVELACE - ? new BigNumber(balance.available.quantity.toString()).dividedBy( - LOVELACES_PER_ADA - ) - : new BigNumber(balance.available.quantity.toString()); - let walletRewardAmount = new BigNumber(0); - if (!isLegacy) { - walletRewardAmount = - balance.reward.unit === WalletUnits.LOVELACE - ? new BigNumber(balance.reward.quantity.toString()).dividedBy( - LOVELACES_PER_ADA - ) - : new BigNumber(balance.reward.quantity.toString()); - } - - // Current (Active) - const active = get(delegation, 'active', null); - const target = get(active, 'target', null); - const status = get(active, 'status', null); - const delegatedStakePoolId = isLegacy ? null : target; - const delegationStakePoolStatus = isLegacy ? null : status; - - // Last - const next = get(delegation, 'next', null); - const lastPendingStakePool = next ? last(next) : null; - const lastTarget = get(lastPendingStakePool, 'target', null); - const lastStatus = get(lastPendingStakePool, 'status', null); - const lastDelegatedStakePoolId = isLegacy ? null : lastTarget; - const lastDelegationStakePoolStatus = isLegacy ? null : lastStatus; - - // Mapping asset items from server data - const walletAssets = { - available: assets.available.map((item) => { - const { policy_id: policyId, asset_name: assetName, quantity } = item; - const uniqueId = `${policyId}${assetName}`; - return { - uniqueId, - policyId, - assetName, - assetNameASCII: hexToString(assetName), - quantity: new BigNumber(quantity.toString()), - }; - }), - total: assets.total.map((item) => { - const { policy_id: policyId, asset_name: assetName, quantity } = item; - const uniqueId = `${policyId}${assetName}`; - return { - uniqueId, - policyId, - assetName, - assetNameASCII: hexToString(assetName), - quantity: new BigNumber(quantity.toString()), - }; - }), - }; - - return new Wallet({ - id, - addressPoolGap, - name, - amount: walletTotalAmount, - availableAmount: walletAvailableAmount, - reward: walletRewardAmount, - assets: walletAssets, - passwordUpdateDate: - passphraseLastUpdatedAt && new Date(passphraseLastUpdatedAt), - hasPassword: isHardwareWallet || passphraseLastUpdatedAt !== null, // For HW set that wallet has password - syncState, - isLegacy, - isHardwareWallet, - delegatedStakePoolId, - delegationStakePoolStatus, - lastDelegatedStakePoolId, - lastDelegationStakePoolStatus, - pendingDelegations: next, - discovery, - }); - } -); - -const _createAddressFromServerData = action( - 'AdaApi::_createAddressFromServerData', - (address: Address) => { - const { id, state, derivation_path: derivationPath } = address; - return new WalletAddress({ - id, - used: state === 'used', - spendingPath: derivationPathToAddressPath(derivationPath), // E.g. "1852'/1815'/0'/0/19", - }); +} // ========== TRANSFORM SERVER DATA INTO FRONTEND MODELS ========= + +const _createWalletFromServerData = action('AdaApi::_createWalletFromServerData', (wallet: AdaWallet) => { + const { + id: rawWalletId, + address_pool_gap: addressPoolGap, + balance, + name, + assets, + passphrase, + delegation, + state: syncState, + isLegacy = false, + discovery, + isHardwareWallet = false + } = wallet; + const id = isLegacy ? getLegacyWalletId(rawWalletId) : rawWalletId; + const passphraseLastUpdatedAt = get(passphrase, 'last_updated_at', null); + const walletTotalAmount = balance.total.unit === WalletUnits.LOVELACE ? new BigNumber(balance.total.quantity.toString()).dividedBy(LOVELACES_PER_ADA) : new BigNumber(balance.total.quantity.toString()); + const walletAvailableAmount = balance.available.unit === WalletUnits.LOVELACE ? new BigNumber(balance.available.quantity.toString()).dividedBy(LOVELACES_PER_ADA) : new BigNumber(balance.available.quantity.toString()); + let walletRewardAmount = new BigNumber(0); + + if (!isLegacy) { + walletRewardAmount = balance.reward.unit === WalletUnits.LOVELACE ? new BigNumber(balance.reward.quantity.toString()).dividedBy(LOVELACES_PER_ADA) : new BigNumber(balance.reward.quantity.toString()); } -); + + // Current (Active) + const active = get(delegation, 'active', null); + const target = get(active, 'target', null); + const status = get(active, 'status', null); + const delegatedStakePoolId = isLegacy ? null : target; + const delegationStakePoolStatus = isLegacy ? null : status; + // Last + const next = get(delegation, 'next', null); + const lastPendingStakePool = next ? last(next) : null; + const lastTarget = get(lastPendingStakePool, 'target', null); + const lastStatus = get(lastPendingStakePool, 'status', null); + const lastDelegatedStakePoolId = isLegacy ? null : lastTarget; + const lastDelegationStakePoolStatus = isLegacy ? null : lastStatus; + // Mapping asset items from server data + const walletAssets = { + available: assets.available.map(item => { + const { + policy_id: policyId, + asset_name: assetName, + quantity + } = item; + const uniqueId = `${policyId}${assetName}`; + return { + uniqueId, + policyId, + assetName, + assetNameASCII: hexToString(assetName), + quantity: new BigNumber(quantity.toString()) + }; + }), + total: assets.total.map(item => { + const { + policy_id: policyId, + asset_name: assetName, + quantity + } = item; + const uniqueId = `${policyId}${assetName}`; + return { + uniqueId, + policyId, + assetName, + assetNameASCII: hexToString(assetName), + quantity: new BigNumber(quantity.toString()) + }; + }) + }; + return new Wallet({ + id, + addressPoolGap, + name, + amount: walletTotalAmount, + availableAmount: walletAvailableAmount, + reward: walletRewardAmount, + assets: walletAssets, + passwordUpdateDate: passphraseLastUpdatedAt && new Date(passphraseLastUpdatedAt), + hasPassword: isHardwareWallet || passphraseLastUpdatedAt !== null, + // For HW set that wallet has password + syncState, + isLegacy, + isHardwareWallet, + delegatedStakePoolId, + delegationStakePoolStatus, + lastDelegatedStakePoolId, + lastDelegationStakePoolStatus, + pendingDelegations: next, + discovery + }); +}); + +const _createAddressFromServerData = action('AdaApi::_createAddressFromServerData', (address: Address) => { + const { + id, + state, + derivation_path: derivationPath + } = address; + return new WalletAddress({ + id, + used: state === 'used', + spendingPath: derivationPathToAddressPath(derivationPath) // E.g. "1852'/1815'/0'/0/19", + + }); +}); const _conditionToTxState = (condition: string) => { switch (condition) { case 'pending': return TransactionStates.PENDING; + case 'expired': return TransactionStates.FAILED; + default: return TransactionStates.OK; } }; -const _createTransactionFromServerData = action( - 'AdaApi::_createTransactionFromServerData', - (data: Transaction) => { - const { - id, - amount, - fee, - deposit, - inserted_at: insertedAt, - pending_since: pendingSince, - depth, - direction, - inputs, - outputs, - withdrawals, - status, - metadata, - } = data; - const state = _conditionToTxState(status); - const stateInfo = - state === TransactionStates.PENDING ? pendingSince : insertedAt; - const date = get(stateInfo, 'time'); - const slotNumber = get(stateInfo, ['block', 'slot_number'], null); - const epochNumber = get(stateInfo, ['block', 'epoch_number'], null); - const confirmations = get(depth, 'quantity', 0); - - // Mapping asset items from server data - const outputAssets = flatten( - outputs.map(({ assets, address }) => - assets ? assets.map((asset) => ({ ...asset, address })) : [] - ) - ); - const transactionAssets = map( - outputAssets, - ({ policy_id: policyId, asset_name: assetName, quantity, address }) => ({ - policyId, - assetName, - quantity: new BigNumber(quantity.toString()), - address, - }) - ); - return new WalletTransaction({ - id, - confirmations, - slotNumber, - epochNumber, - title: direction === 'outgoing' ? 'Ada sent' : 'Ada received', - type: - direction === 'outgoing' - ? TransactionTypes.EXPEND - : TransactionTypes.INCOME, - amount: new BigNumber( - direction === 'outgoing' - ? `-${amount.quantity.toString()}` - : amount.quantity.toString() - ).dividedBy(LOVELACES_PER_ADA), - fee: new BigNumber(fee.quantity.toString()).dividedBy(LOVELACES_PER_ADA), - deposit: new BigNumber(deposit.quantity.toString()).dividedBy( - LOVELACES_PER_ADA - ), - assets: transactionAssets, - date: utcStringToDate(date), - description: '', - addresses: { - from: inputs.map(({ address }) => address || null), - to: outputs.map(({ address }) => address), - withdrawals: withdrawals.map(({ stake_address: address }) => address), - }, - state, - metadata, - }); - } -); - -const _createAssetFromServerData = action( - 'AdaApi::_createAssetFromServerData', - ( - data: ApiAsset, - localData: AssetLocalData, - storedAssetMetadata: StoredAssetMetadata - ) => { - const { - policy_id: policyId, - asset_name: assetName, - fingerprint, - metadata, - } = data; - const uniqueId = `${policyId}${assetName}`; - const storedMetadata = storedAssetMetadata[uniqueId]; - const { decimals } = localData; - const { decimals: recommendedDecimals = null } = - metadata || storedMetadata || {}; - if (metadata) { - storedAssetMetadata[uniqueId] = metadata; - } - return new Asset({ - policyId, - assetName, - fingerprint, - metadata: metadata || storedMetadata, - decimals, - recommendedDecimals, - uniqueId, - }); - } -); - -const _createTransactionFeeFromServerData = action( - 'AdaApi::_createTransactionFeeFromServerData', - (data: TransactionFee) => { - const feeAmount = get(data, ['estimated_max', 'quantity'], 0); - const minimumAdaAmount = get(data, 'minimum_coins.[0].quantity', 0); - const fee = new BigNumber(feeAmount.toString()).dividedBy( - LOVELACES_PER_ADA - ); - const minimumAda = new BigNumber(minimumAdaAmount.toString()).dividedBy( - LOVELACES_PER_ADA - ); - return { - fee, - minimumAda, - }; - } -); - -const _createMigrationFeeFromServerData = action( - 'AdaApi::_createMigrationFeeFromServerData', - (data: TransferFundsCalculateFeeApiResponse) => { - const { quantity: feeAmount = 0 } = data.migration_cost; - const fee = new BigNumber(feeAmount.toString()).dividedBy( - LOVELACES_PER_ADA - ); - const { quantity: leftoversAmount = 0 } = data.leftovers; - const leftovers = new BigNumber(leftoversAmount.toString()).dividedBy( - LOVELACES_PER_ADA - ); - return { fee, leftovers }; +const _createTransactionFromServerData = action('AdaApi::_createTransactionFromServerData', (data: Transaction) => { + const { + id, + amount, + fee, + deposit, + inserted_at: insertedAt, + pending_since: pendingSince, + depth, + direction, + inputs, + outputs, + withdrawals, + status, + metadata + } = data; + + const state = _conditionToTxState(status); + + const stateInfo = state === TransactionStates.PENDING ? pendingSince : insertedAt; + const date = get(stateInfo, 'time'); + const slotNumber = get(stateInfo, ['block', 'slot_number'], null); + const epochNumber = get(stateInfo, ['block', 'epoch_number'], null); + const confirmations = get(depth, 'quantity', 0); + // Mapping asset items from server data + const outputAssets = flatten(outputs.map(({ + assets, + address + }) => assets ? assets.map(asset => ({ ...asset, + address + })) : [])); + const transactionAssets = map(outputAssets, ({ + policy_id: policyId, + asset_name: assetName, + quantity, + address + }) => ({ + policyId, + assetName, + quantity: new BigNumber(quantity.toString()), + address + })); + return new WalletTransaction({ + id, + confirmations, + slotNumber, + epochNumber, + title: direction === 'outgoing' ? 'Ada sent' : 'Ada received', + type: direction === 'outgoing' ? TransactionTypes.EXPEND : TransactionTypes.INCOME, + amount: new BigNumber(direction === 'outgoing' ? `-${amount.quantity.toString()}` : amount.quantity.toString()).dividedBy(LOVELACES_PER_ADA), + fee: new BigNumber(fee.quantity.toString()).dividedBy(LOVELACES_PER_ADA), + deposit: new BigNumber(deposit.quantity.toString()).dividedBy(LOVELACES_PER_ADA), + assets: transactionAssets, + date: utcStringToDate(date), + description: '', + addresses: { + from: inputs.map(({ + address + }) => address || null), + to: outputs.map(({ + address + }) => address), + withdrawals: withdrawals.map(({ + stake_address: address + }) => address) + }, + state, + metadata + }); +}); + +const _createAssetFromServerData = action('AdaApi::_createAssetFromServerData', (data: ApiAsset, localData: AssetLocalData, storedAssetMetadata: StoredAssetMetadata) => { + const { + policy_id: policyId, + asset_name: assetName, + fingerprint, + metadata + } = data; + const uniqueId = `${policyId}${assetName}`; + const storedMetadata = storedAssetMetadata[uniqueId]; + const { + decimals + } = localData; + const { + decimals: recommendedDecimals = null + } = metadata || storedMetadata || {}; + + if (metadata) { + storedAssetMetadata[uniqueId] = metadata; } -); - -const _createDelegationFeeFromServerData = action( - 'AdaApi::_createDelegationFeeFromServerData', - (data: TransactionFee) => { - const fee = new BigNumber( - get(data, ['estimated_max', 'quantity'], 0).toString() - ).dividedBy(LOVELACES_PER_ADA); - const deposits = new BigNumber( - get(data, ['deposit', 'quantity'], 0).toString() - ).dividedBy(LOVELACES_PER_ADA); - // @TODO Use api response data when api is ready - const depositsReclaimed = new BigNumber(0); - return { fee, deposits, depositsReclaimed }; - } -); -const _createStakePoolFromServerData = action( - 'AdaApi::_createStakePoolFromServerData', - (stakePool: AdaApiStakePool, index: number) => { - const { - id, - metrics, - cost, - margin: profitMargin, - metadata, - pledge, - retirement, - } = stakePool; - const { - relative_stake: relativeStake, - produced_blocks: producedBlocks, - non_myopic_member_rewards: nonMyopicMemberRewards, - saturation, - } = metrics; // eslint-disable-line - const { name, description = '', ticker, homepage } = metadata; - const relativeStakePercentage = get(relativeStake, 'quantity', 0); - const producedBlocksCount = get(producedBlocks, 'quantity', 0); - const nonMyopicMemberRewardsQuantity = get( - nonMyopicMemberRewards, - 'quantity', - 0 - ); - const costQuantity = get(cost, 'quantity', 0).toString(); - const pledgeQuantity = get(pledge, 'quantity', 0).toString(); - const profitMarginPercentage = get(profitMargin, 'quantity', 0); - const retiringAt = get(retirement, 'epoch_start_time', null); - return new StakePool({ - id, - relativeStake: relativeStakePercentage, - producedBlocks: producedBlocksCount, - potentialRewards: new BigNumber( - nonMyopicMemberRewardsQuantity.toString() - ).dividedBy(LOVELACES_PER_ADA), - nonMyopicMemberRewards: nonMyopicMemberRewardsQuantity, - ticker, - homepage, - cost: new BigNumber(costQuantity.toString()).dividedBy(LOVELACES_PER_ADA), - description, - isCharity: false, - name, - pledge: new BigNumber(pledgeQuantity.toString()).dividedBy( - LOVELACES_PER_ADA - ), - profitMargin: profitMarginPercentage, - ranking: index + 1, - retiring: retiringAt ? new Date(retiringAt) : null, - saturation: saturation * 100, - }); - } -); - -const _createRedeemItnRewardsFromServerData = action( - 'AdaApi::_createRedeemItnRewardsFromServerData', - (transaction: Transaction) => { - const { quantity, unit } = get(transaction, 'withdrawals[0].amount'); - return unit === WalletUnits.LOVELACE - ? new BigNumber(quantity.toString()).dividedBy(LOVELACES_PER_ADA) - : new BigNumber(quantity.toString()); - } -); + return new Asset({ + policyId, + assetName, + fingerprint, + metadata: metadata || storedMetadata, + decimals, + recommendedDecimals, + uniqueId + }); +}); + +const _createTransactionFeeFromServerData = action('AdaApi::_createTransactionFeeFromServerData', (data: TransactionFee) => { + const feeAmount = get(data, ['estimated_max', 'quantity'], 0); + const minimumAdaAmount = get(data, 'minimum_coins.[0].quantity', 0); + const fee = new BigNumber(feeAmount.toString()).dividedBy(LOVELACES_PER_ADA); + const minimumAda = new BigNumber(minimumAdaAmount.toString()).dividedBy(LOVELACES_PER_ADA); + return { + fee, + minimumAda + }; +}); + +const _createMigrationFeeFromServerData = action('AdaApi::_createMigrationFeeFromServerData', (data: TransferFundsCalculateFeeApiResponse) => { + const { + quantity: feeAmount = 0 + } = data.migration_cost; + const fee = new BigNumber(feeAmount.toString()).dividedBy(LOVELACES_PER_ADA); + const { + quantity: leftoversAmount = 0 + } = data.leftovers; + const leftovers = new BigNumber(leftoversAmount.toString()).dividedBy(LOVELACES_PER_ADA); + return { + fee, + leftovers + }; +}); + +const _createDelegationFeeFromServerData = action('AdaApi::_createDelegationFeeFromServerData', (data: TransactionFee) => { + const fee = new BigNumber(get(data, ['estimated_max', 'quantity'], 0).toString()).dividedBy(LOVELACES_PER_ADA); + const deposits = new BigNumber(get(data, ['deposit', 'quantity'], 0).toString()).dividedBy(LOVELACES_PER_ADA); + // @TODO Use api response data when api is ready + const depositsReclaimed = new BigNumber(0); + return { + fee, + deposits, + depositsReclaimed + }; +}); + +const _createStakePoolFromServerData = action('AdaApi::_createStakePoolFromServerData', (stakePool: AdaApiStakePool, index: number) => { + const { + id, + metrics, + cost, + margin: profitMargin, + metadata, + pledge, + retirement + } = stakePool; + const { + relative_stake: relativeStake, + produced_blocks: producedBlocks, + non_myopic_member_rewards: nonMyopicMemberRewards, + saturation + } = metrics; + // eslint-disable-line + const { + name, + description = '', + ticker, + homepage + } = metadata; + const relativeStakePercentage = get(relativeStake, 'quantity', 0); + const producedBlocksCount = get(producedBlocks, 'quantity', 0); + const nonMyopicMemberRewardsQuantity = get(nonMyopicMemberRewards, 'quantity', 0); + const costQuantity = get(cost, 'quantity', 0).toString(); + const pledgeQuantity = get(pledge, 'quantity', 0).toString(); + const profitMarginPercentage = get(profitMargin, 'quantity', 0); + const retiringAt = get(retirement, 'epoch_start_time', null); + return new StakePool({ + id, + relativeStake: relativeStakePercentage, + producedBlocks: producedBlocksCount, + potentialRewards: new BigNumber(nonMyopicMemberRewardsQuantity.toString()).dividedBy(LOVELACES_PER_ADA), + nonMyopicMemberRewards: nonMyopicMemberRewardsQuantity, + ticker, + homepage, + cost: new BigNumber(costQuantity.toString()).dividedBy(LOVELACES_PER_ADA), + description, + isCharity: false, + name, + pledge: new BigNumber(pledgeQuantity.toString()).dividedBy(LOVELACES_PER_ADA), + profitMargin: profitMarginPercentage, + ranking: index + 1, + retiring: retiringAt ? new Date(retiringAt) : null, + saturation: saturation * 100 + }); +}); + +const _createRedeemItnRewardsFromServerData = action('AdaApi::_createRedeemItnRewardsFromServerData', (transaction: Transaction) => { + const { + quantity, + unit + } = get(transaction, 'withdrawals[0].amount'); + return unit === WalletUnits.LOVELACE ? new BigNumber(quantity.toString()).dividedBy(LOVELACES_PER_ADA) : new BigNumber(quantity.toString()); +}); \ No newline at end of file diff --git a/source/renderer/app/api/errors.js.ts b/source/renderer/app/api/errors.js.ts index 9f0eee4578..48a2b2d47c 100644 --- a/source/renderer/app/api/errors.js.ts +++ b/source/renderer/app/api/errors.js.ts @@ -1,121 +1,101 @@ -import { defineMessages } from 'react-intl'; - +import { defineMessages } from "react-intl"; export const messages = defineMessages({ // common wrongEncryptionPassphrase: { id: 'api.errors.IncorrectPasswordError', defaultMessage: '!!!Incorrect wallet password.', - description: '"Incorrect wallet password." error message.', + description: '"Incorrect wallet password." error message.' }, // wallets walletAlreadyExists: { id: 'api.errors.WalletAlreadyRestoredError', defaultMessage: '!!!Wallet you are trying to restore already exists.', - description: - '"Wallet you are trying to restore already exists." error message.', + description: '"Wallet you are trying to restore already exists." error message.' }, forbiddenMnemonic: { id: 'api.errors.ForbiddenMnemonicError', - defaultMessage: - '!!!Invalid recovery phrase. Submitted recovery phrase is one of the example recovery phrases from the documentation and should not be used for wallets holding funds.', - description: - '"Forbidden Mnemonic: an example Mnemonic has been submitted." error message', + defaultMessage: '!!!Invalid recovery phrase. Submitted recovery phrase is one of the example recovery phrases from the documentation and should not be used for wallets holding funds.', + description: '"Forbidden Mnemonic: an example Mnemonic has been submitted." error message' }, walletAlreadyImported: { id: 'api.errors.WalletAlreadyImportedError', defaultMessage: '!!!Wallet you are trying to import already exists.', - description: - '"Wallet you are trying to import already exists." error message.', + description: '"Wallet you are trying to import already exists." error message.' }, walletFileImportError: { id: 'api.errors.WalletFileImportError', - defaultMessage: - '!!!Wallet could not be imported, please make sure you are providing a correct file.', - description: - '"Wallet could not be imported, please make sure you are providing a correct file." error message.', + defaultMessage: '!!!Wallet could not be imported, please make sure you are providing a correct file.', + description: '"Wallet could not be imported, please make sure you are providing a correct file." error message.' }, invalidMnemonic: { id: 'global.errors.invalidMnemonic', defaultMessage: '!!!Invalid phrase entered, please check.', - description: 'Error message shown when invalid bip39 mnemonic was entered.', + description: 'Error message shown when invalid bip39 mnemonic was entered.' }, // transactions notEnoughMoney: { id: 'api.errors.NotEnoughMoneyToSendError', defaultMessage: '!!!Not enough money to make this transaction.', - description: '"Not enough money to make this transaction." error message.', + description: '"Not enough money to make this transaction." error message.' }, canNotCalculateTransactionFees: { id: 'api.errors.CanNotCalculateTransactionFeesError', - defaultMessage: - '!!!Cannot calculate fees while there are pending transactions.', - description: - '"Cannot calculate fees while there are pending transactions." error message', + defaultMessage: '!!!Cannot calculate fees while there are pending transactions.', + description: '"Cannot calculate fees while there are pending transactions." error message' }, cannotCoverFee: { id: 'api.errors.NotEnoughFundsForTransactionFeesError', defaultMessage: '!!!Not enough ada for fees. Try sending a smaller amount.', - description: - '"Not enough ada for fees. Try sending a smaller amount." error message', + description: '"Not enough ada for fees. Try sending a smaller amount." error message' }, inputsDepleted: { id: 'api.errors.inputsDepleted', - defaultMessage: - '!!!Your wallet contains only reward funds. Please send at least one ADA to your wallet so that you can spend the funds.', - description: - '"Your wallet contains only reward funds. Please send at least one ADA to your wallet so that you can spend the funds." error message', + defaultMessage: '!!!Your wallet contains only reward funds. Please send at least one ADA to your wallet so that you can spend the funds.', + description: '"Your wallet contains only reward funds. Please send at least one ADA to your wallet so that you can spend the funds." error message' }, transactionIsTooBig: { id: 'api.errors.TooBigTransactionError', defaultMessage: '!!!Transaction too big due to too many inputs.', - description: '"Transaction too big due to too many inputs." error message.', + description: '"Transaction too big due to too many inputs." error message.' }, notEnoughFundsForTransaction: { id: 'api.errors.NotEnoughFundsForTransactionError', defaultMessage: '!!!Not enough ada. Try sending a smaller amount.', - description: - '"Not enough ada . Try sending a smaller amount." error message', + description: '"Not enough ada . Try sending a smaller amount." error message' }, invalidAddress: { id: 'api.errors.invalidAddress', defaultMessage: '!!!Please enter a valid address.', - description: 'Error message shown when invalid address was entered.', + description: 'Error message shown when invalid address was entered.' }, tooBigTransactionErrorLinkLabel: { id: 'api.errors.TooBigTransactionErrorLinkLabel', defaultMessage: '!!!Learn more.', - description: - '"Transaction too big due to too many inputs." error link label.', + description: '"Transaction too big due to too many inputs." error link label.' }, tooBigTransactionErrorLinkURL: { id: 'api.errors.TooBigTransactionErrorLinkURL', - defaultMessage: - '!!!https://iohk.zendesk.com/hc/en-us/articles/360017733353', - description: - '"Transaction too big due to too many inputs." error link URL.', + defaultMessage: '!!!https://iohk.zendesk.com/hc/en-us/articles/360017733353', + description: '"Transaction too big due to too many inputs." error link URL.' }, utxoTooSmall: { id: 'api.errors.utxoTooSmall', defaultMessage: '!!!Invalid transaction.', - description: '"Invalid transaction." error message', + description: '"Invalid transaction." error message' }, nothingToMigrate: { id: 'api.errors.nothingToMigrate', - defaultMessage: - '!!!Funds cannot be transferred from this wallet because it contains some unspent transaction outputs (UTXOs), with amounts of ada that are too small to be migrated.', - description: - '"Funds cannot be transferred from this wallet because it contains some unspent transaction outputs (UTXOs), with amounts of ada that are too small to be migrated." error message', + defaultMessage: '!!!Funds cannot be transferred from this wallet because it contains some unspent transaction outputs (UTXOs), with amounts of ada that are too small to be migrated.', + description: '"Funds cannot be transferred from this wallet because it contains some unspent transaction outputs (UTXOs), with amounts of ada that are too small to be migrated." error message' }, invalidSmashServer: { id: 'api.errors.invalidSmashServer', defaultMessage: '!!!This URL is not a valid SMASH server', - description: '"This URL is not a valid SMASH server" error message', + description: '"This URL is not a valid SMASH server" error message' }, cannotLeaveWalletEmpty: { id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', - defaultMessage: - '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', - description: - '"Balance after transaction would not leave enough ada in the wallet to support tokens remaining in wallet', - }, -}); + defaultMessage: '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', + description: '"Balance after transaction would not leave enough ada in the wallet to support tokens remaining in wallet' + } +}); \ No newline at end of file diff --git a/source/renderer/app/api/transactions/types.js.ts b/source/renderer/app/api/transactions/types.js.ts index 74cbc8236e..5b5f9df443 100644 --- a/source/renderer/app/api/transactions/types.js.ts +++ b/source/renderer/app/api/transactions/types.js.ts @@ -1,102 +1,87 @@ -// @flow -import BigNumber from 'bignumber.js'; -import { WalletTransaction } from '../../domains/WalletTransaction'; -import { WalletUnits } from '../../domains/Wallet'; -import type { DelegationAction } from '../../types/stakingTypes'; -import type { ApiTokens } from '../assets/types'; -import type { TransactionMetadata } from '../../types/TransactionMetadata'; -import type { PathRoleIdentityType } from '../../utils/hardwareWalletUtils'; - +import BigNumber from "bignumber.js"; +import { WalletTransaction } from "../../domains/WalletTransaction"; +import { WalletUnits } from "../../domains/Wallet"; +import type { DelegationAction } from "../../types/stakingTypes"; +import type { ApiTokens } from "../assets/types"; +import type { TransactionMetadata } from "../../types/TransactionMetadata"; +import type { PathRoleIdentityType } from "../../utils/hardwareWalletUtils"; export type TransactionAmount = { - quantity: number, - unit: WalletUnits.LOVELACE, + quantity: number; + unit: WalletUnits.LOVELACE; }; - export type TransactionDepth = { - quantity: number, - unit: 'block', + quantity: number; + unit: "block"; }; - export type TransactionInsertionBlock = { - slot_number: number, - epoch_number: number, + slot_number: number; + epoch_number: number; }; - export type Transaction = { - id: string, - amount: TransactionAmount, + id: string; + amount: TransactionAmount; fee: { - quantity: number, - unit: WalletUnits.LOVELACE, - }, + quantity: number; + unit: WalletUnits.LOVELACE; + }; deposit: { - quantity: number, - unit: WalletUnits.LOVELACE, - }, + quantity: number; + unit: WalletUnits.LOVELACE; + }; inserted_at?: { - time: Date, - block: TransactionInsertionBlock, - }, + time: Date; + block: TransactionInsertionBlock; + }; pending_since?: { - time: Date, - block: { - ...TransactionInsertionBlock, + time: Date; + block: TransactionInsertionBlock & { height: { - quantity: number, - unit: string, - }, - }, - }, - depth: TransactionDepth, - direction: 'outgoing' | 'incoming', - inputs: Array, - outputs: Array, - withdrawals: Array, - status: TransactionState, - metadata?: TransactionMetadata, + quantity: number; + unit: string; + }; + }; + }; + depth: TransactionDepth; + direction: "outgoing" | "incoming"; + inputs: Array; + outputs: Array; + withdrawals: Array; + status: TransactionState; + metadata?: TransactionMetadata; }; - export type Transactions = Array; - export type TransactionInputs = { - address: string, - amount?: TransactionAmount, - assets?: ApiTokens, - id: string, - index: number, + address: string; + amount?: TransactionAmount; + assets?: ApiTokens; + id: string; + index: number; }; - export type TransactionOutputs = { - address: string, - amount: TransactionAmount, - assets?: ApiTokens, + address: string; + amount: TransactionAmount; + assets?: ApiTokens; }; - export type TransactionWithdrawals = { - stake_address: string, - amount: TransactionAmount, + stake_address: string; + amount: TransactionAmount; }; -export type TransactionWithdrawalType = 'self' | Array; - -export type TransactionState = 'pending' | 'in_ledger' | 'expired'; - +export type TransactionWithdrawalType = "self" | Array; +export type TransactionState = "pending" | "in_ledger" | "expired"; export type TransactionAddresses = { - from: Array, - to: Array, - withdrawals: Array, + from: Array; + to: Array; + withdrawals: Array; }; - -export type TransactionType = 'card' | 'expend' | 'income' | 'exchange'; - +export type TransactionType = "card" | "expend" | "income" | "exchange"; // Req / Res Transaction Types export type GetTransactionsRequest = { - walletId: string, - order?: 'ascending' | 'descending', - fromDate: ?string, - toDate: ?string, - isLegacy: boolean, - isHardwareWallet?: boolean, - // @API TODO - Params "pending" for V2 + walletId: string; + order?: "ascending" | "descending"; + fromDate: string | null | undefined; + toDate: string | null | undefined; + isLegacy: boolean; + isHardwareWallet?: boolean; // @API TODO - Params "pending" for V2 // searchTerm: string, // skip: number, // limit: number, @@ -104,236 +89,177 @@ export type GetTransactionsRequest = { // isRestoreActive: boolean, // isRestoreCompleted: boolean, // cachedTransactions: Array, -}; +}; export type GetTransactionRequest = { - walletId: string, - transactionId: string, + walletId: string; + transactionId: string; }; - export type GetTransactionFeeRequest = { - walletId: string, - address: string, - amount: number, - assets?: ApiTokens, - walletBalance: BigNumber, - availableBalance: BigNumber, - rewardsBalance: BigNumber, - isLegacy: boolean, - withdrawal?: 'self' | Array, + walletId: string; + address: string; + amount: number; + assets?: ApiTokens; + walletBalance: BigNumber; + availableBalance: BigNumber; + rewardsBalance: BigNumber; + isLegacy: boolean; + withdrawal?: "self" | Array; }; - export type GetTransactionFeeResponse = { - fee: BigNumber, - minimumAda: BigNumber, + fee: BigNumber; + minimumAda: BigNumber; }; - export type CreateTransactionRequest = { - walletId: string, - address: string, - amount: number, - passphrase: string, - isLegacy: boolean, - assets?: ApiTokens, - withdrawal?: 'self' | Array, - hasAssetsRemainingAfterTransaction?: boolean, + walletId: string; + address: string; + amount: number; + passphrase: string; + isLegacy: boolean; + assets?: ApiTokens; + withdrawal?: "self" | Array; + hasAssetsRemainingAfterTransaction?: boolean; }; - export type DeleteTransactionRequest = { - walletId: string, - transactionId: string, - isLegacy: boolean, + walletId: string; + transactionId: string; + isLegacy: boolean; }; - export type GetTransactionsResponse = { - transactions: Array, - total: number, + transactions: Array; + total: number; }; - export type TransactionParams = { - walletId: string, + walletId: string; data: { - payments: Array, - passphrase: string, - }, + payments: Array; + passphrase: string; + }; }; - export type TransactionFeeAmount = { - quantity: number, - unit: WalletUnits.LOVELACE, + quantity: number; + unit: WalletUnits.LOVELACE; }; - export type GetTransactionFeeParams = { - walletId: string, + walletId: string; data: { - payments: Array, - }, + payments: Array; + }; }; - export type TransactionPaymentData = { - address: string, - amount: TransactionFeeAmount, - assets?: ApiTokens, + address: string; + amount: TransactionFeeAmount; + assets?: ApiTokens; }; - export type TransactionFee = { - estimated_min: TransactionFeeAmount, - estimated_max: TransactionFeeAmount, - deposit: TransactionFeeAmount, - minimum_coins: Array, + estimated_min: TransactionFeeAmount; + estimated_max: TransactionFeeAmount; + deposit: TransactionFeeAmount; + minimum_coins: Array; }; - export type CoinSelectionAmount = { - quantity: number, - unit: WalletUnits.LOVELACE, + quantity: number; + unit: WalletUnits.LOVELACE; }; - export type CoinSelectionInput = { - address: string, - amount: CoinSelectionAmount, - id: string, - index: number, - derivationPath: Array, + address: string; + amount: CoinSelectionAmount; + id: string; + index: number; + derivationPath: Array; }; - export type Asset = { - policyId: string, - assetName: string, - quantity: number, + policyId: string; + assetName: string; + quantity: number; }; - export type CoinSelectionOutput = { - address: string, - amount: CoinSelectionAmount, - derivationPath: Array, - assets?: Array, + address: string; + amount: CoinSelectionAmount; + derivationPath: Array; + assets?: Array; }; - -export type CertificateType = - | 'register_reward_account' - | 'quit_pool' - | 'join_pool'; - +export type CertificateType = "register_reward_account" | "quit_pool" | "join_pool"; export type CoinSelectionCertificate = { - pool: string, - certificateType: CertificateType, - rewardAccountPath: Array, + pool: string; + certificateType: CertificateType; + rewardAccountPath: Array; }; - export type CoinSelectionCertificates = Array; - export type CoinSelectionWithdrawal = { - stakeAddress: string, - derivationPath: Array, - amount: CoinSelectionAmount, + stakeAddress: string; + derivationPath: Array; + amount: CoinSelectionAmount; }; - export type CoinSelectionWithdrawals = Array; - export type CoinSelectionsDelegationRequestType = { - walletId: string, - poolId: string, - delegationAction: DelegationAction, + walletId: string; + poolId: string; + delegationAction: DelegationAction; }; - export type CoinSelectionsPaymentRequestType = { - walletId: string, - address: string, - amount: number, - assets?: ApiTokens, - metadata?: VotingMetadataType, + walletId: string; + address: string; + amount: number; + assets?: ApiTokens; + metadata?: VotingMetadataType; }; - -export type CoinSelectionsRequest = - | CoinSelectionsPaymentRequestType - | CoinSelectionsDelegationRequestType; - +export type CoinSelectionsRequest = CoinSelectionsPaymentRequestType | CoinSelectionsDelegationRequestType; export type CoinSelectionsResponse = { - inputs: Array, - outputs: Array, - certificates: CoinSelectionCertificates, - deposits: BigNumber, - depositsReclaimed: BigNumber, - withdrawals: Array, - fee: BigNumber, - metadata: ?string, + inputs: Array; + outputs: Array; + certificates: CoinSelectionCertificates; + deposits: BigNumber; + depositsReclaimed: BigNumber; + withdrawals: Array; + fee: BigNumber; + metadata: string | null | undefined; }; - export type CreateExternalTransactionRequest = { - signedTransactionBlob: Buffer, + signedTransactionBlob: Buffer; }; - export type CreateExternalTransactionResponse = { - id: string, + id: string; }; - export type GetWithdrawalsRequest = { - walletId: string, + walletId: string; }; - export type GetWithdrawalsResponse = { - withdrawals: BigNumber, + withdrawals: BigNumber; }; - export type ICOPublicKeyParams = { - walletId: string, - index: string, + walletId: string; + index: string; data: { - passphrase: string, - format: 'extended' | 'non_extended', - purpose: string, - }, + passphrase: string; + format: "extended" | "non_extended"; + purpose: string; + }; }; - export type CoinSelectionAssetsType = Array; - export type VotingMetaIndexType = 61284 | 61285; - export const VotingMetaIndexes: { - VOTING_REGISTRATION: VotingMetaIndexType, - VOTING_SIGNATURE: VotingMetaIndexType, + VOTING_REGISTRATION: VotingMetaIndexType; + VOTING_SIGNATURE: VotingMetaIndexType; } = { VOTING_REGISTRATION: 61284, - VOTING_SIGNATURE: 61285, -}; - -export type VotingMetaKeyValuePairString = { - [key: 'string']: string, -}; -export type VotingMetaKeyValuePairInt = { - [key: 'int']: number, -}; -export type VotingMetaKeyValuePairBytes = { - [key: 'bytes']: string, -}; -export type VotingMetaKeyValuePairMap = { - [key: 'int']: number, -}; - -export type VotingMetaKeyType = 'string' | 'int' | 'bytes' | 'list' | 'map'; - -export type VotingMetaKeyValuePair = { - [key: 'k' | 'v']: - | VotingMetaKeyValuePairString - | VotingMetaKeyValuePairInt - | VotingMetaKeyValuePairBytes, -}; - -export type VotingMetaRegistrationType = { - [key: 'map']: Array, -}; - -export type VotingMetadataType = { - [key: VotingMetaIndexType]: VotingMetaRegistrationType, -}; - + VOTING_SIGNATURE: 61285 +}; +export type VotingMetaKeyValuePairString = { [key in "string"]?: string }; +export type VotingMetaKeyValuePairInt = { [key in "int"]?: number }; +export type VotingMetaKeyValuePairBytes = { [key in "bytes"]?: string }; +export type VotingMetaKeyValuePairMap = { [key in "int"]?: number }; +export type VotingMetaKeyType = "string" | "int" | "bytes" | "list" | "map"; +export type VotingMetaKeyValuePair = { [key in "k" | "v"]?: VotingMetaKeyValuePairString | VotingMetaKeyValuePairInt | VotingMetaKeyValuePairBytes }; +export type VotingMetaRegistrationType = { [key in "map"]?: Array }; +export type VotingMetadataType = Record; export type VotingDataType = { - stakeAddress: string, - stakeAddressHex: string, - votingKey: string, - stakeKey: string, - role: PathRoleIdentityType, - index: string, - metadata: VotingMetadataType, - nonce: number, -}; + stakeAddress: string; + stakeAddressHex: string; + votingKey: string; + stakeKey: string; + role: PathRoleIdentityType; + index: string; + metadata: VotingMetadataType; + nonce: number; +}; \ No newline at end of file diff --git a/source/renderer/app/api/utils/apiHelpers.js.ts b/source/renderer/app/api/utils/apiHelpers.js.ts index 27aa604bb5..65d70e4d37 100644 --- a/source/renderer/app/api/utils/apiHelpers.js.ts +++ b/source/renderer/app/api/utils/apiHelpers.js.ts @@ -1,51 +1,31 @@ -// @flow -import { ApiMethodNotYetImplementedError } from '../common/errors'; -import ApiError from '../../domains/ApiError'; - -export const notYetImplemented = async () => - new Promise((resolve, reject) => { - reject(new ApiMethodNotYetImplementedError()); - }); - +import { ApiMethodNotYetImplementedError } from "../common/errors"; +import ApiError from "../../domains/ApiError"; +export const notYetImplemented = async () => new Promise((resolve, reject) => { + reject(new ApiMethodNotYetImplementedError()); +}); // helper code for testing async APIs -export const testAsync = async (apiMethod: Function) => { +export const testAsync = async (apiMethod: (...args: Array) => any) => { const result = await apiMethod(); // eslint-disable-next-line no-console console.log(`testAsync result: ${result}`); return result; }; - // helper code for testing sync APIs -export const testSync = (apiMethod: Function) => { +export const testSync = (apiMethod: (...args: Array) => any) => { const result = apiMethod(); // eslint-disable-next-line no-console console.log(`testSync result: ${result}`); return result; }; - // helper code for deferring API call execution -export const wait = (ms: number): Promise => - new Promise((resolve) => setTimeout(resolve, ms)); +export const wait = (ms: number): Promise => new Promise(resolve => setTimeout(resolve, ms)); +export const throwErrorIfNotEnoughAdaToSupportTokens = (error: any, hasAssetsRemainingAfterTransaction?: boolean) => { + const adaToProceedRegex = new RegExp(/.*I need approximately([\s\d.,]+)ada to proceed.*/); -export const throwErrorIfNotEnoughAdaToSupportTokens = ( - error: any, - hasAssetsRemainingAfterTransaction?: boolean -) => { - const adaToProceedRegex = new RegExp( - /.*I need approximately([\s\d.,]+)ada to proceed.*/ - ); - if ( - error.code === 'cannot_cover_fee' && - hasAssetsRemainingAfterTransaction && - adaToProceedRegex.test(error.message) - ) { - const adaToRemain = Math.ceil( - Number(error.message.replace(adaToProceedRegex, '$1')) - ); - throw new ApiError() - .set('cannotLeaveWalletEmpty', true, { - adaToRemain, - }) - .result(); + if (error.code === 'cannot_cover_fee' && hasAssetsRemainingAfterTransaction && adaToProceedRegex.test(error.message)) { + const adaToRemain = Math.ceil(Number(error.message.replace(adaToProceedRegex, '$1'))); + throw new ApiError().set('cannotLeaveWalletEmpty', true, { + adaToRemain + }).result(); } -}; +}; \ No newline at end of file diff --git a/source/renderer/app/api/utils/apiHelpers.spec.js.ts b/source/renderer/app/api/utils/apiHelpers.spec.js.ts index f3fc1a907f..7794ccb2b1 100644 --- a/source/renderer/app/api/utils/apiHelpers.spec.js.ts +++ b/source/renderer/app/api/utils/apiHelpers.spec.js.ts @@ -1,69 +1,47 @@ -import { throwErrorIfNotEnoughAdaToSupportTokens } from './apiHelpers'; - +import { throwErrorIfNotEnoughAdaToSupportTokens } from "./apiHelpers"; describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { it('should not throw if error.code is not "cannot_cover_fee"', () => { const error = new Error(); error.code = 'other_error'; - expect(() => - throwErrorIfNotEnoughAdaToSupportTokens(error, true) - ).not.toThrow(); + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).not.toThrow(); }); - it('should not throw error if error code is "cannot_cover_fee" but hasAssetsRemainingAfterTransaction is undefined', () => { - const error = new Error( - 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' - ); + const error = new Error('I cannot proceed with transaction, I need approximately 1.6 ada to proceed'); error.code = 'cannot_cover_fee'; expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error)).not.toThrow(); }); - it('should not throw error if error code is "cannot_cover_fee" but message does not match reegex', () => { const error = new Error('other message'); error.code = 'cannot_cover_fee'; - expect(() => - throwErrorIfNotEnoughAdaToSupportTokens(error, true) - ).not.toThrow(); + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).not.toThrow(); }); - it('should not throw error if error code is not "cannot_cover_fee" and message matches regex', () => { - const error = new Error( - 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' - ); + const error = new Error('I cannot proceed with transaction, I need approximately 1.6 ada to proceed'); error.code = 'other_code'; - expect(() => - throwErrorIfNotEnoughAdaToSupportTokens(error, true) - ).not.toThrow(); + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).not.toThrow(); }); - it('should not throw if there are no tokens remaining in wallet after transaction', () => { const error = new Error(); error.code = 'cannot_cover_fee'; - expect(() => - throwErrorIfNotEnoughAdaToSupportTokens(error, false) - ).not.toThrow(); + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, false)).not.toThrow(); }); - it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee"', () => { - const error = new Error( - 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.' - ); + const error = new Error('I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.'); error.code = 'cannot_cover_fee'; - - expect(() => - throwErrorIfNotEnoughAdaToSupportTokens(error, true) - ).toThrowError( - new Error({ - additionalValues: { adaToRemain: 1 }, - clause: true, - code: undefined, - defaultMessage: - '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', - forceSet: true, - id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', - isFinalError: false, - tempError: 'cannotLeaveWalletEmpty', - values: { adaToRemain: 1 }, - }) - ); + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrowError(new Error({ + additionalValues: { + adaToRemain: 1 + }, + clause: true, + code: undefined, + defaultMessage: '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', + forceSet: true, + id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', + isFinalError: false, + tempError: 'cannotLeaveWalletEmpty', + values: { + adaToRemain: 1 + } + })); }); -}); +}); \ No newline at end of file diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx index 2fffa265a6..2b96b3ad39 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx @@ -1,84 +1,75 @@ -// @flow -import React, { Component, Fragment } from 'react'; -import { observer } from 'mobx-react'; -import { Input } from 'react-polymorph/lib/components/Input'; -import { InputSkin } from 'react-polymorph/lib/skins/simple/InputSkin'; -import { Checkbox } from 'react-polymorph/lib/components/Checkbox'; -import { CheckboxSkin } from 'react-polymorph/lib/skins/simple/CheckboxSkin'; -import { PopOver } from 'react-polymorph/lib/components/PopOver'; -import { get } from 'lodash'; -import BigNumber from 'bignumber.js'; -import SVGInline from 'react-svg-inline'; -import { intlShape, FormattedHTMLMessage } from 'react-intl'; -import vjf from 'mobx-react-form/lib/validators/VJF'; -import ReactToolboxMobxForm from '../../../utils/ReactToolboxMobxForm'; -import Dialog from '../../widgets/Dialog'; -import DialogCloseButton from '../../widgets/DialogCloseButton'; -import LocalizableError from '../../../i18n/LocalizableError'; -import styles from './WalletSendAssetsConfirmationDialog.scss'; -import questionMarkIcon from '../../../assets/images/question-mark.inline.svg'; -import { FORM_VALIDATION_DEBOUNCE_WAIT } from '../../../config/timingConfig'; -import { submitOnEnter } from '../../../utils/form'; -import { formattedTokenWalletAmount } from '../../../utils/formatters'; -import { FormattedHTMLMessageWithLink } from '../../widgets/FormattedHTMLMessageWithLink'; -import HardwareWalletStatus from '../../hardware-wallet/HardwareWalletStatus'; -import LoadingSpinner from '../../widgets/LoadingSpinner'; -import Wallet, { HwDeviceStatuses } from '../../../domains/Wallet'; -import Asset from '../../assets/Asset'; -import type { HwDeviceStatus } from '../../../domains/Wallet'; -import type { AssetToken } from '../../../api/assets/types'; -import { getMessages } from './WalletSendAssetsConfirmationDialog.messages'; -import { shouldShowEmptyWalletWarning } from '../../../utils/walletUtils'; -import { hasTokensLeftAfterTransaction } from '../../../utils/assets'; -import globalMessages from '../../../i18n/global-messages'; - +import React, { Component, Fragment } from "react"; +import { observer } from "mobx-react"; +import { Input } from "react-polymorph/lib/components/Input"; +import { InputSkin } from "react-polymorph/lib/skins/simple/InputSkin"; +import { Checkbox } from "react-polymorph/lib/components/Checkbox"; +import { CheckboxSkin } from "react-polymorph/lib/skins/simple/CheckboxSkin"; +import { PopOver } from "react-polymorph/lib/components/PopOver"; +import { get } from "lodash"; +import BigNumber from "bignumber.js"; +import SVGInline from "react-svg-inline"; +import { intlShape, FormattedHTMLMessage } from "react-intl"; +import vjf from "mobx-react-form/lib/validators/VJF"; +import ReactToolboxMobxForm from "../../../utils/ReactToolboxMobxForm"; +import Dialog from "../../widgets/Dialog"; +import DialogCloseButton from "../../widgets/DialogCloseButton"; +import LocalizableError from "../../../i18n/LocalizableError"; +import styles from "./WalletSendAssetsConfirmationDialog.scss"; +import questionMarkIcon from "../../../assets/images/question-mark.inline.svg"; +import { FORM_VALIDATION_DEBOUNCE_WAIT } from "../../../config/timingConfig"; +import { submitOnEnter } from "../../../utils/form"; +import { formattedTokenWalletAmount } from "../../../utils/formatters"; +import { FormattedHTMLMessageWithLink } from "../../widgets/FormattedHTMLMessageWithLink"; +import HardwareWalletStatus from "../../hardware-wallet/HardwareWalletStatus"; +import LoadingSpinner from "../../widgets/LoadingSpinner"; +import Wallet, { HwDeviceStatuses } from "../../../domains/Wallet"; +import Asset from "../../assets/Asset"; +import type { HwDeviceStatus } from "../../../domains/Wallet"; +import type { AssetToken } from "../../../api/assets/types"; +import { getMessages } from "./WalletSendAssetsConfirmationDialog.messages"; +import { shouldShowEmptyWalletWarning } from "../../../utils/walletUtils"; +import { hasTokensLeftAfterTransaction } from "../../../utils/assets"; +import globalMessages from "../../../i18n/global-messages"; const SHOW_TOTAL_AMOUNT = false; - type Props = { - amount: string, - receiver: string, - wallet: Wallet, - totalAmount: BigNumber, - selectedAssets: Array, - allAvailableTokens: Array, - assetsAmounts: Array, - transactionFee: ?string, - onSubmit: Function, - amountToNaturalUnits: (amountWithFractions: string) => string, - onCancel: Function, - onExternalLinkClick: Function, - isSubmitting: boolean, - isFlight: boolean, - error: ?LocalizableError, - hwDeviceStatus: HwDeviceStatus, - isHardwareWallet: boolean, - onInitiateTransaction: Function, - onCopyAssetParam: Function, - isTrezor: boolean, - formattedTotalAmount: string, + amount: string; + receiver: string; + wallet: Wallet; + totalAmount: BigNumber; + selectedAssets: Array; + allAvailableTokens: Array; + assetsAmounts: Array; + transactionFee: string | null | undefined; + onSubmit: (...args: Array) => any; + amountToNaturalUnits: (amountWithFractions: string) => string; + onCancel: (...args: Array) => any; + onExternalLinkClick: (...args: Array) => any; + isSubmitting: boolean; + isFlight: boolean; + error: LocalizableError | null | undefined; + hwDeviceStatus: HwDeviceStatus; + isHardwareWallet: boolean; + onInitiateTransaction: (...args: Array) => any; + onCopyAssetParam: (...args: Array) => any; + isTrezor: boolean; + formattedTotalAmount: string; }; - type State = { - selectedAssets: Array, - assetsAmounts: Array, - areTermsAccepted: boolean, + selectedAssets: Array; + assetsAmounts: Array; + areTermsAccepted: boolean; }; - const messages = getMessages(); @observer -class WalletSendAssetsConfirmationDialog extends Component< - Props, - State -> { +class WalletSendAssetsConfirmationDialog extends Component { static contextTypes = { - intl: intlShape.isRequired, + intl: intlShape.isRequired }; - state = { selectedAssets: [], assetsAmounts: [], - areTermsAccepted: false, + areTermsAccepted: false }; componentDidMount() { @@ -86,63 +77,66 @@ class WalletSendAssetsConfirmationDialog extends Component< // value to avoid losing them after the transaction is confirmed // (this affects only hardware wallets for which we close the dialog // after transaction has been confirmed) - const { selectedAssets, assetsAmounts } = this.props; - this.setState({ selectedAssets, assetsAmounts }); + const { + selectedAssets, + assetsAmounts + } = this.props; + this.setState({ + selectedAssets, + assetsAmounts + }); } - form = new ReactToolboxMobxForm( - { - fields: { - passphrase: { - type: 'password', - label: this.context.intl.formatMessage(messages.passphraseLabel), - placeholder: this.context.intl.formatMessage( - messages.passphraseFieldPlaceholder - ), - value: '', - validators: [ - ({ field }) => { - if (this.props.isHardwareWallet) return [true]; - if (field.value === '') { - return [ - false, - this.context.intl.formatMessage(messages.fieldIsRequired), - ]; - } - return [true]; - }, - ], - }, - flightCandidateCheckbox: { - type: 'checkbox', - label: this.context.intl.formatMessage( - messages.flightCandidateCheckboxLabel - ), - }, + form = new ReactToolboxMobxForm({ + fields: { + passphrase: { + type: 'password', + label: this.context.intl.formatMessage(messages.passphraseLabel), + placeholder: this.context.intl.formatMessage(messages.passphraseFieldPlaceholder), + value: '', + validators: [({ + field + }) => { + if (this.props.isHardwareWallet) return [true]; + + if (field.value === '') { + return [false, this.context.intl.formatMessage(messages.fieldIsRequired)]; + } + + return [true]; + }] }, + flightCandidateCheckbox: { + type: 'checkbox', + label: this.context.intl.formatMessage(messages.flightCandidateCheckboxLabel) + } + } + }, { + plugins: { + vjf: vjf() }, - { - plugins: { vjf: vjf() }, - options: { - validateOnChange: true, - validationDebounceWait: FORM_VALIDATION_DEBOUNCE_WAIT, - }, + options: { + validateOnChange: true, + validationDebounceWait: FORM_VALIDATION_DEBOUNCE_WAIT } - ); - + }); submit = () => { this.form.submit({ - onSuccess: (form) => { - const { selectedAssets, assetsAmounts } = this.state; + onSuccess: form => { + const { + selectedAssets, + assetsAmounts + } = this.state; const { receiver, amount, amountToNaturalUnits, - isHardwareWallet, + isHardwareWallet } = this.props; - const { passphrase } = form.values(); - const hasAssetsRemainingAfterTransaction = - this.props.allAvailableTokens?.length > 0; + const { + passphrase + } = form.values(); + const hasAssetsRemainingAfterTransaction = this.props.allAvailableTokens?.length > 0; const transactionData = { receiver, amount: amountToNaturalUnits(amount), @@ -150,87 +144,78 @@ class WalletSendAssetsConfirmationDialog extends Component< isHardwareWallet, assets: selectedAssets, assetsAmounts, - hasAssetsRemainingAfterTransaction, + hasAssetsRemainingAfterTransaction }; this.props.onSubmit(transactionData); }, - onError: () => {}, + onError: () => {} }); }; - - handleSubmitOnEnter = (event: KeyboardEvent) => - (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && - submitOnEnter(this.submit, event); - - renderConfirmationElement = ( - isHardwareWallet: boolean - ): React$Element<*> | null => { + handleSubmitOnEnter = (event: KeyboardEvent) => (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && submitOnEnter(this.submit, event); + renderConfirmationElement = (isHardwareWallet: boolean): React.ReactElement, any> | null => { const passphraseField = this.form.$('passphrase'); - const { areTermsAccepted } = this.state; + const { + areTermsAccepted + } = this.state; const { hwDeviceStatus, isFlight, onExternalLinkClick, wallet, - isTrezor, + isTrezor } = this.props; - let returnJSX = null; - if (!isFlight || (isFlight && areTermsAccepted)) { - const { name } = wallet; - returnJSX = isHardwareWallet ? ( -
- -
- ) : ( - - ); + + if (!isFlight || isFlight && areTermsAccepted) { + const { + name + } = wallet; + returnJSX = isHardwareWallet ?
+ +
: ; } + return returnJSX; }; - onCheckboxClick = (areTermsAccepted: boolean) => { - const { isHardwareWallet, onInitiateTransaction } = this.props; - this.setState({ areTermsAccepted }); + const { + isHardwareWallet, + onInitiateTransaction + } = this.props; + this.setState({ + areTermsAccepted + }); + if (isHardwareWallet) { onInitiateTransaction(); } }; - getAssetAmount = (index: number) => { - const { assetsAmounts } = this.state; + const { + assetsAmounts + } = this.state; return get(assetsAmounts, index, 0); }; - - getFormattedAssetAmount = ( - { metadata, decimals }: AssetToken, - index: number - ) => { + getFormattedAssetAmount = ({ + metadata, + decimals + }: AssetToken, index: number) => { const assetAmount = this.getAssetAmount(index); - return formattedTokenWalletAmount( - new BigNumber(assetAmount), - metadata, - decimals - ); + return formattedTokenWalletAmount(new BigNumber(assetAmount), metadata, decimals); }; render() { - const { form } = this; - const { intl } = this.context; - const { selectedAssets, areTermsAccepted, assetsAmounts } = this.state; + const { + form + } = this; + const { + intl + } = this.context; + const { + selectedAssets, + areTermsAccepted, + assetsAmounts + } = this.state; const passphraseField = form.$('passphrase'); const flightCandidateCheckboxField = form.$('flightCandidateCheckbox'); const { @@ -248,80 +233,35 @@ class WalletSendAssetsConfirmationDialog extends Component< onCopyAssetParam, wallet, formattedTotalAmount, - totalAmount, + totalAmount } = this.props; - - const buttonLabel = !isSubmitting ? ( - intl.formatMessage(messages.sendButtonLabel) - ) : ( - - ); - - const actions = [ - { - label: intl.formatMessage(messages.backButtonLabel), - onClick: !isSubmitting ? onCancel : () => {}, - }, - { - label: buttonLabel, - onClick: this.submit, - primary: true, - className: 'confirmButton', - disabled: - !!error || - (!isHardwareWallet && !passphraseField.isValid) || - (isHardwareWallet && - hwDeviceStatus !== - HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED) || - (!areTermsAccepted && isFlight), - }, - ]; - + const buttonLabel = !isSubmitting ? intl.formatMessage(messages.sendButtonLabel) : ; + const actions = [{ + label: intl.formatMessage(messages.backButtonLabel), + onClick: !isSubmitting ? onCancel : () => {} + }, { + label: buttonLabel, + onClick: this.submit, + primary: true, + className: 'confirmButton', + disabled: !!error || !isHardwareWallet && !passphraseField.isValid || isHardwareWallet && hwDeviceStatus !== HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED || !areTermsAccepted && isFlight + }]; const assetsSeparatorBasicHeight = 27; - const assetsSeparatorCalculatedHeight = selectedAssets.length - ? assetsSeparatorBasicHeight * selectedAssets.length * 2 - 18 - : assetsSeparatorBasicHeight; - + const assetsSeparatorCalculatedHeight = selectedAssets.length ? assetsSeparatorBasicHeight * selectedAssets.length * 2 - 18 : assetsSeparatorBasicHeight; let errorElement = null; + if (error) { const errorHasLink = !!error.values.linkLabel; - errorElement = errorHasLink ? ( - - ) : ( - - ); + errorElement = errorHasLink ? : ; } - const { name } = wallet; - return ( - {}} - className={styles.dialog} - closeButton={} - > - {shouldShowEmptyWalletWarning( - totalAmount, - wallet, - !!allAvailableTokens?.length && - allAvailableTokens.length > 0 && - hasTokensLeftAfterTransaction( - allAvailableTokens, - selectedAssets, - assetsAmounts - ) - ) && ( -
+ const { + name + } = wallet; + return {}} className={styles.dialog} closeButton={}> + {shouldShowEmptyWalletWarning(totalAmount, wallet, !!allAvailableTokens?.length && allAvailableTokens.length > 0 && hasTokensLeftAfterTransaction(allAvailableTokens, selectedAssets, assetsAmounts)) &&
-
- )} +
}
@@ -330,14 +270,11 @@ class WalletSendAssetsConfirmationDialog extends Component<

{receiver}

-
+

{intl.formatMessage(globalMessages.adaName)} @@ -349,23 +286,15 @@ class WalletSendAssetsConfirmationDialog extends Component<

{selectedAssets.map((asset, assetIndex) => { - const assetAmount = this.getFormattedAssetAmount( - asset, - assetIndex - ); - return ( - + const assetAmount = this.getFormattedAssetAmount(asset, assetIndex); + return

{intl.formatMessage(messages.assetLabel)}  #{assetIndex + 1} - +

{assetAmount}
@@ -374,24 +303,10 @@ class WalletSendAssetsConfirmationDialog extends Component<
- {intl.formatMessage( - messages.unformattedAmountLabel - )} - - -
- } - key="tooltip" - > + {intl.formatMessage(messages.unformattedAmountLabel)} + + +
} key="tooltip">
@@ -402,17 +317,15 @@ class WalletSendAssetsConfirmationDialog extends Component< {this.getAssetAmount(assetIndex)}
- - ); - })} + ; + })}
- {SHOW_TOTAL_AMOUNT ? ( - <> + {SHOW_TOTAL_AMOUNT ? <>
@@ -446,9 +359,7 @@ class WalletSendAssetsConfirmationDialog extends Component< {formattedTotalAmount}  {intl.formatMessage(globalMessages.adaUnit)}
- - ) : ( -
+ :
{intl.formatMessage(messages.feesLabel)}
@@ -456,30 +367,17 @@ class WalletSendAssetsConfirmationDialog extends Component< +{transactionFee}  {intl.formatMessage(globalMessages.adaUnit)}
-
- )} +
} - {isFlight && ( -
- - -
- )} + {isFlight &&
+ + +
} {this.renderConfirmationElement(isHardwareWallet)} {errorElement ?

{errorElement}

: null} -
- ); + ; } + } -export default WalletSendAssetsConfirmationDialog \ No newline at end of file +export default WalletSendAssetsConfirmationDialog; \ No newline at end of file diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx index a63bbe980e..30a8b8b5c4 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx @@ -1,191 +1,168 @@ -// @flow -import React, { Component } from 'react'; -import { observer } from 'mobx-react'; -import { Input } from 'react-polymorph/lib/components/Input'; -import { InputSkin } from 'react-polymorph/lib/skins/simple/InputSkin'; -import { Checkbox } from 'react-polymorph/lib/components/Checkbox'; -import { CheckboxSkin } from 'react-polymorph/lib/skins/simple/CheckboxSkin'; -import { FormattedHTMLMessage, intlShape } from 'react-intl'; -import vjf from 'mobx-react-form/lib/validators/VJF'; -import BigNumber from 'bignumber.js'; -import ReactToolboxMobxForm from '../../../utils/ReactToolboxMobxForm'; -import Dialog from '../../widgets/Dialog'; -import DialogCloseButton from '../../widgets/DialogCloseButton'; -import LocalizableError from '../../../i18n/LocalizableError'; -import styles from './WalletSendConfirmationDialog.scss'; -import { FORM_VALIDATION_DEBOUNCE_WAIT } from '../../../config/timingConfig'; -import { submitOnEnter } from '../../../utils/form'; -import { FormattedHTMLMessageWithLink } from '../../widgets/FormattedHTMLMessageWithLink'; -import HardwareWalletStatus from '../../hardware-wallet/HardwareWalletStatus'; -import LoadingSpinner from '../../widgets/LoadingSpinner'; -import type { HwDeviceStatus } from '../../../domains/Wallet'; -import Wallet, { HwDeviceStatuses } from '../../../domains/Wallet'; -import { getMessages } from './WalletSendAssetsConfirmationDialog.messages'; -import { shouldShowEmptyWalletWarning } from '../../../utils/walletUtils'; -import type { AssetToken } from '../../../api/assets/types'; -import globalMessages from '../../../i18n/global-messages'; - +import React, { Component } from "react"; +import { observer } from "mobx-react"; +import { Input } from "react-polymorph/lib/components/Input"; +import { InputSkin } from "react-polymorph/lib/skins/simple/InputSkin"; +import { Checkbox } from "react-polymorph/lib/components/Checkbox"; +import { CheckboxSkin } from "react-polymorph/lib/skins/simple/CheckboxSkin"; +import { FormattedHTMLMessage, intlShape } from "react-intl"; +import vjf from "mobx-react-form/lib/validators/VJF"; +import BigNumber from "bignumber.js"; +import ReactToolboxMobxForm from "../../../utils/ReactToolboxMobxForm"; +import Dialog from "../../widgets/Dialog"; +import DialogCloseButton from "../../widgets/DialogCloseButton"; +import LocalizableError from "../../../i18n/LocalizableError"; +import styles from "./WalletSendConfirmationDialog.scss"; +import { FORM_VALIDATION_DEBOUNCE_WAIT } from "../../../config/timingConfig"; +import { submitOnEnter } from "../../../utils/form"; +import { FormattedHTMLMessageWithLink } from "../../widgets/FormattedHTMLMessageWithLink"; +import HardwareWalletStatus from "../../hardware-wallet/HardwareWalletStatus"; +import LoadingSpinner from "../../widgets/LoadingSpinner"; +import type { HwDeviceStatus } from "../../../domains/Wallet"; +import Wallet, { HwDeviceStatuses } from "../../../domains/Wallet"; +import { getMessages } from "./WalletSendAssetsConfirmationDialog.messages"; +import { shouldShowEmptyWalletWarning } from "../../../utils/walletUtils"; +import type { AssetToken } from "../../../api/assets/types"; +import globalMessages from "../../../i18n/global-messages"; type Props = { - amount: string, - receiver: string, - wallet: Wallet, - totalAmount: BigNumber, - allAvailableTokens?: Array, - transactionFee: ?string, - onSubmit: Function, - amountToNaturalUnits: (amountWithFractions: string) => string, - onCancel: Function, - isSubmitting: boolean, - isFlight: boolean, - error: ?LocalizableError, - hwDeviceStatus: HwDeviceStatus, - isHardwareWallet: boolean, - onInitiateTransaction: Function, - onExternalLinkClick: Function, - isTrezor: boolean, - formattedTotalAmount: string, + amount: string; + receiver: string; + wallet: Wallet; + totalAmount: BigNumber; + allAvailableTokens?: Array; + transactionFee: string | null | undefined; + onSubmit: (...args: Array) => any; + amountToNaturalUnits: (amountWithFractions: string) => string; + onCancel: (...args: Array) => any; + isSubmitting: boolean; + isFlight: boolean; + error: LocalizableError | null | undefined; + hwDeviceStatus: HwDeviceStatus; + isHardwareWallet: boolean; + onInitiateTransaction: (...args: Array) => any; + onExternalLinkClick: (...args: Array) => any; + isTrezor: boolean; + formattedTotalAmount: string; }; - type State = { - areTermsAccepted: boolean, + areTermsAccepted: boolean; }; - const messages = getMessages(); @observer -class WalletSendConfirmationDialog extends Component< - Props, - State -> { +class WalletSendConfirmationDialog extends Component { static contextTypes = { - intl: intlShape.isRequired, + intl: intlShape.isRequired }; - state = { - areTermsAccepted: false, + areTermsAccepted: false }; + form = new ReactToolboxMobxForm({ + fields: { + passphrase: { + type: 'password', + label: this.context.intl.formatMessage(messages.passphraseLabel), + placeholder: this.context.intl.formatMessage(messages.passphraseFieldPlaceholder), + value: '', + validators: [({ + field + }) => { + if (this.props.isHardwareWallet) return [true]; + + if (field.value === '') { + return [false, this.context.intl.formatMessage(messages.fieldIsRequired)]; + } - form = new ReactToolboxMobxForm( - { - fields: { - passphrase: { - type: 'password', - label: this.context.intl.formatMessage(messages.passphraseLabel), - placeholder: this.context.intl.formatMessage( - messages.passphraseFieldPlaceholder - ), - value: '', - validators: [ - ({ field }) => { - if (this.props.isHardwareWallet) return [true]; - if (field.value === '') { - return [ - false, - this.context.intl.formatMessage(messages.fieldIsRequired), - ]; - } - return [true]; - }, - ], - }, - flightCandidateCheckbox: { - type: 'checkbox', - label: this.context.intl.formatMessage( - messages.flightCandidateCheckboxLabel - ), - }, + return [true]; + }] }, + flightCandidateCheckbox: { + type: 'checkbox', + label: this.context.intl.formatMessage(messages.flightCandidateCheckboxLabel) + } + } + }, { + plugins: { + vjf: vjf() }, - { - plugins: { vjf: vjf() }, - options: { - validateOnChange: true, - validationDebounceWait: FORM_VALIDATION_DEBOUNCE_WAIT, - }, + options: { + validateOnChange: true, + validationDebounceWait: FORM_VALIDATION_DEBOUNCE_WAIT } - ); - + }); submit = () => { this.form.submit({ - onSuccess: (form) => { + onSuccess: form => { const { receiver, amount, amountToNaturalUnits, - isHardwareWallet, + isHardwareWallet } = this.props; - const { passphrase } = form.values(); - const hasAssetsRemainingAfterTransaction = - this.props.allAvailableTokens?.length && - this.props.allAvailableTokens.length > 0; + const { + passphrase + } = form.values(); + const hasAssetsRemainingAfterTransaction = this.props.allAvailableTokens?.length && this.props.allAvailableTokens.length > 0; const transactionData = { receiver, amount: amountToNaturalUnits(amount), passphrase, isHardwareWallet, - hasAssetsRemainingAfterTransaction, + hasAssetsRemainingAfterTransaction }; this.props.onSubmit(transactionData); }, - onError: () => {}, + onError: () => {} }); }; - - handleSubmitOnEnter = (event: KeyboardEvent) => - (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && - submitOnEnter(this.submit, event); - - renderConfirmationElement = ( - isHardwareWallet: boolean - ): ?React$Element<*> => { + handleSubmitOnEnter = (event: KeyboardEvent) => (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && submitOnEnter(this.submit, event); + renderConfirmationElement = (isHardwareWallet: boolean): React.ReactElement, any> | null | undefined => { const passphraseField = this.form.$('passphrase'); - const { areTermsAccepted } = this.state; + const { + areTermsAccepted + } = this.state; const { hwDeviceStatus, isFlight, onExternalLinkClick, wallet, - isTrezor, + isTrezor } = this.props; - if (!isFlight || (isFlight && areTermsAccepted)) { - const { name } = wallet; - return isHardwareWallet ? ( -
- -
- ) : ( - - ); + if (!isFlight || isFlight && areTermsAccepted) { + const { + name + } = wallet; + return isHardwareWallet ?
+ +
: ; } + return null; }; - onCheckboxClick = (areTermsAccepted: boolean) => { - const { isHardwareWallet, onInitiateTransaction } = this.props; - this.setState({ areTermsAccepted }); + const { + isHardwareWallet, + onInitiateTransaction + } = this.props; + this.setState({ + areTermsAccepted + }); + if (isHardwareWallet) { onInitiateTransaction(); } }; render() { - const { form } = this; - const { intl } = this.context; - const { areTermsAccepted } = this.state; + const { + form + } = this; + const { + intl + } = this.context; + const { + areTermsAccepted + } = this.state; const passphraseField = form.$('passphrase'); const flightCandidateCheckboxField = form.$('flightCandidateCheckbox'); const { @@ -202,69 +179,33 @@ class WalletSendConfirmationDialog extends Component< isHardwareWallet, wallet, formattedTotalAmount, - totalAmount, + totalAmount } = this.props; - - const buttonLabel = !isSubmitting ? ( - intl.formatMessage(messages.sendButtonLabel) - ) : ( - - ); - - const actions = [ - { - label: intl.formatMessage(messages.backButtonLabel), - onClick: !isSubmitting ? onCancel : () => {}, - }, - { - label: buttonLabel, - onClick: this.submit, - primary: true, - className: 'confirmButton', - disabled: - !!error || - (!isHardwareWallet && !passphraseField.isValid) || - (isHardwareWallet && - hwDeviceStatus !== - HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED) || - (!areTermsAccepted && isFlight), - }, - ]; - + const buttonLabel = !isSubmitting ? intl.formatMessage(messages.sendButtonLabel) : ; + const actions = [{ + label: intl.formatMessage(messages.backButtonLabel), + onClick: !isSubmitting ? onCancel : () => {} + }, { + label: buttonLabel, + onClick: this.submit, + primary: true, + className: 'confirmButton', + disabled: !!error || !isHardwareWallet && !passphraseField.isValid || isHardwareWallet && hwDeviceStatus !== HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED || !areTermsAccepted && isFlight + }]; let errorElement = null; + if (error) { const errorHasLink = !!error.values.linkLabel; - errorElement = errorHasLink ? ( - - ) : ( - - ); + errorElement = errorHasLink ? : ; } - const { name } = wallet; - return ( - {}} - className={styles.dialog} - closeButton={} - > - {shouldShowEmptyWalletWarning( - totalAmount, - wallet, - !!allAvailableTokens?.length && allAvailableTokens.length > 0 - ) && ( -
+ const { + name + } = wallet; + return {}} className={styles.dialog} closeButton={}> + {shouldShowEmptyWalletWarning(totalAmount, wallet, !!allAvailableTokens?.length && allAvailableTokens.length > 0) &&
-
- )} +
}
{intl.formatMessage(messages.addressToLabel)} @@ -302,27 +243,15 @@ class WalletSendConfirmationDialog extends Component<  {intl.formatMessage(globalMessages.adaUnit)}
- {isFlight && ( -
- - -
- )} + {isFlight &&
+ + +
} {this.renderConfirmationElement(isHardwareWallet)} {errorElement ?

{errorElement}

: null} -
- ); + ; } + } -export default WalletSendConfirmationDialog \ No newline at end of file +export default WalletSendConfirmationDialog; \ No newline at end of file diff --git a/source/renderer/app/stores/WalletsStore.js.ts b/source/renderer/app/stores/WalletsStore.js.ts index f775980c54..6b71c6e896 100644 --- a/source/renderer/app/stores/WalletsStore.js.ts +++ b/source/renderer/app/stores/WalletsStore.js.ts @@ -1,64 +1,39 @@ -// @flow -import { observable, action, computed, runInAction, flow } from 'mobx'; -import { get, find, findIndex, isEqual, includes } from 'lodash'; -import { BigNumber } from 'bignumber.js'; -import Store from './lib/Store'; -import Request from './lib/LocalizedRequest'; -import Wallet, { WalletSyncStateStatuses } from '../domains/Wallet'; -import WalletAddress from '../domains/WalletAddress'; -import { WalletTransaction } from '../domains/WalletTransaction'; -import { MAX_ADA_WALLETS_COUNT } from '../config/numbersConfig'; -import { i18nContext } from '../utils/i18nContext'; -import { mnemonicToSeedHex, getScrambledInput } from '../utils/crypto'; -import { paperWalletPdfGenerator } from '../utils/paperWalletPdfGenerator'; -import { addressPDFGenerator } from '../utils/addressPDFGenerator'; -import { downloadCsv } from '../utils/csvGenerator'; -import { buildRoute, matchRoute } from '../utils/routing'; -import { logger } from '../utils/logging'; -import { ROUTES } from '../routes-config'; -import { formattedWalletAmount } from '../utils/formatters'; -import { ellipsis } from '../utils/strings'; -import { - bech32EncodePublicKey, - isReceiverAddressType, -} from '../utils/hardwareWalletUtils'; -import { - WalletPaperWalletOpenPdfError, - WalletRewardsOpenCsvError, -} from '../i18n/errors'; -import { - WALLET_KINDS, - WALLET_DAEDALUS_KINDS, - WALLET_YOROI_KINDS, - WALLET_HARDWARE_KINDS, - RESTORE_WALLET_STEPS, -} from '../config/walletRestoreConfig'; -import { IS_WALLET_PUBLIC_KEY_SHARING_ENABLED } from '../config/walletsConfig'; -import { introspectAddressChannel } from '../ipc/introspect-address'; -import { saveQRCodeImageChannel } from '../ipc/saveQRCodeImageChannel'; -import type { AddressStyle } from '../../../common/types/address-introspection.types'; -import type { AssetToken } from '../api/assets/types'; -import type { - WalletKind, - WalletDaedalusKind, - WalletYoroiKind, - WalletHardwareKind, -} from '../types/walletRestoreTypes'; -import type { CsvFileContent } from '../../../common/types/csv-request.types'; -import type { WalletExportTypeChoices } from '../types/walletExportTypes'; -import type { WalletImportFromFileParams } from '../actions/wallets-actions'; -import type LocalizableError from '../i18n/LocalizableError'; -import type { - TransferFundsCalculateFeeRequest, - TransferFundsRequest, -} from '../api/wallets/types'; -import type { QuitStakePoolRequest } from '../api/staking/types'; -import type { - TransportDevice, - HardwareWalletExtendedPublicKeyResponse, -} from '../../../common/types/hardware-wallets.types'; -import { NetworkMagics } from '../../../common/types/cardano-node.types'; - +import { observable, action, computed, runInAction, flow } from "mobx"; +import { get, find, findIndex, isEqual, includes } from "lodash"; +import { BigNumber } from "bignumber.js"; +import Store from "./lib/Store"; +import Request from "./lib/LocalizedRequest"; +import Wallet, { WalletSyncStateStatuses } from "../domains/Wallet"; +import WalletAddress from "../domains/WalletAddress"; +import { WalletTransaction } from "../domains/WalletTransaction"; +import { MAX_ADA_WALLETS_COUNT } from "../config/numbersConfig"; +import { i18nContext } from "../utils/i18nContext"; +import { mnemonicToSeedHex, getScrambledInput } from "../utils/crypto"; +import { paperWalletPdfGenerator } from "../utils/paperWalletPdfGenerator"; +import { addressPDFGenerator } from "../utils/addressPDFGenerator"; +import { downloadCsv } from "../utils/csvGenerator"; +import { buildRoute, matchRoute } from "../utils/routing"; +import { logger } from "../utils/logging"; +import { ROUTES } from "../routes-config"; +import { formattedWalletAmount } from "../utils/formatters"; +import { ellipsis } from "../utils/strings"; +import { bech32EncodePublicKey, isReceiverAddressType } from "../utils/hardwareWalletUtils"; +import { WalletPaperWalletOpenPdfError, WalletRewardsOpenCsvError } from "../i18n/errors"; +import { WALLET_KINDS, WALLET_DAEDALUS_KINDS, WALLET_YOROI_KINDS, WALLET_HARDWARE_KINDS, RESTORE_WALLET_STEPS } from "../config/walletRestoreConfig"; +import { IS_WALLET_PUBLIC_KEY_SHARING_ENABLED } from "../config/walletsConfig"; +import { introspectAddressChannel } from "../ipc/introspect-address"; +import { saveQRCodeImageChannel } from "../ipc/saveQRCodeImageChannel"; +import type { AddressStyle } from "../../../common/types/address-introspection.types"; +import type { AssetToken } from "../api/assets/types"; +import type { WalletKind, WalletDaedalusKind, WalletYoroiKind, WalletHardwareKind } from "../types/walletRestoreTypes"; +import type { CsvFileContent } from "../../../common/types/csv-request.types"; +import type { WalletExportTypeChoices } from "../types/walletExportTypes"; +import type { WalletImportFromFileParams } from "../actions/wallets-actions"; +import type LocalizableError from "../i18n/LocalizableError"; +import type { TransferFundsCalculateFeeRequest, TransferFundsRequest } from "../api/wallets/types"; +import type { QuitStakePoolRequest } from "../api/staking/types"; +import type { TransportDevice, HardwareWalletExtendedPublicKeyResponse } from "../../../common/types/hardware-wallets.types"; +import { NetworkMagics } from "../../../common/types/cardano-node.types"; /* eslint-disable consistent-return */ /** @@ -67,163 +42,175 @@ import { NetworkMagics } from '../../../common/types/cardano-node.types'; export default class WalletsStore extends Store { WALLET_REFRESH_INTERVAL = 5000; - - @observable undelegateWalletSubmissionSuccess: ?boolean = null; - - @observable isAddressFromSameWallet: boolean = false; - + @observable + undelegateWalletSubmissionSuccess: boolean | null | undefined = null; + @observable + isAddressFromSameWallet: boolean = false; // REQUESTS - @observable walletsRequest: Request> = new Request( - this.api.ada.getWallets - ); - @observable accountPublicKeyRequest: Request = new Request( - this.api.ada.getAccountPublicKey - ); - @observable icoPublicKeyRequest: Request = new Request( - this.api.ada.getICOPublicKey - ); - @observable importFromFileRequest: Request = new Request( - this.api.ada.importWalletFromFile - ); - @observable createWalletRequest: Request = new Request( - this.api.ada.createWallet - ); @observable - getWalletAddressesRequest: Request> = new Request( - this.api.ada.getAddresses - ); - @observable deleteWalletRequest: Request = new Request( - this.api.ada.deleteWallet - ); - @observable sendMoneyRequest: Request = new Request( - this.api.ada.createTransaction - ); - @observable getWalletRecoveryPhraseRequest: Request< - Array - > = new Request(this.api.ada.getWalletRecoveryPhrase); - @observable getWalletCertificateAdditionalMnemonicsRequest: Request< - Array - > = new Request(this.api.ada.getWalletCertificateAdditionalMnemonics); - @observable getWalletCertificateRecoveryPhraseRequest: Request< - Array - > = new Request(this.api.ada.getWalletCertificateRecoveryPhrase); - @observable getWalletRecoveryPhraseFromCertificateRequest: Request< - Array - > = new Request(this.api.ada.getWalletRecoveryPhraseFromCertificate); - @observable restoreDaedalusRequest: Request = new Request( - this.api.ada.restoreWallet - ); - @observable restoreLegacyRequest: Request = new Request( - this.api.ada.restoreLegacyWallet - ); - @observable restoreByronRandomWalletRequest: Request = new Request( - this.api.ada.restoreByronRandomWallet - ); - @observable restoreByronIcarusWalletRequest: Request = new Request( - this.api.ada.restoreByronIcarusWallet - ); - @observable restoreByronTrezorWalletRequest: Request = new Request( - this.api.ada.restoreByronTrezorWallet - ); - @observable restoreByronLedgerWalletRequest: Request = new Request( - this.api.ada.restoreByronLedgerWallet - ); + walletsRequest: Request> = new Request(this.api.ada.getWallets); + @observable + accountPublicKeyRequest: Request = new Request(this.api.ada.getAccountPublicKey); + @observable + icoPublicKeyRequest: Request = new Request(this.api.ada.getICOPublicKey); + @observable + importFromFileRequest: Request = new Request(this.api.ada.importWalletFromFile); + @observable + createWalletRequest: Request = new Request(this.api.ada.createWallet); + @observable + getWalletAddressesRequest: Request> = new Request(this.api.ada.getAddresses); + @observable + deleteWalletRequest: Request = new Request(this.api.ada.deleteWallet); + @observable + sendMoneyRequest: Request = new Request(this.api.ada.createTransaction); + @observable + getWalletRecoveryPhraseRequest: Request> = new Request(this.api.ada.getWalletRecoveryPhrase); + @observable + getWalletCertificateAdditionalMnemonicsRequest: Request> = new Request(this.api.ada.getWalletCertificateAdditionalMnemonics); + @observable + getWalletCertificateRecoveryPhraseRequest: Request> = new Request(this.api.ada.getWalletCertificateRecoveryPhrase); + @observable + getWalletRecoveryPhraseFromCertificateRequest: Request> = new Request(this.api.ada.getWalletRecoveryPhraseFromCertificate); + @observable + restoreDaedalusRequest: Request = new Request(this.api.ada.restoreWallet); + @observable + restoreLegacyRequest: Request = new Request(this.api.ada.restoreLegacyWallet); @observable - transferFundsCalculateFeeRequest: Request = new Request( - this.api.ada.transferFundsCalculateFee - ); - @observable transferFundsRequest: Request = new Request( - this.api.ada.transferFunds - ); - @observable createHardwareWalletRequest: Request = new Request( - this.api.ada.createHardwareWallet - ); + restoreByronRandomWalletRequest: Request = new Request(this.api.ada.restoreByronRandomWallet); + @observable + restoreByronIcarusWalletRequest: Request = new Request(this.api.ada.restoreByronIcarusWallet); + @observable + restoreByronTrezorWalletRequest: Request = new Request(this.api.ada.restoreByronTrezorWallet); + @observable + restoreByronLedgerWalletRequest: Request = new Request(this.api.ada.restoreByronLedgerWallet); + @observable + transferFundsCalculateFeeRequest: Request = new Request(this.api.ada.transferFundsCalculateFee); + @observable + transferFundsRequest: Request = new Request(this.api.ada.transferFunds); + @observable + createHardwareWalletRequest: Request = new Request(this.api.ada.createHardwareWallet); /* ---------- Active Wallet ---------- */ - @observable active: ?Wallet = null; - @observable activeValue: ?BigNumber = null; - @observable activePublicKey: ?string = null; - @observable icoPublicKey: ?string = null; + @observable + active: Wallet | null | undefined = null; + @observable + activeValue: BigNumber | null | undefined = null; + @observable + activePublicKey: string | null | undefined = null; + @observable + icoPublicKey: string | null | undefined = null; + /* ---------- Create Wallet ---------- */ - @observable createWalletStep = null; - @observable createWalletShowAbortConfirmation = false; + @observable + createWalletStep = null; + @observable + createWalletShowAbortConfirmation = false; // TODO: Remove once the new wallet creation process is ready - @observable createWalletUseNewProcess = false; + @observable + createWalletUseNewProcess = false; /* ---------- Restore Wallet ---------- */ - @observable restoreWalletStep = null; - @observable restoreWalletShowAbortConfirmation = false; + @observable + restoreWalletStep = null; + @observable + restoreWalletShowAbortConfirmation = false; // STEP: WALLET TYPE - @observable walletKind: ?WalletKind = null; - @observable walletKindDaedalus: ?WalletDaedalusKind = null; - @observable walletKindYoroi: ?WalletYoroiKind = null; - @observable walletKindHardware: ?WalletHardwareKind = null; + @observable + walletKind: WalletKind | null | undefined = null; + @observable + walletKindDaedalus: WalletDaedalusKind | null | undefined = null; + @observable + walletKindYoroi: WalletYoroiKind | null | undefined = null; + @observable + walletKindHardware: WalletHardwareKind | null | undefined = null; // STEP: RECOVERY PHRASE - @observable mnemonics: Array = []; + @observable + mnemonics: Array = []; // STEP: CONFIGURATION - @observable walletName: string = ''; - @observable spendingPassword: string = ''; - @observable repeatPassword: string = ''; + @observable + walletName: string = ''; + @observable + spendingPassword: string = ''; + @observable + repeatPassword: string = ''; // TODO: Remove once the new restore creation process is ready - @observable restoreWalletUseNewProcess = true; - @observable restoredWallet: ?Wallet = null; + @observable + restoreWalletUseNewProcess = true; + @observable + restoredWallet: Wallet | null | undefined = null; /* ---------- Export Wallet ---------- */ - @observable walletExportType: WalletExportTypeChoices = 'paperWallet'; - @observable walletExportMnemonic = - 'marine joke dry silk ticket thing sugar stereo aim'; + @observable + walletExportType: WalletExportTypeChoices = 'paperWallet'; + @observable + walletExportMnemonic = 'marine joke dry silk ticket thing sugar stereo aim'; /* ---------- Delete Wallet ---------- */ - @observable isDeleting: boolean = false; + @observable + isDeleting: boolean = false; + /* ---------- Restore Wallet ---------- */ - @observable isRestoring: boolean = false; + @observable + isRestoring: boolean = false; /* ---------- Paper Wallet ---------- */ - @observable createPaperWalletCertificateStep = 0; - @observable walletCertificatePassword = null; - @observable walletCertificateAddress = null; - @observable walletCertificateRecoveryPhrase = null; - @observable generatingCertificateInProgress = false; - @observable generatingCertificateError: ?LocalizableError = null; - @observable generatingRewardsCsvInProgress = false; - @observable generatingRewardsCsvError: ?LocalizableError = null; - @observable certificateStep = null; - @observable certificateTemplate = null; - @observable additionalMnemonicWords = null; + @observable + createPaperWalletCertificateStep = 0; + @observable + walletCertificatePassword = null; + @observable + walletCertificateAddress = null; + @observable + walletCertificateRecoveryPhrase = null; + @observable + generatingCertificateInProgress = false; + @observable + generatingCertificateError: LocalizableError | null | undefined = null; + @observable + generatingRewardsCsvInProgress = false; + @observable + generatingRewardsCsvError: LocalizableError | null | undefined = null; + @observable + certificateStep = null; + @observable + certificateTemplate = null; + @observable + additionalMnemonicWords = null; /* ---------- Transfer Funds ---------- */ - @observable transferFundsSourceWalletId: string = ''; - @observable transferFundsTargetWalletId: string = ''; - @observable transferFundsStep: number = 0; - @observable transferFundsFee: ?BigNumber = null; - @observable transferFundsLeftovers: ?BigNumber = null; + @observable + transferFundsSourceWalletId: string = ''; + @observable + transferFundsTargetWalletId: string = ''; + @observable + transferFundsStep: number = 0; + @observable + transferFundsFee: BigNumber | null | undefined = null; + @observable + transferFundsLeftovers: BigNumber | null | undefined = null; /* ---------- Other ---------- */ - _newWalletDetails: { - name: string, - mnemonic: string, - spendingPassword: string, + name: string; + mnemonic: string; + spendingPassword: string; } = { name: '', mnemonic: '', - spendingPassword: '', + spendingPassword: '' }; _pollingBlocked = false; setup() { setInterval(this._pollRefresh, this.WALLET_REFRESH_INTERVAL); - this.registerReactions([this._updateActiveWalletOnRouteChanges]); - const { router, walletBackup, wallets: walletsActions, app, - networkStatus, + networkStatus } = this.actions; - // Create Wallet Actions --- walletsActions.createWallet.listen(this._create); walletsActions.createWalletBegin.listen(this._createWalletBegin); @@ -231,48 +218,32 @@ export default class WalletsStore extends Store { walletsActions.createWalletAbort.listen(this._createWalletAbort); walletsActions.createWalletClose.listen(this._createWalletClose); walletsActions.createHardwareWallet.listen(this._createHardwareWallet); - // --- // Restore Wallet Actions --- walletsActions.restoreWallet.listen(this._restore); walletsActions.restoreWalletBegin.listen(this._restoreWalletBegin); walletsActions.restoreWalletEnd.listen(this._restoreWalletEnd); - walletsActions.restoreWalletChangeStep.listen( - this._restoreWalletChangeStep - ); + walletsActions.restoreWalletChangeStep.listen(this._restoreWalletChangeStep); walletsActions.restoreWalletClose.listen(this._restoreWalletClose); - walletsActions.restoreWalletCancelClose.listen( - this._restoreWalletCancelClose - ); + walletsActions.restoreWalletCancelClose.listen(this._restoreWalletCancelClose); walletsActions.restoreWalletSetKind.listen(this._restoreWalletSetKind); - walletsActions.restoreWalletSetMnemonics.listen( - this._restoreWalletSetMnemonics - ); + walletsActions.restoreWalletSetMnemonics.listen(this._restoreWalletSetMnemonics); walletsActions.restoreWalletSetConfig.listen(this._restoreWalletSetConfig); walletsActions.deleteWallet.listen(this._deleteWallet); walletsActions.undelegateWallet.listen(this._undelegateWallet); - walletsActions.setUndelegateWalletSubmissionSuccess.listen( - this._setUndelegateWalletSubmissionSuccess - ); + walletsActions.setUndelegateWalletSubmissionSuccess.listen(this._setUndelegateWalletSubmissionSuccess); walletsActions.sendMoney.listen(this._sendMoney); walletsActions.importWalletFromFile.listen(this._importWalletFromFile); walletsActions.chooseWalletExportType.listen(this._chooseWalletExportType); walletsActions.getAccountPublicKey.listen(this._getAccountPublicKey); walletsActions.getICOPublicKey.listen(this._getICOPublicKey); - walletsActions.generateCertificate.listen(this._generateCertificate); walletsActions.generateAddressPDF.listen(this._generateAddressPDF); walletsActions.saveQRCodeImage.listen(this._saveQRCodeImage); walletsActions.updateCertificateStep.listen(this._updateCertificateStep); - walletsActions.closeCertificateGeneration.listen( - this._closeCertificateGeneration - ); - + walletsActions.closeCertificateGeneration.listen(this._closeCertificateGeneration); walletsActions.generateCsv.listen(this._generateCsv); - walletsActions.closeRewardsCsvGeneration.listen( - this._closeRewardsCsvGeneration - ); - + walletsActions.closeRewardsCsvGeneration.listen(this._closeRewardsCsvGeneration); walletsActions.setCertificateTemplate.listen(this._setCertificateTemplate); walletsActions.finishCertificate.listen(this._finishCertificate); walletsActions.finishRewardsCsv.listen(this._finishRewardsCsv); @@ -284,23 +255,18 @@ export default class WalletsStore extends Store { walletsActions.transferFundsNextStep.listen(this._transferFundsNextStep); walletsActions.transferFundsPrevStep.listen(this._transferFundsPrevStep); walletsActions.transferFunds.listen(this._transferFunds); - walletsActions.transferFundsSetSourceWalletId.listen( - this._transferFundsSetSourceWalletId - ); - walletsActions.transferFundsSetTargetWalletId.listen( - this._transferFundsSetTargetWalletId - ); + walletsActions.transferFundsSetSourceWalletId.listen(this._transferFundsSetSourceWalletId); + walletsActions.transferFundsSetTargetWalletId.listen(this._transferFundsSetTargetWalletId); walletsActions.transferFundsRedeem.listen(this._transferFundsRedeem); walletsActions.transferFundsClose.listen(this._transferFundsClose); - walletsActions.transferFundsCalculateFee.listen( - this._transferFundsCalculateFee - ); + walletsActions.transferFundsCalculateFee.listen(this._transferFundsCalculateFee); } - @action _getAccountPublicKey = async ({ - spendingPassword: passphrase, + @action + _getAccountPublicKey = async ({ + spendingPassword: passphrase }: { - spendingPassword: string, + spendingPassword: string; }) => { if (!this.active || !IS_WALLET_PUBLIC_KEY_SHARING_ENABLED) { return; @@ -315,7 +281,7 @@ export default class WalletsStore extends Store { walletId, index, passphrase, - extended, + extended }).promise; runInAction('update account public key', () => { this.activePublicKey = accountPublicKey; @@ -324,11 +290,11 @@ export default class WalletsStore extends Store { throw error; } }; - - @action _getICOPublicKey = async ({ - spendingPassword: passphrase, + @action + _getICOPublicKey = async ({ + spendingPassword: passphrase }: { - spendingPassword: string, + spendingPassword: string; }) => { if (!this.active || !IS_WALLET_PUBLIC_KEY_SHARING_ENABLED) { return; @@ -338,6 +304,7 @@ export default class WalletsStore extends Store { const index = '0H'; const format = 'extended'; const purpose = '1854H'; + try { const icoPublicKey = await this.icoPublicKeyRequest.execute({ walletId, @@ -345,8 +312,8 @@ export default class WalletsStore extends Store { data: { passphrase, format, - purpose, - }, + purpose + } }).promise; runInAction('update ICO public key', () => { this.icoPublicKey = icoPublicKey; @@ -355,101 +322,111 @@ export default class WalletsStore extends Store { throw error; } }; - - _create = async (params: { name: string, spendingPassword: string }) => { + _create = async (params: { + name: string; + spendingPassword: string; + }) => { Object.assign(this._newWalletDetails, params); + try { - const recoveryPhrase: ?Array = await this.getWalletRecoveryPhraseRequest.execute() - .promise; + const recoveryPhrase: Array | null | undefined = await this.getWalletRecoveryPhraseRequest.execute().promise; + if (recoveryPhrase != null) { this.actions.walletBackup.initiateWalletBackup.trigger({ - recoveryPhrase, + recoveryPhrase }); } } catch (error) { throw error; } }; - // TODO: Remove once the new wallet creation process is ready - @action _togglecreateWalletUseNewProcess = () => { + @action + _togglecreateWalletUseNewProcess = () => { this.createWalletUseNewProcess = !this.createWalletUseNewProcess; }; - - @action _createWalletBegin = () => { + @action + _createWalletBegin = () => { this.createWalletStep = 0; this.createWalletShowAbortConfirmation = false; }; - - @action _createWalletChangeStep = (isBack: boolean = false) => { + @action + _createWalletChangeStep = (isBack: boolean = false) => { const currrentCreateWalletStep = this.createWalletStep || 0; - this.createWalletStep = - isBack === true - ? currrentCreateWalletStep - 1 - : currrentCreateWalletStep + 1; + this.createWalletStep = isBack === true ? currrentCreateWalletStep - 1 : currrentCreateWalletStep + 1; this.createWalletShowAbortConfirmation = false; }; - - @action _createWalletClose = () => { + @action + _createWalletClose = () => { this.createWalletStep = null; this.createWalletShowAbortConfirmation = false; }; - - @action _createWalletAbort = () => { + @action + _createWalletAbort = () => { this.createWalletShowAbortConfirmation = true; }; - - @action _restoreWalletBegin = () => { + @action + _restoreWalletBegin = () => { this.restoreWalletStep = 0; this.restoreWalletShowAbortConfirmation = false; }; - - @action _restoreWalletEnd = async () => { + @action + _restoreWalletEnd = async () => { this._resumePolling(); - const { restoredWallet } = this; + + const { + restoredWallet + } = this; + if (restoredWallet) { await this._patchWalletRequestWithNewWallet(restoredWallet); this.goToWalletRoute(restoredWallet.id); this.refreshWalletsData(); + this._restoreWalletResetRequests(); + this._restoreWalletResetData(); } }; - - @action _restoreWalletChangeStep = (isBack: boolean = false) => { + @action + _restoreWalletChangeStep = (isBack: boolean = false) => { // Reset restore requests to clear previous errors const currrentRestoreWalletStep = this.restoreWalletStep || 0; + this._restoreWalletResetRequests(); + if (this.restoreWalletStep === null) { this._restoreWalletResetData(); } - this.restoreWalletStep = - isBack === true - ? currrentRestoreWalletStep - 1 - : currrentRestoreWalletStep + 1; + + this.restoreWalletStep = isBack === true ? currrentRestoreWalletStep - 1 : currrentRestoreWalletStep + 1; this.restoreWalletShowAbortConfirmation = false; }; - - @action _restoreWalletClose = () => { + @action + _restoreWalletClose = () => { this._resumePolling(); - const { mnemonics, walletName, spendingPassword } = this; - const shouldDisplayAbortAlert = - (mnemonics.length || walletName.length || spendingPassword.length) && - this.restoreWalletStep !== null && - this.restoreWalletStep < RESTORE_WALLET_STEPS.length - 1; + + const { + mnemonics, + walletName, + spendingPassword + } = this; + const shouldDisplayAbortAlert = (mnemonics.length || walletName.length || spendingPassword.length) && this.restoreWalletStep !== null && this.restoreWalletStep < RESTORE_WALLET_STEPS.length - 1; + if (shouldDisplayAbortAlert && !this.restoreWalletShowAbortConfirmation) { this.restoreWalletShowAbortConfirmation = true; } else { this._restoreWalletResetRequests(); + this._restoreWalletResetData(); + this.actions.dialogs.closeActiveDialog.trigger(); } }; - - @action _restoreWalletCancelClose = () => { + @action + _restoreWalletCancelClose = () => { this.restoreWalletShowAbortConfirmation = false; }; - _restoreWalletResetRequests = () => { this.restoreDaedalusRequest.reset(); this.restoreByronIcarusWalletRequest.reset(); @@ -458,8 +435,8 @@ export default class WalletsStore extends Store { this.restoreByronTrezorWalletRequest.reset(); this.getWalletRecoveryPhraseFromCertificateRequest.reset(); }; - - @action _restoreWalletResetData = () => { + @action + _restoreWalletResetData = () => { this.restoreWalletStep = null; this.restoreWalletShowAbortConfirmation = false; this.restoredWallet = null; @@ -472,32 +449,32 @@ export default class WalletsStore extends Store { this.spendingPassword = ''; this.repeatPassword = ''; }; - - @action _restoreWalletSetKind = ({ + @action + _restoreWalletSetKind = ({ param, - kind, + kind }: { - param?: string, - kind: string, + param?: string; + kind: string; }) => { - (this: any)[`walletKind${param || ''}`] = kind; + (this as any)[`walletKind${param || ''}`] = kind; this.mnemonics = []; }; - - @action _restoreWalletSetMnemonics = ({ - mnemonics, + @action + _restoreWalletSetMnemonics = ({ + mnemonics }: { - mnemonics: Array, + mnemonics: Array; }) => { this.mnemonics = mnemonics; }; - - @action _restoreWalletSetConfig = ({ + @action + _restoreWalletSetConfig = ({ param, - value, + value }: { - param: string, - value: string, + param: string; + value: string; }) => { if (param === 'walletName') { this.walletName = value; @@ -507,41 +484,48 @@ export default class WalletsStore extends Store { this.repeatPassword = value; } }; - - @action _createHardwareWallet = async (params: { - walletName: string, - extendedPublicKey: HardwareWalletExtendedPublicKeyResponse, - device: TransportDevice, + @action + _createHardwareWallet = async (params: { + walletName: string; + extendedPublicKey: HardwareWalletExtendedPublicKeyResponse; + device: TransportDevice; }) => { - const { walletName, extendedPublicKey, device } = params; - const { deviceId, deviceType, deviceModel, deviceName, path } = device; - const accountPublicKey = - extendedPublicKey.publicKeyHex + extendedPublicKey.chainCodeHex; - + const { + walletName, + extendedPublicKey, + device + } = params; + const { + deviceId, + deviceType, + deviceModel, + deviceName, + path + } = device; + const accountPublicKey = extendedPublicKey.publicKeyHex + extendedPublicKey.chainCodeHex; logger.debug('[HW-DEBUG] HWStore - Execute HW create / restore', { deviceId, deviceType, deviceModel, deviceName, path, - walletName, + walletName }); try { await this._pausePolling(); const wallet = await this.createHardwareWalletRequest.execute({ walletName, - accountPublicKey, + accountPublicKey }); await this.stores.hardwareWallets._setHardwareWalletLocalData({ walletId: wallet.id, data: { device, extendedPublicKey, - disconnected: false, - }, + disconnected: false + } }); - await this.stores.hardwareWallets._setHardwareWalletDevice({ deviceId, data: { @@ -549,9 +533,11 @@ export default class WalletsStore extends Store { deviceModel, deviceName, path, - paired: wallet.id, // device paired with software wallet - disconnected: false, // device physically disconnected - }, + paired: wallet.id, + // device paired with software wallet + disconnected: false // device physically disconnected + + } }); if (wallet) { @@ -566,14 +552,10 @@ export default class WalletsStore extends Store { this._resumePolling(); } }; - _finishWalletBackup = async () => { - this._newWalletDetails.mnemonic = this.stores.walletBackup.recoveryPhrase.join( - ' ' - ); - const wallet = await this.createWalletRequest.execute( - this._newWalletDetails - ).promise; + this._newWalletDetails.mnemonic = this.stores.walletBackup.recoveryPhrase.join(' '); + const wallet = await this.createWalletRequest.execute(this._newWalletDetails).promise; + if (wallet) { await this._patchWalletRequestWithNewWallet(wallet); this.actions.dialogs.closeActiveDialog.trigger(); @@ -581,31 +563,35 @@ export default class WalletsStore extends Store { this.refreshWalletsData(); } }; - - _deleteWallet = async (params: { walletId: string, isLegacy: boolean }) => { + _deleteWallet = async (params: { + walletId: string; + isLegacy: boolean; + }) => { // Pause polling in order to avoid fetching data for wallet we are about to delete runInAction('AdaWalletsStore::isDeleting set', () => { this.isDeleting = true; }); await this._pausePolling(); const walletToDelete = this.getWalletById(params.walletId); + if (!walletToDelete) { runInAction('AdaWalletsStore::isDeleting reset', () => { this.isDeleting = false; }); return; } + const indexOfWalletToDelete = this.all.indexOf(walletToDelete); await this.deleteWalletRequest.execute({ walletId: params.walletId, - isLegacy: params.isLegacy || false, + isLegacy: params.isLegacy || false }); - await this.walletsRequest.patch((result) => { + await this.walletsRequest.patch(result => { result.splice(indexOfWalletToDelete, 1); }); - runInAction('AdaWalletsStore::_deleteWallet', () => { this.isDeleting = false; + if (this.hasAnyWallets) { const nextIndexInList = Math.max(indexOfWalletToDelete - 1, 0); const nextWalletInList = this.all[nextIndexInList]; @@ -614,85 +600,87 @@ export default class WalletsStore extends Store { this.active = null; this.activeValue = null; this.actions.router.goToRoute.trigger({ - route: ROUTES.WALLETS.ADD, + route: ROUTES.WALLETS.ADD }); } }); this.actions.dialogs.closeActiveDialog.trigger(); this.actions.walletsLocal.unsetWalletLocalData.trigger({ - walletId: params.walletId, + walletId: params.walletId }); await this.stores.hardwareWallets._unsetHardwareWalletLocalData({ - walletId: params.walletId, + walletId: params.walletId }); + this._resumePolling(); + this.deleteWalletRequest.reset(); this.refreshWalletsData(); }; - _undelegateWallet = async (params: QuitStakePoolRequest) => { - const { quitStakePoolRequest } = this.stores.staking; - const { quitStakePool } = this.actions.staking; + const { + quitStakePoolRequest + } = this.stores.staking; + const { + quitStakePool + } = this.actions.staking; const walletToUndelegate = this.getWalletById(params.walletId); + if (!walletToUndelegate) { return; } + await quitStakePool.trigger(params); - this._setUndelegateWalletSubmissionSuccess({ result: true }); + + this._setUndelegateWalletSubmissionSuccess({ + result: true + }); + quitStakePoolRequest.reset(); this.refreshWalletsData(); }; - - _setUndelegateWalletSubmissionSuccess = ({ result }: { result: boolean }) => { - runInAction( - 'AdaWalletsStore::_setUndelegateWalletSubmissionSuccess', - () => { - this.undelegateWalletSubmissionSuccess = result; - } - ); + _setUndelegateWalletSubmissionSuccess = ({ + result + }: { + result: boolean; + }) => { + runInAction('AdaWalletsStore::_setUndelegateWalletSubmissionSuccess', () => { + this.undelegateWalletSubmissionSuccess = result; + }); }; - - _getUnscrambledMnemonics = async ( - mnemonics: Array - ): Array => { + _getUnscrambledMnemonics = async (mnemonics: Array): Array => { // Split recovery phrase to 18 (scrambled mnemonics) + 9 (mnemonics seed) mnemonics - const { passphrase, scrambledInput } = getScrambledInput(mnemonics); - + const { + passphrase, + scrambledInput + } = getScrambledInput(mnemonics); // Unscramble 18-word wallet certificate mnemonic to 12-word mnemonic - const unscrambledRecoveryPhrase: Array = await this.getWalletRecoveryPhraseFromCertificateRequest.execute( - { - passphrase, - scrambledInput, - } - ).promise; - + const unscrambledRecoveryPhrase: Array = await this.getWalletRecoveryPhraseFromCertificateRequest.execute({ + passphrase, + scrambledInput + }).promise; this.getWalletRecoveryPhraseFromCertificateRequest.reset(); - // @ts-ignore return unscrambledRecoveryPhrase; }; - - @action _restore = async () => { + @action + _restore = async () => { this.isRestoring = true; - // Pause polling in order to avoid fetching data for wallet we are about to restore // so that we remain on the "Add wallet" screen until user closes the TADA screen await this._pausePolling(); + // Reset restore requests to clear previous errors this._restoreWalletResetRequests(); const data = { recoveryPhrase: this.mnemonics, walletName: this.walletName, - spendingPassword: this.spendingPassword, + spendingPassword: this.spendingPassword }; - const request = this.restoreRequest; - if ( - this.walletKind === WALLET_KINDS.DAEDALUS && - this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.BYRON_27_WORD - ) { + if (this.walletKind === WALLET_KINDS.DAEDALUS && this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.BYRON_27_WORD) { // Reset getWalletRecoveryPhraseFromCertificateRequest to clear previous errors this.getWalletRecoveryPhraseFromCertificateRequest.reset(); data.recoveryPhrase = await this._getUnscrambledMnemonics(this.mnemonics); @@ -700,9 +688,7 @@ export default class WalletsStore extends Store { try { const restoredWallet = await request.execute(data).promise; - if (!restoredWallet) - throw new Error('Restored wallet was not received correctly'); - + if (!restoredWallet) throw new Error('Restored wallet was not received correctly'); runInAction('set restoredWallet', () => { this.restoredWallet = restoredWallet; this.restoreWalletStep = 3; @@ -713,37 +699,31 @@ export default class WalletsStore extends Store { }); } }; - _sendMoney = async ({ receiver, amount, passphrase, assets, assetsAmounts: assetsAmountsStr, - hasAssetsRemainingAfterTransaction, + hasAssetsRemainingAfterTransaction }: { - receiver: string, - amount: string, - passphrase: string, - assets?: Array, - assetsAmounts?: Array, - hasAssetsRemainingAfterTransaction?: boolean, + receiver: string; + amount: string; + passphrase: string; + assets?: Array; + assetsAmounts?: Array; + hasAssetsRemainingAfterTransaction?: boolean; }) => { - const assetsAmounts = assetsAmountsStr - ? assetsAmountsStr.map((assetAmount) => new BigNumber(assetAmount)) - : null; - const formattedAssets = - assets && assets.length - ? assets.map( - // eslint-disable-next-line - ({ policyId: policy_id, assetName: asset_name }, index) => ({ - policy_id, - asset_name, - quantity: get(assetsAmounts, index, 0), - }) - ) - : null; - + const assetsAmounts = assetsAmountsStr ? assetsAmountsStr.map(assetAmount => new BigNumber(assetAmount)) : null; + const formattedAssets = assets && assets.length ? assets.map( // eslint-disable-next-line + ({ + policyId: policy_id, + assetName: asset_name + }, index) => ({ + policy_id, + asset_name, + quantity: get(assetsAmounts, index, 0) + })) : null; const wallet = this.active; if (!wallet) throw new Error('Active wallet required before sending.'); await this.sendMoneyRequest.execute({ @@ -753,111 +733,117 @@ export default class WalletsStore extends Store { walletId: wallet.id, isLegacy: wallet.isLegacy, assets: formattedAssets, - hasAssetsRemainingAfterTransaction, + hasAssetsRemainingAfterTransaction }); this.refreshWalletsData(); this.actions.dialogs.closeActiveDialog.trigger(); this.sendMoneyRequest.reset(); this.goToWalletRoute(wallet.id); }; - - @action _transferFundsNextStep = async () => { + @action + _transferFundsNextStep = async () => { const { transferFundsStep, transferFundsSourceWalletId, - transferFundsTargetWalletId, + transferFundsTargetWalletId } = this; let nextStep = 0; + if (transferFundsStep === 0 && transferFundsSourceWalletId) { nextStep = 1; } - if ( - transferFundsStep === 1 && - transferFundsSourceWalletId && - transferFundsTargetWalletId - ) { + + if (transferFundsStep === 1 && transferFundsSourceWalletId && transferFundsTargetWalletId) { await this._transferFundsCalculateFee({ - sourceWalletId: transferFundsSourceWalletId, + sourceWalletId: transferFundsSourceWalletId }); nextStep = 2; } + runInAction('update transfer funds step', () => { this.transferFundsStep = nextStep; }); }; - - @action _transferFundsPrevStep = () => { - const { transferFundsStep } = this; + @action + _transferFundsPrevStep = () => { + const { + transferFundsStep + } = this; const prevStep = transferFundsStep > 0 ? transferFundsStep - 1 : 0; this.transferFundsStep = prevStep; }; - - @action _transferFunds = async ({ - spendingPassword, + @action + _transferFunds = async ({ + spendingPassword }: { - spendingPassword: string, + spendingPassword: string; }) => { - const { transferFundsSourceWalletId, transferFundsTargetWalletId } = this; + const { + transferFundsSourceWalletId, + transferFundsTargetWalletId + } = this; const targetWalletAddresses = await this.getWalletAddressesRequest.execute({ walletId: transferFundsTargetWalletId, - queryParams: { state: 'unused' }, + queryParams: { + state: 'unused' + } }).promise; await this.transferFundsRequest.execute({ sourceWalletId: transferFundsSourceWalletId, - targetWalletAddresses: targetWalletAddresses - ? targetWalletAddresses.map((address) => address.id).slice(0, 20) - : null, - passphrase: spendingPassword, + targetWalletAddresses: targetWalletAddresses ? targetWalletAddresses.map(address => address.id).slice(0, 20) : null, + passphrase: spendingPassword }); - this.refreshWalletsData(); + this._transferFundsClose(); + this.transferFundsRequest.reset(); this.goToWalletRoute(transferFundsSourceWalletId); }; - - @action _transferFundsSetSourceWalletId = ({ - sourceWalletId, + @action + _transferFundsSetSourceWalletId = ({ + sourceWalletId }: { - sourceWalletId: string, + sourceWalletId: string; }) => { this.transferFundsSourceWalletId = sourceWalletId; // Sets the target wallet to the first wallet - const { allWallets } = this; + const { + allWallets + } = this; this.transferFundsTargetWalletId = get(allWallets, [0, 'id'], ''); // Sets to first step this.transferFundsStep = 1; }; - - @action _transferFundsSetTargetWalletId = ({ - targetWalletId, + @action + _transferFundsSetTargetWalletId = ({ + targetWalletId }: { - targetWalletId: string, + targetWalletId: string; }) => { this.transferFundsTargetWalletId = targetWalletId; }; - - @action _transferFundsRedeem = () => { - this.transferFundsStep = 0; - // TODO: Call API method + @action + _transferFundsRedeem = () => { + this.transferFundsStep = 0; // TODO: Call API method }; - - @action _transferFundsClose = () => { + @action + _transferFundsClose = () => { this.transferFundsStep = 0; this.transferFundsFee = null; this.transferFundsCalculateFeeRequest.reset(); }; - - @action _transferFundsCalculateFee = async ({ - sourceWalletId, + @action + _transferFundsCalculateFee = async ({ + sourceWalletId }: { - sourceWalletId: string, + sourceWalletId: string; }) => { const { fee, - leftovers, + leftovers } = await this.transferFundsCalculateFeeRequest.execute({ - sourceWalletId, + sourceWalletId }).promise; runInAction('set migration fee and leftovers', () => { this.transferFundsFee = fee; @@ -866,110 +852,126 @@ export default class WalletsStore extends Store { }; // =================== PUBLIC API ==================== // - // GETTERS - - @computed get hasActiveWallet(): boolean { + @computed + get hasActiveWallet(): boolean { return !!this.active; } - @computed get hasLoadedWallets(): boolean { + @computed + get hasLoadedWallets(): boolean { return this.walletsRequest.wasExecuted; } - @computed get hasAnyWallets(): boolean { + @computed + get hasAnyWallets(): boolean { if (this.walletsRequest.result == null) return false; - return ( - this.walletsRequest.wasExecuted && this.walletsRequest.result.length > 0 - ); + return this.walletsRequest.wasExecuted && this.walletsRequest.result.length > 0; } - @computed get hasRewardsWallets(): boolean { + @computed + get hasRewardsWallets(): boolean { return this.allWallets.length > 0; } - @computed get hasMaxWallets(): boolean { + @computed + get hasMaxWallets(): boolean { return this.all.length >= MAX_ADA_WALLETS_COUNT; } - @computed get all(): Array { + @computed + get all(): Array { return [...this.allWallets, ...this.allLegacyWallets]; } - @computed get allWallets(): Array { - return this.walletsRequest.result - ? this.walletsRequest.result.filter(({ isLegacy }: Wallet) => !isLegacy) - : []; + @computed + get allWallets(): Array { + return this.walletsRequest.result ? this.walletsRequest.result.filter(({ + isLegacy + }: Wallet) => !isLegacy) : []; } - @computed get allLegacyWallets(): Array { - return this.walletsRequest.result - ? this.walletsRequest.result.filter(({ isLegacy }: Wallet) => isLegacy) - : []; + @computed + get allLegacyWallets(): Array { + return this.walletsRequest.result ? this.walletsRequest.result.filter(({ + isLegacy + }: Wallet) => isLegacy) : []; } - @computed get first(): ?Wallet { + @computed + get first(): Wallet | null | undefined { return this.all.length > 0 ? this.all[0] : null; } - @computed get hasAnyLoaded(): boolean { + @computed + get hasAnyLoaded(): boolean { return this.all.length > 0; } - @computed get activeWalletRoute(): ?string { + @computed + get activeWalletRoute(): string | null | undefined { if (!this.active) return null; return this.getWalletRoute(this.active.id); } - @computed get isWalletRoute(): boolean { - const { currentRoute } = this.stores.app; + @computed + get isWalletRoute(): boolean { + const { + currentRoute + } = this.stores.app; return matchRoute(`${ROUTES.WALLETS.ROOT}(/*rest)`, currentRoute); } - @computed get restoreRequest(): Request { + @computed + get restoreRequest(): Request { switch (this.walletKind) { case WALLET_KINDS.DAEDALUS: - if ( - this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.SHELLEY_15_WORD || - this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.SHELLEY_24_WORD - ) { + if (this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.SHELLEY_15_WORD || this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.SHELLEY_24_WORD) { return this.restoreDaedalusRequest; } + return this.restoreByronRandomWalletRequest; + case WALLET_KINDS.YOROI: if (this.walletKindYoroi === WALLET_YOROI_KINDS.BYRON_15_WORD) { return this.restoreByronIcarusWalletRequest; } + return this.restoreDaedalusRequest; + case WALLET_KINDS.HARDWARE: if (this.walletKindHardware === WALLET_HARDWARE_KINDS.LEDGER) { return this.restoreByronLedgerWalletRequest; } + return this.restoreByronTrezorWalletRequest; + default: return this.restoreDaedalusRequest; } } - getWalletById = (id: string): ?Wallet => this.all.find((w) => w.id === id); - - getWalletByName = (name: string): ?Wallet => - this.all.find((w) => w.name === name); - - getWalletRoute = (walletId: string, page: string = 'summary'): string => - buildRoute(ROUTES.WALLETS.PAGE, { id: walletId, page }); + getWalletById = (id: string): Wallet | null | undefined => this.all.find(w => w.id === id); + getWalletByName = (name: string): Wallet | null | undefined => this.all.find(w => w.name === name); + getWalletRoute = (walletId: string, page: string = 'summary'): string => buildRoute(ROUTES.WALLETS.PAGE, { + id: walletId, + page + }); // ACTIONS - goToWalletRoute(walletId: string) { const route = this.getWalletRoute(walletId); - this.actions.router.goToRoute.trigger({ route }); + this.actions.router.goToRoute.trigger({ + route + }); } // =================== PRIVATE API ==================== // - - @computed get _canRedirectToWallet(): boolean { - const { currentRoute } = this.stores.app; + @computed + get _canRedirectToWallet(): boolean { + const { + currentRoute + } = this.stores.app; const isRootRoute = matchRoute(ROUTES.WALLETS.ROOT, currentRoute); const isAddWalletRoute = matchRoute(ROUTES.WALLETS.ADD, currentRoute); return isRootRoute || isAddWalletRoute; @@ -977,13 +979,16 @@ export default class WalletsStore extends Store { _patchWalletRequestWithNewWallet = async (wallet: Wallet) => { // Only add the new wallet if it does not exist yet in the result! - await this.walletsRequest.patch((result) => { - if (!find(result, { id: wallet.id })) { + await this.walletsRequest.patch(result => { + if (!find(result, { + id: wallet.id + })) { if (wallet.isLegacy) { // Legacy wallets are always added to the end of the list! result.push(wallet); } else { const index = findIndex(result, 'isLegacy'); + if (index >= 0) { result.splice(index, 0, wallet); } else { @@ -993,49 +998,58 @@ export default class WalletsStore extends Store { } }); }; - _pollRefresh = async () => { - const { isConnected } = this.stores.networkStatus; + const { + isConnected + } = this.stores.networkStatus; return isConnected && this.refreshWalletsData(); }; - _updateActiveWalletOnRouteChanges = () => { - const { currentRoute } = this.stores.app; + const { + currentRoute + } = this.stores.app; const hasAnyWalletLoaded = this.hasAnyLoaded; const isWalletAddPage = matchRoute(ROUTES.WALLETS.ADD, currentRoute); runInAction('WalletsStore::_updateActiveWalletOnRouteChanges', () => { // There are not wallets loaded (yet) -> unset active and return - if (isWalletAddPage || !hasAnyWalletLoaded) - return this._unsetActiveWallet(); - const match = matchRoute( - `${ROUTES.WALLETS.ROOT}/:id(*page)`, - currentRoute - ); + if (isWalletAddPage || !hasAnyWalletLoaded) return this._unsetActiveWallet(); + const match = matchRoute(`${ROUTES.WALLETS.ROOT}/:id(*page)`, currentRoute); + if (match) { // We have a route for a specific wallet -> let's try to find it - const walletForCurrentRoute = this.all.find((w) => w.id === match.id); + const walletForCurrentRoute = this.all.find(w => w.id === match.id); + if (walletForCurrentRoute) { // The wallet exists, we are done - this._setActiveWallet({ walletId: walletForCurrentRoute.id }); + this._setActiveWallet({ + walletId: walletForCurrentRoute.id + }); } else if (hasAnyWalletLoaded) { // There is no wallet with given id -> pick first wallet - this._setActiveWallet({ walletId: this.all[0].id }); + this._setActiveWallet({ + walletId: this.all[0].id + }); + if (this.active) this.goToWalletRoute(this.active.id); } } else if (this._canRedirectToWallet) { // The route does not specify any wallet -> pick first wallet if (!this.hasActiveWallet && hasAnyWalletLoaded) { - this._setActiveWallet({ walletId: this.all[0].id }); + this._setActiveWallet({ + walletId: this.all[0].id + }); } + if (this.active) { this.goToWalletRoute(this.active.id); } } }); }; - isValidAddress = async (address: string) => { - const { network } = this.environment; + const { + network + } = this.environment; const expectedNetworkTag = get(NetworkMagics, [network]); const validAddressStyles: AddressStyle[] = ['Byron', 'Icarus', 'Shelley']; this.isAddressFromSameWallet = false; @@ -1043,144 +1057,133 @@ export default class WalletsStore extends Store { if (!expectedNetworkTag) { throw new Error('Unexpected environment'); } + try { - const response = await introspectAddressChannel.send({ input: address }); + const response = await introspectAddressChannel.send({ + input: address + }); - if ( - response === 'Invalid' || - !isReceiverAddressType(response.introspection.address_type) - ) { + if (response === 'Invalid' || !isReceiverAddressType(response.introspection.address_type)) { return false; } runInAction('check if address is from the same wallet', () => { - const walletAddresses = this.stores.addresses.all - .slice() - .map((addr) => addr.id); - this.isAddressFromSameWallet = !!walletAddresses.filter( - (addr) => addr === address - ).length; + const walletAddresses = this.stores.addresses.all.slice().map(addr => addr.id); + this.isAddressFromSameWallet = !!walletAddresses.filter(addr => addr === address).length; }); - return ( - validAddressStyles.includes(response.introspection.address_style) && - ((Array.isArray(expectedNetworkTag) && - includes(expectedNetworkTag, response.introspection.network_tag)) || - expectedNetworkTag === response.introspection.network_tag) - ); + return validAddressStyles.includes(response.introspection.address_style) && (Array.isArray(expectedNetworkTag) && includes(expectedNetworkTag, response.introspection.network_tag) || expectedNetworkTag === response.introspection.network_tag); } catch (error) { logger.error(error); } }; - - isValidCertificateMnemonic = (mnemonic: string) => - this.api.ada.isValidCertificateMnemonic(mnemonic); - - @action refreshWalletsData = async () => { + isValidCertificateMnemonic = (mnemonic: string) => this.api.ada.isValidCertificateMnemonic(mnemonic); + @action + refreshWalletsData = async () => { // Prevent wallets data refresh if polling is blocked if (this._pollingBlocked) return; if (this.stores.networkStatus.isConnected) { const result = await this.walletsRequest.execute().promise; if (!result) return; - const walletIds = result - .filter( - ({ syncState }: Wallet) => - syncState.status !== WalletSyncStateStatuses.NOT_RESPONDING - ) - .map((wallet: Wallet) => wallet.id); - + const walletIds = result.filter(({ + syncState + }: Wallet) => syncState.status !== WalletSyncStateStatuses.NOT_RESPONDING).map((wallet: Wallet) => wallet.id); await this.actions.walletsLocal.refreshWalletsLocalData.trigger(); - runInAction('refresh active wallet', () => { if (this.active) { - this._setActiveWallet({ walletId: this.active.id }); + this._setActiveWallet({ + walletId: this.active.id + }); } }); runInAction('refresh address data', () => { - this.stores.addresses.addressesRequests = walletIds.map((walletId) => ({ + this.stores.addresses.addressesRequests = walletIds.map(walletId => ({ walletId, - allRequest: this.stores.addresses._getAddressesAllRequest(walletId), + allRequest: this.stores.addresses._getAddressesAllRequest(walletId) })); + this.stores.addresses._refreshAddresses(); }); runInAction('refresh transaction data', () => { - this.stores.transactions.transactionsRequests = walletIds.map( - (walletId) => ({ - walletId, - recentRequest: this.stores.transactions._getTransactionsRecentRequest( - walletId - ), - allRequest: this.stores.transactions._getTransactionsAllRequest( - walletId - ), - withdrawalsRequest: this.stores.transactions._getWithdrawalsRequest( - walletId - ), - }) - ); + this.stores.transactions.transactionsRequests = walletIds.map(walletId => ({ + walletId, + recentRequest: this.stores.transactions._getTransactionsRecentRequest(walletId), + allRequest: this.stores.transactions._getTransactionsAllRequest(walletId), + withdrawalsRequest: this.stores.transactions._getWithdrawalsRequest(walletId) + })); + this.stores.transactions._refreshTransactionData(); }); this.actions.wallets.refreshWalletsDataSuccess.trigger(); } }; - - @action resetWalletsData = () => { + @action + resetWalletsData = () => { this.walletsRequest.reset(); this.stores.addresses.addressesRequests = []; this.stores.transactions.transactionsRequests = []; this.isAddressFromSameWallet = false; }; - - @action _importWalletFromFile = async ( - params: WalletImportFromFileParams - ) => { - const { filePath, walletName, spendingPassword } = params; + @action + _importWalletFromFile = async (params: WalletImportFromFileParams) => { + const { + filePath, + walletName, + spendingPassword + } = params; const importedWallet = await this.importFromFileRequest.execute({ filePath, walletName, - spendingPassword, + spendingPassword }).promise; - if (!importedWallet) - throw new Error('Imported wallet was not received correctly'); + if (!importedWallet) throw new Error('Imported wallet was not received correctly'); await this._patchWalletRequestWithNewWallet(importedWallet); this.actions.dialogs.closeActiveDialog.trigger(); this.importFromFileRequest.reset(); this.goToWalletRoute(importedWallet.id); this.refreshWalletsData(); }; - - @action _setActiveWallet = ({ walletId }: { walletId: string }) => { + @action + _setActiveWallet = ({ + walletId + }: { + walletId: string; + }) => { if (this.hasAnyWallets) { const activeWalletId = this.active ? this.active.id : null; - const newActiveWallet = this.all.find((wallet) => wallet.id === walletId); - if ( - (!this.active || !this.active.isNotResponding) && - newActiveWallet && - newActiveWallet.isNotResponding - ) { + const newActiveWallet = this.all.find(wallet => wallet.id === walletId); + + if ((!this.active || !this.active.isNotResponding) && newActiveWallet && newActiveWallet.isNotResponding) { this.actions.router.goToRoute.trigger({ route: ROUTES.WALLETS.PAGE, - params: { id: newActiveWallet.id, page: 'summary' }, + params: { + id: newActiveWallet.id, + page: 'summary' + } }); } + const hasActiveWalletBeenChanged = activeWalletId !== walletId; const hasActiveWalletBeenUpdated = !isEqual(this.active, newActiveWallet); + if (hasActiveWalletBeenChanged) { // Active wallet has been replaced or removed this.active = newActiveWallet || null; this.stores.addresses.lastGeneratedAddress = null; + if (this.active) { this.activeValue = formattedWalletAmount(this.active.amount); + if (this.active && this.active.isHardwareWallet) { const { - hardwareWalletsConnectionData, + hardwareWalletsConnectionData } = this.stores.hardwareWallets; - const hardwareWalletConnectionData = get( - hardwareWalletsConnectionData, - this.active.id - ); + const hardwareWalletConnectionData = get(hardwareWalletsConnectionData, this.active.id); + if (hardwareWalletConnectionData) { - const { extendedPublicKey } = hardwareWalletConnectionData; + const { + extendedPublicKey + } = hardwareWalletConnectionData; const extendedPublicKeyHex = `${extendedPublicKey.publicKeyHex}${extendedPublicKey.chainCodeHex}`; const xpub = Buffer.from(extendedPublicKeyHex, 'hex'); const activePublicKey = bech32EncodePublicKey(xpub); @@ -1197,41 +1200,42 @@ export default class WalletsStore extends Store { } } }; - - @action _unsetActiveWallet = () => { + @action + _unsetActiveWallet = () => { this.active = null; this.activeValue = null; this.activePublicKey = null; this.icoPublicKey = null; this.stores.addresses.lastGeneratedAddress = null; }; - - @action _onRouteChange = (options: { route: string, params: ?Object }) => { + @action + _onRouteChange = (options: { + route: string; + params: Record | null | undefined; + }) => { // Reset the send request anytime we visit the send page (e.g: to remove any previous errors) - if ( - matchRoute(ROUTES.WALLETS.SEND, buildRoute(options.route, options.params)) - ) { + if (matchRoute(ROUTES.WALLETS.SEND, buildRoute(options.route, options.params))) { this.sendMoneyRequest.reset(); this.isAddressFromSameWallet = false; } }; - - @action _chooseWalletExportType = (params: { - walletExportType: WalletExportTypeChoices, + @action + _chooseWalletExportType = (params: { + walletExportType: WalletExportTypeChoices; }) => { if (this.walletExportType !== params.walletExportType) { this.walletExportType = params.walletExportType; } }; - - @action _pausePolling = async () => { + @action + _pausePolling = async () => { if (this.walletsRequest.isExecuting) await this.walletsRequest; runInAction('AdaWalletsStore::_pausePolling', () => { this._pollingBlocked = true; }); }; - - @action _resumePolling = () => { + @action + _resumePolling = () => { this._pollingBlocked = false; }; @@ -1244,8 +1248,8 @@ export default class WalletsStore extends Store { * @private */ _generateCertificate = flow(function* generateCertificate(params: { - filePath: string, - timestamp: string, + filePath: string; + timestamp: string; }): Generator { try { // Pause polling in order not to show Paper wallet in the UI @@ -1255,78 +1259,60 @@ export default class WalletsStore extends Store { this._updateCertificateCreationState(true); // Generate wallet recovery phrase - const recoveryPhrase: Array = yield this.getWalletRecoveryPhraseRequest.execute() - .promise; - + const recoveryPhrase: Array = yield this.getWalletRecoveryPhraseRequest.execute().promise; // Generate 9-words (additional) mnemonic - const additionalMnemonicWords: Array = yield this.getWalletCertificateAdditionalMnemonicsRequest.execute() - .promise; + const additionalMnemonicWords: Array = yield this.getWalletCertificateAdditionalMnemonicsRequest.execute().promise; this.additionalMnemonicWords = additionalMnemonicWords.join(' '); - // Generate spending password from 9-word mnemonic and save to store const spendingPassword = mnemonicToSeedHex(this.additionalMnemonicWords); this.walletCertificatePassword = spendingPassword; - // Generate paper wallet scrambled mnemonic - const walletCertificateRecoveryPhrase: Array = yield this.getWalletCertificateRecoveryPhraseRequest.execute( - { - passphrase: spendingPassword, - input: recoveryPhrase.join(' '), - } - ).promise; - this.walletCertificateRecoveryPhrase = walletCertificateRecoveryPhrase.join( - ' ' - ); - + const walletCertificateRecoveryPhrase: Array = yield this.getWalletCertificateRecoveryPhraseRequest.execute({ + passphrase: spendingPassword, + input: recoveryPhrase.join(' ') + }).promise; + this.walletCertificateRecoveryPhrase = walletCertificateRecoveryPhrase.join(' '); // Create temporary wallet const walletData = { name: 'Paper Wallet', - mnemonic: recoveryPhrase.join(' '), + mnemonic: recoveryPhrase.join(' ') }; const wallet = yield this.createWalletRequest.execute(walletData).promise; - // Get temporary wallet address let walletAddresses; + if (wallet) { walletAddresses = yield this.getWalletAddressesRequest.execute({ - walletId: wallet.id, + walletId: wallet.id }).promise; - // delete temporary wallet yield this.deleteWalletRequest.execute({ walletId: wallet.id, - isLegacy: wallet.isLegacy, + isLegacy: wallet.isLegacy }); } // Set wallet certificate address const walletAddress = get(walletAddresses, ['0', 'id'], null); this.walletCertificateAddress = walletAddress; - // download pdf certificate - yield this._downloadCertificate( - walletAddress, - walletCertificateRecoveryPhrase, - params.filePath, - params.timestamp - ); + yield this._downloadCertificate(walletAddress, walletCertificateRecoveryPhrase, params.filePath, params.timestamp); } catch (error) { throw error; } finally { this._resumePolling(); } }).bind(this); - - _downloadCertificate = async ( - address: string, - recoveryPhrase: Array, - filePath: string, - timestamp: string - ) => { + _downloadCertificate = async (address: string, recoveryPhrase: Array, filePath: string, timestamp: string) => { const locale = this.stores.profile.currentLocale; const intl = i18nContext(locale); - const { isMainnet } = this.environment; - const { buildLabel } = global; + const { + isMainnet + } = this.environment; + const { + buildLabel + } = global; + try { await paperWalletPdfGenerator({ address, @@ -1335,11 +1321,12 @@ export default class WalletsStore extends Store { filePath, isMainnet, buildLabel, - timestamp, + timestamp }); runInAction('handle successful certificate download', () => { // Reset progress this._updateCertificateCreationState(false); + // Update certificate generator step this._updateCertificateStep(); }); @@ -1350,23 +1337,26 @@ export default class WalletsStore extends Store { }); } }; - _generateAddressPDF = async ({ note, address, - filePath, + filePath }: { - note: string, - address: string, - filePath: string, + note: string; + address: string; + filePath: string; }) => { const { currentLocale, currentDateFormat, - currentTimeFormat, + currentTimeFormat } = this.stores.profile; - const { network, isMainnet } = this.environment; + const { + network, + isMainnet + } = this.environment; const intl = i18nContext(currentLocale); + try { await addressPDFGenerator({ address, @@ -1377,42 +1367,42 @@ export default class WalletsStore extends Store { currentTimeFormat, network, isMainnet, - intl, + intl }); const walletAddress = ellipsis(address, 15, 15); - this.actions.wallets.generateAddressPDFSuccess.trigger({ walletAddress }); + this.actions.wallets.generateAddressPDFSuccess.trigger({ + walletAddress + }); } catch (error) { throw new Error(error); } }; - _saveQRCodeImage = async ({ address, - filePath, + filePath }: { - address: string, - filePath: string, + address: string; + filePath: string; }) => { try { await saveQRCodeImageChannel.send({ address, - filePath, + filePath }); const walletAddress = ellipsis(address, 15, 15); - this.actions.wallets.saveQRCodeImageSuccess.trigger({ walletAddress }); + this.actions.wallets.saveQRCodeImageSuccess.trigger({ + walletAddress + }); } catch (error) { throw new Error(error); } }; + _updateCertificateCreationState = action((state: boolean, error?: Record | null | undefined) => { + this.generatingCertificateInProgress = state; - _updateCertificateCreationState = action( - (state: boolean, error?: ?Object) => { - this.generatingCertificateInProgress = state; - this._updateGeneratingCertificateError(error); - } - ); - - _updateGeneratingCertificateError = action((error?: ?Object) => { + this._updateGeneratingCertificateError(error); + }); + _updateGeneratingCertificateError = action((error?: Record | null | undefined) => { if (error && error.syscall && error.syscall === 'open') { // User tries to replace a file that is open this.generatingCertificateError = new WalletPaperWalletOpenPdfError(); @@ -1429,10 +1419,10 @@ export default class WalletsStore extends Store { */ _generateCsv = flow(function* generateCsv({ fileContent, - filePath, + filePath }: { - fileContent: CsvFileContent, - filePath: string, + fileContent: CsvFileContent; + filePath: string; }) { try { yield this._pausePolling(); @@ -1448,15 +1438,11 @@ export default class WalletsStore extends Store { this._resumePolling(); } }).bind(this); - - _downloadRewardsCsv = async ( - fileContent: CsvFileContent, - filePath: string - ) => { + _downloadRewardsCsv = async (fileContent: CsvFileContent, filePath: string) => { try { await downloadCsv({ fileContent, - filePath, + filePath }); runInAction('handle successful rewards csv download', () => { this._updateRewardsCsvCreationState(false); @@ -1467,13 +1453,12 @@ export default class WalletsStore extends Store { }); } }; - - _updateRewardsCsvCreationState = action((state: boolean, error?: ?Object) => { + _updateRewardsCsvCreationState = action((state: boolean, error?: Record | null | undefined) => { this.generatingRewardsCsvInProgress = state; + this._updateGeneratingRewardsCsvError(error); }); - - _updateGeneratingRewardsCsvError = action((error?: ?Object) => { + _updateGeneratingRewardsCsvError = action((error?: Record | null | undefined) => { if (error && error.syscall && error.syscall === 'open') { // User tries to replace a file that is open this.generatingRewardsCsvError = new WalletRewardsOpenCsvError(); @@ -1481,52 +1466,60 @@ export default class WalletsStore extends Store { this.generatingRewardsCsvError = null; } }); - - @action _setCertificateTemplate = (params: { selectedTemplate: string }) => { + @action + _setCertificateTemplate = (params: { + selectedTemplate: string; + }) => { this.certificateTemplate = params.selectedTemplate; + this._updateCertificateStep(); }; - - @action _finishCertificate = () => { + @action + _finishCertificate = () => { this._updateGeneratingCertificateError(); + this._closeCertificateGeneration(); }; - - @action _finishRewardsCsv = () => { + @action + _finishRewardsCsv = () => { this._updateGeneratingRewardsCsvError(); + this._closeRewardsCsvGeneration(); }; - - @action _updateCertificateStep = (isBack: boolean = false) => { + @action + _updateCertificateStep = (isBack: boolean = false) => { this._updateGeneratingCertificateError(); + const currrentCertificateStep = this.certificateStep || 0; - this.certificateStep = isBack - ? currrentCertificateStep - 1 - : currrentCertificateStep + 1; + this.certificateStep = isBack ? currrentCertificateStep - 1 : currrentCertificateStep + 1; }; - - @action _closeCertificateGeneration = () => { + @action + _closeCertificateGeneration = () => { this.actions.dialogs.closeActiveDialog.trigger(); + this._resetCertificateData(); }; - - @action _closeRewardsCsvGeneration = () => { + @action + _closeRewardsCsvGeneration = () => { this.actions.dialogs.closeActiveDialog.trigger(); + this._resetRewardsCsvData(); }; - - @action _resetCertificateData = () => { + @action + _resetCertificateData = () => { this.walletCertificatePassword = null; this.walletCertificateAddress = null; this.walletCertificateRecoveryPhrase = null; this.generatingCertificateInProgress = false; this.certificateTemplate = false; this.certificateStep = null; + this._updateGeneratingCertificateError(); }; - - @action _resetRewardsCsvData = () => { + @action + _resetRewardsCsvData = () => { this.generatingRewardsCsvInProgress = false; + this._updateGeneratingRewardsCsvError(); }; -} +} \ No newline at end of file From 63594d4b59d6e9a554ff6c5e4aa4099834f7203e Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:40:29 +0000 Subject: [PATCH 16/42] [DDW-827] added ts-ignore annotations and re-formatted files according to tsconfig --- .../app/actions/wallets-actions.js.ts | 4 + source/renderer/app/api/api.js.ts | 131 ++++++++++++++++++ source/renderer/app/api/errors.js.ts | 1 + .../renderer/app/api/transactions/types.js.ts | 30 ++++ .../renderer/app/api/utils/apiHelpers.js.ts | 7 + .../app/api/utils/apiHelpers.spec.js.ts | 21 +++ .../WalletSendAssetsConfirmationDialog.js.tsx | 15 ++ .../WalletSendConfirmationDialog.js.tsx | 7 + source/renderer/app/stores/WalletsStore.js.ts | 127 +++++++++++++++++ tsconfig.json | 101 ++++++++++++++ 10 files changed, 444 insertions(+) create mode 100644 tsconfig.json diff --git a/source/renderer/app/actions/wallets-actions.js.ts b/source/renderer/app/actions/wallets-actions.js.ts index 10186eb73d..1419ddadd5 100644 --- a/source/renderer/app/actions/wallets-actions.js.ts +++ b/source/renderer/app/actions/wallets-actions.js.ts @@ -4,6 +4,7 @@ import type { TransportDevice, HardwareWalletExtendedPublicKeyResponse } from ". import type { CsvFileContent } from "../../../common/types/csv-request.types"; import type { QuitStakePoolRequest } from "../api/staking/types"; import type { AssetToken } from "../api/assets/types"; + export type WalletImportFromFileParams = { filePath: string; walletName: string | null | undefined; @@ -34,6 +35,7 @@ export default class WalletsActions { kind: string; }> = new Action(); restoreWalletSetMnemonics: Action<{ + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. mnemonics: Array; }> = new Action(); restoreWalletSetConfig: Action<{ @@ -54,7 +56,9 @@ export default class WalletsActions { receiver: string; amount: string; passphrase: string; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assets?: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assetsAmounts?: Array; hasAssetsRemainingAfterTransaction?: boolean; }> = new Action(); diff --git a/source/renderer/app/api/api.js.ts b/source/renderer/app/api/api.js.ts index 99b3e452da..ac1a19ee49 100644 --- a/source/renderer/app/api/api.js.ts +++ b/source/renderer/app/api/api.js.ts @@ -92,6 +92,7 @@ import type { RequestConfig } from "./common/types"; // Network Types import type { GetNetworkInfoResponse, NetworkInfoResponse, GetNetworkClockResponse, NetworkClockResponse, GetNetworkParametersResponse, GetNetworkParametersApiResponse } from "./network/types"; // Transactions Types +// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './transactions/types' or its c... Remove this comment to see the full error message import type { Transaction, TransactionFee, TransactionWithdrawals, GetTransactionFeeRequest, GetTransactionFeeResponse, CreateTransactionRequest, DeleteTransactionRequest, GetTransactionRequest, GetTransactionsRequest, GetTransactionsResponse, CoinSelectionsPaymentRequestType, CoinSelectionsDelegationRequestType, CoinSelectionsResponse, CreateExternalTransactionRequest, CreateExternalTransactionResponse, GetWithdrawalsRequest, GetWithdrawalsResponse, VotingMetadataType, ICOPublicKeyParams } from "./transactions/types"; // Wallets Types import type { AdaWallet, AdaWallets, CreateHardwareWalletRequest, LegacyAdaWallet, LegacyAdaWallets, WalletUtxos, CreateWalletRequest, DeleteWalletRequest, RestoreWalletRequest, RestoreLegacyWalletRequest, RestoreExportedByronWalletRequest, UpdateSpendingPasswordRequest, ExportWalletToFileRequest, GetWalletCertificateRecoveryPhraseRequest, GetWalletRecoveryPhraseFromCertificateRequest, ImportWalletFromKeyRequest, ImportWalletFromFileRequest, GetWalletUtxosRequest, GetWalletRequest, GetWalletPublicKeyRequest, TransferFundsCalculateFeeRequest, TransferFundsCalculateFeeApiResponse, TransferFundsCalculateFeeResponse, TransferFundsRequest, TransferFundsResponse, UpdateWalletRequest, GetCurrencyListResponse, GetCurrencyRateRequest, GetCurrencyRateResponse, GetAccountPublicKeyRequest } from "./wallets/types"; @@ -116,7 +117,9 @@ import type { AssetLocalData } from "./utils/localStorage"; import Asset from "../domains/Asset"; import { getAssets } from "./assets/requests/getAssets"; import { getAccountPublicKey } from "./wallets/requests/getAccountPublicKey"; +// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './utils/apiHelpers' or its cor... Remove this comment to see the full error message import { throwErrorIfNotEnoughAdaToSupportTokens } from "./utils/apiHelpers"; + export default class AdaApi { config: RequestConfig; // We need to preserve all asset metadata during single runtime in order @@ -132,11 +135,13 @@ export default class AdaApi { this.config = config; } + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWallets = async (): Promise> => { logger.debug('AdaApi::getWallets called'); const { getHardwareWalletLocalData, getHardwareWalletsLocalData + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. } = global.daedalus.api.localStorage; try { @@ -159,11 +164,13 @@ export default class AdaApi { }, isLegacy: true }; + // @ts-ignore ts-migrate(2698) FIXME: Spread types may only be created from object types... Remove this comment to see the full error message wallets.push({ ...legacyAdaWallet, ...extraLegacyWalletProps }); }); // @TODO - Remove this once we get hardware wallet flag from WBE + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return await Promise.all(wallets.map(async wallet => { const { id @@ -180,6 +187,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWallet = async (request: GetWalletRequest): Promise => { logger.debug('AdaApi::getWallet called', { parameters: filterLogData(request) @@ -226,6 +234,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletPublicKey = async (request: GetWalletPublicKeyRequest): Promise => { logger.debug('AdaApi::getWalletPublicKey called', { parameters: filterLogData(request) @@ -253,6 +262,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getAccountPublicKey = async (request: GetAccountPublicKeyRequest): Promise => { logger.debug('AdaApi::getAccountPublicKey called', { parameters: filterLogData(request) @@ -282,6 +292,7 @@ export default class AdaApi { throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getAddresses = async (request: GetAddressesRequest): Promise> => { logger.debug('AdaApi::getAddresses called', { parameters: filterLogData(request) @@ -299,12 +310,14 @@ export default class AdaApi { response = await getByronWalletAddresses(this.config, walletId, queryParams); } else { response = await getAddresses(this.config, walletId, queryParams); + // @ts-ignore ts-migrate(2339) FIXME: Property 'reverse' does not exist on type '{}'. response.reverse(); } logger.debug('AdaApi::getAddresses success', { addresses: response }); + // @ts-ignore ts-migrate(2339) FIXME: Property 'map' does not exist on type '{}'. return response.map(_createAddressFromServerData); } catch (error) { logger.error('AdaApi::getAddresses error', { @@ -313,6 +326,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getTransaction = async (request: GetTransactionRequest): Promise => { logger.debug('AdaApi::getTransaction called', { parameters: request @@ -335,6 +349,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getTransactions = async (request: GetTransactionsRequest): Promise => { logger.debug('AdaApi::getTransactions called', { parameters: request @@ -346,6 +361,7 @@ export default class AdaApi { toDate, isLegacy } = request; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Object'. const params = Object.assign({}, { order: order || 'descending' }); @@ -365,6 +381,7 @@ export default class AdaApi { transactions: response }); const transactions = response.map(tx => _createTransactionFromServerData(tx)); + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return Promise.resolve({ transactions, total: response.length @@ -524,6 +541,7 @@ export default class AdaApi { // } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getAssets = async (request: GetAssetsRequest): Promise => { logger.debug('AdaApi::getAssets called', { parameters: request @@ -539,11 +557,13 @@ export default class AdaApi { logger.debug('AdaApi::getAssets success', { assets: response }); + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. const assetsLocaldata = await global.daedalus.api.localStorage.getAssetsLocalData(); logger.debug('AdaApi::getAssetsLocalData success', { assetsLocaldata }); const assets = response.map(asset => _createAssetFromServerData(asset, assetsLocaldata[asset.policy_id + asset.asset_name] || {}, this.storedAssetMetadata)); + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return new Promise(resolve => resolve({ assets, total: response.length @@ -555,6 +575,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWithdrawals = async (request: GetWithdrawalsRequest): Promise => { logger.debug('AdaApi::getWithdrawals called', { parameters: request @@ -586,6 +607,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createWallet = async (request: CreateWalletRequest): Promise => { logger.debug('AdaApi::createWallet called', { parameters: filterLogData(request) @@ -616,6 +638,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createLegacyWallet = async (request: CreateWalletRequest): Promise => { logger.debug('AdaApi::createLegacyWallet called', { parameters: filterLogData(request) @@ -674,6 +697,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message deleteWallet = async (request: DeleteWalletRequest): Promise => { logger.debug('AdaApi::deleteWallet called', { parameters: filterLogData(request) @@ -707,6 +731,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createTransaction = async (request: CreateTransactionRequest): Promise => { logger.debug('AdaApi::createTransaction called', { parameters: filterLogData(request) @@ -766,7 +791,9 @@ export default class AdaApi { } }; // For testing purpose ONLY + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createExpiredTransaction = async (request: any): Promise => { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. if (global.environment.isDev) { logger.debug('AdaApi::createTransaction called', { parameters: filterLogData(request) @@ -829,6 +856,7 @@ export default class AdaApi { return null; }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message calculateTransactionFee = async (request: GetTransactionFeeRequest): Promise => { logger.debug('AdaApi::calculateTransactionFee called', { parameters: filterLogData(request) @@ -880,6 +908,7 @@ export default class AdaApi { } = _createTransactionFeeFromServerData(response); const amountWithFee = formattedTxAmount.plus(fee); + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. const isRewardsRedemptionRequest = Array.isArray(withdrawal); if (!isRewardsRedemptionRequest && amountWithFee.gt(walletBalance)) { @@ -920,6 +949,7 @@ export default class AdaApi { logError: true, msg: 'AdaApi::calculateTransactionFee error' }).set(notEnoughMoneyError, true).where('code', 'not_enough_money').set('utxoTooSmall', true, { + // @ts-ignore ts-migrate(2339) FIXME: Property 'exec' does not exist on type '{}'. minimumAda: get(/(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), 2, 0) }).where('code', 'utxo_too_small').set('invalidAddress').where('code', 'bad_request').inc('message', 'Unable to decode Address').result(); } @@ -932,6 +962,7 @@ export default class AdaApi { payments?: CoinSelectionsPaymentRequestType; delegation?: CoinSelectionsDelegationRequestType; metadata?: VotingMetadataType; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message }): Promise => { logger.debug('AdaApi::selectCoins called', { parameters: filterLogData(request) @@ -970,6 +1001,7 @@ export default class AdaApi { metadata: metadata || null }; } else { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Missing parameters!'); } @@ -986,61 +1018,92 @@ export default class AdaApi { let totalInputs = new BigNumber(0); let totalOutputs = new BigNumber(0); map(response.inputs, input => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message const inputAmount = new BigNumber(input.amount.quantity.toString()); + // @ts-ignore ts-migrate(2339) FIXME: Property 'assets' does not exist on type 'unknown'... Remove this comment to see the full error message const inputAssets = map(input.assets, asset => ({ + // @ts-ignore ts-migrate(2339) FIXME: Property 'policy_id' does not exist on type 'unkno... Remove this comment to see the full error message policyId: asset.policy_id, + // @ts-ignore ts-migrate(2339) FIXME: Property 'asset_name' does not exist on type 'unkn... Remove this comment to see the full error message assetName: asset.asset_name, + // @ts-ignore ts-migrate(2339) FIXME: Property 'quantity' does not exist on type 'unknow... Remove this comment to see the full error message quantity: asset.quantity })); totalInputs = totalInputs.plus(inputAmount); const inputData = { + // @ts-ignore ts-migrate(2339) FIXME: Property 'address' does not exist on type 'unknown... Remove this comment to see the full error message address: input.address, + // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message amount: input.amount, + // @ts-ignore ts-migrate(2339) FIXME: Property 'id' does not exist on type 'unknown'. id: input.id, + // @ts-ignore ts-migrate(2339) FIXME: Property 'index' does not exist on type 'unknown'. index: input.index, + // @ts-ignore ts-migrate(2339) FIXME: Property 'derivation_path' does not exist on type ... Remove this comment to see the full error message derivationPath: input.derivation_path, assets: inputAssets }; + // @ts-ignore ts-migrate(2339) FIXME: Property 'push' does not exist on type '{}'. inputsData.push(inputData); }); map(outputs, output => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message const outputAmount = new BigNumber(output.amount.quantity.toString()); + // @ts-ignore ts-migrate(2339) FIXME: Property 'assets' does not exist on type 'unknown'... Remove this comment to see the full error message const outputAssets = map(output.assets, asset => ({ + // @ts-ignore ts-migrate(2339) FIXME: Property 'policy_id' does not exist on type 'unkno... Remove this comment to see the full error message policyId: asset.policy_id, + // @ts-ignore ts-migrate(2339) FIXME: Property 'asset_name' does not exist on type 'unkn... Remove this comment to see the full error message assetName: asset.asset_name, + // @ts-ignore ts-migrate(2339) FIXME: Property 'quantity' does not exist on type 'unknow... Remove this comment to see the full error message quantity: asset.quantity })); totalOutputs = totalOutputs.plus(outputAmount); const outputData = { + // @ts-ignore ts-migrate(2339) FIXME: Property 'address' does not exist on type 'unknown... Remove this comment to see the full error message address: output.address, + // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message amount: output.amount, + // @ts-ignore ts-migrate(2339) FIXME: Property 'derivation_path' does not exist on type ... Remove this comment to see the full error message derivationPath: output.derivation_path || null, assets: outputAssets }; + // @ts-ignore ts-migrate(2339) FIXME: Property 'push' does not exist on type '{}'. outputsData.push(outputData); }); if (response.certificates) { map(response.certificates, certificate => { const certificateData = { + // @ts-ignore ts-migrate(2339) FIXME: Property 'certificate_type' does not exist on type... Remove this comment to see the full error message certificateType: certificate.certificate_type, + // @ts-ignore ts-migrate(2339) FIXME: Property 'reward_account_path' does not exist on t... Remove this comment to see the full error message rewardAccountPath: certificate.reward_account_path, + // @ts-ignore ts-migrate(2339) FIXME: Property 'pool' does not exist on type 'unknown'. pool: certificate.pool || null }; + // @ts-ignore ts-migrate(2339) FIXME: Property 'push' does not exist on type '{}'. certificatesData.push(certificateData); }); } const withdrawalsData = map(response.withdrawals, withdrawal => ({ + // @ts-ignore ts-migrate(2339) FIXME: Property 'stake_address' does not exist on type 'u... Remove this comment to see the full error message stakeAddress: withdrawal.stake_address, + // @ts-ignore ts-migrate(2339) FIXME: Property 'derivation_path' does not exist on type ... Remove this comment to see the full error message derivationPath: withdrawal.derivation_path, + // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message amount: withdrawal.amount })); + // @ts-ignore ts-migrate(2339) FIXME: Property 'quantity' does not exist on type 'unknow... Remove this comment to see the full error message const depositsArray = map(response.deposits, deposit => deposit.quantity.toString()); + // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type '{}'. const deposits = depositsArray.length ? BigNumber.sum.apply(null, depositsArray) : new BigNumber(0); // @TODO - Use api response when api is ready const depositsReclaimed = delegation && delegation.delegationAction === DELEGATION_ACTIONS.QUIT ? new BigNumber(DELEGATION_DEPOSIT).multipliedBy(LOVELACES_PER_ADA) : new BigNumber(0); + // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message const withdrawalsArray = map(response.withdrawals, withdrawal => withdrawal.amount.quantity.toString()); + // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type '{}'. const withdrawals = withdrawalsArray.length ? BigNumber.sum.apply(null, withdrawalsArray) : new BigNumber(0); if (withdrawals) { @@ -1090,10 +1153,12 @@ export default class AdaApi { logError: true, msg: 'AdaApi::calculateTransactionFee error' }).set(notEnoughMoneyError, true).where('code', 'not_enough_money').set('utxoTooSmall', true, { + // @ts-ignore ts-migrate(2339) FIXME: Property 'exec' does not exist on type '{}'. minimumAda: get(/(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), 2, 0) }).where('code', 'utxo_too_small').set('invalidAddress').where('code', 'bad_request').inc('message', 'Unable to decode Address').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createExternalTransaction = async (request: CreateExternalTransactionRequest): Promise => { const { signedTransactionBlob @@ -1113,6 +1178,7 @@ export default class AdaApi { }; inspectAddress = async (request: { addressId: string; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message }): Promise => { logger.debug('AdaApi::inspectAddress called', { parameters: filterLogData(request) @@ -1136,6 +1202,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getPublicKey = async (request: any): Promise => { logger.debug('AdaApi::getPublicKey called', { parameters: filterLogData(request) @@ -1163,6 +1230,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getICOPublicKey = async (request: ICOPublicKeyParams): Promise => { logger.debug('AdaApi::getICOPublicKey called', { parameters: filterLogData(request) @@ -1181,6 +1249,7 @@ export default class AdaApi { throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message constructAddress = async (request: any): Promise => { const { data @@ -1201,6 +1270,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createAddress = async (request: CreateByronWalletAddressRequest): Promise => { logger.debug('AdaApi::createAddress called', { parameters: filterLogData(request) @@ -1229,6 +1299,7 @@ export default class AdaApi { throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message deleteTransaction = async (request: DeleteTransactionRequest): Promise => { logger.debug('AdaApi::deleteTransaction called', { parameters: request @@ -1263,12 +1334,15 @@ export default class AdaApi { // is no longer pending - in which case there is nothing we can do. } }; + // @ts-ignore ts-migrate(2339) FIXME: Property 'split' does not exist on type 'string'. isValidCertificateMnemonic = (mnemonic: string): boolean => mnemonic.split(' ').length === ADA_CERTIFICATE_MNEMONIC_LENGTH; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletRecoveryPhrase(): Promise> { logger.debug('AdaApi::getWalletRecoveryPhrase called'); try { + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message const response: Promise> = new Promise(resolve => resolve(generateAccountMnemonics(WALLET_RECOVERY_PHRASE_WORD_COUNT))); logger.debug('AdaApi::getWalletRecoveryPhrase success'); return response; @@ -1280,10 +1354,12 @@ export default class AdaApi { } } + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletCertificateAdditionalMnemonics(): Promise> { logger.debug('AdaApi::getWalletCertificateAdditionalMnemonics called'); try { + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message const response: Promise> = new Promise(resolve => resolve(generateAdditionalMnemonics())); logger.debug('AdaApi::getWalletCertificateAdditionalMnemonics success'); return response; @@ -1295,6 +1371,7 @@ export default class AdaApi { } } + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletCertificateRecoveryPhrase(request: GetWalletCertificateRecoveryPhraseRequest): Promise> { logger.debug('AdaApi::getWalletCertificateRecoveryPhrase called'); const { @@ -1303,6 +1380,7 @@ export default class AdaApi { } = request; try { + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message const response: Promise> = new Promise(resolve => resolve(scrambleMnemonics({ passphrase, scrambledInput @@ -1317,6 +1395,7 @@ export default class AdaApi { } } + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletRecoveryPhraseFromCertificate(request: GetWalletRecoveryPhraseFromCertificateRequest): Promise> { logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate called'); const { @@ -1330,16 +1409,19 @@ export default class AdaApi { scrambledInput }); logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate success'); + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return Promise.resolve(response); } catch (error) { logger.error('AdaApi::getWalletRecoveryPhraseFromCertificate error', { error }); const errorRejection = new ApiError(error).set('invalidMnemonic', true).result(); + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return Promise.reject(errorRejection); } } + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreWallet = async (request: RestoreWalletRequest): Promise => { logger.debug('AdaApi::restoreWallet called', { parameters: filterLogData(request) @@ -1370,6 +1452,7 @@ export default class AdaApi { throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createHardwareWallet = async (request: CreateHardwareWalletRequest): Promise => { logger.debug('AdaApi::createHardwareWallet called', { parameters: filterLogData(request) @@ -1401,6 +1484,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getCurrencyList = async (): Promise => { try { const apiResponse = await getCurrencyList(); @@ -1416,6 +1500,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getCurrencyRate = async (currency: GetCurrencyRateRequest): Promise => { try { const apiResponse = await getCurrencyRate(currency); @@ -1431,6 +1516,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreLegacyWallet = async (request: RestoreLegacyWalletRequest): Promise => { logger.debug('AdaApi::restoreLegacyWallet called', { parameters: filterLogData(request) @@ -1475,6 +1561,7 @@ export default class AdaApi { throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreByronRandomWallet = async (request: RestoreLegacyWalletRequest): Promise => { logger.debug('AdaApi::restoreByronRandomWallet called', { parameters: filterLogData(request) @@ -1530,6 +1617,7 @@ export default class AdaApi { throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreByronIcarusWallet = async (request: RestoreLegacyWalletRequest): Promise => { logger.debug('AdaApi::restoreByronIcarusWallet called', { parameters: filterLogData(request) @@ -1574,6 +1662,7 @@ export default class AdaApi { throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreByronTrezorWallet = async (request: RestoreLegacyWalletRequest): Promise => { logger.debug('AdaApi::restoreByronTrezorWallet called', { parameters: filterLogData(request) @@ -1618,6 +1707,7 @@ export default class AdaApi { throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreByronLedgerWallet = async (request: RestoreLegacyWalletRequest): Promise => { logger.debug('AdaApi::restoreByronLedgerWallet called', { parameters: filterLogData(request) @@ -1662,6 +1752,7 @@ export default class AdaApi { throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreExportedByronWallet = async (request: RestoreExportedByronWalletRequest): Promise => { logger.debug('AdaApi::restoreExportedByronWallet called', { name: request.name @@ -1695,6 +1786,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message importWalletFromKey = async (request: ImportWalletFromKeyRequest): Promise => { logger.debug('AdaApi::importWalletFromKey called', { parameters: filterLogData(request) @@ -1720,6 +1812,7 @@ export default class AdaApi { throw new ApiError(error).set('walletAlreadyImported', true).where('code', 'wallet_already_exists').result('walletFileImportError'); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message importWalletFromFile = async (request: ImportWalletFromFileRequest): Promise => { logger.debug('AdaApi::importWalletFromFile called', { parameters: filterLogData(request) @@ -1746,6 +1839,7 @@ export default class AdaApi { throw new ApiError(error).set('walletAlreadyImported', true).where('code', 'wallet_already_exists').result('walletFileImportError'); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message updateWallet = async (request: UpdateWalletRequest): Promise => { logger.debug('AdaApi::updateWallet called', { parameters: filterLogData(request) @@ -1792,6 +1886,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message updateSpendingPassword = async (request: UpdateSpendingPasswordRequest): Promise => { logger.debug('AdaApi::updateSpendingPassword called', { parameters: filterLogData(request) @@ -1838,6 +1933,7 @@ export default class AdaApi { throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message quitStakePool = async (request: QuitStakePoolRequest): Promise => { logger.debug('AdaApi::quitStakePool called', { parameters: filterLogData(request) @@ -1863,6 +1959,7 @@ export default class AdaApi { throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getSmashSettings = async (): Promise => { logger.debug('AdaApi::getSmashSettings called'); @@ -1881,6 +1978,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message checkSmashServerIsValid = async (url: string): Promise => { logger.debug('AdaApi::checkSmashServerIsValid called', { parameters: { @@ -1908,6 +2006,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message updateSmashSettings = async (poolMetadataSource: PoolMetadataSource): Promise => { logger.debug('AdaApi::updateSmashSettings called', { parameters: { @@ -1945,6 +2044,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getRedeemItnRewardsFee = async (request: GetRedeemItnRewardsFeeRequest): Promise => { const { address, @@ -1986,6 +2086,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message requestRedeemItnRewards = async (request: RequestRedeemItnRewardsRequest): Promise => { const { address, @@ -2025,6 +2126,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message exportWalletToFile = async (request: ExportWalletToFileRequest): Promise<[]> => { const { walletId, @@ -2035,6 +2137,7 @@ export default class AdaApi { }); try { + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message const response: Promise<[]> = await exportWalletAsJSON(this.config, { walletId, filePath @@ -2050,6 +2153,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletUtxos = async (request: GetWalletUtxosRequest): Promise => { const { walletId, @@ -2083,6 +2187,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message transferFundsCalculateFee = async (request: TransferFundsCalculateFeeRequest): Promise => { const { sourceWalletId @@ -2108,6 +2213,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message transferFunds = async (request: TransferFundsRequest): Promise => { const { sourceWalletId, @@ -2145,6 +2251,7 @@ export default class AdaApi { throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getStakePools = async (stake: number = 0): Promise> => { logger.debug('AdaApi::getStakePools called', { parameters: { @@ -2174,11 +2281,13 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message testReset = async (): Promise => { logger.debug('AdaApi::testReset called'); try { const wallets = await this.getWallets(); + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message await Promise.all(wallets.map(wallet => this.deleteWallet({ walletId: wallet.id, isLegacy: wallet.isLegacy, @@ -2192,6 +2301,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getNetworkInfo = async (): Promise => { logger.debug('AdaApi::getNetworkInfo called'); @@ -2241,6 +2351,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getNetworkClock = async (isForceCheck: boolean): Promise => { logger.debug('AdaApi::getNetworkClock called', { isForceCheck @@ -2264,6 +2375,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getNetworkParameters = async (): Promise => { logger.debug('AdaApi::getNetworkParameters called'); @@ -2305,6 +2417,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getNews = async (): Promise => { logger.debug('AdaApi::getNews called'); // Fetch news json @@ -2313,11 +2426,13 @@ export default class AdaApi { try { rawNews = await getNews(); + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'JSON'. news = JSON.parse(rawNews); } catch (error) { logger.error('AdaApi::getNews error', { error }); + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Unable to fetch news'); } @@ -2332,10 +2447,12 @@ export default class AdaApi { logger.error('AdaApi::getNews (hash) error', { error }); + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Unable to fetch news hash'); } if (newsHash !== expectedNewsHash) { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Newsfeed could not be verified'); } @@ -2345,6 +2462,7 @@ export default class AdaApi { }); return news; }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message calculateDelegationFee = async (request: GetDelegationFeeRequest): Promise => { logger.debug('AdaApi::calculateDelegationFee called', { parameters: filterLogData(request) @@ -2365,6 +2483,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message joinStakePool = async (request: JoinStakePoolRequest): Promise => { logger.debug('AdaApi::joinStakePool called', { parameters: filterLogData(request) @@ -2392,6 +2511,7 @@ export default class AdaApi { throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createWalletSignature = async (request: CreateWalletSignatureRequest): Promise => { logger.debug('AdaApi::createWalletSignature called', { parameters: filterLogData(request) @@ -2461,6 +2581,7 @@ export default class AdaApi { throw new ApiError(error); } }; + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createVotingRegistrationTransaction = async (request: CreateVotingRegistrationRequest): Promise => { logger.debug('AdaApi::createVotingRegistrationTransaction called', { parameters: filterLogData(request) @@ -2550,20 +2671,28 @@ export default class AdaApi { }).where('code', 'transaction_is_too_big').result(); } }; + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message setCardanoNodeFault = async (fault: FaultInjectionIpcRequest) => { await cardanoFaultInjectionChannel.send(fault); }; // No implementation here but can be overwritten + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setLocalTimeDifference: (...args: Array) => any; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setSyncProgress: (...args: Array) => any; setFaultyNodeSettingsApi: boolean; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. resetTestOverrides: (...args: Array) => any; // Newsfeed testing utility setTestingNewsFeed: (testingNewsFeedData: GetNewsResponse) => void; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setTestingStakePools: (testingStakePoolsData: Array) => void; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setTestingWallets: (testingWalletsData: Array) => void; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. setTestingWallet: (testingWalletData: Record, walletIndex?: number) => void; // Stake pools testing utility + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setFakeStakePoolsJsonForTesting: (fakeStakePoolsJson: Array) => void; setStakePoolsFetchingFailed: () => void; } // ========== TRANSFORM SERVER DATA INTO FRONTEND MODELS ========= @@ -2646,6 +2775,7 @@ const _createWalletFromServerData = action('AdaApi::_createWalletFromServerData' availableAmount: walletAvailableAmount, reward: walletRewardAmount, assets: walletAssets, + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Date'. passwordUpdateDate: passphraseLastUpdatedAt && new Date(passphraseLastUpdatedAt), hasPassword: isHardwareWallet || passphraseLastUpdatedAt !== null, // For HW set that wallet has password @@ -2873,6 +3003,7 @@ const _createStakePoolFromServerData = action('AdaApi::_createStakePoolFromServe pledge: new BigNumber(pledgeQuantity.toString()).dividedBy(LOVELACES_PER_ADA), profitMargin: profitMarginPercentage, ranking: index + 1, + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Date'. retiring: retiringAt ? new Date(retiringAt) : null, saturation: saturation * 100 }); diff --git a/source/renderer/app/api/errors.js.ts b/source/renderer/app/api/errors.js.ts index 48a2b2d47c..c2313afeba 100644 --- a/source/renderer/app/api/errors.js.ts +++ b/source/renderer/app/api/errors.js.ts @@ -1,4 +1,5 @@ import { defineMessages } from "react-intl"; + export const messages = defineMessages({ // common wrongEncryptionPassphrase: { diff --git a/source/renderer/app/api/transactions/types.js.ts b/source/renderer/app/api/transactions/types.js.ts index 5b5f9df443..0272679925 100644 --- a/source/renderer/app/api/transactions/types.js.ts +++ b/source/renderer/app/api/transactions/types.js.ts @@ -29,10 +29,12 @@ export type Transaction = { unit: WalletUnits.LOVELACE; }; inserted_at?: { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Date'. time: Date; block: TransactionInsertionBlock; }; pending_since?: { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Date'. time: Date; block: TransactionInsertionBlock & { height: { @@ -43,12 +45,16 @@ export type Transaction = { }; depth: TransactionDepth; direction: "outgoing" | "incoming"; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. inputs: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. outputs: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. withdrawals: Array; status: TransactionState; metadata?: TransactionMetadata; }; +// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. export type Transactions = Array; export type TransactionInputs = { address: string; @@ -66,11 +72,15 @@ export type TransactionWithdrawals = { stake_address: string; amount: TransactionAmount; }; +// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. export type TransactionWithdrawalType = "self" | Array; export type TransactionState = "pending" | "in_ledger" | "expired"; export type TransactionAddresses = { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. from: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. to: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. withdrawals: Array; }; export type TransactionType = "card" | "expend" | "income" | "exchange"; @@ -104,6 +114,7 @@ export type GetTransactionFeeRequest = { availableBalance: BigNumber; rewardsBalance: BigNumber; isLegacy: boolean; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. withdrawal?: "self" | Array; }; export type GetTransactionFeeResponse = { @@ -117,6 +128,7 @@ export type CreateTransactionRequest = { passphrase: string; isLegacy: boolean; assets?: ApiTokens; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. withdrawal?: "self" | Array; hasAssetsRemainingAfterTransaction?: boolean; }; @@ -126,12 +138,14 @@ export type DeleteTransactionRequest = { isLegacy: boolean; }; export type GetTransactionsResponse = { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. transactions: Array; total: number; }; export type TransactionParams = { walletId: string; data: { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. payments: Array; passphrase: string; }; @@ -143,6 +157,7 @@ export type TransactionFeeAmount = { export type GetTransactionFeeParams = { walletId: string; data: { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. payments: Array; }; }; @@ -155,6 +170,7 @@ export type TransactionFee = { estimated_min: TransactionFeeAmount; estimated_max: TransactionFeeAmount; deposit: TransactionFeeAmount; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. minimum_coins: Array; }; export type CoinSelectionAmount = { @@ -166,6 +182,7 @@ export type CoinSelectionInput = { amount: CoinSelectionAmount; id: string; index: number; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. derivationPath: Array; }; export type Asset = { @@ -176,21 +193,27 @@ export type Asset = { export type CoinSelectionOutput = { address: string; amount: CoinSelectionAmount; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. derivationPath: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assets?: Array; }; export type CertificateType = "register_reward_account" | "quit_pool" | "join_pool"; export type CoinSelectionCertificate = { pool: string; certificateType: CertificateType; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. rewardAccountPath: Array; }; +// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. export type CoinSelectionCertificates = Array; export type CoinSelectionWithdrawal = { stakeAddress: string; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. derivationPath: Array; amount: CoinSelectionAmount; }; +// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. export type CoinSelectionWithdrawals = Array; export type CoinSelectionsDelegationRequestType = { walletId: string; @@ -206,16 +229,20 @@ export type CoinSelectionsPaymentRequestType = { }; export type CoinSelectionsRequest = CoinSelectionsPaymentRequestType | CoinSelectionsDelegationRequestType; export type CoinSelectionsResponse = { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. inputs: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. outputs: Array; certificates: CoinSelectionCertificates; deposits: BigNumber; depositsReclaimed: BigNumber; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. withdrawals: Array; fee: BigNumber; metadata: string | null | undefined; }; export type CreateExternalTransactionRequest = { + // @ts-ignore ts-migrate(2580) FIXME: Cannot find name 'Buffer'. Do you need to install ... Remove this comment to see the full error message signedTransactionBlob: Buffer; }; export type CreateExternalTransactionResponse = { @@ -236,6 +263,7 @@ export type ICOPublicKeyParams = { purpose: string; }; }; +// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. export type CoinSelectionAssetsType = Array; export type VotingMetaIndexType = 61284 | 61285; export const VotingMetaIndexes: { @@ -251,7 +279,9 @@ export type VotingMetaKeyValuePairBytes = { [key in "bytes"]?: string }; export type VotingMetaKeyValuePairMap = { [key in "int"]?: number }; export type VotingMetaKeyType = "string" | "int" | "bytes" | "list" | "map"; export type VotingMetaKeyValuePair = { [key in "k" | "v"]?: VotingMetaKeyValuePairString | VotingMetaKeyValuePairInt | VotingMetaKeyValuePairBytes }; +// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. export type VotingMetaRegistrationType = { [key in "map"]?: Array }; +// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. export type VotingMetadataType = Record; export type VotingDataType = { stakeAddress: string; diff --git a/source/renderer/app/api/utils/apiHelpers.js.ts b/source/renderer/app/api/utils/apiHelpers.js.ts index 65d70e4d37..1472796b59 100644 --- a/source/renderer/app/api/utils/apiHelpers.js.ts +++ b/source/renderer/app/api/utils/apiHelpers.js.ts @@ -1,9 +1,12 @@ import { ApiMethodNotYetImplementedError } from "../common/errors"; import ApiError from "../../domains/ApiError"; + +// @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message export const notYetImplemented = async () => new Promise((resolve, reject) => { reject(new ApiMethodNotYetImplementedError()); }); // helper code for testing async APIs +// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. export const testAsync = async (apiMethod: (...args: Array) => any) => { const result = await apiMethod(); // eslint-disable-next-line no-console @@ -11,6 +14,7 @@ export const testAsync = async (apiMethod: (...args: Array) => any) => { return result; }; // helper code for testing sync APIs +// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. export const testSync = (apiMethod: (...args: Array) => any) => { const result = apiMethod(); // eslint-disable-next-line no-console @@ -18,11 +22,14 @@ export const testSync = (apiMethod: (...args: Array) => any) => { return result; }; // helper code for deferring API call execution +// @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message export const wait = (ms: number): Promise => new Promise(resolve => setTimeout(resolve, ms)); export const throwErrorIfNotEnoughAdaToSupportTokens = (error: any, hasAssetsRemainingAfterTransaction?: boolean) => { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'RegExp'. const adaToProceedRegex = new RegExp(/.*I need approximately([\s\d.,]+)ada to proceed.*/); if (error.code === 'cannot_cover_fee' && hasAssetsRemainingAfterTransaction && adaToProceedRegex.test(error.message)) { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Math'. const adaToRemain = Math.ceil(Number(error.message.replace(adaToProceedRegex, '$1'))); throw new ApiError().set('cannotLeaveWalletEmpty', true, { adaToRemain diff --git a/source/renderer/app/api/utils/apiHelpers.spec.js.ts b/source/renderer/app/api/utils/apiHelpers.spec.js.ts index 7794ccb2b1..aeae9f0bd1 100644 --- a/source/renderer/app/api/utils/apiHelpers.spec.js.ts +++ b/source/renderer/app/api/utils/apiHelpers.spec.js.ts @@ -1,33 +1,54 @@ +// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './apiHelpers' or its correspon... Remove this comment to see the full error message import { throwErrorIfNotEnoughAdaToSupportTokens } from "./apiHelpers"; + +// @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { + // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw if error.code is not "cannot_cover_fee"', () => { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error(); error.code = 'other_error'; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).not.toThrow(); }); + // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw error if error code is "cannot_cover_fee" but hasAssetsRemainingAfterTransaction is undefined', () => { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error('I cannot proceed with transaction, I need approximately 1.6 ada to proceed'); error.code = 'cannot_cover_fee'; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error)).not.toThrow(); }); + // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw error if error code is "cannot_cover_fee" but message does not match reegex', () => { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error('other message'); error.code = 'cannot_cover_fee'; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).not.toThrow(); }); + // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw error if error code is not "cannot_cover_fee" and message matches regex', () => { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error('I cannot proceed with transaction, I need approximately 1.6 ada to proceed'); error.code = 'other_code'; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).not.toThrow(); }); + // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw if there are no tokens remaining in wallet after transaction', () => { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error(); error.code = 'cannot_cover_fee'; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, false)).not.toThrow(); }); + // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee"', () => { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error('I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.'); error.code = 'cannot_cover_fee'; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrowError(new Error({ additionalValues: { adaToRemain: 1 diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx index 2b96b3ad39..eea889cf32 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx @@ -14,7 +14,9 @@ import ReactToolboxMobxForm from "../../../utils/ReactToolboxMobxForm"; import Dialog from "../../widgets/Dialog"; import DialogCloseButton from "../../widgets/DialogCloseButton"; import LocalizableError from "../../../i18n/LocalizableError"; +// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './WalletSendAssetsConfirmation... Remove this comment to see the full error message import styles from "./WalletSendAssetsConfirmationDialog.scss"; +// @ts-ignore ts-migrate(2307) FIXME: Cannot find module '../../../assets/images/questio... Remove this comment to see the full error message import questionMarkIcon from "../../../assets/images/question-mark.inline.svg"; import { FORM_VALIDATION_DEBOUNCE_WAIT } from "../../../config/timingConfig"; import { submitOnEnter } from "../../../utils/form"; @@ -30,32 +32,43 @@ import { getMessages } from "./WalletSendAssetsConfirmationDialog.messages"; import { shouldShowEmptyWalletWarning } from "../../../utils/walletUtils"; import { hasTokensLeftAfterTransaction } from "../../../utils/assets"; import globalMessages from "../../../i18n/global-messages"; + const SHOW_TOTAL_AMOUNT = false; type Props = { amount: string; receiver: string; wallet: Wallet; totalAmount: BigNumber; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. selectedAssets: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. allAvailableTokens: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assetsAmounts: Array; transactionFee: string | null | undefined; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onSubmit: (...args: Array) => any; amountToNaturalUnits: (amountWithFractions: string) => string; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onCancel: (...args: Array) => any; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onExternalLinkClick: (...args: Array) => any; isSubmitting: boolean; isFlight: boolean; error: LocalizableError | null | undefined; hwDeviceStatus: HwDeviceStatus; isHardwareWallet: boolean; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onInitiateTransaction: (...args: Array) => any; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onCopyAssetParam: (...args: Array) => any; isTrezor: boolean; formattedTotalAmount: string; }; type State = { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. selectedAssets: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assetsAmounts: Array; areTermsAccepted: boolean; }; @@ -247,6 +260,7 @@ class WalletSendAssetsConfirmationDialog extends Component { disabled: !!error || !isHardwareWallet && !passphraseField.isValid || isHardwareWallet && hwDeviceStatus !== HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED || !areTermsAccepted && isFlight }]; const assetsSeparatorBasicHeight = 27; + // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type '{}'. const assetsSeparatorCalculatedHeight = selectedAssets.length ? assetsSeparatorBasicHeight * selectedAssets.length * 2 - 18 : assetsSeparatorBasicHeight; let errorElement = null; @@ -285,6 +299,7 @@ class WalletSendAssetsConfirmationDialog extends Component { + // @ts-ignore ts-migrate(2339) FIXME: Property 'map' does not exist on type '{}'. {selectedAssets.map((asset, assetIndex) => { const assetAmount = this.getFormattedAssetAmount(asset, assetIndex); return diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx index 30a8b8b5c4..00ed4a655b 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx @@ -11,6 +11,7 @@ import ReactToolboxMobxForm from "../../../utils/ReactToolboxMobxForm"; import Dialog from "../../widgets/Dialog"; import DialogCloseButton from "../../widgets/DialogCloseButton"; import LocalizableError from "../../../i18n/LocalizableError"; +// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './WalletSendConfirmationDialog... Remove this comment to see the full error message import styles from "./WalletSendConfirmationDialog.scss"; import { FORM_VALIDATION_DEBOUNCE_WAIT } from "../../../config/timingConfig"; import { submitOnEnter } from "../../../utils/form"; @@ -23,22 +24,28 @@ import { getMessages } from "./WalletSendAssetsConfirmationDialog.messages"; import { shouldShowEmptyWalletWarning } from "../../../utils/walletUtils"; import type { AssetToken } from "../../../api/assets/types"; import globalMessages from "../../../i18n/global-messages"; + type Props = { amount: string; receiver: string; wallet: Wallet; totalAmount: BigNumber; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. allAvailableTokens?: Array; transactionFee: string | null | undefined; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onSubmit: (...args: Array) => any; amountToNaturalUnits: (amountWithFractions: string) => string; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onCancel: (...args: Array) => any; isSubmitting: boolean; isFlight: boolean; error: LocalizableError | null | undefined; hwDeviceStatus: HwDeviceStatus; isHardwareWallet: boolean; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onInitiateTransaction: (...args: Array) => any; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onExternalLinkClick: (...args: Array) => any; isTrezor: boolean; formattedTotalAmount: string; diff --git a/source/renderer/app/stores/WalletsStore.js.ts b/source/renderer/app/stores/WalletsStore.js.ts index 6b71c6e896..134b316c85 100644 --- a/source/renderer/app/stores/WalletsStore.js.ts +++ b/source/renderer/app/stores/WalletsStore.js.ts @@ -28,6 +28,7 @@ import type { AssetToken } from "../api/assets/types"; import type { WalletKind, WalletDaedalusKind, WalletYoroiKind, WalletHardwareKind } from "../types/walletRestoreTypes"; import type { CsvFileContent } from "../../../common/types/csv-request.types"; import type { WalletExportTypeChoices } from "../types/walletExportTypes"; +// @ts-ignore ts-migrate(2307) FIXME: Cannot find module '../actions/wallets-actions' or... Remove this comment to see the full error message import type { WalletImportFromFileParams } from "../actions/wallets-actions"; import type LocalizableError from "../i18n/LocalizableError"; import type { TransferFundsCalculateFeeRequest, TransferFundsRequest } from "../api/wallets/types"; @@ -48,46 +49,67 @@ export default class WalletsStore extends Store { isAddressFromSameWallet: boolean = false; // REQUESTS @observable + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. walletsRequest: Request> = new Request(this.api.ada.getWallets); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message accountPublicKeyRequest: Request = new Request(this.api.ada.getAccountPublicKey); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message icoPublicKeyRequest: Request = new Request(this.api.ada.getICOPublicKey); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message importFromFileRequest: Request = new Request(this.api.ada.importWalletFromFile); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message createWalletRequest: Request = new Request(this.api.ada.createWallet); @observable + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. getWalletAddressesRequest: Request> = new Request(this.api.ada.getAddresses); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message deleteWalletRequest: Request = new Request(this.api.ada.deleteWallet); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message sendMoneyRequest: Request = new Request(this.api.ada.createTransaction); @observable + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. getWalletRecoveryPhraseRequest: Request> = new Request(this.api.ada.getWalletRecoveryPhrase); @observable + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. getWalletCertificateAdditionalMnemonicsRequest: Request> = new Request(this.api.ada.getWalletCertificateAdditionalMnemonics); @observable + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. getWalletCertificateRecoveryPhraseRequest: Request> = new Request(this.api.ada.getWalletCertificateRecoveryPhrase); @observable + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. getWalletRecoveryPhraseFromCertificateRequest: Request> = new Request(this.api.ada.getWalletRecoveryPhraseFromCertificate); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreDaedalusRequest: Request = new Request(this.api.ada.restoreWallet); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreLegacyRequest: Request = new Request(this.api.ada.restoreLegacyWallet); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreByronRandomWalletRequest: Request = new Request(this.api.ada.restoreByronRandomWallet); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreByronIcarusWalletRequest: Request = new Request(this.api.ada.restoreByronIcarusWallet); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreByronTrezorWalletRequest: Request = new Request(this.api.ada.restoreByronTrezorWallet); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreByronLedgerWalletRequest: Request = new Request(this.api.ada.restoreByronLedgerWallet); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message transferFundsCalculateFeeRequest: Request = new Request(this.api.ada.transferFundsCalculateFee); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message transferFundsRequest: Request = new Request(this.api.ada.transferFunds); @observable + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message createHardwareWalletRequest: Request = new Request(this.api.ada.createHardwareWallet); /* ---------- Active Wallet ---------- */ @@ -125,6 +147,7 @@ export default class WalletsStore extends Store { walletKindHardware: WalletHardwareKind | null | undefined = null; // STEP: RECOVERY PHRASE @observable + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. mnemonics: Array = []; // STEP: CONFIGURATION @observable @@ -203,6 +226,7 @@ export default class WalletsStore extends Store { setup() { setInterval(this._pollRefresh, this.WALLET_REFRESH_INTERVAL); + // @ts-ignore ts-migrate(2339) FIXME: Property 'registerReactions' does not exist on typ... Remove this comment to see the full error message this.registerReactions([this._updateActiveWalletOnRouteChanges]); const { router, @@ -210,6 +234,7 @@ export default class WalletsStore extends Store { wallets: walletsActions, app, networkStatus + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message } = this.actions; // Create Wallet Actions --- walletsActions.createWallet.listen(this._create); @@ -263,6 +288,7 @@ export default class WalletsStore extends Store { } @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _getAccountPublicKey = async ({ spendingPassword: passphrase }: { @@ -291,6 +317,7 @@ export default class WalletsStore extends Store { } }; @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _getICOPublicKey = async ({ spendingPassword: passphrase }: { @@ -322,16 +349,20 @@ export default class WalletsStore extends Store { throw error; } }; + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _create = async (params: { name: string; spendingPassword: string; }) => { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Object'. Object.assign(this._newWalletDetails, params); try { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. const recoveryPhrase: Array | null | undefined = await this.getWalletRecoveryPhraseRequest.execute().promise; if (recoveryPhrase != null) { + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.walletBackup.initiateWalletBackup.trigger({ recoveryPhrase }); @@ -371,6 +402,7 @@ export default class WalletsStore extends Store { this.restoreWalletShowAbortConfirmation = false; }; @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _restoreWalletEnd = async () => { this._resumePolling(); @@ -411,6 +443,7 @@ export default class WalletsStore extends Store { walletName, spendingPassword } = this; + // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type 'string'. const shouldDisplayAbortAlert = (mnemonics.length || walletName.length || spendingPassword.length) && this.restoreWalletStep !== null && this.restoreWalletStep < RESTORE_WALLET_STEPS.length - 1; if (shouldDisplayAbortAlert && !this.restoreWalletShowAbortConfirmation) { @@ -420,6 +453,7 @@ export default class WalletsStore extends Store { this._restoreWalletResetData(); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); } }; @@ -464,6 +498,7 @@ export default class WalletsStore extends Store { _restoreWalletSetMnemonics = ({ mnemonics }: { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. mnemonics: Array; }) => { this.mnemonics = mnemonics; @@ -485,6 +520,7 @@ export default class WalletsStore extends Store { } }; @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _createHardwareWallet = async (params: { walletName: string; extendedPublicKey: HardwareWalletExtendedPublicKeyResponse; @@ -518,6 +554,7 @@ export default class WalletsStore extends Store { walletName, accountPublicKey }); + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message await this.stores.hardwareWallets._setHardwareWalletLocalData({ walletId: wallet.id, data: { @@ -526,6 +563,7 @@ export default class WalletsStore extends Store { disconnected: false } }); + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message await this.stores.hardwareWallets._setHardwareWalletDevice({ deviceId, data: { @@ -544,6 +582,7 @@ export default class WalletsStore extends Store { await this._patchWalletRequestWithNewWallet(wallet); this.goToWalletRoute(wallet.id); this.refreshWalletsData(); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); } } catch (error) { @@ -552,17 +591,21 @@ export default class WalletsStore extends Store { this._resumePolling(); } }; + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _finishWalletBackup = async () => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this._newWalletDetails.mnemonic = this.stores.walletBackup.recoveryPhrase.join(' '); const wallet = await this.createWalletRequest.execute(this._newWalletDetails).promise; if (wallet) { await this._patchWalletRequestWithNewWallet(wallet); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this.goToWalletRoute(wallet.id); this.refreshWalletsData(); } }; + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _deleteWallet = async (params: { walletId: string; isLegacy: boolean; @@ -593,21 +636,26 @@ export default class WalletsStore extends Store { this.isDeleting = false; if (this.hasAnyWallets) { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Math'. const nextIndexInList = Math.max(indexOfWalletToDelete - 1, 0); const nextWalletInList = this.all[nextIndexInList]; this.goToWalletRoute(nextWalletInList.id); } else { this.active = null; this.activeValue = null; + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.router.goToRoute.trigger({ route: ROUTES.WALLETS.ADD }); } }); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.walletsLocal.unsetWalletLocalData.trigger({ walletId: params.walletId }); + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message await this.stores.hardwareWallets._unsetHardwareWalletLocalData({ walletId: params.walletId }); @@ -617,12 +665,15 @@ export default class WalletsStore extends Store { this.deleteWalletRequest.reset(); this.refreshWalletsData(); }; + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _undelegateWallet = async (params: QuitStakePoolRequest) => { const { quitStakePoolRequest + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.staking; const { quitStakePool + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message } = this.actions.staking; const walletToUndelegate = this.getWalletById(params.walletId); @@ -648,6 +699,7 @@ export default class WalletsStore extends Store { this.undelegateWalletSubmissionSuccess = result; }); }; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. _getUnscrambledMnemonics = async (mnemonics: Array): Array => { // Split recovery phrase to 18 (scrambled mnemonics) + 9 (mnemonics seed) mnemonics const { @@ -655,6 +707,7 @@ export default class WalletsStore extends Store { scrambledInput } = getScrambledInput(mnemonics); // Unscramble 18-word wallet certificate mnemonic to 12-word mnemonic + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. const unscrambledRecoveryPhrase: Array = await this.getWalletRecoveryPhraseFromCertificateRequest.execute({ passphrase, scrambledInput @@ -664,6 +717,7 @@ export default class WalletsStore extends Store { return unscrambledRecoveryPhrase; }; @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _restore = async () => { this.isRestoring = true; // Pause polling in order to avoid fetching data for wallet we are about to restore @@ -688,6 +742,7 @@ export default class WalletsStore extends Store { try { const restoredWallet = await request.execute(data).promise; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. if (!restoredWallet) throw new Error('Restored wallet was not received correctly'); runInAction('set restoredWallet', () => { this.restoredWallet = restoredWallet; @@ -699,6 +754,7 @@ export default class WalletsStore extends Store { }); } }; + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _sendMoney = async ({ receiver, amount, @@ -710,7 +766,9 @@ export default class WalletsStore extends Store { receiver: string; amount: string; passphrase: string; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assets?: Array; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assetsAmounts?: Array; hasAssetsRemainingAfterTransaction?: boolean; }) => { @@ -725,9 +783,11 @@ export default class WalletsStore extends Store { quantity: get(assetsAmounts, index, 0) })) : null; const wallet = this.active; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. if (!wallet) throw new Error('Active wallet required before sending.'); await this.sendMoneyRequest.execute({ address: receiver, + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'parseInt'. amount: parseInt(amount, 10), passphrase, walletId: wallet.id, @@ -736,11 +796,13 @@ export default class WalletsStore extends Store { hasAssetsRemainingAfterTransaction }); this.refreshWalletsData(); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this.sendMoneyRequest.reset(); this.goToWalletRoute(wallet.id); }; @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _transferFundsNextStep = async () => { const { transferFundsStep, @@ -773,6 +835,7 @@ export default class WalletsStore extends Store { this.transferFundsStep = prevStep; }; @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _transferFunds = async ({ spendingPassword }: { @@ -834,6 +897,7 @@ export default class WalletsStore extends Store { this.transferFundsCalculateFeeRequest.reset(); }; @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _transferFundsCalculateFee = async ({ sourceWalletId }: { @@ -880,11 +944,13 @@ export default class WalletsStore extends Store { } @computed + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. get all(): Array { return [...this.allWallets, ...this.allLegacyWallets]; } @computed + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. get allWallets(): Array { return this.walletsRequest.result ? this.walletsRequest.result.filter(({ isLegacy @@ -892,6 +958,7 @@ export default class WalletsStore extends Store { } @computed + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. get allLegacyWallets(): Array { return this.walletsRequest.result ? this.walletsRequest.result.filter(({ isLegacy @@ -918,6 +985,7 @@ export default class WalletsStore extends Store { get isWalletRoute(): boolean { const { currentRoute + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.app; return matchRoute(`${ROUTES.WALLETS.ROOT}(/*rest)`, currentRoute); } @@ -961,6 +1029,7 @@ export default class WalletsStore extends Store { // ACTIONS goToWalletRoute(walletId: string) { const route = this.getWalletRoute(walletId); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.router.goToRoute.trigger({ route }); @@ -971,12 +1040,14 @@ export default class WalletsStore extends Store { get _canRedirectToWallet(): boolean { const { currentRoute + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.app; const isRootRoute = matchRoute(ROUTES.WALLETS.ROOT, currentRoute); const isAddWalletRoute = matchRoute(ROUTES.WALLETS.ADD, currentRoute); return isRootRoute || isAddWalletRoute; } + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _patchWalletRequestWithNewWallet = async (wallet: Wallet) => { // Only add the new wallet if it does not exist yet in the result! await this.walletsRequest.patch(result => { @@ -1001,12 +1072,14 @@ export default class WalletsStore extends Store { _pollRefresh = async () => { const { isConnected + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.networkStatus; return isConnected && this.refreshWalletsData(); }; _updateActiveWalletOnRouteChanges = () => { const { currentRoute + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.app; const hasAnyWalletLoaded = this.hasAnyLoaded; const isWalletAddPage = matchRoute(ROUTES.WALLETS.ADD, currentRoute); @@ -1049,12 +1122,14 @@ export default class WalletsStore extends Store { isValidAddress = async (address: string) => { const { network + // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message } = this.environment; const expectedNetworkTag = get(NetworkMagics, [network]); const validAddressStyles: AddressStyle[] = ['Byron', 'Icarus', 'Shelley']; this.isAddressFromSameWallet = false; if (!expectedNetworkTag) { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Unexpected environment'); } @@ -1068,26 +1143,32 @@ export default class WalletsStore extends Store { } runInAction('check if address is from the same wallet', () => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message const walletAddresses = this.stores.addresses.all.slice().map(addr => addr.id); this.isAddressFromSameWallet = !!walletAddresses.filter(addr => addr === address).length; }); + // @ts-ignore ts-migrate(2339) FIXME: Property 'includes' does not exist on type '{}'. return validAddressStyles.includes(response.introspection.address_style) && (Array.isArray(expectedNetworkTag) && includes(expectedNetworkTag, response.introspection.network_tag) || expectedNetworkTag === response.introspection.network_tag); } catch (error) { logger.error(error); } }; + // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message isValidCertificateMnemonic = (mnemonic: string) => this.api.ada.isValidCertificateMnemonic(mnemonic); @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message refreshWalletsData = async () => { // Prevent wallets data refresh if polling is blocked if (this._pollingBlocked) return; + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message if (this.stores.networkStatus.isConnected) { const result = await this.walletsRequest.execute().promise; if (!result) return; const walletIds = result.filter(({ syncState }: Wallet) => syncState.status !== WalletSyncStateStatuses.NOT_RESPONDING).map((wallet: Wallet) => wallet.id); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message await this.actions.walletsLocal.refreshWalletsLocalData.trigger(); runInAction('refresh active wallet', () => { if (this.active) { @@ -1097,34 +1178,46 @@ export default class WalletsStore extends Store { } }); runInAction('refresh address data', () => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.addresses.addressesRequests = walletIds.map(walletId => ({ walletId, + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message allRequest: this.stores.addresses._getAddressesAllRequest(walletId) })); + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.addresses._refreshAddresses(); }); runInAction('refresh transaction data', () => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.transactions.transactionsRequests = walletIds.map(walletId => ({ walletId, + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message recentRequest: this.stores.transactions._getTransactionsRecentRequest(walletId), + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message allRequest: this.stores.transactions._getTransactionsAllRequest(walletId), + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message withdrawalsRequest: this.stores.transactions._getWithdrawalsRequest(walletId) })); + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.transactions._refreshTransactionData(); }); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.wallets.refreshWalletsDataSuccess.trigger(); } }; @action resetWalletsData = () => { this.walletsRequest.reset(); + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.addresses.addressesRequests = []; + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.transactions.transactionsRequests = []; this.isAddressFromSameWallet = false; }; @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _importWalletFromFile = async (params: WalletImportFromFileParams) => { const { filePath, @@ -1136,8 +1229,10 @@ export default class WalletsStore extends Store { walletName, spendingPassword }).promise; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. if (!importedWallet) throw new Error('Imported wallet was not received correctly'); await this._patchWalletRequestWithNewWallet(importedWallet); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this.importFromFileRequest.reset(); this.goToWalletRoute(importedWallet.id); @@ -1154,6 +1249,7 @@ export default class WalletsStore extends Store { const newActiveWallet = this.all.find(wallet => wallet.id === walletId); if ((!this.active || !this.active.isNotResponding) && newActiveWallet && newActiveWallet.isNotResponding) { + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.router.goToRoute.trigger({ route: ROUTES.WALLETS.PAGE, params: { @@ -1169,6 +1265,7 @@ export default class WalletsStore extends Store { if (hasActiveWalletBeenChanged) { // Active wallet has been replaced or removed this.active = newActiveWallet || null; + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.addresses.lastGeneratedAddress = null; if (this.active) { @@ -1177,6 +1274,7 @@ export default class WalletsStore extends Store { if (this.active && this.active.isHardwareWallet) { const { hardwareWalletsConnectionData + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.hardwareWallets; const hardwareWalletConnectionData = get(hardwareWalletsConnectionData, this.active.id); @@ -1185,6 +1283,7 @@ export default class WalletsStore extends Store { extendedPublicKey } = hardwareWalletConnectionData; const extendedPublicKeyHex = `${extendedPublicKey.publicKeyHex}${extendedPublicKey.chainCodeHex}`; + // @ts-ignore ts-migrate(2580) FIXME: Cannot find name 'Buffer'. Do you need to install ... Remove this comment to see the full error message const xpub = Buffer.from(extendedPublicKeyHex, 'hex'); const activePublicKey = bech32EncodePublicKey(xpub); this.activePublicKey = activePublicKey || null; @@ -1206,11 +1305,13 @@ export default class WalletsStore extends Store { this.activeValue = null; this.activePublicKey = null; this.icoPublicKey = null; + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.addresses.lastGeneratedAddress = null; }; @action _onRouteChange = (options: { route: string; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. params: Record | null | undefined; }) => { // Reset the send request anytime we visit the send page (e.g: to remove any previous errors) @@ -1228,6 +1329,7 @@ export default class WalletsStore extends Store { } }; @action + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _pausePolling = async () => { if (this.walletsRequest.isExecuting) await this.walletsRequest; runInAction('AdaWalletsStore::_pausePolling', () => { @@ -1250,6 +1352,7 @@ export default class WalletsStore extends Store { _generateCertificate = flow(function* generateCertificate(params: { filePath: string; timestamp: string; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Generator'. }): Generator { try { // Pause polling in order not to show Paper wallet in the UI @@ -1259,14 +1362,17 @@ export default class WalletsStore extends Store { this._updateCertificateCreationState(true); // Generate wallet recovery phrase + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. const recoveryPhrase: Array = yield this.getWalletRecoveryPhraseRequest.execute().promise; // Generate 9-words (additional) mnemonic + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. const additionalMnemonicWords: Array = yield this.getWalletCertificateAdditionalMnemonicsRequest.execute().promise; this.additionalMnemonicWords = additionalMnemonicWords.join(' '); // Generate spending password from 9-word mnemonic and save to store const spendingPassword = mnemonicToSeedHex(this.additionalMnemonicWords); this.walletCertificatePassword = spendingPassword; // Generate paper wallet scrambled mnemonic + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. const walletCertificateRecoveryPhrase: Array = yield this.getWalletCertificateRecoveryPhraseRequest.execute({ passphrase: spendingPassword, input: recoveryPhrase.join(' ') @@ -1302,15 +1408,20 @@ export default class WalletsStore extends Store { } finally { this._resumePolling(); } + // @ts-ignore ts-migrate(2339) FIXME: Property 'bind' does not exist on type '(params: {... Remove this comment to see the full error message }).bind(this); + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _downloadCertificate = async (address: string, recoveryPhrase: Array, filePath: string, timestamp: string) => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message const locale = this.stores.profile.currentLocale; const intl = i18nContext(locale); const { isMainnet + // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message } = this.environment; const { buildLabel + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. } = global; try { @@ -1337,6 +1448,7 @@ export default class WalletsStore extends Store { }); } }; + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _generateAddressPDF = async ({ note, address, @@ -1350,10 +1462,12 @@ export default class WalletsStore extends Store { currentLocale, currentDateFormat, currentTimeFormat + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.profile; const { network, isMainnet + // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message } = this.environment; const intl = i18nContext(currentLocale); @@ -1370,13 +1484,16 @@ export default class WalletsStore extends Store { intl }); const walletAddress = ellipsis(address, 15, 15); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.wallets.generateAddressPDFSuccess.trigger({ walletAddress }); } catch (error) { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error(error); } }; + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _saveQRCodeImage = async ({ address, filePath @@ -1390,18 +1507,22 @@ export default class WalletsStore extends Store { filePath }); const walletAddress = ellipsis(address, 15, 15); + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.wallets.saveQRCodeImageSuccess.trigger({ walletAddress }); } catch (error) { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error(error); } }; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. _updateCertificateCreationState = action((state: boolean, error?: Record | null | undefined) => { this.generatingCertificateInProgress = state; this._updateGeneratingCertificateError(error); }); + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. _updateGeneratingCertificateError = action((error?: Record | null | undefined) => { if (error && error.syscall && error.syscall === 'open') { // User tries to replace a file that is open @@ -1437,7 +1558,9 @@ export default class WalletsStore extends Store { } finally { this._resumePolling(); } + // @ts-ignore ts-migrate(2339) FIXME: Property 'bind' does not exist on type '(args_0: {... Remove this comment to see the full error message }).bind(this); + // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _downloadRewardsCsv = async (fileContent: CsvFileContent, filePath: string) => { try { await downloadCsv({ @@ -1453,11 +1576,13 @@ export default class WalletsStore extends Store { }); } }; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. _updateRewardsCsvCreationState = action((state: boolean, error?: Record | null | undefined) => { this.generatingRewardsCsvInProgress = state; this._updateGeneratingRewardsCsvError(error); }); + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. _updateGeneratingRewardsCsvError = action((error?: Record | null | undefined) => { if (error && error.syscall && error.syscall === 'open') { // User tries to replace a file that is open @@ -1495,12 +1620,14 @@ export default class WalletsStore extends Store { }; @action _closeCertificateGeneration = () => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this._resetCertificateData(); }; @action _closeRewardsCsvGeneration = () => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this._resetRewardsCsvData(); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..6c6afe9b93 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,101 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2019", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "lib": ["dom"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "jsx": "react", /* Specify what JSX code is generated. */ + "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ + // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + "resolveJsonModule": true, /* Enable importing .json files */ + // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ + "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": false, /* Enable all strict type-checking options. */ + "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ + // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + "noImplicitThis": false, /* Enable error reporting when `this` is given the type `any`. */ + // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} From 127d55c87c5bd9988aafb38ee6d02c1f971e4d97 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:40:51 +0000 Subject: [PATCH 17/42] [DDW-827] updated ts-ignore annotations in components --- .../wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx index eea889cf32..68af329263 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx @@ -299,7 +299,7 @@ class WalletSendAssetsConfirmationDialog extends Component { - // @ts-ignore ts-migrate(2339) FIXME: Property 'map' does not exist on type '{}'. + {/* @ts-ignore ts-migrate(2339) FIXME: Property 'map' does not exist on type '{}'. */} {selectedAssets.map((asset, assetIndex) => { const assetAmount = this.getFormattedAssetAmount(asset, assetIndex); return From b0e766ef86081da077183f7247bb20dbe925d5cf Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:42:31 +0000 Subject: [PATCH 18/42] [DDW-827] re-enabled husky pre-commit step --- package.json | 1 + yarn.lock | 442 ++++++++++++++++++++++++++++----------------------- 2 files changed, 241 insertions(+), 202 deletions(-) diff --git a/package.json b/package.json index 3dcc7f8cc4..9bdf9a4f95 100644 --- a/package.json +++ b/package.json @@ -280,6 +280,7 @@ }, "husky": { "hooks": { + "pre-commit": "pretty-quick --staged", "pre-push": "yarn check:all" } }, diff --git a/yarn.lock b/yarn.lock index d441020095..ffbef01711 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20,7 +20,6 @@ "@babel/code-frame@7.12.11": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" - integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== dependencies: "@babel/highlight" "^7.10.4" @@ -45,7 +44,6 @@ "@babel/code-frame@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" - integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== dependencies: "@babel/highlight" "^7.16.7" @@ -64,7 +62,6 @@ "@babel/compat-data@^7.16.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.16.8.tgz#31560f9f29fdf1868de8cb55049538a1b9732a60" - integrity sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q== "@babel/core@7.16.0", "@babel/core@^7.1.0", "@babel/core@^7.12.3": version "7.16.0" @@ -107,10 +104,29 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.1.6", "@babel/core@^7.13.16": +"@babel/core@^7.1.6": + version "7.16.12" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.16.12.tgz#5edc53c1b71e54881315923ae2aedea2522bb784" + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.16.8" + "@babel/helper-compilation-targets" "^7.16.7" + "@babel/helper-module-transforms" "^7.16.7" + "@babel/helpers" "^7.16.7" + "@babel/parser" "^7.16.12" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.10" + "@babel/types" "^7.16.8" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.1.2" + semver "^6.3.0" + source-map "^0.5.0" + +"@babel/core@^7.13.16": version "7.16.12" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.16.12.tgz#5edc53c1b71e54881315923ae2aedea2522bb784" - integrity sha512-dK5PtG1uiN2ikk++5OzSYsitZKny4wOCD0nrO4TqnW4BVBTQ2NGS3NgilvT/TEyxTST7LNyWV/T4tXDoD3fOgg== dependencies: "@babel/code-frame" "^7.16.7" "@babel/generator" "^7.16.8" @@ -155,7 +171,6 @@ "@babel/generator@^7.16.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.16.8.tgz#359d44d966b8cd059d543250ce79596f792f2ebe" - integrity sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw== dependencies: "@babel/types" "^7.16.8" jsesc "^2.5.1" @@ -176,7 +191,6 @@ "@babel/helper-annotate-as-pure@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz#bb2339a7534a9c128e3102024c60760a3a7f3862" - integrity sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw== dependencies: "@babel/types" "^7.16.7" @@ -197,7 +211,6 @@ "@babel/helper-builder-binary-assignment-operator-visitor@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.16.7.tgz#38d138561ea207f0f69eb1626a418e4f7e6a580b" - integrity sha512-C6FdbRaxYjwVu/geKW4ZeQ0Q31AftgRcdSnZ5/jsH6BzCJbtvXvhpfkbkThYSuutZA7nCXpPR6AD9zd1dprMkA== dependencies: "@babel/helper-explode-assignable-expression" "^7.16.7" "@babel/types" "^7.16.7" @@ -239,7 +252,6 @@ "@babel/helper-compilation-targets@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz#06e66c5f299601e6c7da350049315e83209d551b" - integrity sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA== dependencies: "@babel/compat-data" "^7.16.4" "@babel/helper-validator-option" "^7.16.7" @@ -268,10 +280,21 @@ "@babel/helper-replace-supers" "^7.16.0" "@babel/helper-split-export-declaration" "^7.16.0" -"@babel/helper-create-class-features-plugin@^7.16.10", "@babel/helper-create-class-features-plugin@^7.16.7": +"@babel/helper-create-class-features-plugin@^7.16.10": + version "7.16.10" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.10.tgz#8a6959b9cc818a88815ba3c5474619e9c0f2c21c" + dependencies: + "@babel/helper-annotate-as-pure" "^7.16.7" + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-member-expression-to-functions" "^7.16.7" + "@babel/helper-optimise-call-expression" "^7.16.7" + "@babel/helper-replace-supers" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + +"@babel/helper-create-class-features-plugin@^7.16.7": version "7.16.10" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.10.tgz#8a6959b9cc818a88815ba3c5474619e9c0f2c21c" - integrity sha512-wDeej0pu3WN/ffTxMNCPW5UCiOav8IcLRxSIyp/9+IF2xJUM9h/OYjg0IJLHaL6F8oU8kqMz9nc1vryXhMsgXg== dependencies: "@babel/helper-annotate-as-pure" "^7.16.7" "@babel/helper-environment-visitor" "^7.16.7" @@ -299,7 +322,6 @@ "@babel/helper-create-regexp-features-plugin@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.16.7.tgz#0cb82b9bac358eb73bfbd73985a776bfa6b14d48" - integrity sha512-fk5A6ymfp+O5+p2yCkXAu5Kyj6v0xh0RBeNcAkYUMDvvAAoxvSKXn+Jb37t/yWFiQVDFK1ELpUTD8/aLhCPu+g== dependencies: "@babel/helper-annotate-as-pure" "^7.16.7" regexpu-core "^4.7.1" @@ -328,7 +350,6 @@ "@babel/helper-define-polyfill-provider@^0.3.1": version "0.3.1" resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.1.tgz#52411b445bdb2e676869e5a74960d2d3826d2665" - integrity sha512-J9hGMpJQmtWmj46B3kBHmL38UhJGhYX7eqkcq+2gsstyYt341HmPeWspihX43yVRA0mS+8GGk2Gckc7bY/HCmA== dependencies: "@babel/helper-compilation-targets" "^7.13.0" "@babel/helper-module-imports" "^7.12.13" @@ -342,7 +363,6 @@ "@babel/helper-environment-visitor@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz#ff484094a839bde9d89cd63cba017d7aae80ecd7" - integrity sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag== dependencies: "@babel/types" "^7.16.7" @@ -361,7 +381,6 @@ "@babel/helper-explode-assignable-expression@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.7.tgz#12a6d8522fdd834f194e868af6354e8650242b7a" - integrity sha512-KyUenhWMC8VrxzkGP0Jizjo4/Zx+1nNZhgocs+gLzyZyB8SHidhoq9KK/8Ato4anhwsivfkBLftky7gvzbZMtQ== dependencies: "@babel/types" "^7.16.7" @@ -384,7 +403,6 @@ "@babel/helper-function-name@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz#f1ec51551fb1c8956bc8dd95f38523b6cf375f8f" - integrity sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA== dependencies: "@babel/helper-get-function-arity" "^7.16.7" "@babel/template" "^7.16.7" @@ -405,7 +423,6 @@ "@babel/helper-get-function-arity@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz#ea08ac753117a669f1508ba06ebcc49156387419" - integrity sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw== dependencies: "@babel/types" "^7.16.7" @@ -424,7 +441,6 @@ "@babel/helper-hoist-variables@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz#86bcb19a77a509c7b77d0e22323ef588fa58c246" - integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg== dependencies: "@babel/types" "^7.16.7" @@ -443,7 +459,6 @@ "@babel/helper-member-expression-to-functions@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.7.tgz#42b9ca4b2b200123c3b7e726b0ae5153924905b0" - integrity sha512-VtJ/65tYiU/6AbMTDwyoXGPKHgTsfRarivm+YbB5uAzKUyuPjgZSgAFeG87FCigc7KNHu2Pegh1XIT3lXjvz3Q== dependencies: "@babel/types" "^7.16.7" @@ -462,7 +477,6 @@ "@babel/helper-module-imports@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz#25612a8091a999704461c8a222d0efec5d091437" - integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg== dependencies: "@babel/types" "^7.16.7" @@ -494,7 +508,6 @@ "@babel/helper-module-transforms@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz#7665faeb721a01ca5327ddc6bba15a5cb34b6a41" - integrity sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng== dependencies: "@babel/helper-environment-visitor" "^7.16.7" "@babel/helper-module-imports" "^7.16.7" @@ -520,7 +533,6 @@ "@babel/helper-optimise-call-expression@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.7.tgz#a34e3560605abbd31a18546bd2aad3e6d9a174f2" - integrity sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w== dependencies: "@babel/types" "^7.16.7" @@ -535,7 +547,6 @@ "@babel/helper-plugin-utils@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz#aa3a8ab4c3cceff8e65eb9e73d87dc4ff320b2f5" - integrity sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA== "@babel/helper-regex@^7.10.4": version "7.10.5" @@ -563,7 +574,6 @@ "@babel/helper-remap-async-to-generator@^7.16.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.16.8.tgz#29ffaade68a367e2ed09c90901986918d25e57e3" - integrity sha512-fm0gH7Flb8H51LqJHy3HJ3wnE1+qtYR2A99K06ahwrawLdOFsCEWjZOrYricXJHoPSudNKxrMBUPEIPxiIIvBw== dependencies: "@babel/helper-annotate-as-pure" "^7.16.7" "@babel/helper-wrap-function" "^7.16.8" @@ -590,7 +600,6 @@ "@babel/helper-replace-supers@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.16.7.tgz#e9f5f5f32ac90429c1a4bdec0f231ef0c2838ab1" - integrity sha512-y9vsWilTNaVnVh6xiJfABzsNpgDPKev9HnAgz6Gb1p6UUwf9NepdlsV7VXGCftJM+jqD5f7JIEubcpLjZj5dBw== dependencies: "@babel/helper-environment-visitor" "^7.16.7" "@babel/helper-member-expression-to-functions" "^7.16.7" @@ -614,7 +623,6 @@ "@babel/helper-simple-access@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz#d656654b9ea08dbb9659b69d61063ccd343ff0f7" - integrity sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g== dependencies: "@babel/types" "^7.16.7" @@ -645,7 +653,6 @@ "@babel/helper-split-export-declaration@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz#0b648c0c42da9d3920d85ad585f2778620b8726b" - integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw== dependencies: "@babel/types" "^7.16.7" @@ -660,7 +667,6 @@ "@babel/helper-validator-identifier@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" - integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== "@babel/helper-validator-option@^7.14.5": version "7.14.5" @@ -669,7 +675,6 @@ "@babel/helper-validator-option@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23" - integrity sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ== "@babel/helper-wrap-function@^7.10.4": version "7.10.4" @@ -692,7 +697,6 @@ "@babel/helper-wrap-function@^7.16.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.16.8.tgz#58afda087c4cd235de92f7ceedebca2c41274200" - integrity sha512-8RpyRVIAW1RcDDGTA+GpPAwV22wXCfKOoM9bet6TLkGIFTkRQSkH1nMQ5Yet4MpoXe1ZwHPVtNasc2w0uZMqnw== dependencies: "@babel/helper-function-name" "^7.16.7" "@babel/template" "^7.16.7" @@ -718,7 +722,6 @@ "@babel/helpers@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.16.7.tgz#7e3504d708d50344112767c3542fc5e357fffefc" - integrity sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw== dependencies: "@babel/template" "^7.16.7" "@babel/traverse" "^7.16.7" @@ -743,7 +746,6 @@ "@babel/highlight@^7.16.7": version "7.16.10" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.16.10.tgz#744f2eb81579d6eea753c227b0f570ad785aba88" - integrity sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw== dependencies: "@babel/helper-validator-identifier" "^7.16.7" chalk "^2.0.0" @@ -753,15 +755,34 @@ version "7.16.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.4.tgz#d5f92f57cf2c74ffe9b37981c0e72fee7311372e" -"@babel/parser@^7.1.6", "@babel/parser@^7.13.16", "@babel/parser@^7.16.10", "@babel/parser@^7.16.12", "@babel/parser@^7.16.7", "@babel/parser@^7.7.0": +"@babel/parser@^7.1.6": version "7.16.12" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.12.tgz#9474794f9a650cf5e2f892444227f98e28cdf8b6" - integrity sha512-VfaV15po8RiZssrkPweyvbGVSe4x2y+aciFCgn0n0/SJMR22cwofRV1mtnJQYcSB1wUTaA/X1LnA3es66MCO5A== "@babel/parser@^7.10.4", "@babel/parser@^7.11.5": version "7.11.5" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037" +"@babel/parser@^7.13.16": + version "7.16.12" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.12.tgz#9474794f9a650cf5e2f892444227f98e28cdf8b6" + +"@babel/parser@^7.16.10": + version "7.16.12" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.12.tgz#9474794f9a650cf5e2f892444227f98e28cdf8b6" + +"@babel/parser@^7.16.12": + version "7.16.12" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.12.tgz#9474794f9a650cf5e2f892444227f98e28cdf8b6" + +"@babel/parser@^7.16.7": + version "7.16.12" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.12.tgz#9474794f9a650cf5e2f892444227f98e28cdf8b6" + +"@babel/parser@^7.7.0": + version "7.16.12" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.12.tgz#9474794f9a650cf5e2f892444227f98e28cdf8b6" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.16.2": version "7.16.2" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.2.tgz#2977fca9b212db153c195674e57cfab807733183" @@ -771,7 +792,6 @@ "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.7.tgz#4eda6d6c2a0aa79c70fa7b6da67763dfe2141050" - integrity sha512-anv/DObl7waiGEnC24O9zqL0pSuI9hljihqiDuFHC8d7/bjr/4RLGPWuc8rYOff/QPzbEPSkzG8wGG9aDuhHRg== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -786,7 +806,6 @@ "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.16.7.tgz#cc001234dfc139ac45f6bcf801866198c8c72ff9" - integrity sha512-di8vUHRdf+4aJ7ltXhaDbPoszdkh59AQtJM5soLsuHpQJdFQZOA4uGj0V2u/CZ8bJ/u8ULDL5yq6FO/bCXnKHw== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" @@ -811,7 +830,6 @@ "@babel/plugin-proposal-async-generator-functions@^7.16.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.16.8.tgz#3bdd1ebbe620804ea9416706cd67d60787504bc8" - integrity sha512-71YHIvMuiuqWJQkebWJtdhQTfd4Q4mF76q2IX37uZPkG9+olBxsX+rH1vkhFto4UeJZ9dPY2s+mDvhDm1u2BGQ== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/helper-remap-async-to-generator" "^7.16.8" @@ -824,10 +842,9 @@ "@babel/helper-create-class-features-plugin" "^7.2.1" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-proposal-class-properties@^7.1.0", "@babel/plugin-proposal-class-properties@^7.13.0", "@babel/plugin-proposal-class-properties@^7.16.7": +"@babel/plugin-proposal-class-properties@^7.1.0": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.7.tgz#925cad7b3b1a2fcea7e59ecc8eb5954f961f91b0" - integrity sha512-IobU0Xme31ewjYOShSIqd/ZGM/r/cuOz2z0MDbNrhF5FW+ZVgi0f2lyeoj9KFPDOAqsYxmLWZte1WOwlvY9aww== dependencies: "@babel/helper-create-class-features-plugin" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -839,6 +856,13 @@ "@babel/helper-create-class-features-plugin" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4" +"@babel/plugin-proposal-class-properties@^7.13.0": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.7.tgz#925cad7b3b1a2fcea7e59ecc8eb5954f961f91b0" + dependencies: + "@babel/helper-create-class-features-plugin" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-proposal-class-properties@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.0.tgz#c029618267ddebc7280fa286e0f8ca2a278a2d1a" @@ -846,6 +870,13 @@ "@babel/helper-create-class-features-plugin" "^7.16.0" "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-proposal-class-properties@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.7.tgz#925cad7b3b1a2fcea7e59ecc8eb5954f961f91b0" + dependencies: + "@babel/helper-create-class-features-plugin" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-proposal-class-static-block@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.16.0.tgz#5296942c564d8144c83eea347d0aa8a0b89170e7" @@ -857,7 +888,6 @@ "@babel/plugin-proposal-class-static-block@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.16.7.tgz#712357570b612106ef5426d13dc433ce0f200c2a" - integrity sha512-dgqJJrcZoG/4CkMopzhPJjGxsIe9A8RlkQLnL/Vhhx8AA9ZuaRwGSlscSh42hazc7WSrya/IK7mTeoF0DP9tEw== dependencies: "@babel/helper-create-class-features-plugin" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -888,7 +918,6 @@ "@babel/plugin-proposal-dynamic-import@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.7.tgz#c19c897eaa46b27634a00fee9fb7d829158704b2" - integrity sha512-I8SW9Ho3/8DRSdmDdH3gORdyUuYnk1m4cMxUAdu5oy4n3OfN8flDEH+d60iG7dUfi0KkYwSvoalHzzdRzpWHTg== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/plugin-syntax-dynamic-import" "^7.8.3" @@ -910,7 +939,6 @@ "@babel/plugin-proposal-export-namespace-from@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.16.7.tgz#09de09df18445a5786a305681423ae63507a6163" - integrity sha512-ZxdtqDXLRGBL64ocZcs7ovt71L3jhC1RGSyR996svrCi3PYqHNkb3SwPJCs8RIzD86s+WPpt2S73+EHCGO+NUA== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" @@ -932,7 +960,6 @@ "@babel/plugin-proposal-json-strings@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.16.7.tgz#9732cb1d17d9a2626a08c5be25186c195b6fa6e8" - integrity sha512-lNZ3EEggsGY78JavgbHsK9u5P3pQaW7k4axlgFLYkMd7UBsiNahCITShLjNQschPyjtO6dADrL24757IdhBrsQ== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/plugin-syntax-json-strings" "^7.8.3" @@ -954,7 +981,6 @@ "@babel/plugin-proposal-logical-assignment-operators@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.16.7.tgz#be23c0ba74deec1922e639832904be0bea73cdea" - integrity sha512-K3XzyZJGQCr00+EtYtrDjmwX7o7PLK6U9bi1nCwkQioRFVUv6dJoxbQjtWVtP+bCPy82bONBKG8NPyQ4+i6yjg== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" @@ -966,10 +992,9 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0" -"@babel/plugin-proposal-nullish-coalescing-operator@^7.13.8", "@babel/plugin-proposal-nullish-coalescing-operator@^7.16.7": +"@babel/plugin-proposal-nullish-coalescing-operator@^7.13.8": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.7.tgz#141fc20b6857e59459d430c850a0011e36561d99" - integrity sha512-aUOrYU3EVtjf62jQrCj63pYZ7k6vns2h/DQvHPWGmsJRYzWXZ6/AsfgpiRy6XiuIDADhJzP2Q9MwSMKauBQ+UQ== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" @@ -981,6 +1006,13 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" +"@babel/plugin-proposal-nullish-coalescing-operator@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.7.tgz#141fc20b6857e59459d430c850a0011e36561d99" + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-proposal-numeric-separator@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.10.4.tgz#ce1590ff0a65ad12970a609d78855e9a4c1aef06" @@ -998,7 +1030,6 @@ "@babel/plugin-proposal-numeric-separator@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.16.7.tgz#d6b69f4af63fb38b6ca2558442a7fb191236eba9" - integrity sha512-vQgPMknOIgiuVqbokToyXbkY/OmmjAzr/0lhSIbG/KmnzXPGwW/AdhdKpi+O4X/VkWiWjnkKOBiqJrTaC98VKw== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/plugin-syntax-numeric-separator" "^7.10.4" @@ -1010,10 +1041,9 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.16.7": +"@babel/plugin-proposal-object-rest-spread@^7.0.0": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.16.7.tgz#94593ef1ddf37021a25bdcb5754c4a8d534b01d8" - integrity sha512-3O0Y4+dw94HA86qSg9IHfyPktgR7q3gpNVAeiKQd+8jBKFaU5NQS1Yatgo4wY+UFNuLjvxcSmzcsHqrhgTyBUA== dependencies: "@babel/compat-data" "^7.16.4" "@babel/helper-compilation-targets" "^7.16.7" @@ -1039,6 +1069,16 @@ "@babel/plugin-syntax-object-rest-spread" "^7.8.3" "@babel/plugin-transform-parameters" "^7.16.0" +"@babel/plugin-proposal-object-rest-spread@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.16.7.tgz#94593ef1ddf37021a25bdcb5754c4a8d534b01d8" + dependencies: + "@babel/compat-data" "^7.16.4" + "@babel/helper-compilation-targets" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-transform-parameters" "^7.16.7" + "@babel/plugin-proposal-optional-catch-binding@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.10.4.tgz#31c938309d24a78a49d68fdabffaa863758554dd" @@ -1056,7 +1096,6 @@ "@babel/plugin-proposal-optional-catch-binding@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.16.7.tgz#c623a430674ffc4ab732fd0a0ae7722b67cb74cf" - integrity sha512-eMOH/L4OvWSZAE1VkHbr1vckLG1WUcHGJSLqqQwl2GaUqG6QjddvrOaTUMNYiv77H5IKPMZ9U9P7EaHwvAShfA== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" @@ -1069,10 +1108,9 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.11.0" "@babel/plugin-syntax-optional-chaining" "^7.8.0" -"@babel/plugin-proposal-optional-chaining@^7.13.12", "@babel/plugin-proposal-optional-chaining@^7.16.7": +"@babel/plugin-proposal-optional-chaining@^7.13.12": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.7.tgz#7cd629564724816c0e8a969535551f943c64c39a" - integrity sha512-eC3xy+ZrUcBtP7x+sq62Q/HYd674pPTb/77XZMb5wbDPGWIdUbSr4Agr052+zaUPSb+gGRnjxXfKFvx5iMJ+DA== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" @@ -1086,6 +1124,14 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" "@babel/plugin-syntax-optional-chaining" "^7.8.3" +"@babel/plugin-proposal-optional-chaining@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.7.tgz#7cd629564724816c0e8a969535551f943c64c39a" + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-proposal-private-methods@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.10.4.tgz#b160d972b8fdba5c7d111a145fc8c421fc2a6909" @@ -1103,7 +1149,6 @@ "@babel/plugin-proposal-private-methods@^7.16.11": version "7.16.11" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.11.tgz#e8df108288555ff259f4527dbe84813aac3a1c50" - integrity sha512-F/2uAkPlXDr8+BHpZvo19w3hLFKge+k75XUprE6jaqKxjGkSYcK+4c+bup5PdW/7W/Rpjwql7FTVEDW+fRAQsw== dependencies: "@babel/helper-create-class-features-plugin" "^7.16.10" "@babel/helper-plugin-utils" "^7.16.7" @@ -1120,7 +1165,6 @@ "@babel/plugin-proposal-private-property-in-object@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.16.7.tgz#b0b8cef543c2c3d57e59e2c611994861d46a3fce" - integrity sha512-rMQkjcOFbm+ufe3bTZLyOfsOUOxyvLXZJCTARhJr+8UMSoZmqTe1K1BgkFcrW37rAchWg57yI69ORxiWvUINuQ== dependencies: "@babel/helper-annotate-as-pure" "^7.16.7" "@babel/helper-create-class-features-plugin" "^7.16.7" @@ -1144,7 +1188,6 @@ "@babel/plugin-proposal-unicode-property-regex@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.16.7.tgz#635d18eb10c6214210ffc5ff4932552de08188a2" - integrity sha512-QRK0YI/40VLhNVGIjRNAAQkEHws0cswSdFFjpFyt943YmJIU1da9uW63Iu6NFV6CxTZW5eTDCrwZUstBWgp/Rg== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -1212,7 +1255,6 @@ "@babel/plugin-syntax-flow@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.16.7.tgz#202b147e5892b8452bbb0bb269c7ed2539ab8832" - integrity sha512-UDo3YGQO0jH6ytzVwgSLv9i/CzMcUjbKenL67dTrAZPPv6GFAtDhe6jqnvmoKzC/7htNTohhos+onPtDMqJwaQ== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1291,7 +1333,6 @@ "@babel/plugin-syntax-typescript@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.16.7.tgz#39c9b55ee153151990fb038651d58d3fd03f98f8" - integrity sha512-YhUIJHHGkqPgEcMYkPCKTyGUdoGKWtopIycQyjJH8OjvRgOYsXsaKehLVPScKJWAULPxMa4N1vCe6szREFlZ7A== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1310,7 +1351,6 @@ "@babel/plugin-transform-arrow-functions@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.7.tgz#44125e653d94b98db76369de9c396dc14bef4154" - integrity sha512-9ffkFFMbvzTvv+7dTp/66xvZAWASuPD5Tl9LK3Z9vhOmANo6j94rik+5YMBt4CwHVMWLWpMsriIc2zsa3WW3xQ== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1333,7 +1373,6 @@ "@babel/plugin-transform-async-to-generator@^7.16.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.16.8.tgz#b83dff4b970cf41f1b819f8b49cc0cfbaa53a808" - integrity sha512-MtmUmTJQHCnyJVrScNzNlofQJ3dLFuobYn3mwOTKHnSCMtbNsqvF71GQmJfFjdrXSsAA7iysFmYWw4bXZ20hOg== dependencies: "@babel/helper-module-imports" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -1354,7 +1393,6 @@ "@babel/plugin-transform-block-scoped-functions@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.16.7.tgz#4d0d57d9632ef6062cdf354bb717102ee042a620" - integrity sha512-JUuzlzmF40Z9cXyytcbZEZKckgrQzChbQJw/5PuEHYeqzCsvebDx0K0jWnIIVcmmDOAVctCgnYs0pMcrYj2zJg== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1373,7 +1411,6 @@ "@babel/plugin-transform-block-scoping@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.16.7.tgz#f50664ab99ddeaee5bc681b8f3a6ea9d72ab4f87" - integrity sha512-ObZev2nxVAYA4bhyusELdo9hb3H+A56bxH3FZMbEImZFiEDYVHXQSJ1hQKFlDnlt8G9bBrCZ5ZpURZUrV4G5qQ== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1405,7 +1442,6 @@ "@babel/plugin-transform-classes@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.16.7.tgz#8f4b9562850cd973de3b498f1218796eb181ce00" - integrity sha512-WY7og38SFAGYRe64BrjKf8OrE6ulEHtr5jEYaZMwox9KebgqPi67Zqz8K53EKk1fFEJgm96r32rkKZ3qA2nCWQ== dependencies: "@babel/helper-annotate-as-pure" "^7.16.7" "@babel/helper-environment-visitor" "^7.16.7" @@ -1431,7 +1467,6 @@ "@babel/plugin-transform-computed-properties@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.16.7.tgz#66dee12e46f61d2aae7a73710f591eb3df616470" - integrity sha512-gN72G9bcmenVILj//sv1zLNaPyYcOzUho2lIJBMh/iakJ9ygCo/hEF9cpGb61SCMEDxbbyBoVQxrt+bWKu5KGw== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1450,7 +1485,6 @@ "@babel/plugin-transform-destructuring@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.16.7.tgz#ca9588ae2d63978a4c29d3f33282d8603f618e23" - integrity sha512-VqAwhTHBnu5xBVDCvrvqJbtLUa++qZaWC0Fgr2mqokBlulZARGyIvZDoqbPlPaKImQ9dKAcCzbv+ul//uqu70A== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1471,7 +1505,6 @@ "@babel/plugin-transform-dotall-regex@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.16.7.tgz#6b2d67686fab15fb6a7fd4bd895d5982cfc81241" - integrity sha512-Lyttaao2SjZF6Pf4vk1dVKv8YypMpomAbygW+mU5cYP3S5cWTfCJjG8xV6CFdzGFlfWK81IjL9viiTvpb6G7gQ== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -1491,7 +1524,6 @@ "@babel/plugin-transform-duplicate-keys@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.16.7.tgz#2207e9ca8f82a0d36a5a67b6536e7ef8b08823c9" - integrity sha512-03DvpbRfvWIXyK0/6QiR1KMTWeT6OcQ7tbhjrXyFS02kjuX/mu5Bvnh5SDSWHxyawit2g5aWhKwI86EE7GUnTw== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1512,7 +1544,6 @@ "@babel/plugin-transform-exponentiation-operator@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.16.7.tgz#efa9862ef97e9e9e5f653f6ddc7b665e8536fe9b" - integrity sha512-8UYLSlyLgRixQvlYH3J2ekXFHDFLQutdy7FfFAMm3CPZ6q9wHCwnUyiXpQCe3gVVnQlHc5nsuiEVziteRNTXEA== dependencies: "@babel/helper-builder-binary-assignment-operator-visitor" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -1534,7 +1565,6 @@ "@babel/plugin-transform-flow-strip-types@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.16.7.tgz#291fb140c78dabbf87f2427e7c7c332b126964b8" - integrity sha512-mzmCq3cNsDpZZu9FADYYyfZJIOrSONmHcop2XEKPdBNMa4PDC4eEvcOvzZaCNcjKu72v0XQlA5y1g58aLRXdYg== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/plugin-syntax-flow" "^7.16.7" @@ -1554,7 +1584,6 @@ "@babel/plugin-transform-for-of@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.7.tgz#649d639d4617dff502a9a158c479b3b556728d8c" - integrity sha512-/QZm9W92Ptpw7sjI9Nx1mbcsWz33+l8kuMIQnDwgQBG5s3fAfQvkRjQ7NqXhtNcKOnPkdICmUHyCaWW06HCsqg== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1575,7 +1604,6 @@ "@babel/plugin-transform-function-name@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.16.7.tgz#5ab34375c64d61d083d7d2f05c38d90b97ec65cf" - integrity sha512-SU/C68YVwTRxqWj5kgsbKINakGag0KTgq9f2iZEXdStoAbOzLHEBRYzImmA6yFo8YZhJVflvXmIHUO7GWHmxxA== dependencies: "@babel/helper-compilation-targets" "^7.16.7" "@babel/helper-function-name" "^7.16.7" @@ -1596,7 +1624,6 @@ "@babel/plugin-transform-literals@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.16.7.tgz#254c9618c5ff749e87cb0c0cef1a0a050c0bdab1" - integrity sha512-6tH8RTpTWI0s2sV6uq3e/C9wPo4PTqqZps4uF0kzQ9/xPLFQtipynvmT1g/dOfEJ+0EQsHhkQ/zyRId8J2b8zQ== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1615,7 +1642,6 @@ "@babel/plugin-transform-member-expression-literals@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.16.7.tgz#6e5dcf906ef8a098e630149d14c867dd28f92384" - integrity sha512-mBruRMbktKQwbxaJof32LT9KLy2f3gH+27a5XSuXo6h7R3vqltl0PgZ80C8ZMKw98Bf8bqt6BEVi3svOh2PzMw== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1638,7 +1664,6 @@ "@babel/plugin-transform-modules-amd@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.16.7.tgz#b28d323016a7daaae8609781d1f8c9da42b13186" - integrity sha512-KaaEtgBL7FKYwjJ/teH63oAmE3lP34N3kshz8mm4VMAw7U3PxjVwwUmxEFksbgsNUaO3wId9R2AVQYSEGRa2+g== dependencies: "@babel/helper-module-transforms" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -1653,10 +1678,9 @@ "@babel/helper-simple-access" "^7.10.4" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-commonjs@^7.13.8", "@babel/plugin-transform-modules-commonjs@^7.16.8": +"@babel/plugin-transform-modules-commonjs@^7.13.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.16.8.tgz#cdee19aae887b16b9d331009aa9a219af7c86afe" - integrity sha512-oflKPvsLT2+uKQopesJt3ApiaIS2HW+hzHFcwRNtyDGieAeC/dIHZX8buJQ2J2X1rxGPy4eRcUijm3qcSPjYcA== dependencies: "@babel/helper-module-transforms" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -1672,6 +1696,15 @@ "@babel/helper-simple-access" "^7.16.0" babel-plugin-dynamic-import-node "^2.3.3" +"@babel/plugin-transform-modules-commonjs@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.16.8.tgz#cdee19aae887b16b9d331009aa9a219af7c86afe" + dependencies: + "@babel/helper-module-transforms" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-simple-access" "^7.16.7" + babel-plugin-dynamic-import-node "^2.3.3" + "@babel/plugin-transform-modules-systemjs@^7.10.4": version "7.10.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.10.5.tgz#6270099c854066681bae9e05f87e1b9cadbe8c85" @@ -1694,7 +1727,6 @@ "@babel/plugin-transform-modules-systemjs@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.16.7.tgz#887cefaef88e684d29558c2b13ee0563e287c2d7" - integrity sha512-DuK5E3k+QQmnOqBR9UkusByy5WZWGRxfzV529s9nPra1GE7olmxfqO2FHobEOYSPIjPBTr4p66YDcjQnt8cBmw== dependencies: "@babel/helper-hoist-variables" "^7.16.7" "@babel/helper-module-transforms" "^7.16.7" @@ -1719,7 +1751,6 @@ "@babel/plugin-transform-modules-umd@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.16.7.tgz#23dad479fa585283dbd22215bff12719171e7618" - integrity sha512-EMh7uolsC8O4xhudF2F6wedbSHm1HHZ0C6aJ7K67zcDNidMzVcxWdGr+htW9n21klm+bOn+Rx4CBsAntZd3rEQ== dependencies: "@babel/helper-module-transforms" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -1739,7 +1770,6 @@ "@babel/plugin-transform-named-capturing-groups-regex@^7.16.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.16.8.tgz#7f860e0e40d844a02c9dcf9d84965e7dfd666252" - integrity sha512-j3Jw+n5PvpmhRR+mrgIh04puSANCk/T/UA3m3P1MjJkhlK906+ApHhDIqBQDdOgL/r1UYpz4GNclTXxyZrYGSw== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.16.7" @@ -1758,7 +1788,6 @@ "@babel/plugin-transform-new-target@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.16.7.tgz#9967d89a5c243818e0800fdad89db22c5f514244" - integrity sha512-xiLDzWNMfKoGOpc6t3U+etCE2yRnn3SM09BXqWPIZOBpL2gvVrBWUKnsJx0K/ADi5F5YC5f8APFfWrz25TdlGg== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1779,7 +1808,6 @@ "@babel/plugin-transform-object-super@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.16.7.tgz#ac359cf8d32cf4354d27a46867999490b6c32a94" - integrity sha512-14J1feiQVWaGvRxj2WjyMuXS2jsBkgB3MdSN5HuC2G5nRspa5RK9COcs82Pwy5BuGcjb+fYaUj94mYcOj7rCvw== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/helper-replace-supers" "^7.16.7" @@ -1800,7 +1828,6 @@ "@babel/plugin-transform-parameters@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.16.7.tgz#a1721f55b99b736511cb7e0152f61f17688f331f" - integrity sha512-AT3MufQ7zZEhU2hwOA11axBnExW0Lszu4RL/tAlUJBuNoRak+wehQW8h6KcXOcgjY42fHtDxswuMhMjFEuv/aw== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1819,7 +1846,6 @@ "@babel/plugin-transform-property-literals@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.16.7.tgz#2dadac85155436f22c696c4827730e0fe1057a55" - integrity sha512-z4FGr9NMGdoIl1RqavCqGG+ZuYjfZ/hkCIeuH6Do7tXmSm0ls11nYVSJqFEUOSJbDab5wC6lRE/w6YjVcr6Hqw== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1888,7 +1914,6 @@ "@babel/plugin-transform-regenerator@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.16.7.tgz#9e7576dc476cb89ccc5096fff7af659243b4adeb" - integrity sha512-mF7jOgGYCkSJagJ6XCujSQg+6xC1M77/03K2oBmVJWoFGNUtnVJO4WHKJk3dnPC8HCcj4xBQP1Egm8DWh3Pb3Q== dependencies: regenerator-transform "^0.14.2" @@ -1907,7 +1932,6 @@ "@babel/plugin-transform-reserved-words@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.16.7.tgz#1d798e078f7c5958eec952059c460b220a63f586" - integrity sha512-KQzzDnZ9hWQBjwi5lpY5v9shmm6IVG0U9pB18zvMu2i4H90xpT4gmqwPYsn8rObiadYe2M0gmgsiOIF5A/2rtg== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1935,7 +1959,6 @@ "@babel/plugin-transform-shorthand-properties@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.7.tgz#e8549ae4afcf8382f711794c0c7b6b934c5fbd2a" - integrity sha512-hah2+FEnoRoATdIb05IOXf+4GzXYTq75TVhIn1PewihbpyrNWUt2JbudKQOETWw6QpLe+AIUpJ5MVLYTQbeeUg== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1956,7 +1979,6 @@ "@babel/plugin-transform-spread@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.16.7.tgz#a303e2122f9f12e0105daeedd0f30fb197d8ff44" - integrity sha512-+pjJpgAngb53L0iaA5gU/1MLXJIfXcYepLgXB3esVRf4fqmj8f2cxM3/FKaHsZms08hFQJkFccEWuIpm429TXg== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" @@ -1977,7 +1999,6 @@ "@babel/plugin-transform-sticky-regex@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.16.7.tgz#c84741d4f4a38072b9a1e2e3fd56d359552e8660" - integrity sha512-NJa0Bd/87QV5NZZzTuZG5BPJjLYadeSZ9fO6oOUoL4iQx+9EEuw/eEM92SrsT19Yc2jgB1u1hsjqDtH02c3Drw== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -1997,7 +2018,6 @@ "@babel/plugin-transform-template-literals@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.16.7.tgz#f3d1c45d28967c8e80f53666fc9c3e50618217ab" - integrity sha512-VwbkDDUeenlIjmfNeDX/V0aWrQH2QiVyJtwymVQSzItFDTpxfyJh3EVaQiS0rIN/CqbLGr0VcGmuwyTdZtdIsA== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -2016,14 +2036,20 @@ "@babel/plugin-transform-typeof-symbol@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.16.7.tgz#9cdbe622582c21368bd482b660ba87d5545d4f7e" - integrity sha512-p2rOixCKRJzpg9JB4gjnG4gjWkWa89ZoYUnl9snJ1cWIcTH/hvxZqfO+WjG6T8DRBpctEol5jw1O5rA8gkCokQ== dependencies: "@babel/helper-plugin-utils" "^7.16.7" -"@babel/plugin-transform-typescript@^7.16.7", "@babel/plugin-transform-typescript@^7.16.8": +"@babel/plugin-transform-typescript@^7.16.7": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.16.8.tgz#591ce9b6b83504903fa9dd3652c357c2ba7a1ee0" + dependencies: + "@babel/helper-create-class-features-plugin" "^7.16.7" + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-typescript" "^7.16.7" + +"@babel/plugin-transform-typescript@^7.16.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.16.8.tgz#591ce9b6b83504903fa9dd3652c357c2ba7a1ee0" - integrity sha512-bHdQ9k7YpBDO2d0NVfkj51DpQcvwIzIusJ7mEUaMlbZq3Kt/U47j24inXZHQ5MDiYpCs+oZiwnXyKedE8+q7AQ== dependencies: "@babel/helper-create-class-features-plugin" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -2044,7 +2070,6 @@ "@babel/plugin-transform-unicode-escapes@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz#da8717de7b3287a2c6d659750c964f302b31ece3" - integrity sha512-TAV5IGahIz3yZ9/Hfv35TV2xEm+kaBDaZQCn2S/hG9/CZ0DktxJv9eKfPc7yYCvOYR4JGx1h8C+jcSOvgaaI/Q== dependencies: "@babel/helper-plugin-utils" "^7.16.7" @@ -2065,7 +2090,6 @@ "@babel/plugin-transform-unicode-regex@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.16.7.tgz#0f7aa4a501198976e25e82702574c34cfebe9ef2" - integrity sha512-oC5tYYKw56HO75KZVLQ+R/Nl3Hro9kf8iG0hXoaHP7tjAyCpvqBiSNe6vGrZni1Z6MggmUOC6A7VP7AVmw225Q== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -2159,7 +2183,6 @@ "@babel/preset-env@^7.1.6": version "7.16.11" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.16.11.tgz#5dd88fd885fae36f88fd7c8342475c9f0abe2982" - integrity sha512-qcmWG8R7ZW6WBRPZK//y+E3Cli151B20W1Rv7ln27vuPaXU/8TKms6jFdiJtF7UDTxcrb7mZd88tAeK9LjdT8g== dependencies: "@babel/compat-data" "^7.16.8" "@babel/helper-compilation-targets" "^7.16.7" @@ -2327,7 +2350,6 @@ "@babel/preset-flow@^7.13.13": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.16.7.tgz#7fd831323ab25eeba6e4b77a589f680e30581cbd" - integrity sha512-6ceP7IyZdUYQ3wUVqyRSQXztd1YmFHWI4Xv11MIqAlE4WqxBSd/FZ61V9k+TS5Gd4mkHOtQtPp9ymRpxH4y1Ug== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/helper-validator-option" "^7.16.7" @@ -2375,10 +2397,25 @@ "@babel/plugin-transform-react-jsx-source" "^7.10.4" "@babel/plugin-transform-react-pure-annotations" "^7.10.4" -"@babel/preset-typescript@^7.1.0", "@babel/preset-typescript@^7.13.0", "@babel/preset-typescript@^7.16.7": +"@babel/preset-typescript@^7.1.0": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.16.7.tgz#ab114d68bb2020afc069cd51b37ff98a046a70b9" + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-validator-option" "^7.16.7" + "@babel/plugin-transform-typescript" "^7.16.7" + +"@babel/preset-typescript@^7.13.0": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.16.7.tgz#ab114d68bb2020afc069cd51b37ff98a046a70b9" + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-validator-option" "^7.16.7" + "@babel/plugin-transform-typescript" "^7.16.7" + +"@babel/preset-typescript@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.16.7.tgz#ab114d68bb2020afc069cd51b37ff98a046a70b9" - integrity sha512-WbVEmgXdIyvzB77AQjGBEyYPZx+8tTsO50XtfozQrkW8QB2rLJpH2lgx0TRw5EJrBxOZQ+wCcyPVQvS8tjEHpQ== dependencies: "@babel/helper-plugin-utils" "^7.16.7" "@babel/helper-validator-option" "^7.16.7" @@ -2396,10 +2433,19 @@ pirates "^4.0.0" source-map-support "^0.5.9" -"@babel/register@^7.0.0", "@babel/register@^7.13.16": +"@babel/register@^7.0.0": + version "7.16.9" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.16.9.tgz#fcfb23cfdd9ad95c9771e58183de83b513857806" + dependencies: + clone-deep "^4.0.1" + find-cache-dir "^2.0.0" + make-dir "^2.1.0" + pirates "^4.0.0" + source-map-support "^0.5.16" + +"@babel/register@^7.13.16": version "7.16.9" resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.16.9.tgz#fcfb23cfdd9ad95c9771e58183de83b513857806" - integrity sha512-jJ72wcghdRIlENfvALcyODhNoGE5j75cYHdC+aQMh6cU/P86tiiXTp9XYZct1UxUMo/4+BgQRyNZEGx0KWGS+g== dependencies: clone-deep "^4.0.1" find-cache-dir "^2.0.0" @@ -2452,7 +2498,6 @@ "@babel/template@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155" - integrity sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w== dependencies: "@babel/code-frame" "^7.16.7" "@babel/parser" "^7.16.7" @@ -2486,10 +2531,54 @@ globals "^11.1.0" lodash "^4.17.19" -"@babel/traverse@^7.16.10", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8", "@babel/traverse@^7.7.0": +"@babel/traverse@^7.16.10": + version "7.16.10" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.16.10.tgz#448f940defbe95b5a8029975b051f75993e8239f" + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.16.8" + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-hoist-variables" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/parser" "^7.16.10" + "@babel/types" "^7.16.8" + debug "^4.1.0" + globals "^11.1.0" + +"@babel/traverse@^7.16.7": + version "7.16.10" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.16.10.tgz#448f940defbe95b5a8029975b051f75993e8239f" + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.16.8" + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-hoist-variables" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/parser" "^7.16.10" + "@babel/types" "^7.16.8" + debug "^4.1.0" + globals "^11.1.0" + +"@babel/traverse@^7.16.8": + version "7.16.10" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.16.10.tgz#448f940defbe95b5a8029975b051f75993e8239f" + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.16.8" + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-hoist-variables" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/parser" "^7.16.10" + "@babel/types" "^7.16.8" + debug "^4.1.0" + globals "^11.1.0" + +"@babel/traverse@^7.7.0": version "7.16.10" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.16.10.tgz#448f940defbe95b5a8029975b051f75993e8239f" - integrity sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw== dependencies: "@babel/code-frame" "^7.16.7" "@babel/generator" "^7.16.8" @@ -2517,10 +2606,23 @@ lodash "^4.17.19" to-fast-properties "^2.0.0" -"@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.7.0": +"@babel/types@^7.16.7": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.16.8.tgz#0ba5da91dd71e0a4e7781a30f22770831062e3c1" + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + to-fast-properties "^2.0.0" + +"@babel/types@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.16.8.tgz#0ba5da91dd71e0a4e7781a30f22770831062e3c1" + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + to-fast-properties "^2.0.0" + +"@babel/types@^7.7.0": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.16.8.tgz#0ba5da91dd71e0a4e7781a30f22770831062e3c1" - integrity sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg== dependencies: "@babel/helper-validator-identifier" "^7.16.7" to-fast-properties "^2.0.0" @@ -2549,12 +2651,10 @@ "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" - integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg== "@cspotcode/source-map-support@0.7.0": version "0.7.0" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz#4789840aa859e46d2f3173727ab707c66bf344f5" - integrity sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA== dependencies: "@cspotcode/source-map-consumer" "0.8.0" @@ -2705,7 +2805,6 @@ "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" - integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw== dependencies: ajv "^6.12.4" debug "^4.1.1" @@ -2720,7 +2819,6 @@ "@humanwhocodes/config-array@^0.5.0": version "0.5.0" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" - integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg== dependencies: "@humanwhocodes/object-schema" "^1.2.0" debug "^4.1.1" @@ -2729,7 +2827,6 @@ "@humanwhocodes/object-schema@^1.2.0": version "1.2.1" resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" - integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== "@icons/material@^0.2.4": version "0.2.4" @@ -3273,7 +3370,6 @@ dependencies: "@storybook/client-logger" "5.3.14" "@storybook/theming" "5.3.14" - "@types/react-syntax-highlighter" "11.0.2" "@types/react-textarea-autosize" "^4.3.3" core-js "^3.0.1" global "^4.3.2" @@ -3387,7 +3483,6 @@ version "5.3.14" resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.3.14.tgz#5e4e02585b37754bbebb8810ffb17c8ce706a1f8" dependencies: - "@types/npmlog" "^4.1.2" chalk "^3.0.0" core-js "^3.0.1" npmlog "^4.1.2" @@ -3610,7 +3705,6 @@ dependencies: "@babel/code-frame" "^7.10.4" "@babel/runtime" "^7.12.5" - "@types/aria-query" "^4.2.0" aria-query "^5.0.0" chalk "^4.1.0" dom-accessibility-api "^0.5.9" @@ -3703,14 +3797,12 @@ "@ts-morph/bootstrap@^0.9.1": version "0.9.1" resolved "https://registry.yarnpkg.com/@ts-morph/bootstrap/-/bootstrap-0.9.1.tgz#4761cac8d9e5c7d2d7cdb120f6dda027c2b831cd" - integrity sha512-u3F2vhLm48e6lZUIf9Gj41OXCzAr62avbWdlMZ9K1JCH//XuAgr2u3c+2usGOOIXBaP83LshBTzDgw/tb9tSzg== dependencies: "@ts-morph/common" "~0.9.0" "@ts-morph/common@~0.9.0": version "0.9.2" resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.9.2.tgz#fc63ed4f8d3a45e4ed6849fe20a57f4f2baecc5d" - integrity sha512-IPyg+c3Am0EBoa63W0f/AKeLrJhvzMzQ4BIvD1baxLopmiHOj1HFTXYxC6e8iTZ+UYtN+/WFM9UyGRnoA20b8g== dependencies: fast-glob "^3.2.5" minimatch "^3.0.4" @@ -3720,27 +3812,22 @@ "@tsconfig/node10@^1.0.7": version "1.0.8" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" - integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg== "@tsconfig/node12@^1.0.7": version "1.0.9" resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c" - integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw== "@tsconfig/node14@^1.0.0": version "1.0.1" resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" - integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== "@tsconfig/node16@^1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" - integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== "@types/aes-js@^3.1.1": version "3.1.1" resolved "https://registry.yarnpkg.com/@types/aes-js/-/aes-js-3.1.1.tgz#34b3978122310c135de4b377270d1d65676fae28" - integrity sha512-SDSGgXT3LRCH6qMWk8OHT1vLSVNuHNvCpKCx2/TYtQMbMGGgxJC9fspwSkQjqzRagrWnCrxuLL3jMNXLXHHvSw== "@types/anymatch@*": version "1.3.1" @@ -3817,7 +3904,7 @@ version "3.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" dependencies: - "@types/istanbul-lib-report" "*" + "@types/jest@*": version "27.0.3" @@ -3885,7 +3972,6 @@ "@types/node@^17.0.13": version "17.0.13" resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.13.tgz#5ed7ed7c662948335fcad6c412bb42d99ea754e3" - integrity sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -3918,7 +4004,6 @@ "@types/qrcode.react@^1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@types/qrcode.react/-/qrcode.react-1.0.2.tgz#f892432cc41b5dac52e3ca8873b717c8bfea6002" - integrity sha512-I9Oq5Cjlkgy3Tw7krCnCXLw2/zMhizkTere49OOcta23tkvH0xBTP0yInimTh0gstLRtb8Ki9NZVujE5UI6ffQ== dependencies: "@types/react" "*" @@ -3934,12 +4019,10 @@ resolved "https://registry.yarnpkg.com/@types/react-color/-/react-color-3.0.4.tgz#c63daf012ad067ac0127bdd86725f079d02082bd" dependencies: "@types/react" "*" - "@types/reactcss" "*" "@types/react-svg-inline@^2.1.3": version "2.1.3" resolved "https://registry.yarnpkg.com/@types/react-svg-inline/-/react-svg-inline-2.1.3.tgz#e76f2141de6a92c66597b81475255d86efd99d76" - integrity sha512-scD7jZaLmLrjwnHzfKdYG3omgETHMh3WKYqkNpLP8peBaviBIcdhvWWQFv/0jQOenB4U8ncKD5l8cL6gb4ZKxQ== dependencies: "@types/react" "*" @@ -3959,7 +4042,6 @@ "@types/react@^17.0.38": version "17.0.38" resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.38.tgz#f24249fefd89357d5fa71f739a686b8d7c7202bd" - integrity sha512-SI92X1IA+FMnP3qM5m4QReluXzhcmovhZnLNm3pyeQlooi02qI7sLiepEYqT678uNiyc25XfCqxREFpy3W7YhQ== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" @@ -3974,7 +4056,6 @@ "@types/scheduler@*": version "0.16.2" resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" - integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew== "@types/source-list-map@*": version "0.1.2" @@ -4017,7 +4098,6 @@ "@types/anymatch" "*" "@types/node" "*" "@types/tapable" "*" - "@types/uglify-js" "*" "@types/webpack-sources" "*" source-map "^0.6.0" @@ -4056,7 +4136,6 @@ "@typescript-eslint/eslint-plugin@^5.10.1": version "5.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.1.tgz#870195d0f2146b36d11fc71131b75aba52354c69" - integrity sha512-xN3CYqFlyE/qOcy978/L0xLR2HlcAGIyIK5sMOasxaaAPfQRj/MmMV6OC3I7NZO84oEUdWCOju34Z9W8E0pFDQ== dependencies: "@typescript-eslint/scope-manager" "5.10.1" "@typescript-eslint/type-utils" "5.10.1" @@ -4082,7 +4161,6 @@ "@typescript-eslint/parser@^5.10.1": version "5.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.10.1.tgz#4ce9633cc33fc70bc13786cb793c1a76fe5ad6bd" - integrity sha512-GReo3tjNBwR5RnRO0K2wDIDN31cM3MmDtgyQ85oAxAmC5K3j/g85IjP+cDfcqDsDDBf1HNKQAD0WqOYL8jXqUA== dependencies: "@typescript-eslint/scope-manager" "5.10.1" "@typescript-eslint/types" "5.10.1" @@ -4099,7 +4177,6 @@ "@typescript-eslint/scope-manager@5.10.1": version "5.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.10.1.tgz#f0539c73804d2423506db2475352a4dec36cd809" - integrity sha512-Lyvi559Gvpn94k7+ElXNMEnXu/iundV5uFmCUNnftbFrUbAJ1WBoaGgkbOBm07jVZa682oaBU37ao/NGGX4ZDg== dependencies: "@typescript-eslint/types" "5.10.1" "@typescript-eslint/visitor-keys" "5.10.1" @@ -4107,7 +4184,6 @@ "@typescript-eslint/type-utils@5.10.1": version "5.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.10.1.tgz#5e526c00142585e40ab1503e83f1ff608c367405" - integrity sha512-AfVJkV8uck/UIoDqhu+ptEdBoQATON9GXnhOpPLzkQRJcSChkvD//qsz9JVffl2goxX+ybs5klvacE9vmrQyCw== dependencies: "@typescript-eslint/utils" "5.10.1" debug "^4.3.2" @@ -4120,7 +4196,6 @@ "@typescript-eslint/types@5.10.1": version "5.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.1.tgz#dca9bd4cb8c067fc85304a31f38ec4766ba2d1ea" - integrity sha512-ZvxQ2QMy49bIIBpTqFiOenucqUyjTQ0WNLhBM6X1fh1NNlYAC6Kxsx8bRTY3jdYsYg44a0Z/uEgQkohbR0H87Q== "@typescript-eslint/typescript-estree@4.33.0": version "4.33.0" @@ -4137,7 +4212,6 @@ "@typescript-eslint/typescript-estree@5.10.1": version "5.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.1.tgz#b268e67be0553f8790ba3fe87113282977adda15" - integrity sha512-PwIGnH7jIueXv4opcwEbVGDATjGPO1dx9RkUl5LlHDSe+FXxPwFL5W/qYd5/NHr7f6lo/vvTrAzd0KlQtRusJQ== dependencies: "@typescript-eslint/types" "5.10.1" "@typescript-eslint/visitor-keys" "5.10.1" @@ -4150,7 +4224,6 @@ "@typescript-eslint/utils@5.10.1": version "5.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.10.1.tgz#fa682a33af47080ba2c4368ee0ad2128213a1196" - integrity sha512-RRmlITiUbLuTRtn/gcPRi4202niF+q7ylFLCKu4c+O/PcpRvZ/nAUwQ2G00bZgpWkhrNLNnvhZLbDn8Ml0qsQw== dependencies: "@types/json-schema" "^7.0.9" "@typescript-eslint/scope-manager" "5.10.1" @@ -4169,7 +4242,6 @@ "@typescript-eslint/visitor-keys@5.10.1": version "5.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.1.tgz#29102de692f59d7d34ecc457ed59ab5fc558010b" - integrity sha512-NjQ0Xinhy9IL979tpoTRuLKxMc0zJC7QVSdeerXs2/QvOy2yRkzX5dRb10X5woNUdJgU8G3nYRDlI33sq1K4YQ== dependencies: "@typescript-eslint/types" "5.10.1" eslint-visitor-keys "^3.0.0" @@ -4419,7 +4491,6 @@ acorn-jsx@^5.2.0: acorn-jsx@^5.3.1: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" - integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-node@^1.3.0: version "1.8.2" @@ -4436,7 +4507,6 @@ acorn-walk@^7.0.0, acorn-walk@^7.1.1: acorn-walk@^8.1.1: version "8.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" - integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== acorn@6.4.2, acorn@^4.0.4, acorn@^6.4.1, acorn@^7.0.0, acorn@^7.1.1, acorn@^7.4.0, acorn@^8.2.4, acorn@^8.4.1: version "6.4.2" @@ -4528,7 +4598,6 @@ ajv@^8.0.0: ajv@^8.0.1: version "8.9.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.9.0.tgz#738019146638824dea25edcf299dcba1b0e7eb18" - integrity sha512-qOKJyNj/h+OWx7s5DePL6Zu1KeM9jPZhwBqs+7DzP6bGOvqzVCSf0xueYmVuaC/oQ/VtS2zLMLHdQFbkka+XDQ== dependencies: fast-deep-equal "^3.1.1" json-schema-traverse "^1.0.0" @@ -4747,7 +4816,6 @@ are-we-there-yet@~1.1.2: arg@^4.1.0: version "4.1.3" resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" - integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== argparse@^1.0.7: version "1.0.10" @@ -5023,12 +5091,10 @@ ast-types@0.11.3: ast-types@0.11.7: version "0.11.7" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.7.tgz#f318bf44e339db6a320be0009ded64ec1471f46c" - integrity sha512-2mP3TwtkY/aTv5X3ZsMpNAbOnyoC/aMJwJSoaELPkHId0nSQgFcnU4dRW3isxiz7+zBexk0ym3WNVjMiQBnJSw== ast-types@0.14.2: version "0.14.2" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.14.2.tgz#600b882df8583e3cd4f2df5fa20fa83759d4bdfd" - integrity sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA== dependencies: tslib "^2.0.1" @@ -5195,12 +5261,10 @@ babel-core@^6.0.0, babel-core@^6.26.0: babel-core@^7.0.0-bridge.0: version "7.0.0-bridge.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" - integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== babel-eslint@^10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" - integrity sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg== dependencies: "@babel/code-frame" "^7.0.0" "@babel/parser" "^7.7.0" @@ -5445,7 +5509,6 @@ babel-plugin-polyfill-corejs3@^0.4.0: babel-plugin-polyfill-corejs3@^0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.1.tgz#d66183bf10976ea677f4149a7fcc4d8df43d4060" - integrity sha512-TihqEe4sQcb/QcPJvxe94/9RZuLQuF1+To4WqQcRvc+3J3gLCPIPgDKzGLG6zmQLfH3nn25heRuDNkS2KR4I8A== dependencies: "@babel/helper-define-polyfill-provider" "^0.3.1" core-js-compat "^3.20.0" @@ -6043,7 +6106,6 @@ browserslist@^4.17.5, browserslist@^4.18.1: browserslist@^4.19.1: version "4.19.1" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.19.1.tgz#4ac0435b35ab655896c31d53018b6dd5e9e4c9a3" - integrity sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A== dependencies: caniuse-lite "^1.0.30001286" electron-to-chromium "^1.4.17" @@ -6360,7 +6422,6 @@ caniuse-lite@^1.0.30001280: caniuse-lite@^1.0.30001286: version "1.0.30001304" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001304.tgz#38af55ed3fc8220cb13e35e6e7309c8c65a05559" - integrity sha512-bdsfZd6K6ap87AGqSHJP/s1V+U6Z5lyrcbBu3ovbCCf8cSYpwTtGrCBObMpJqwxfTbLW6YTIdbb1jEeTelcpYQ== capture-exit@^2.0.0: version "2.0.0" @@ -6744,7 +6805,6 @@ clone-deep@^2.0.1: clone-deep@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" - integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== dependencies: is-plain-object "^2.0.4" kind-of "^6.0.2" @@ -7086,10 +7146,16 @@ core-js-compat@^3.18.0, core-js-compat@^3.19.1: browserslist "^4.18.1" semver "7.0.0" -core-js-compat@^3.20.0, core-js-compat@^3.20.2: +core-js-compat@^3.20.0: + version "3.20.3" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.20.3.tgz#d71f85f94eb5e4bea3407412e549daa083d23bd6" + dependencies: + browserslist "^4.19.1" + semver "7.0.0" + +core-js-compat@^3.20.2: version "3.20.3" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.20.3.tgz#d71f85f94eb5e4bea3407412e549daa083d23bd6" - integrity sha512-c8M5h0IkNZ+I92QhIpuSijOxGAcj3lgpsWdkCqmUTZNwidujF4r3pi6x1DCN+Vcs5qTS2XWWMfWSuCqyupX8gw== dependencies: browserslist "^4.19.1" semver "7.0.0" @@ -7145,7 +7211,6 @@ cosmiconfig@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982" dependencies: - "@types/parse-json" "^4.0.0" import-fresh "^3.1.0" parse-json "^5.0.0" path-type "^4.0.0" @@ -7155,7 +7220,6 @@ cosmiconfig@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3" dependencies: - "@types/parse-json" "^4.0.0" import-fresh "^3.2.1" parse-json "^5.0.0" path-type "^4.0.0" @@ -7219,7 +7283,6 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: create-jest-runner@^0.5.3: version "0.5.3" resolved "https://registry.yarnpkg.com/create-jest-runner/-/create-jest-runner-0.5.3.tgz#1387e2ce70b08e4c989ae55f677005b64f9ba97b" - integrity sha512-a9VY2doMBmzRollJB3Ft3/Y5fBceSWJ4gdyVsg4/d7nP1S4715VG939s2VnITDj79YBmRgKhjGjNRv1c+Kre1g== dependencies: chalk "^2.4.2" jest-worker "^24.0.0" @@ -7242,7 +7305,6 @@ create-react-context@0.3.0, create-react-context@^0.3.0: create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" - integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== cross-env@7.0.2: version "7.0.2" @@ -8325,7 +8387,6 @@ electron-to-chromium@^1.3.896: electron-to-chromium@^1.4.17: version "1.4.57" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.57.tgz#2b2766df76ac8dbc0a1d41249bc5684a31849892" - integrity sha512-FNC+P5K1n6pF+M0zIK+gFCoXcJhhzDViL3DRIGy2Fv5PohuSES1JHR7T+GlwxSxlzx4yYbsuzCZvHxcBSRCIOw== electron@13.6.3: version "13.6.3" @@ -8863,7 +8924,6 @@ eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0: eslint-visitor-keys@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz#6fbb166a6798ee5991358bc2daa1ba76cc1254a1" - integrity sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ== eslint@7.10.0: version "7.10.0" @@ -8910,7 +8970,6 @@ eslint@7.10.0: eslint@^7.14.0: version "7.32.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" - integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== dependencies: "@babel/code-frame" "7.12.11" "@eslint/eslintrc" "^0.4.3" @@ -8968,7 +9027,6 @@ espree@^7.3.0: espree@^7.3.1: version "7.3.1" resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" - integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== dependencies: acorn "^7.4.0" acorn-jsx "^5.3.1" @@ -8995,7 +9053,6 @@ esquery@^1.2.0: esquery@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" - integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== dependencies: estraverse "^5.1.0" @@ -9322,10 +9379,19 @@ fast-glob@^3.1.1, fast-glob@^3.2.4: micromatch "^4.0.2" picomatch "^2.2.1" -fast-glob@^3.2.5, fast-glob@^3.2.9: +fast-glob@^3.2.5: + version "3.2.11" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-glob@^3.2.9: version "3.2.11" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" - integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" @@ -9462,7 +9528,6 @@ file-entry-cache@^5.0.1: file-entry-cache@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" - integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: flat-cache "^3.0.4" @@ -9673,7 +9738,6 @@ flat-cache@^2.0.1: flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" - integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== dependencies: flatted "^3.1.0" rimraf "^3.0.2" @@ -9685,7 +9749,6 @@ flatted@^2.0.0: flatted@^3.1.0: version "3.2.5" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3" - integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== flora-colossus@^1.0.0: version "1.0.1" @@ -9701,7 +9764,6 @@ flow-bin@0.119.1: flow-parser@0.*: version "0.170.0" resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.170.0.tgz#52cac19fd884c41894f39368bdf384183a597b3b" - integrity sha512-H1Fu8EM/F6MtOpHYpsFXPyySatowrXMWENxRmmKAfirfBr8kjHrms3YDuv82Nhn0xWaXV7Hhynp2tEaZsLhHLw== flow-remove-types@^1.2.1: version "1.2.3" @@ -10315,10 +10377,15 @@ globals@^12.1.0: dependencies: type-fest "^0.8.1" -globals@^13.6.0, globals@^13.9.0: +globals@^13.6.0: + version "13.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.12.0.tgz#4d733760304230a0082ed96e21e5c565f898089e" + dependencies: + type-fest "^0.20.2" + +globals@^13.9.0: version "13.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-13.12.0.tgz#4d733760304230a0082ed96e21e5c565f898089e" - integrity sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg== dependencies: type-fest "^0.20.2" @@ -10369,7 +10436,6 @@ globby@^11.0.3: globby@^11.0.4: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== dependencies: array-union "^2.1.0" dir-glob "^3.0.1" @@ -10867,7 +10933,6 @@ html-webpack-plugin@^4.0.0-beta.2: version "4.5.0" resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.5.0.tgz#625097650886b97ea5dae331c320e3238f6c121c" dependencies: - "@types/html-minifier-terser" "^5.0.0" "@types/tapable" "^1.0.5" "@types/webpack" "^4.41.8" html-minifier-terser "^5.0.1" @@ -11046,7 +11111,6 @@ ignore@^5.1.4, ignore@^5.1.8: ignore@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" - integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== immediate@~3.0.5: version "3.0.6" @@ -11497,7 +11561,6 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: is-glob@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" @@ -12462,7 +12525,6 @@ jest-watcher@^26.6.2: jest-worker@^24.0.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" - integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== dependencies: merge-stream "^2.0.0" supports-color "^6.1.0" @@ -12526,7 +12588,6 @@ jsbn@~0.1.0: jscodeshift@^0.13.0: version "0.13.1" resolved "https://registry.yarnpkg.com/jscodeshift/-/jscodeshift-0.13.1.tgz#69bfe51e54c831296380585c6d9e733512aecdef" - integrity sha512-lGyiEbGOvmMRKgWk4vf+lUrCWO/8YR8sUR3FKF1Cq5fovjZDlIcw3Hu5ppLHAnEXshVffvaM0eyuY/AbOeYpnQ== dependencies: "@babel/core" "^7.13.16" "@babel/parser" "^7.13.16" @@ -12551,7 +12612,6 @@ jscodeshift@^0.13.0: jscodeshift@^0.6.3: version "0.6.4" resolved "https://registry.yarnpkg.com/jscodeshift/-/jscodeshift-0.6.4.tgz#e19ab86214edac86a75c4557fc88b3937d558a8e" - integrity sha512-+NF/tlNbc2WEhXUuc4WEJLsJumF84tnaMUZW2hyJw3jThKKRvsPX4sPJVgO1lPE28z0gNL+gwniLG9d8mYvQCQ== dependencies: "@babel/core" "^7.1.6" "@babel/parser" "^7.1.6" @@ -12681,7 +12741,6 @@ json-schema@0.2.3: json-schema@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.3.0.tgz#90a9c5054bd065422c00241851ce8d59475b701b" - integrity sha512-TYfxx36xfl52Rf1LU9HyWSLGPdYLL+SQ8/E/0yVyKG8wCCDaSrhPap0vEdlsZWRaS6tnKKLPGiEJGiREVC8kxQ== json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" @@ -12716,7 +12775,6 @@ json3@^3.3.2: json5-writer@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/json5-writer/-/json5-writer-0.1.8.tgz#98e1934ef6002f8ac12f36438e2b39c49af213fd" - integrity sha512-h5sqkk/vSKvESOUTBniGWs8p8nTzHsoDrxPS9enJfQVINqXv3lm+FAyizLwbrCwCn0q7NXqDBb+r8AdUdK3XZw== dependencies: jscodeshift "^0.6.3" @@ -13274,7 +13332,6 @@ lodash.toarray@^4.4.0: lodash.truncate@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" - integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= lodash.union@^4.6.0: version "4.6.0" @@ -13304,7 +13361,6 @@ log-symbols@^4.1.0: log-update@^3.3.0: version "3.4.0" resolved "https://registry.yarnpkg.com/log-update/-/log-update-3.4.0.tgz#3b9a71e00ac5b1185cc193a36d654581c48f97b9" - integrity sha512-ILKe88NeMt4gmDvk/eb615U/IVn7K9KWGkoYbdatQ69Z65nj1ZzjM6fHXfcs0Uge+e+EGnMW7DY4T9yko8vWFg== dependencies: ansi-escapes "^3.2.0" cli-cursor "^2.1.0" @@ -13436,7 +13492,6 @@ make-dir@^3.0.0, make-dir@^3.0.2: make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== make-iterator@^1.0.0: version "1.0.1" @@ -13616,7 +13671,6 @@ meow@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/meow/-/meow-7.1.1.tgz#7c01595e3d337fcb0ec4e8eed1666ea95903d306" dependencies: - "@types/minimist" "^1.2.0" camelcase-keys "^6.2.2" decamelize-keys "^1.1.0" hard-rejection "^2.1.0" @@ -13712,7 +13766,6 @@ micromatch@^4.0.2: micromatch@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" - integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== dependencies: braces "^3.0.1" picomatch "^2.2.3" @@ -14893,7 +14946,6 @@ parse-json@^5.0.0: parse-ms@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/parse-ms/-/parse-ms-2.1.0.tgz#348565a753d4391fa524029956b172cb7753097d" - integrity sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA== parse-node-version@^1.0.0: version "1.0.1" @@ -14937,7 +14989,6 @@ path-browserify@0.0.1: path-browserify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" - integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== path-dirname@^1.0.0: version "1.0.2" @@ -15080,7 +15131,6 @@ picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1: picomatch@^2.2.3: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== pify@^2.0.0, pify@^2.3.0: version "2.3.0" @@ -15516,7 +15566,6 @@ pretty-hrtime@^1.0.0, pretty-hrtime@^1.0.3: pretty-ms@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-7.0.1.tgz#7d903eaab281f7d8e03c66f867e239dc32fb73e8" - integrity sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q== dependencies: parse-ms "^2.1.0" @@ -16522,7 +16571,6 @@ recast@^0.14.7: recast@^0.16.1: version "0.16.2" resolved "https://registry.yarnpkg.com/recast/-/recast-0.16.2.tgz#3796ebad5fe49ed85473b479cd6df554ad725dc2" - integrity sha512-O/7qXi51DPjRVdbrpNzoBQH5dnAPQNbfoOFyRiUwreTMJfIHYOEBzwuH+c0+/BTSJ3CQyKs6ILSWXhESH6Op3A== dependencies: ast-types "0.11.7" esprima "~4.0.0" @@ -16532,7 +16580,6 @@ recast@^0.16.1: recast@^0.20.4: version "0.20.5" resolved "https://registry.yarnpkg.com/recast/-/recast-0.20.5.tgz#8e2c6c96827a1b339c634dd232957d230553ceae" - integrity sha512-E5qICoPoNL4yU0H0NoBDntNB0Q5oMSNh9usFctYniLBluTthi3RsQVBXIJNbApOlvSwW/RGxIuokPcAc59J5fQ== dependencies: ast-types "0.14.2" esprima "~4.0.0" @@ -16687,7 +16734,6 @@ regexpp@^3.1.0: regexpp@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" - integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== regexpu-core@^4.7.0: version "4.7.1" @@ -17498,7 +17544,6 @@ shallow-clone@^1.0.0: shallow-clone@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" - integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== dependencies: kind-of "^6.0.2" @@ -18093,7 +18138,6 @@ string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0: string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: emoji-regex "^8.0.0" is-fullwidth-code-point "^3.0.0" @@ -18205,7 +18249,6 @@ strip-ansi@^6.0.0: strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: ansi-regex "^5.0.1" @@ -18463,7 +18506,6 @@ table@^6.0.1: table@^6.0.9: version "6.8.0" resolved "https://registry.yarnpkg.com/table/-/table-6.8.0.tgz#87e28f14fa4321c3377ba286f07b79b281a3b3ca" - integrity sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA== dependencies: ajv "^8.0.1" lodash.truncate "^4.4.2" @@ -18547,10 +18589,15 @@ telejson@^3.2.0: lodash "^4.17.15" memoizerific "^1.11.3" -temp@^0.8.1, temp@^0.8.4: +temp@^0.8.1: + version "0.8.4" + resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.4.tgz#8c97a33a4770072e0a05f919396c7665a7dd59f2" + dependencies: + rimraf "~2.6.2" + +temp@^0.8.4: version "0.8.4" resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.4.tgz#8c97a33a4770072e0a05f919396c7665a7dd59f2" - integrity sha512-s0ZZzd0BzYv5tLSptZooSjK8oj6C+c19p7Vqta9+6NPOf7r+fxq0cJe6/oN4LTC79sy5NY8ucOJNgwsKCSbfqg== dependencies: rimraf "~2.6.2" @@ -18650,7 +18697,6 @@ throat@^3.0.0: throat@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" - integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= throat@^5.0.0: version "5.0.0" @@ -18984,7 +19030,6 @@ ts-essentials@^2.0.3: ts-migrate-plugins@^0.1.27: version "0.1.27" resolved "https://registry.yarnpkg.com/ts-migrate-plugins/-/ts-migrate-plugins-0.1.27.tgz#e7244d1d56661e51b07258944cede065bd0605f4" - integrity sha512-+pDSRA2lCS7k0wvSB0oDDO+FMqGrsXMKkYYAvK2HuLpzsO1EwVZ5mPjZpidr2yCfXOxkkT87zjiBf7uEXqfB0w== dependencies: eslint "^7.14.0" jscodeshift "^0.13.0" @@ -18994,7 +19039,6 @@ ts-migrate-plugins@^0.1.27: ts-migrate-server@^0.1.27: version "0.1.27" resolved "https://registry.yarnpkg.com/ts-migrate-server/-/ts-migrate-server-0.1.27.tgz#daa95b01634a651f4dd5ff90d35b93791e564905" - integrity sha512-sDcrBx2oUL/Ycs3YNwqMz5KxPtNjwMIDGpVbvuxDkVXDG+ly4tyF+tc5byQzKpVGx2mI+ccxrX8VG74wICTJlg== dependencies: "@ts-morph/bootstrap" "^0.9.1" pretty-ms "^7.0.1" @@ -19003,7 +19047,6 @@ ts-migrate-server@^0.1.27: ts-migrate@^0.1.27: version "0.1.27" resolved "https://registry.yarnpkg.com/ts-migrate/-/ts-migrate-0.1.27.tgz#4b21f6eedcb33734579afd29df781cab994387c0" - integrity sha512-nwZwLfCX635Fiaw5JKB0bQjNvbLfeA+010+n00KnIu5/I9s8CbypJ6b49wFyTdZCnIYklh8n/JxcTQIodTHAqQ== dependencies: create-jest-runner "^0.5.3" json5 "^2.1.1" @@ -19016,7 +19059,6 @@ ts-migrate@^0.1.27: ts-node@^10.4.0: version "10.4.0" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.4.0.tgz#680f88945885f4e6cf450e7f0d6223dd404895f7" - integrity sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A== dependencies: "@cspotcode/source-map-support" "0.7.0" "@tsconfig/node10" "^1.0.7" @@ -19170,7 +19212,6 @@ typeforce@^1.18.0: typescript@^4.5.5: version "4.5.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" - integrity sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA== ua-parser-js@^0.7.18: version "0.7.27" @@ -19480,7 +19521,6 @@ upath@^1.1.1: updatable-log@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/updatable-log/-/updatable-log-0.2.0.tgz#8adfe35dd744bd87e8bf217425e4e8bb81b6f3c6" - integrity sha512-gR48/mTR6YFB+B1sNoap3nx8HFbEvDl0ej9KhlQTFZdmP8yL5fzFiCUfeHCUf1QvNnXowY1pM9iiGkPKrd0XyQ== dependencies: chalk "^2.4.2" figures "^3.0.0" @@ -20235,7 +20275,6 @@ wrappy@1: write-file-atomic@^2.3.0: version "2.4.3" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" - integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== dependencies: graceful-fs "^4.1.11" imurmurhash "^0.1.4" @@ -20414,7 +20453,6 @@ yauzl@^2.10.0: yn@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" - integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== zip-stream@^2.1.2: version "2.1.3" From aa50b820a60babdeced70a52047afb48c74c4dba Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:48:38 +0000 Subject: [PATCH 19/42] [DDW-827] renamed file extensions --- ...llets-actions.js.ts => wallets-actions.ts} | 0 source/renderer/app/api/{api.js.ts => api.ts} | 0 source/renderer/app/api/errors.js.ts | 102 ------------------ .../transactions/{types.js.ts => types.ts} | 0 ...iHelpers.spec.js.ts => apiHelpers.spec.ts} | 0 .../utils/{apiHelpers.js.ts => apiHelpers.ts} | 0 ...=> WalletSendAssetsConfirmationDialog.tsx} | 0 ...s.tsx => WalletSendConfirmationDialog.tsx} | 0 .../{WalletsStore.js.ts => WalletsStore.ts} | 0 9 files changed, 102 deletions(-) rename source/renderer/app/actions/{wallets-actions.js.ts => wallets-actions.ts} (100%) rename source/renderer/app/api/{api.js.ts => api.ts} (100%) delete mode 100644 source/renderer/app/api/errors.js.ts rename source/renderer/app/api/transactions/{types.js.ts => types.ts} (100%) rename source/renderer/app/api/utils/{apiHelpers.spec.js.ts => apiHelpers.spec.ts} (100%) rename source/renderer/app/api/utils/{apiHelpers.js.ts => apiHelpers.ts} (100%) rename source/renderer/app/components/wallet/send-form/{WalletSendAssetsConfirmationDialog.js.tsx => WalletSendAssetsConfirmationDialog.tsx} (100%) rename source/renderer/app/components/wallet/send-form/{WalletSendConfirmationDialog.js.tsx => WalletSendConfirmationDialog.tsx} (100%) rename source/renderer/app/stores/{WalletsStore.js.ts => WalletsStore.ts} (100%) diff --git a/source/renderer/app/actions/wallets-actions.js.ts b/source/renderer/app/actions/wallets-actions.ts similarity index 100% rename from source/renderer/app/actions/wallets-actions.js.ts rename to source/renderer/app/actions/wallets-actions.ts diff --git a/source/renderer/app/api/api.js.ts b/source/renderer/app/api/api.ts similarity index 100% rename from source/renderer/app/api/api.js.ts rename to source/renderer/app/api/api.ts diff --git a/source/renderer/app/api/errors.js.ts b/source/renderer/app/api/errors.js.ts deleted file mode 100644 index c2313afeba..0000000000 --- a/source/renderer/app/api/errors.js.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { defineMessages } from "react-intl"; - -export const messages = defineMessages({ - // common - wrongEncryptionPassphrase: { - id: 'api.errors.IncorrectPasswordError', - defaultMessage: '!!!Incorrect wallet password.', - description: '"Incorrect wallet password." error message.' - }, - // wallets - walletAlreadyExists: { - id: 'api.errors.WalletAlreadyRestoredError', - defaultMessage: '!!!Wallet you are trying to restore already exists.', - description: '"Wallet you are trying to restore already exists." error message.' - }, - forbiddenMnemonic: { - id: 'api.errors.ForbiddenMnemonicError', - defaultMessage: '!!!Invalid recovery phrase. Submitted recovery phrase is one of the example recovery phrases from the documentation and should not be used for wallets holding funds.', - description: '"Forbidden Mnemonic: an example Mnemonic has been submitted." error message' - }, - walletAlreadyImported: { - id: 'api.errors.WalletAlreadyImportedError', - defaultMessage: '!!!Wallet you are trying to import already exists.', - description: '"Wallet you are trying to import already exists." error message.' - }, - walletFileImportError: { - id: 'api.errors.WalletFileImportError', - defaultMessage: '!!!Wallet could not be imported, please make sure you are providing a correct file.', - description: '"Wallet could not be imported, please make sure you are providing a correct file." error message.' - }, - invalidMnemonic: { - id: 'global.errors.invalidMnemonic', - defaultMessage: '!!!Invalid phrase entered, please check.', - description: 'Error message shown when invalid bip39 mnemonic was entered.' - }, - // transactions - notEnoughMoney: { - id: 'api.errors.NotEnoughMoneyToSendError', - defaultMessage: '!!!Not enough money to make this transaction.', - description: '"Not enough money to make this transaction." error message.' - }, - canNotCalculateTransactionFees: { - id: 'api.errors.CanNotCalculateTransactionFeesError', - defaultMessage: '!!!Cannot calculate fees while there are pending transactions.', - description: '"Cannot calculate fees while there are pending transactions." error message' - }, - cannotCoverFee: { - id: 'api.errors.NotEnoughFundsForTransactionFeesError', - defaultMessage: '!!!Not enough ada for fees. Try sending a smaller amount.', - description: '"Not enough ada for fees. Try sending a smaller amount." error message' - }, - inputsDepleted: { - id: 'api.errors.inputsDepleted', - defaultMessage: '!!!Your wallet contains only reward funds. Please send at least one ADA to your wallet so that you can spend the funds.', - description: '"Your wallet contains only reward funds. Please send at least one ADA to your wallet so that you can spend the funds." error message' - }, - transactionIsTooBig: { - id: 'api.errors.TooBigTransactionError', - defaultMessage: '!!!Transaction too big due to too many inputs.', - description: '"Transaction too big due to too many inputs." error message.' - }, - notEnoughFundsForTransaction: { - id: 'api.errors.NotEnoughFundsForTransactionError', - defaultMessage: '!!!Not enough ada. Try sending a smaller amount.', - description: '"Not enough ada . Try sending a smaller amount." error message' - }, - invalidAddress: { - id: 'api.errors.invalidAddress', - defaultMessage: '!!!Please enter a valid address.', - description: 'Error message shown when invalid address was entered.' - }, - tooBigTransactionErrorLinkLabel: { - id: 'api.errors.TooBigTransactionErrorLinkLabel', - defaultMessage: '!!!Learn more.', - description: '"Transaction too big due to too many inputs." error link label.' - }, - tooBigTransactionErrorLinkURL: { - id: 'api.errors.TooBigTransactionErrorLinkURL', - defaultMessage: '!!!https://iohk.zendesk.com/hc/en-us/articles/360017733353', - description: '"Transaction too big due to too many inputs." error link URL.' - }, - utxoTooSmall: { - id: 'api.errors.utxoTooSmall', - defaultMessage: '!!!Invalid transaction.', - description: '"Invalid transaction." error message' - }, - nothingToMigrate: { - id: 'api.errors.nothingToMigrate', - defaultMessage: '!!!Funds cannot be transferred from this wallet because it contains some unspent transaction outputs (UTXOs), with amounts of ada that are too small to be migrated.', - description: '"Funds cannot be transferred from this wallet because it contains some unspent transaction outputs (UTXOs), with amounts of ada that are too small to be migrated." error message' - }, - invalidSmashServer: { - id: 'api.errors.invalidSmashServer', - defaultMessage: '!!!This URL is not a valid SMASH server', - description: '"This URL is not a valid SMASH server" error message' - }, - cannotLeaveWalletEmpty: { - id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', - defaultMessage: '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', - description: '"Balance after transaction would not leave enough ada in the wallet to support tokens remaining in wallet' - } -}); \ No newline at end of file diff --git a/source/renderer/app/api/transactions/types.js.ts b/source/renderer/app/api/transactions/types.ts similarity index 100% rename from source/renderer/app/api/transactions/types.js.ts rename to source/renderer/app/api/transactions/types.ts diff --git a/source/renderer/app/api/utils/apiHelpers.spec.js.ts b/source/renderer/app/api/utils/apiHelpers.spec.ts similarity index 100% rename from source/renderer/app/api/utils/apiHelpers.spec.js.ts rename to source/renderer/app/api/utils/apiHelpers.spec.ts diff --git a/source/renderer/app/api/utils/apiHelpers.js.ts b/source/renderer/app/api/utils/apiHelpers.ts similarity index 100% rename from source/renderer/app/api/utils/apiHelpers.js.ts rename to source/renderer/app/api/utils/apiHelpers.ts diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx similarity index 100% rename from source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.js.tsx rename to source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx similarity index 100% rename from source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.js.tsx rename to source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx diff --git a/source/renderer/app/stores/WalletsStore.js.ts b/source/renderer/app/stores/WalletsStore.ts similarity index 100% rename from source/renderer/app/stores/WalletsStore.js.ts rename to source/renderer/app/stores/WalletsStore.ts From d29df47076668e16a618d2ebe7adfd8c71956d45 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:51:36 +0000 Subject: [PATCH 20/42] [DDW-827] added ts extensions to prettierignore --- .prettierignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.prettierignore b/.prettierignore index cd386dc5fa..523aeda201 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,6 +11,8 @@ # But not these file types !*.js +!*.ts +!*.tsx !*.scss !*.json From c1f1b73bd5bb1ce2d24a61ab9689b5483723fe7c Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 09:53:48 +0000 Subject: [PATCH 21/42] [DDW-827] Formatted files --- .../renderer/app/actions/wallets-actions.ts | 17 +- source/renderer/app/api/api.ts | 2795 ++++++++++------- source/renderer/app/api/transactions/types.ts | 74 +- .../renderer/app/api/utils/apiHelpers.spec.ts | 67 +- source/renderer/app/api/utils/apiHelpers.ts | 43 +- .../WalletSendAssetsConfirmationDialog.tsx | 415 ++- .../WalletSendConfirmationDialog.tsx | 296 +- source/renderer/app/stores/WalletsStore.ts | 790 +++-- 8 files changed, 2614 insertions(+), 1883 deletions(-) diff --git a/source/renderer/app/actions/wallets-actions.ts b/source/renderer/app/actions/wallets-actions.ts index 1419ddadd5..2fd15f18ce 100644 --- a/source/renderer/app/actions/wallets-actions.ts +++ b/source/renderer/app/actions/wallets-actions.ts @@ -1,9 +1,12 @@ -import Action from "./lib/Action"; -import type { WalletExportTypeChoices } from "../types/walletExportTypes"; -import type { TransportDevice, HardwareWalletExtendedPublicKeyResponse } from "../../../common/types/hardware-wallets.types"; -import type { CsvFileContent } from "../../../common/types/csv-request.types"; -import type { QuitStakePoolRequest } from "../api/staking/types"; -import type { AssetToken } from "../api/assets/types"; +import Action from './lib/Action'; +import type { WalletExportTypeChoices } from '../types/walletExportTypes'; +import type { + TransportDevice, + HardwareWalletExtendedPublicKeyResponse, +} from '../../../common/types/hardware-wallets.types'; +import type { CsvFileContent } from '../../../common/types/csv-request.types'; +import type { QuitStakePoolRequest } from '../api/staking/types'; +import type { AssetToken } from '../api/assets/types'; export type WalletImportFromFileParams = { filePath: string; @@ -135,4 +138,4 @@ export default class WalletsActions { extendedPublicKey: HardwareWalletExtendedPublicKeyResponse; device: TransportDevice; }> = new Action(); -} \ No newline at end of file +} diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index ac1a19ee49..24ee43de32 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -1,124 +1,232 @@ -import { split, get, map, last, size, concat, flatten } from "lodash"; -import { action } from "mobx"; -import BigNumber from "bignumber.js"; -import moment from "moment"; +import { split, get, map, last, size, concat, flatten } from 'lodash'; +import { action } from 'mobx'; +import BigNumber from 'bignumber.js'; +import moment from 'moment'; // domains -import Wallet, { WalletDelegationStatuses, WalletUnits } from "../domains/Wallet"; -import { WalletTransaction, TransactionTypes, TransactionStates, TransactionWithdrawal } from "../domains/WalletTransaction"; -import WalletAddress from "../domains/WalletAddress"; +import Wallet, { + WalletDelegationStatuses, + WalletUnits, +} from '../domains/Wallet'; +import { + WalletTransaction, + TransactionTypes, + TransactionStates, + TransactionWithdrawal, +} from '../domains/WalletTransaction'; +import WalletAddress from '../domains/WalletAddress'; // Addresses requests -import { getAddresses } from "./addresses/requests/getAddresses"; -import { getByronWalletAddresses } from "./addresses/requests/getByronWalletAddresses"; -import { createByronWalletAddress } from "./addresses/requests/createByronWalletAddress"; -import { constructAddress } from "./addresses/requests/constructAddress"; -import { inspectAddress } from "./addresses/requests/inspectAddress"; +import { getAddresses } from './addresses/requests/getAddresses'; +import { getByronWalletAddresses } from './addresses/requests/getByronWalletAddresses'; +import { createByronWalletAddress } from './addresses/requests/createByronWalletAddress'; +import { constructAddress } from './addresses/requests/constructAddress'; +import { inspectAddress } from './addresses/requests/inspectAddress'; // Network requests -import { getNetworkInfo } from "./network/requests/getNetworkInfo"; -import { getNetworkClock } from "./network/requests/getNetworkClock"; -import { getNetworkParameters } from "./network/requests/getNetworkParameters"; +import { getNetworkInfo } from './network/requests/getNetworkInfo'; +import { getNetworkClock } from './network/requests/getNetworkClock'; +import { getNetworkParameters } from './network/requests/getNetworkParameters'; // Transactions requests -import { getTransactionFee } from "./transactions/requests/getTransactionFee"; -import { getByronWalletTransactionFee } from "./transactions/requests/getByronWalletTransactionFee"; -import { getTransaction } from "./transactions/requests/getTransaction"; -import { getTransactionHistory } from "./transactions/requests/getTransactionHistory"; -import { getLegacyWalletTransactionHistory } from "./transactions/requests/getLegacyWalletTransactionHistory"; -import { getWithdrawalHistory } from "./transactions/requests/getWithdrawalHistory"; -import { createTransaction } from "./transactions/requests/createTransaction"; -import { createByronWalletTransaction } from "./transactions/requests/createByronWalletTransaction"; -import { deleteLegacyTransaction } from "./transactions/requests/deleteLegacyTransaction"; -import { selectCoins } from "./transactions/requests/selectCoins"; -import { createExternalTransaction } from "./transactions/requests/createExternalTransaction"; -import { getPublicKey } from "./transactions/requests/getPublicKey"; -import { getICOPublicKey } from "./transactions/requests/getICOPublicKey"; +import { getTransactionFee } from './transactions/requests/getTransactionFee'; +import { getByronWalletTransactionFee } from './transactions/requests/getByronWalletTransactionFee'; +import { getTransaction } from './transactions/requests/getTransaction'; +import { getTransactionHistory } from './transactions/requests/getTransactionHistory'; +import { getLegacyWalletTransactionHistory } from './transactions/requests/getLegacyWalletTransactionHistory'; +import { getWithdrawalHistory } from './transactions/requests/getWithdrawalHistory'; +import { createTransaction } from './transactions/requests/createTransaction'; +import { createByronWalletTransaction } from './transactions/requests/createByronWalletTransaction'; +import { deleteLegacyTransaction } from './transactions/requests/deleteLegacyTransaction'; +import { selectCoins } from './transactions/requests/selectCoins'; +import { createExternalTransaction } from './transactions/requests/createExternalTransaction'; +import { getPublicKey } from './transactions/requests/getPublicKey'; +import { getICOPublicKey } from './transactions/requests/getICOPublicKey'; // Voting requests -import { createWalletSignature } from "./voting/requests/createWalletSignature"; +import { createWalletSignature } from './voting/requests/createWalletSignature'; // Wallets requests -import { updateSpendingPassword } from "./wallets/requests/updateSpendingPassword"; -import { updateByronSpendingPassword } from "./wallets/requests/updateByronSpendingPassword"; -import { deleteWallet } from "./wallets/requests/deleteWallet"; -import { deleteLegacyWallet } from "./wallets/requests/deleteLegacyWallet"; -import { exportWalletAsJSON } from "./wallets/requests/exportWalletAsJSON"; -import { importWalletAsJSON } from "./wallets/requests/importWalletAsJSON"; -import { getWallets } from "./wallets/requests/getWallets"; -import { getLegacyWallets } from "./wallets/requests/getLegacyWallets"; -import { importWalletAsKey } from "./wallets/requests/importWalletAsKey"; -import { createWallet } from "./wallets/requests/createWallet"; -import { restoreWallet } from "./wallets/requests/restoreWallet"; -import { restoreLegacyWallet } from "./wallets/requests/restoreLegacyWallet"; -import { restoreByronWallet } from "./wallets/requests/restoreByronWallet"; -import { restoreExportedByronWallet } from "./wallets/requests/restoreExportedByronWallet"; -import { updateWallet } from "./wallets/requests/updateWallet"; -import { updateByronWallet } from "./wallets/requests/updateByronWallet"; -import { getWalletUtxos } from "./wallets/requests/getWalletUtxos"; -import { getByronWalletUtxos } from "./wallets/requests/getByronWalletUtxos"; -import { getWallet } from "./wallets/requests/getWallet"; -import { getWalletPublicKey } from "./wallets/requests/getWalletPublicKey"; -import { getLegacyWallet } from "./wallets/requests/getLegacyWallet"; -import { transferFundsCalculateFee } from "./wallets/requests/transferFundsCalculateFee"; -import { transferFunds } from "./wallets/requests/transferFunds"; -import { createHardwareWallet } from "./wallets/requests/createHardwareWallet"; -import { getCurrencyList } from "./wallets/requests/getCurrencyList"; -import { getCurrencyRate } from "./wallets/requests/getCurrencyRate"; +import { updateSpendingPassword } from './wallets/requests/updateSpendingPassword'; +import { updateByronSpendingPassword } from './wallets/requests/updateByronSpendingPassword'; +import { deleteWallet } from './wallets/requests/deleteWallet'; +import { deleteLegacyWallet } from './wallets/requests/deleteLegacyWallet'; +import { exportWalletAsJSON } from './wallets/requests/exportWalletAsJSON'; +import { importWalletAsJSON } from './wallets/requests/importWalletAsJSON'; +import { getWallets } from './wallets/requests/getWallets'; +import { getLegacyWallets } from './wallets/requests/getLegacyWallets'; +import { importWalletAsKey } from './wallets/requests/importWalletAsKey'; +import { createWallet } from './wallets/requests/createWallet'; +import { restoreWallet } from './wallets/requests/restoreWallet'; +import { restoreLegacyWallet } from './wallets/requests/restoreLegacyWallet'; +import { restoreByronWallet } from './wallets/requests/restoreByronWallet'; +import { restoreExportedByronWallet } from './wallets/requests/restoreExportedByronWallet'; +import { updateWallet } from './wallets/requests/updateWallet'; +import { updateByronWallet } from './wallets/requests/updateByronWallet'; +import { getWalletUtxos } from './wallets/requests/getWalletUtxos'; +import { getByronWalletUtxos } from './wallets/requests/getByronWalletUtxos'; +import { getWallet } from './wallets/requests/getWallet'; +import { getWalletPublicKey } from './wallets/requests/getWalletPublicKey'; +import { getLegacyWallet } from './wallets/requests/getLegacyWallet'; +import { transferFundsCalculateFee } from './wallets/requests/transferFundsCalculateFee'; +import { transferFunds } from './wallets/requests/transferFunds'; +import { createHardwareWallet } from './wallets/requests/createHardwareWallet'; +import { getCurrencyList } from './wallets/requests/getCurrencyList'; +import { getCurrencyRate } from './wallets/requests/getCurrencyRate'; // Staking -import StakePool from "../domains/StakePool"; +import StakePool from '../domains/StakePool'; // News requests -import { getNews } from "./news/requests/getNews"; +import { getNews } from './news/requests/getNews'; // Stake Pools request -import { getStakePools } from "./staking/requests/getStakePools"; -import { getDelegationFee } from "./staking/requests/getDelegationFee"; -import { joinStakePool } from "./staking/requests/joinStakePool"; -import { quitStakePool } from "./staking/requests/quitStakePool"; -import { getSmashSettings } from "./staking/requests/getSmashSettings"; -import { checkSmashServerHealth } from "./staking/requests/checkSmashServerHealth"; -import { updateSmashSettings } from "./staking/requests/updateSmashSettings"; +import { getStakePools } from './staking/requests/getStakePools'; +import { getDelegationFee } from './staking/requests/getDelegationFee'; +import { joinStakePool } from './staking/requests/joinStakePool'; +import { quitStakePool } from './staking/requests/quitStakePool'; +import { getSmashSettings } from './staking/requests/getSmashSettings'; +import { checkSmashServerHealth } from './staking/requests/checkSmashServerHealth'; +import { updateSmashSettings } from './staking/requests/updateSmashSettings'; // Utility functions -import { cardanoFaultInjectionChannel } from "../ipc/cardano.ipc"; -import patchAdaApi from "./utils/patchAdaApi"; -import { getLegacyWalletId, utcStringToDate } from "./utils"; -import { logger } from "../utils/logging"; -import { hexToString } from "../utils/strings"; -import { unscrambleMnemonics, scrambleMnemonics, generateAccountMnemonics, generateAdditionalMnemonics } from "./utils/mnemonics"; -import { filterLogData } from "../../../common/utils/logging"; -import { derivationPathToAddressPath } from "../utils/hardwareWalletUtils"; +import { cardanoFaultInjectionChannel } from '../ipc/cardano.ipc'; +import patchAdaApi from './utils/patchAdaApi'; +import { getLegacyWalletId, utcStringToDate } from './utils'; +import { logger } from '../utils/logging'; +import { hexToString } from '../utils/strings'; +import { + unscrambleMnemonics, + scrambleMnemonics, + generateAccountMnemonics, + generateAdditionalMnemonics, +} from './utils/mnemonics'; +import { filterLogData } from '../../../common/utils/logging'; +import { derivationPathToAddressPath } from '../utils/hardwareWalletUtils'; // Config constants -import { LOVELACES_PER_ADA } from "../config/numbersConfig"; -import { SMASH_SERVER_STATUSES, SMASH_SERVERS_LIST, MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE, REWARDS_REDEMPTION_FEE_CALCULATION_AMOUNT, DELEGATION_DEPOSIT, DELEGATION_ACTIONS } from "../config/stakingConfig"; -import { ADA_CERTIFICATE_MNEMONIC_LENGTH, WALLET_RECOVERY_PHRASE_WORD_COUNT } from "../config/cryptoConfig"; -import { currencyConfig } from "../config/currencyConfig"; +import { LOVELACES_PER_ADA } from '../config/numbersConfig'; +import { + SMASH_SERVER_STATUSES, + SMASH_SERVERS_LIST, + MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE, + REWARDS_REDEMPTION_FEE_CALCULATION_AMOUNT, + DELEGATION_DEPOSIT, + DELEGATION_ACTIONS, +} from '../config/stakingConfig'; +import { + ADA_CERTIFICATE_MNEMONIC_LENGTH, + WALLET_RECOVERY_PHRASE_WORD_COUNT, +} from '../config/cryptoConfig'; +import { currencyConfig } from '../config/currencyConfig'; // Addresses Types -import type { Address, GetAddressesRequest, CreateByronWalletAddressRequest, InspectAddressResponse } from "./addresses/types"; +import type { + Address, + GetAddressesRequest, + CreateByronWalletAddressRequest, + InspectAddressResponse, +} from './addresses/types'; // Common Types -import type { RequestConfig } from "./common/types"; +import type { RequestConfig } from './common/types'; // Network Types -import type { GetNetworkInfoResponse, NetworkInfoResponse, GetNetworkClockResponse, NetworkClockResponse, GetNetworkParametersResponse, GetNetworkParametersApiResponse } from "./network/types"; +import type { + GetNetworkInfoResponse, + NetworkInfoResponse, + GetNetworkClockResponse, + NetworkClockResponse, + GetNetworkParametersResponse, + GetNetworkParametersApiResponse, +} from './network/types'; // Transactions Types // @ts-ignore ts-migrate(2307) FIXME: Cannot find module './transactions/types' or its c... Remove this comment to see the full error message -import type { Transaction, TransactionFee, TransactionWithdrawals, GetTransactionFeeRequest, GetTransactionFeeResponse, CreateTransactionRequest, DeleteTransactionRequest, GetTransactionRequest, GetTransactionsRequest, GetTransactionsResponse, CoinSelectionsPaymentRequestType, CoinSelectionsDelegationRequestType, CoinSelectionsResponse, CreateExternalTransactionRequest, CreateExternalTransactionResponse, GetWithdrawalsRequest, GetWithdrawalsResponse, VotingMetadataType, ICOPublicKeyParams } from "./transactions/types"; +import type { + Transaction, + TransactionFee, + TransactionWithdrawals, + GetTransactionFeeRequest, + GetTransactionFeeResponse, + CreateTransactionRequest, + DeleteTransactionRequest, + GetTransactionRequest, + GetTransactionsRequest, + GetTransactionsResponse, + CoinSelectionsPaymentRequestType, + CoinSelectionsDelegationRequestType, + CoinSelectionsResponse, + CreateExternalTransactionRequest, + CreateExternalTransactionResponse, + GetWithdrawalsRequest, + GetWithdrawalsResponse, + VotingMetadataType, + ICOPublicKeyParams, +} from './transactions/types'; // Wallets Types -import type { AdaWallet, AdaWallets, CreateHardwareWalletRequest, LegacyAdaWallet, LegacyAdaWallets, WalletUtxos, CreateWalletRequest, DeleteWalletRequest, RestoreWalletRequest, RestoreLegacyWalletRequest, RestoreExportedByronWalletRequest, UpdateSpendingPasswordRequest, ExportWalletToFileRequest, GetWalletCertificateRecoveryPhraseRequest, GetWalletRecoveryPhraseFromCertificateRequest, ImportWalletFromKeyRequest, ImportWalletFromFileRequest, GetWalletUtxosRequest, GetWalletRequest, GetWalletPublicKeyRequest, TransferFundsCalculateFeeRequest, TransferFundsCalculateFeeApiResponse, TransferFundsCalculateFeeResponse, TransferFundsRequest, TransferFundsResponse, UpdateWalletRequest, GetCurrencyListResponse, GetCurrencyRateRequest, GetCurrencyRateResponse, GetAccountPublicKeyRequest } from "./wallets/types"; -import type { WalletProps } from "../domains/Wallet"; +import type { + AdaWallet, + AdaWallets, + CreateHardwareWalletRequest, + LegacyAdaWallet, + LegacyAdaWallets, + WalletUtxos, + CreateWalletRequest, + DeleteWalletRequest, + RestoreWalletRequest, + RestoreLegacyWalletRequest, + RestoreExportedByronWalletRequest, + UpdateSpendingPasswordRequest, + ExportWalletToFileRequest, + GetWalletCertificateRecoveryPhraseRequest, + GetWalletRecoveryPhraseFromCertificateRequest, + ImportWalletFromKeyRequest, + ImportWalletFromFileRequest, + GetWalletUtxosRequest, + GetWalletRequest, + GetWalletPublicKeyRequest, + TransferFundsCalculateFeeRequest, + TransferFundsCalculateFeeApiResponse, + TransferFundsCalculateFeeResponse, + TransferFundsRequest, + TransferFundsResponse, + UpdateWalletRequest, + GetCurrencyListResponse, + GetCurrencyRateRequest, + GetCurrencyRateResponse, + GetAccountPublicKeyRequest, +} from './wallets/types'; +import type { WalletProps } from '../domains/Wallet'; // News Types -import type { GetNewsResponse } from "./news/types"; +import type { GetNewsResponse } from './news/types'; // Staking Types -import type { JoinStakePoolRequest, GetDelegationFeeRequest, DelegationCalculateFeeResponse, AdaApiStakePools, AdaApiStakePool, QuitStakePoolRequest, GetRedeemItnRewardsFeeRequest, GetRedeemItnRewardsFeeResponse, RequestRedeemItnRewardsRequest, RequestRedeemItnRewardsResponse, GetSmashSettingsApiResponse, CheckSmashServerHealthApiResponse, PoolMetadataSource } from "./staking/types"; +import type { + JoinStakePoolRequest, + GetDelegationFeeRequest, + DelegationCalculateFeeResponse, + AdaApiStakePools, + AdaApiStakePool, + QuitStakePoolRequest, + GetRedeemItnRewardsFeeRequest, + GetRedeemItnRewardsFeeResponse, + RequestRedeemItnRewardsRequest, + RequestRedeemItnRewardsResponse, + GetSmashSettingsApiResponse, + CheckSmashServerHealthApiResponse, + PoolMetadataSource, +} from './staking/types'; // Voting Types -import type { CreateVotingRegistrationRequest, CreateWalletSignatureRequest } from "./voting/types"; -import type { StakePoolProps } from "../domains/StakePool"; -import type { FaultInjectionIpcRequest } from "../../../common/types/cardano-node.types"; -import { TlsCertificateNotValidError } from "./nodes/errors"; -import { getSHA256HexForString } from "./utils/hashing"; -import { getNewsHash } from "./news/requests/getNewsHash"; -import { deleteTransaction } from "./transactions/requests/deleteTransaction"; -import { WALLET_BYRON_KINDS } from "../config/walletRestoreConfig"; -import ApiError from "../domains/ApiError"; -import { formattedAmountToLovelace } from "../utils/formatters"; -import type { GetAssetsRequest, GetAssetsResponse, ApiAsset, StoredAssetMetadata } from "./assets/types"; -import type { AssetLocalData } from "./utils/localStorage"; -import Asset from "../domains/Asset"; -import { getAssets } from "./assets/requests/getAssets"; -import { getAccountPublicKey } from "./wallets/requests/getAccountPublicKey"; +import type { + CreateVotingRegistrationRequest, + CreateWalletSignatureRequest, +} from './voting/types'; +import type { StakePoolProps } from '../domains/StakePool'; +import type { FaultInjectionIpcRequest } from '../../../common/types/cardano-node.types'; +import { TlsCertificateNotValidError } from './nodes/errors'; +import { getSHA256HexForString } from './utils/hashing'; +import { getNewsHash } from './news/requests/getNewsHash'; +import { deleteTransaction } from './transactions/requests/deleteTransaction'; +import { WALLET_BYRON_KINDS } from '../config/walletRestoreConfig'; +import ApiError from '../domains/ApiError'; +import { formattedAmountToLovelace } from '../utils/formatters'; +import type { + GetAssetsRequest, + GetAssetsResponse, + ApiAsset, + StoredAssetMetadata, +} from './assets/types'; +import type { AssetLocalData } from './utils/localStorage'; +import Asset from '../domains/Asset'; +import { getAssets } from './assets/requests/getAssets'; +import { getAccountPublicKey } from './wallets/requests/getAccountPublicKey'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module './utils/apiHelpers' or its cor... Remove this comment to see the full error message -import { throwErrorIfNotEnoughAdaToSupportTokens } from "./utils/apiHelpers"; +import { throwErrorIfNotEnoughAdaToSupportTokens } from './utils/apiHelpers'; export default class AdaApi { config: RequestConfig; @@ -140,49 +248,51 @@ export default class AdaApi { logger.debug('AdaApi::getWallets called'); const { getHardwareWalletLocalData, - getHardwareWalletsLocalData - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. + getHardwareWalletsLocalData, + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. } = global.daedalus.api.localStorage; try { const wallets: AdaWallets = await getWallets(this.config); - const legacyWallets: LegacyAdaWallets = await getLegacyWallets(this.config); + const legacyWallets: LegacyAdaWallets = await getLegacyWallets( + this.config + ); const hwLocalData = await getHardwareWalletsLocalData(); logger.debug('AdaApi::getWallets success', { wallets, legacyWallets, - hwLocalData: filterLogData(hwLocalData) + hwLocalData: filterLogData(hwLocalData), }); - map(legacyWallets, legacyAdaWallet => { + map(legacyWallets, (legacyAdaWallet) => { const extraLegacyWalletProps = { address_pool_gap: 0, // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING - } + status: WalletDelegationStatuses.NOT_DELEGATING, + }, }, - isLegacy: true + isLegacy: true, }; // @ts-ignore ts-migrate(2698) FIXME: Spread types may only be created from object types... Remove this comment to see the full error message - wallets.push({ ...legacyAdaWallet, - ...extraLegacyWalletProps - }); + wallets.push({ ...legacyAdaWallet, ...extraLegacyWalletProps }); }); // @TODO - Remove this once we get hardware wallet flag from WBE // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - return await Promise.all(wallets.map(async wallet => { - const { - id - } = wallet; - const walletData = await getHardwareWalletLocalData(id); - return _createWalletFromServerData({ ...wallet, - isHardwareWallet: walletData && walletData.device && size(walletData.device) > 0 - }); - })); + return await Promise.all( + wallets.map(async (wallet) => { + const { id } = wallet; + const walletData = await getHardwareWalletLocalData(id); + return _createWalletFromServerData({ + ...wallet, + isHardwareWallet: + walletData && walletData.device && size(walletData.device) > 0, + }); + }) + ); } catch (error) { logger.error('AdaApi::getWallets error', { - error + error, }); throw new ApiError(error); } @@ -190,124 +300,123 @@ export default class AdaApi { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWallet = async (request: GetWalletRequest): Promise => { logger.debug('AdaApi::getWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); try { - const { - walletId, - isLegacy - } = request; + const { walletId, isLegacy } = request; let wallet; if (isLegacy) { - const legacyWallet: LegacyAdaWallet = await getLegacyWallet(this.config, { - walletId - }); + const legacyWallet: LegacyAdaWallet = await getLegacyWallet( + this.config, + { + walletId, + } + ); const extraLegacyWalletProps = { address_pool_gap: 0, // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING - } + status: WalletDelegationStatuses.NOT_DELEGATING, + }, }, - isLegacy: true - }; - wallet = { ...legacyWallet, - ...extraLegacyWalletProps + isLegacy: true, }; + wallet = { ...legacyWallet, ...extraLegacyWalletProps }; } else { wallet = await getWallet(this.config, { - walletId + walletId, }); } logger.debug('AdaApi::getWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::getWallet error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getWalletPublicKey = async (request: GetWalletPublicKeyRequest): Promise => { + getWalletPublicKey = async ( + request: GetWalletPublicKeyRequest + ): Promise => { logger.debug('AdaApi::getWalletPublicKey called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); try { - const { - walletId, - role, - index - } = request; + const { walletId, role, index } = request; const walletPublicKey: string = await getWalletPublicKey(this.config, { walletId, role, - index + index, }); logger.debug('AdaApi::getWalletPublicKey success', { - walletPublicKey + walletPublicKey, }); return walletPublicKey; } catch (error) { logger.error('AdaApi::getWalletPublicKey error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getAccountPublicKey = async (request: GetAccountPublicKeyRequest): Promise => { + getAccountPublicKey = async ( + request: GetAccountPublicKeyRequest + ): Promise => { logger.debug('AdaApi::getAccountPublicKey called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); try { - const { - walletId, - index, - passphrase, - extended - } = request; + const { walletId, index, passphrase, extended } = request; const accountPublicKey: string = await getAccountPublicKey(this.config, { walletId, index, passphrase, - extended + extended, }); logger.debug('AdaApi::getAccountPublicKey success', { - accountPublicKey + accountPublicKey, }); return accountPublicKey; } catch (error) { logger.error('AdaApi::getAccountPublicKey error', { - error + error, }); - throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); + throw new ApiError(error) + .set('wrongEncryptionPassphrase') + .where('code', 'bad_request') + .inc('message', 'passphrase is too short') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getAddresses = async (request: GetAddressesRequest): Promise> => { + getAddresses = async ( + request: GetAddressesRequest + ): Promise> => { logger.debug('AdaApi::getAddresses called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - walletId, - queryParams, - isLegacy - } = request; + const { walletId, queryParams, isLegacy } = request; try { let response = []; if (isLegacy) { - response = await getByronWalletAddresses(this.config, walletId, queryParams); + response = await getByronWalletAddresses( + this.config, + walletId, + queryParams + ); } else { response = await getAddresses(this.config, walletId, queryParams); // @ts-ignore ts-migrate(2339) FIXME: Property 'reverse' does not exist on type '{}'. @@ -315,80 +424,90 @@ export default class AdaApi { } logger.debug('AdaApi::getAddresses success', { - addresses: response + addresses: response, }); // @ts-ignore ts-migrate(2339) FIXME: Property 'map' does not exist on type '{}'. return response.map(_createAddressFromServerData); } catch (error) { logger.error('AdaApi::getAddresses error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getTransaction = async (request: GetTransactionRequest): Promise => { + getTransaction = async ( + request: GetTransactionRequest + ): Promise => { logger.debug('AdaApi::getTransaction called', { - parameters: request + parameters: request, }); - const { - walletId, - transactionId - } = request; + const { walletId, transactionId } = request; try { - const response = await getTransaction(this.config, walletId, transactionId); + const response = await getTransaction( + this.config, + walletId, + transactionId + ); logger.debug('AdaApi::getTransaction success', { - response + response, }); return _createTransactionFromServerData(response); } catch (error) { logger.error('AdaApi::getTransaction error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getTransactions = async (request: GetTransactionsRequest): Promise => { + getTransactions = async ( + request: GetTransactionsRequest + ): Promise => { logger.debug('AdaApi::getTransactions called', { - parameters: request + parameters: request, }); - const { - walletId, - order, - fromDate, - toDate, - isLegacy - } = request; + const { walletId, order, fromDate, toDate, isLegacy } = request; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Object'. - const params = Object.assign({}, { - order: order || 'descending' - }); - if (fromDate) params.start = `${moment.utc(fromDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; - if (toDate) params.end = `${moment.utc(toDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; + const params = Object.assign( + {}, + { + order: order || 'descending', + } + ); + if (fromDate) + params.start = `${moment.utc(fromDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; + if (toDate) + params.end = `${moment.utc(toDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; try { let response; if (isLegacy) { - response = await getLegacyWalletTransactionHistory(this.config, walletId, params); + response = await getLegacyWalletTransactionHistory( + this.config, + walletId, + params + ); } else { response = await getTransactionHistory(this.config, walletId, params); } logger.debug('AdaApi::getTransactions success', { - transactions: response + transactions: response, }); - const transactions = response.map(tx => _createTransactionFromServerData(tx)); + const transactions = response.map((tx) => + _createTransactionFromServerData(tx) + ); // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return Promise.resolve({ transactions, - total: response.length + total: response.length, }); } catch (error) { logger.error('AdaApi::getTransactions error', { - error + error, }); throw new ApiError(error); } // @API TODO - Filter / Search fine tuning "pending" for V2 @@ -539,70 +658,80 @@ export default class AdaApi { // logger.error('AdaApi::searchHistory error', { error }); // throw new GenericApiError(error); // } - }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getAssets = async (request: GetAssetsRequest): Promise => { logger.debug('AdaApi::getAssets called', { - parameters: request + parameters: request, }); - const { - walletId - } = request; + const { walletId } = request; try { const response = await getAssets(this.config, { - walletId + walletId, }); logger.debug('AdaApi::getAssets success', { - assets: response + assets: response, }); // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. const assetsLocaldata = await global.daedalus.api.localStorage.getAssetsLocalData(); logger.debug('AdaApi::getAssetsLocalData success', { - assetsLocaldata - }); - const assets = response.map(asset => _createAssetFromServerData(asset, assetsLocaldata[asset.policy_id + asset.asset_name] || {}, this.storedAssetMetadata)); + assetsLocaldata, + }); + const assets = response.map((asset) => + _createAssetFromServerData( + asset, + assetsLocaldata[asset.policy_id + asset.asset_name] || {}, + this.storedAssetMetadata + ) + ); // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - return new Promise(resolve => resolve({ - assets, - total: response.length - })); + return new Promise((resolve) => + resolve({ + assets, + total: response.length, + }) + ); } catch (error) { logger.error('AdaApi::getAssets error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getWithdrawals = async (request: GetWithdrawalsRequest): Promise => { + getWithdrawals = async ( + request: GetWithdrawalsRequest + ): Promise => { logger.debug('AdaApi::getWithdrawals called', { - parameters: request + parameters: request, }); - const { - walletId - } = request; + const { walletId } = request; try { const response = await getWithdrawalHistory(this.config, walletId); logger.debug('AdaApi::getWithdrawals success', { - transactions: response + transactions: response, }); let withdrawals = new BigNumber(0); - const outgoingTransactions = response.filter((tx: Transaction) => tx.direction === 'outgoing' && tx.status === 'in_ledger'); + const outgoingTransactions = response.filter( + (tx: Transaction) => + tx.direction === 'outgoing' && tx.status === 'in_ledger' + ); outgoingTransactions.forEach((tx: Transaction) => { tx.withdrawals.forEach((w: TransactionWithdrawals) => { - const withdrawal = new BigNumber(w.amount.quantity.toString()).dividedBy(LOVELACES_PER_ADA); + const withdrawal = new BigNumber( + w.amount.quantity.toString() + ).dividedBy(LOVELACES_PER_ADA); withdrawals = withdrawals.plus(withdrawal); }); }); return { - withdrawals + withdrawals, }; } catch (error) { logger.error('AdaApi::getWithdrawals error', { - error + error, }); throw new ApiError(error); } @@ -610,89 +739,83 @@ export default class AdaApi { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createWallet = async (request: CreateWalletRequest): Promise => { logger.debug('AdaApi::createWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - name, - mnemonic, - spendingPassword - } = request; + const { name, mnemonic, spendingPassword } = request; try { const walletInitData = { name, mnemonic_sentence: split(mnemonic, ' '), - passphrase: spendingPassword + passphrase: spendingPassword, }; const wallet: AdaWallet = await createWallet(this.config, { - walletInitData + walletInitData, }); logger.debug('AdaApi::createWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::createWallet error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - createLegacyWallet = async (request: CreateWalletRequest): Promise => { + createLegacyWallet = async ( + request: CreateWalletRequest + ): Promise => { logger.debug('AdaApi::createLegacyWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - name, - mnemonic, - spendingPassword - } = request; + const { name, mnemonic, spendingPassword } = request; try { const walletInitData = { name, mnemonic_sentence: split(mnemonic, ' '), - passphrase: spendingPassword + passphrase: spendingPassword, }; - const legacyWallet: LegacyAdaWallet = await restoreByronWallet(this.config, { - walletInitData - }, 'random'); + const legacyWallet: LegacyAdaWallet = await restoreByronWallet( + this.config, + { + walletInitData, + }, + 'random' + ); // Generate address for the newly created Byron wallet - const { - id: walletId - } = legacyWallet; + const { id: walletId } = legacyWallet; const address: Address = await createByronWalletAddress(this.config, { passphrase: spendingPassword, - walletId + walletId, }); logger.debug('AdaApi::createByronWalletAddress success', { - address + address, }); const extraLegacyWalletProps = { address_pool_gap: 0, // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING - } + status: WalletDelegationStatuses.NOT_DELEGATING, + }, }, isLegacy: true, assets: { available: [], - total: [] - } - }; - const wallet: AdaWallet = { ...legacyWallet, - ...extraLegacyWalletProps + total: [], + }, }; + const wallet: AdaWallet = { ...legacyWallet, ...extraLegacyWalletProps }; logger.debug('AdaApi::createLegacyWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::createLegacyWallet error', { - error + error, }); throw new ApiError(error); } @@ -700,41 +823,40 @@ export default class AdaApi { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message deleteWallet = async (request: DeleteWalletRequest): Promise => { logger.debug('AdaApi::deleteWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); try { - const { - walletId, - isLegacy - } = request; + const { walletId, isLegacy } = request; let response; if (isLegacy) { response = await deleteLegacyWallet(this.config, { - walletId + walletId, }); } else { response = await deleteWallet(this.config, { - walletId + walletId, }); } logger.debug('AdaApi::deleteWallet success', { - response + response, }); return true; } catch (error) { logger.error('AdaApi::deleteWallet error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - createTransaction = async (request: CreateTransactionRequest): Promise => { + createTransaction = async ( + request: CreateTransactionRequest + ): Promise => { logger.debug('AdaApi::createTransaction called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); const { walletId, @@ -744,50 +866,59 @@ export default class AdaApi { isLegacy, assets, withdrawal = TransactionWithdrawal, - hasAssetsRemainingAfterTransaction + hasAssetsRemainingAfterTransaction, } = request; try { const data = { - payments: [{ - address, - amount: { - quantity: amount, - unit: WalletUnits.LOVELACE + payments: [ + { + address, + amount: { + quantity: amount, + unit: WalletUnits.LOVELACE, + }, + assets, }, - assets - }], - passphrase + ], + passphrase, }; let response: Transaction; if (isLegacy) { response = await createByronWalletTransaction(this.config, { walletId, - data + data, }); } else { response = await createTransaction(this.config, { walletId, - data: { ...data, - withdrawal - } + data: { ...data, withdrawal }, }); } logger.debug('AdaApi::createTransaction success', { - transaction: response + transaction: response, }); return _createTransactionFromServerData(response); } catch (error) { logger.error('AdaApi::createTransaction error', { - error + error, }); - throwErrorIfNotEnoughAdaToSupportTokens(error, hasAssetsRemainingAfterTransaction); - throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').set('transactionIsTooBig', true, { - linkLabel: 'tooBigTransactionErrorLinkLabel', - linkURL: 'tooBigTransactionErrorLinkURL' - }).where('code', 'transaction_is_too_big').result(); + throwErrorIfNotEnoughAdaToSupportTokens( + error, + hasAssetsRemainingAfterTransaction + ); + throw new ApiError(error) + .set('wrongEncryptionPassphrase') + .where('code', 'bad_request') + .inc('message', 'passphrase is too short') + .set('transactionIsTooBig', true, { + linkLabel: 'tooBigTransactionErrorLinkLabel', + linkURL: 'tooBigTransactionErrorLinkURL', + }) + .where('code', 'transaction_is_too_big') + .result(); } }; // For testing purpose ONLY @@ -796,7 +927,7 @@ export default class AdaApi { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. if (global.environment.isDev) { logger.debug('AdaApi::createTransaction called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); const { walletId, @@ -805,61 +936,69 @@ export default class AdaApi { passphrase, isLegacy, withdrawal = TransactionWithdrawal, - ttl + ttl, } = request; try { const data = { - payments: [{ - address, - amount: { - quantity: amount, - unit: WalletUnits.LOVELACE - } - }], + payments: [ + { + address, + amount: { + quantity: amount, + unit: WalletUnits.LOVELACE, + }, + }, + ], passphrase, time_to_live: { quantity: ttl, - unit: 'second' - } + unit: 'second', + }, }; let response: Transaction; if (isLegacy) { response = await createByronWalletTransaction(this.config, { walletId, - data + data, }); } else { response = await createTransaction(this.config, { walletId, - data: { ...data, - withdrawal - } + data: { ...data, withdrawal }, }); } logger.debug('AdaApi::createTransaction success', { - transaction: response + transaction: response, }); return _createTransactionFromServerData(response); } catch (error) { logger.error('AdaApi::createTransaction error', { - error + error, }); - throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').set('transactionIsTooBig', true, { - linkLabel: 'tooBigTransactionErrorLinkLabel', - linkURL: 'tooBigTransactionErrorLinkURL' - }).where('code', 'transaction_is_too_big').result(); + throw new ApiError(error) + .set('wrongEncryptionPassphrase') + .where('code', 'bad_request') + .inc('message', 'passphrase is too short') + .set('transactionIsTooBig', true, { + linkLabel: 'tooBigTransactionErrorLinkLabel', + linkURL: 'tooBigTransactionErrorLinkURL', + }) + .where('code', 'transaction_is_too_big') + .result(); } } return null; }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - calculateTransactionFee = async (request: GetTransactionFeeRequest): Promise => { + calculateTransactionFee = async ( + request: GetTransactionFeeRequest + ): Promise => { logger.debug('AdaApi::calculateTransactionFee called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); const { walletId, @@ -870,42 +1009,41 @@ export default class AdaApi { availableBalance, rewardsBalance, isLegacy, - withdrawal = TransactionWithdrawal + withdrawal = TransactionWithdrawal, } = request; try { const data = { - payments: [{ - address, - amount: { - quantity: amount, - unit: WalletUnits.LOVELACE + payments: [ + { + address, + amount: { + quantity: amount, + unit: WalletUnits.LOVELACE, + }, + assets, }, - assets - }] + ], }; let response: TransactionFee; if (isLegacy) { response = await getByronWalletTransactionFee(this.config, { walletId, - data + data, }); } else { response = await getTransactionFee(this.config, { walletId, - data: { ...data, - withdrawal - } + data: { ...data, withdrawal }, }); } - const formattedTxAmount = new BigNumber(amount.toString()).dividedBy(LOVELACES_PER_ADA); + const formattedTxAmount = new BigNumber(amount.toString()).dividedBy( + LOVELACES_PER_ADA + ); - const { - fee, - minimumAda - } = _createTransactionFeeFromServerData(response); + const { fee, minimumAda } = _createTransactionFeeFromServerData(response); const amountWithFee = formattedTxAmount.plus(fee); // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. @@ -918,11 +1056,11 @@ export default class AdaApi { } logger.debug('AdaApi::calculateTransactionFee success', { - transactionFee: response + transactionFee: response, }); return { fee, - minimumAda + minimumAda, }; } catch (error) { let notEnoughMoneyError; @@ -932,7 +1070,10 @@ export default class AdaApi { // - walletBalance > availableBalance // = show "Cannot calculate fees while there are pending transactions." notEnoughMoneyError = 'canNotCalculateTransactionFees'; - } else if (!walletBalance.isZero() && walletBalance.isEqualTo(rewardsBalance)) { + } else if ( + !walletBalance.isZero() && + walletBalance.isEqualTo(rewardsBalance) + ) { // 2. Wallet contains only rewards: // - walletBalance === rewardsBalance // = show "Cannot send from a wallet that contains only rewards balances." @@ -947,11 +1088,23 @@ export default class AdaApi { // ApiError with logging showcase throw new ApiError(error, { logError: true, - msg: 'AdaApi::calculateTransactionFee error' - }).set(notEnoughMoneyError, true).where('code', 'not_enough_money').set('utxoTooSmall', true, { - // @ts-ignore ts-migrate(2339) FIXME: Property 'exec' does not exist on type '{}'. - minimumAda: get(/(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), 2, 0) - }).where('code', 'utxo_too_small').set('invalidAddress').where('code', 'bad_request').inc('message', 'Unable to decode Address').result(); + msg: 'AdaApi::calculateTransactionFee error', + }) + .set(notEnoughMoneyError, true) + .where('code', 'not_enough_money') + .set('utxoTooSmall', true, { + // @ts-ignore ts-migrate(2339) FIXME: Property 'exec' does not exist on type '{}'. + minimumAda: get( + /(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), + 2, + 0 + ), + }) + .where('code', 'utxo_too_small') + .set('invalidAddress') + .where('code', 'bad_request') + .inc('message', 'Unable to decode Address') + .result(); } }; selectCoins = async (request: { @@ -962,10 +1115,10 @@ export default class AdaApi { payments?: CoinSelectionsPaymentRequestType; delegation?: CoinSelectionsDelegationRequestType; metadata?: VotingMetadataType; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message }): Promise => { logger.debug('AdaApi::selectCoins called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); const { walletId, @@ -974,7 +1127,7 @@ export default class AdaApi { walletBalance, availableBalance, rewardsBalance, - metadata + metadata, } = request; try { @@ -984,21 +1137,23 @@ export default class AdaApi { data = { delegation_action: { action: delegation.delegationAction, - pool: delegation.poolId - } + pool: delegation.poolId, + }, }; } else if (payments) { data = { - payments: [{ - address: payments.address, - amount: { - quantity: payments.amount, - unit: WalletUnits.LOVELACE + payments: [ + { + address: payments.address, + amount: { + quantity: payments.amount, + unit: WalletUnits.LOVELACE, + }, + assets: payments.assets, }, - assets: payments.assets - }], + ], withdrawal: TransactionWithdrawal, - metadata: metadata || null + metadata: metadata || null, }; } else { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. @@ -1007,7 +1162,7 @@ export default class AdaApi { const response = await selectCoins(this.config, { walletId, - data + data, }); // @TODO - handle CHANGE paramete on smarter way and change corresponding downstream logic const outputs = concat(response.outputs, response.change); @@ -1017,17 +1172,17 @@ export default class AdaApi { const certificatesData = []; let totalInputs = new BigNumber(0); let totalOutputs = new BigNumber(0); - map(response.inputs, input => { + map(response.inputs, (input) => { // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message const inputAmount = new BigNumber(input.amount.quantity.toString()); // @ts-ignore ts-migrate(2339) FIXME: Property 'assets' does not exist on type 'unknown'... Remove this comment to see the full error message - const inputAssets = map(input.assets, asset => ({ + const inputAssets = map(input.assets, (asset) => ({ // @ts-ignore ts-migrate(2339) FIXME: Property 'policy_id' does not exist on type 'unkno... Remove this comment to see the full error message policyId: asset.policy_id, // @ts-ignore ts-migrate(2339) FIXME: Property 'asset_name' does not exist on type 'unkn... Remove this comment to see the full error message assetName: asset.asset_name, // @ts-ignore ts-migrate(2339) FIXME: Property 'quantity' does not exist on type 'unknow... Remove this comment to see the full error message - quantity: asset.quantity + quantity: asset.quantity, })); totalInputs = totalInputs.plus(inputAmount); const inputData = { @@ -1041,22 +1196,22 @@ export default class AdaApi { index: input.index, // @ts-ignore ts-migrate(2339) FIXME: Property 'derivation_path' does not exist on type ... Remove this comment to see the full error message derivationPath: input.derivation_path, - assets: inputAssets + assets: inputAssets, }; // @ts-ignore ts-migrate(2339) FIXME: Property 'push' does not exist on type '{}'. inputsData.push(inputData); }); - map(outputs, output => { + map(outputs, (output) => { // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message const outputAmount = new BigNumber(output.amount.quantity.toString()); // @ts-ignore ts-migrate(2339) FIXME: Property 'assets' does not exist on type 'unknown'... Remove this comment to see the full error message - const outputAssets = map(output.assets, asset => ({ + const outputAssets = map(output.assets, (asset) => ({ // @ts-ignore ts-migrate(2339) FIXME: Property 'policy_id' does not exist on type 'unkno... Remove this comment to see the full error message policyId: asset.policy_id, // @ts-ignore ts-migrate(2339) FIXME: Property 'asset_name' does not exist on type 'unkn... Remove this comment to see the full error message assetName: asset.asset_name, // @ts-ignore ts-migrate(2339) FIXME: Property 'quantity' does not exist on type 'unknow... Remove this comment to see the full error message - quantity: asset.quantity + quantity: asset.quantity, })); totalOutputs = totalOutputs.plus(outputAmount); const outputData = { @@ -1066,51 +1221,65 @@ export default class AdaApi { amount: output.amount, // @ts-ignore ts-migrate(2339) FIXME: Property 'derivation_path' does not exist on type ... Remove this comment to see the full error message derivationPath: output.derivation_path || null, - assets: outputAssets + assets: outputAssets, }; // @ts-ignore ts-migrate(2339) FIXME: Property 'push' does not exist on type '{}'. outputsData.push(outputData); }); if (response.certificates) { - map(response.certificates, certificate => { + map(response.certificates, (certificate) => { const certificateData = { // @ts-ignore ts-migrate(2339) FIXME: Property 'certificate_type' does not exist on type... Remove this comment to see the full error message certificateType: certificate.certificate_type, // @ts-ignore ts-migrate(2339) FIXME: Property 'reward_account_path' does not exist on t... Remove this comment to see the full error message rewardAccountPath: certificate.reward_account_path, // @ts-ignore ts-migrate(2339) FIXME: Property 'pool' does not exist on type 'unknown'. - pool: certificate.pool || null + pool: certificate.pool || null, }; // @ts-ignore ts-migrate(2339) FIXME: Property 'push' does not exist on type '{}'. certificatesData.push(certificateData); }); } - const withdrawalsData = map(response.withdrawals, withdrawal => ({ + const withdrawalsData = map(response.withdrawals, (withdrawal) => ({ // @ts-ignore ts-migrate(2339) FIXME: Property 'stake_address' does not exist on type 'u... Remove this comment to see the full error message stakeAddress: withdrawal.stake_address, // @ts-ignore ts-migrate(2339) FIXME: Property 'derivation_path' does not exist on type ... Remove this comment to see the full error message derivationPath: withdrawal.derivation_path, // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message - amount: withdrawal.amount + amount: withdrawal.amount, })); // @ts-ignore ts-migrate(2339) FIXME: Property 'quantity' does not exist on type 'unknow... Remove this comment to see the full error message - const depositsArray = map(response.deposits, deposit => deposit.quantity.toString()); + const depositsArray = map(response.deposits, (deposit) => + deposit.quantity.toString() + ); // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type '{}'. - const deposits = depositsArray.length ? BigNumber.sum.apply(null, depositsArray) : new BigNumber(0); + const deposits = depositsArray.length + ? BigNumber.sum.apply(null, depositsArray) + : new BigNumber(0); // @TODO - Use api response when api is ready - const depositsReclaimed = delegation && delegation.delegationAction === DELEGATION_ACTIONS.QUIT ? new BigNumber(DELEGATION_DEPOSIT).multipliedBy(LOVELACES_PER_ADA) : new BigNumber(0); + const depositsReclaimed = + delegation && delegation.delegationAction === DELEGATION_ACTIONS.QUIT + ? new BigNumber(DELEGATION_DEPOSIT).multipliedBy(LOVELACES_PER_ADA) + : new BigNumber(0); // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message - const withdrawalsArray = map(response.withdrawals, withdrawal => withdrawal.amount.quantity.toString()); + const withdrawalsArray = map(response.withdrawals, (withdrawal) => + withdrawal.amount.quantity.toString() + ); // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type '{}'. - const withdrawals = withdrawalsArray.length ? BigNumber.sum.apply(null, withdrawalsArray) : new BigNumber(0); + const withdrawals = withdrawalsArray.length + ? BigNumber.sum.apply(null, withdrawalsArray) + : new BigNumber(0); if (withdrawals) { totalOutputs = totalOutputs.minus(withdrawals); } - const fee = delegation && delegation.delegationAction === DELEGATION_ACTIONS.QUIT ? totalInputs.minus(totalOutputs).plus(depositsReclaimed) : totalInputs.minus(totalOutputs).minus(deposits); + const fee = + delegation && delegation.delegationAction === DELEGATION_ACTIONS.QUIT + ? totalInputs.minus(totalOutputs).plus(depositsReclaimed) + : totalInputs.minus(totalOutputs).minus(deposits); const extendedResponse = { inputs: inputsData, outputs: outputsData, @@ -1119,15 +1288,15 @@ export default class AdaApi { fee: fee.dividedBy(LOVELACES_PER_ADA), deposits: deposits.dividedBy(LOVELACES_PER_ADA), depositsReclaimed: depositsReclaimed.dividedBy(LOVELACES_PER_ADA), - metadata: response.metadata || null + metadata: response.metadata || null, }; logger.debug('AdaApi::selectCoins success', { - extendedResponse + extendedResponse, }); return extendedResponse; } catch (error) { logger.error('AdaApi::selectCoins error', { - error + error, }); let notEnoughMoneyError; @@ -1136,7 +1305,10 @@ export default class AdaApi { // - walletBalance > availableBalance // = show "Cannot calculate fees while there are pending transactions." notEnoughMoneyError = 'canNotCalculateTransactionFees'; - } else if (!walletBalance.isZero() && walletBalance.isEqualTo(rewardsBalance)) { + } else if ( + !walletBalance.isZero() && + walletBalance.isEqualTo(rewardsBalance) + ) { // 2. Wallet contains only rewards: // - walletBalance === rewardsBalance // = show "Cannot send from a wallet that contains only rewards balances." @@ -1151,53 +1323,63 @@ export default class AdaApi { // ApiError with logging showcase throw new ApiError(error, { logError: true, - msg: 'AdaApi::calculateTransactionFee error' - }).set(notEnoughMoneyError, true).where('code', 'not_enough_money').set('utxoTooSmall', true, { - // @ts-ignore ts-migrate(2339) FIXME: Property 'exec' does not exist on type '{}'. - minimumAda: get(/(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), 2, 0) - }).where('code', 'utxo_too_small').set('invalidAddress').where('code', 'bad_request').inc('message', 'Unable to decode Address').result(); + msg: 'AdaApi::calculateTransactionFee error', + }) + .set(notEnoughMoneyError, true) + .where('code', 'not_enough_money') + .set('utxoTooSmall', true, { + // @ts-ignore ts-migrate(2339) FIXME: Property 'exec' does not exist on type '{}'. + minimumAda: get( + /(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), + 2, + 0 + ), + }) + .where('code', 'utxo_too_small') + .set('invalidAddress') + .where('code', 'bad_request') + .inc('message', 'Unable to decode Address') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - createExternalTransaction = async (request: CreateExternalTransactionRequest): Promise => { - const { - signedTransactionBlob - } = request; + createExternalTransaction = async ( + request: CreateExternalTransactionRequest + ): Promise => { + const { signedTransactionBlob } = request; try { const response = await createExternalTransaction(this.config, { - signedTransactionBlob + signedTransactionBlob, }); return response; } catch (error) { logger.error('AdaApi::createExternalTransaction error', { - error + error, }); throw new ApiError(error); } }; inspectAddress = async (request: { addressId: string; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message + // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message }): Promise => { logger.debug('AdaApi::inspectAddress called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - addressId - } = request; + const { addressId } = request; try { const response = await inspectAddress(this.config, { - addressId + addressId, }); logger.debug('AdaApi::inspectAddress success', { - response + response, }); return response; } catch (error) { logger.error('AdaApi::inspectAddress error', { - error + error, }); throw new ApiError(error); } @@ -1205,27 +1387,23 @@ export default class AdaApi { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getPublicKey = async (request: any): Promise => { logger.debug('AdaApi::getPublicKey called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - walletId, - role, - index - } = request; + const { walletId, role, index } = request; try { const response = await getPublicKey(this.config, { walletId, role, - index + index, }); logger.debug('AdaApi::getPublicKey success', { - response + response, }); return response; } catch (error) { logger.error('AdaApi::getPublicKey error', { - error + error, }); throw new ApiError(error); } @@ -1233,82 +1411,84 @@ export default class AdaApi { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getICOPublicKey = async (request: ICOPublicKeyParams): Promise => { logger.debug('AdaApi::getICOPublicKey called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); try { const response = await getICOPublicKey(this.config, request); logger.debug('AdaApi::getICOPublicKey success', { - icoPublicKey: response + icoPublicKey: response, }); return response; } catch (error) { logger.error('AdaApi::getICOPublicKey error', { - error + error, }); - throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); + throw new ApiError(error) + .set('wrongEncryptionPassphrase') + .where('code', 'bad_request') + .inc('message', 'passphrase is too short') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message constructAddress = async (request: any): Promise => { - const { - data - } = request; + const { data } = request; try { const response = await constructAddress(this.config, { - data + data, }); logger.debug('AdaApi::constructAddress success', { - response + response, }); return response; } catch (error) { logger.error('AdaApi::constructAddress error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - createAddress = async (request: CreateByronWalletAddressRequest): Promise => { + createAddress = async ( + request: CreateByronWalletAddressRequest + ): Promise => { logger.debug('AdaApi::createAddress called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - addressIndex, - walletId, - passphrase: passwordString - } = request; + const { addressIndex, walletId, passphrase: passwordString } = request; const passphrase = passwordString || ''; try { const address: Address = await createByronWalletAddress(this.config, { passphrase, walletId, - addressIndex + addressIndex, }); logger.debug('AdaApi::createAddress success', { - address + address, }); return _createAddressFromServerData(address); } catch (error) { logger.error('AdaApi::createAddress error', { - error + error, }); - throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); + throw new ApiError(error) + .set('wrongEncryptionPassphrase') + .where('code', 'bad_request') + .inc('message', 'passphrase is too short') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - deleteTransaction = async (request: DeleteTransactionRequest): Promise => { + deleteTransaction = async ( + request: DeleteTransactionRequest + ): Promise => { logger.debug('AdaApi::deleteTransaction called', { - parameters: request + parameters: request, }); - const { - walletId, - transactionId, - isLegacy - } = request; + const { walletId, transactionId, isLegacy } = request; try { let response; @@ -1316,26 +1496,27 @@ export default class AdaApi { if (isLegacy) { response = await deleteLegacyTransaction(this.config, { walletId, - transactionId + transactionId, }); } else { response = await deleteTransaction(this.config, { walletId, - transactionId + transactionId, }); } logger.debug('AdaApi::deleteTransaction success', response); } catch (error) { logger.error('AdaApi::deleteTransaction error', { - error + error, }); // In this particular call we don't need to handle the error in the UI // The only reason transaction canceling would fail is if the transaction // is no longer pending - in which case there is nothing we can do. } }; // @ts-ignore ts-migrate(2339) FIXME: Property 'split' does not exist on type 'string'. - isValidCertificateMnemonic = (mnemonic: string): boolean => mnemonic.split(' ').length === ADA_CERTIFICATE_MNEMONIC_LENGTH; + isValidCertificateMnemonic = (mnemonic: string): boolean => + mnemonic.split(' ').length === ADA_CERTIFICATE_MNEMONIC_LENGTH; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletRecoveryPhrase(): Promise> { @@ -1343,12 +1524,14 @@ export default class AdaApi { try { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - const response: Promise> = new Promise(resolve => resolve(generateAccountMnemonics(WALLET_RECOVERY_PHRASE_WORD_COUNT))); + const response: Promise> = new Promise((resolve) => + resolve(generateAccountMnemonics(WALLET_RECOVERY_PHRASE_WORD_COUNT)) + ); logger.debug('AdaApi::getWalletRecoveryPhrase success'); return response; } catch (error) { logger.error('AdaApi::getWalletRecoveryPhrase error', { - error + error, }); throw new ApiError(error); } @@ -1360,62 +1543,68 @@ export default class AdaApi { try { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - const response: Promise> = new Promise(resolve => resolve(generateAdditionalMnemonics())); + const response: Promise> = new Promise((resolve) => + resolve(generateAdditionalMnemonics()) + ); logger.debug('AdaApi::getWalletCertificateAdditionalMnemonics success'); return response; } catch (error) { logger.error('AdaApi::getWalletCertificateAdditionalMnemonics error', { - error + error, }); throw new ApiError(error); } } // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getWalletCertificateRecoveryPhrase(request: GetWalletCertificateRecoveryPhraseRequest): Promise> { + getWalletCertificateRecoveryPhrase( + request: GetWalletCertificateRecoveryPhraseRequest + ): Promise> { logger.debug('AdaApi::getWalletCertificateRecoveryPhrase called'); - const { - passphrase, - input: scrambledInput - } = request; + const { passphrase, input: scrambledInput } = request; try { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - const response: Promise> = new Promise(resolve => resolve(scrambleMnemonics({ - passphrase, - scrambledInput - }))); + const response: Promise> = new Promise((resolve) => + resolve( + scrambleMnemonics({ + passphrase, + scrambledInput, + }) + ) + ); logger.debug('AdaApi::getWalletCertificateRecoveryPhrase success'); return response; } catch (error) { logger.error('AdaApi::getWalletCertificateRecoveryPhrase error', { - error + error, }); throw new ApiError(error); } } // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getWalletRecoveryPhraseFromCertificate(request: GetWalletRecoveryPhraseFromCertificateRequest): Promise> { + getWalletRecoveryPhraseFromCertificate( + request: GetWalletRecoveryPhraseFromCertificateRequest + ): Promise> { logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate called'); - const { - passphrase, - scrambledInput - } = request; + const { passphrase, scrambledInput } = request; try { const response = unscrambleMnemonics({ passphrase, - scrambledInput + scrambledInput, }); logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate success'); // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return Promise.resolve(response); } catch (error) { logger.error('AdaApi::getWalletRecoveryPhraseFromCertificate error', { - error + error, }); - const errorRejection = new ApiError(error).set('invalidMnemonic', true).result(); + const errorRejection = new ApiError(error) + .set('invalidMnemonic', true) + .result(); // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return Promise.reject(errorRejection); } @@ -1424,62 +1613,67 @@ export default class AdaApi { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreWallet = async (request: RestoreWalletRequest): Promise => { logger.debug('AdaApi::restoreWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - recoveryPhrase, - walletName, - spendingPassword - } = request; + const { recoveryPhrase, walletName, spendingPassword } = request; const walletInitData = { name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword + passphrase: spendingPassword, }; try { const wallet: AdaWallet = await restoreWallet(this.config, { - walletInitData + walletInitData, }); logger.debug('AdaApi::restoreWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreWallet error', { - error + error, }); - throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); + throw new ApiError(error) + .set('forbiddenMnemonic') + .where('message', 'JSONValidationFailed') + .inc( + 'diagnostic.validationError', + 'Forbidden Mnemonic: an example Mnemonic has been submitted' + ) + .set('forbiddenMnemonic') + .where('code', 'invalid_restoration_parameters') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - createHardwareWallet = async (request: CreateHardwareWalletRequest): Promise => { + createHardwareWallet = async ( + request: CreateHardwareWalletRequest + ): Promise => { logger.debug('AdaApi::createHardwareWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - walletName, - accountPublicKey - } = request; + const { walletName, accountPublicKey } = request; const walletInitData = { name: walletName, - account_public_key: accountPublicKey + account_public_key: accountPublicKey, }; try { - const hardwareWallet: AdaWallet = await createHardwareWallet(this.config, { - walletInitData - }); - const wallet = { ...hardwareWallet, - isHardwareWallet: true - }; + const hardwareWallet: AdaWallet = await createHardwareWallet( + this.config, + { + walletInitData, + } + ); + const wallet = { ...hardwareWallet, isHardwareWallet: true }; logger.debug('AdaApi::createHardwareWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::createHardwareWallet error', { - error + error, }); throw new ApiError(error); } @@ -1488,367 +1682,420 @@ export default class AdaApi { getCurrencyList = async (): Promise => { try { const apiResponse = await getCurrencyList(); - const response: GetCurrencyListResponse = currencyConfig.responses.list(apiResponse); + const response: GetCurrencyListResponse = currencyConfig.responses.list( + apiResponse + ); logger.debug('AdaApi::getCurrencyList success', { - response + response, }); return response; } catch (error) { logger.error('AdaApi::getCurrencyList error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getCurrencyRate = async (currency: GetCurrencyRateRequest): Promise => { + getCurrencyRate = async ( + currency: GetCurrencyRateRequest + ): Promise => { try { const apiResponse = await getCurrencyRate(currency); - const response: GetCurrencyRateResponse = currencyConfig.responses.rate(apiResponse); + const response: GetCurrencyRateResponse = currencyConfig.responses.rate( + apiResponse + ); logger.debug('AdaApi::getCurrencyRate success', { - response + response, }); return response; } catch (error) { logger.error('AdaApi::getCurrencyRate error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - restoreLegacyWallet = async (request: RestoreLegacyWalletRequest): Promise => { + restoreLegacyWallet = async ( + request: RestoreLegacyWalletRequest + ): Promise => { logger.debug('AdaApi::restoreLegacyWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - recoveryPhrase, - walletName, - spendingPassword - } = request; + const { recoveryPhrase, walletName, spendingPassword } = request; const walletInitData = { style: 'random', name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword + passphrase: spendingPassword, }; try { - const legacyWallet: LegacyAdaWallet = await restoreLegacyWallet(this.config, { - walletInitData - }); + const legacyWallet: LegacyAdaWallet = await restoreLegacyWallet( + this.config, + { + walletInitData, + } + ); const extraLegacyWalletProps = { address_pool_gap: 0, // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING - } + status: WalletDelegationStatuses.NOT_DELEGATING, + }, }, - isLegacy: true - }; - const wallet = { ...legacyWallet, - ...extraLegacyWalletProps + isLegacy: true, }; + const wallet = { ...legacyWallet, ...extraLegacyWalletProps }; logger.debug('AdaApi::restoreLegacyWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreLegacyWallet error', { - error + error, }); - throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); + throw new ApiError(error) + .set('forbiddenMnemonic') + .where('message', 'JSONValidationFailed') + .inc( + 'diagnostic.validationError', + 'Forbidden Mnemonic: an example Mnemonic has been submitted' + ) + .set('forbiddenMnemonic') + .where('code', 'invalid_restoration_parameters') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - restoreByronRandomWallet = async (request: RestoreLegacyWalletRequest): Promise => { + restoreByronRandomWallet = async ( + request: RestoreLegacyWalletRequest + ): Promise => { logger.debug('AdaApi::restoreByronRandomWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - recoveryPhrase, - walletName, - spendingPassword - } = request; + const { recoveryPhrase, walletName, spendingPassword } = request; const walletInitData = { name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword + passphrase: spendingPassword, }; const type = WALLET_BYRON_KINDS.RANDOM; try { - const legacyWallet: LegacyAdaWallet = await restoreByronWallet(this.config, { - walletInitData - }, type); + const legacyWallet: LegacyAdaWallet = await restoreByronWallet( + this.config, + { + walletInitData, + }, + type + ); // Generate address for the newly restored Byron wallet - const { - id: walletId - } = legacyWallet; + const { id: walletId } = legacyWallet; const address: Address = await createByronWalletAddress(this.config, { passphrase: spendingPassword, - walletId + walletId, }); logger.debug('AdaApi::createAddress (Byron) success', { - address + address, }); const extraLegacyWalletProps = { address_pool_gap: 0, // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING - } + status: WalletDelegationStatuses.NOT_DELEGATING, + }, }, - isLegacy: true - }; - const wallet = { ...legacyWallet, - ...extraLegacyWalletProps + isLegacy: true, }; + const wallet = { ...legacyWallet, ...extraLegacyWalletProps }; logger.debug('AdaApi::restoreByronRandomWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreByronRandomWallet error', { - error + error, }); - throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); + throw new ApiError(error) + .set('forbiddenMnemonic') + .where('message', 'JSONValidationFailed') + .inc( + 'diagnostic.validationError', + 'Forbidden Mnemonic: an example Mnemonic has been submitted' + ) + .set('forbiddenMnemonic') + .where('code', 'invalid_restoration_parameters') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - restoreByronIcarusWallet = async (request: RestoreLegacyWalletRequest): Promise => { + restoreByronIcarusWallet = async ( + request: RestoreLegacyWalletRequest + ): Promise => { logger.debug('AdaApi::restoreByronIcarusWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - recoveryPhrase, - walletName, - spendingPassword - } = request; + const { recoveryPhrase, walletName, spendingPassword } = request; const walletInitData = { name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword + passphrase: spendingPassword, }; const type = WALLET_BYRON_KINDS.ICARUS; try { - const legacyWallet: LegacyAdaWallet = await restoreByronWallet(this.config, { - walletInitData - }, type); + const legacyWallet: LegacyAdaWallet = await restoreByronWallet( + this.config, + { + walletInitData, + }, + type + ); const extraLegacyWalletProps = { address_pool_gap: 0, // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING - } + status: WalletDelegationStatuses.NOT_DELEGATING, + }, }, - isLegacy: true - }; - const wallet = { ...legacyWallet, - ...extraLegacyWalletProps + isLegacy: true, }; + const wallet = { ...legacyWallet, ...extraLegacyWalletProps }; logger.debug('AdaApi::restoreByronIcarusWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreByronIcarusWallet error', { - error + error, }); - throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); + throw new ApiError(error) + .set('forbiddenMnemonic') + .where('message', 'JSONValidationFailed') + .inc( + 'diagnostic.validationError', + 'Forbidden Mnemonic: an example Mnemonic has been submitted' + ) + .set('forbiddenMnemonic') + .where('code', 'invalid_restoration_parameters') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - restoreByronTrezorWallet = async (request: RestoreLegacyWalletRequest): Promise => { + restoreByronTrezorWallet = async ( + request: RestoreLegacyWalletRequest + ): Promise => { logger.debug('AdaApi::restoreByronTrezorWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - recoveryPhrase, - walletName, - spendingPassword - } = request; + const { recoveryPhrase, walletName, spendingPassword } = request; const walletInitData = { name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword + passphrase: spendingPassword, }; const type = WALLET_BYRON_KINDS.TREZOR; try { - const legacyWallet: LegacyAdaWallet = await restoreByronWallet(this.config, { - walletInitData - }, type); + const legacyWallet: LegacyAdaWallet = await restoreByronWallet( + this.config, + { + walletInitData, + }, + type + ); const extraLegacyWalletProps = { address_pool_gap: 0, // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING - } + status: WalletDelegationStatuses.NOT_DELEGATING, + }, }, - isLegacy: true - }; - const wallet = { ...legacyWallet, - ...extraLegacyWalletProps + isLegacy: true, }; + const wallet = { ...legacyWallet, ...extraLegacyWalletProps }; logger.debug('AdaApi::restoreByronTrezorWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreByronTrezorWallet error', { - error + error, }); - throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); + throw new ApiError(error) + .set('forbiddenMnemonic') + .where('message', 'JSONValidationFailed') + .inc( + 'diagnostic.validationError', + 'Forbidden Mnemonic: an example Mnemonic has been submitted' + ) + .set('forbiddenMnemonic') + .where('code', 'invalid_restoration_parameters') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - restoreByronLedgerWallet = async (request: RestoreLegacyWalletRequest): Promise => { + restoreByronLedgerWallet = async ( + request: RestoreLegacyWalletRequest + ): Promise => { logger.debug('AdaApi::restoreByronLedgerWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - recoveryPhrase, - walletName, - spendingPassword - } = request; + const { recoveryPhrase, walletName, spendingPassword } = request; const walletInitData = { name: walletName, mnemonic_sentence: recoveryPhrase, - passphrase: spendingPassword + passphrase: spendingPassword, }; const type = WALLET_BYRON_KINDS.LEDGER; try { - const legacyWallet: LegacyAdaWallet = await restoreByronWallet(this.config, { - walletInitData - }, type); + const legacyWallet: LegacyAdaWallet = await restoreByronWallet( + this.config, + { + walletInitData, + }, + type + ); const extraLegacyWalletProps = { address_pool_gap: 0, // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING - } + status: WalletDelegationStatuses.NOT_DELEGATING, + }, }, - isLegacy: true - }; - const wallet = { ...legacyWallet, - ...extraLegacyWalletProps + isLegacy: true, }; + const wallet = { ...legacyWallet, ...extraLegacyWalletProps }; logger.debug('AdaApi::restoreByronLedgerWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreByronLedgerWallet error', { - error + error, }); - throw new ApiError(error).set('forbiddenMnemonic').where('message', 'JSONValidationFailed').inc('diagnostic.validationError', 'Forbidden Mnemonic: an example Mnemonic has been submitted').set('forbiddenMnemonic').where('code', 'invalid_restoration_parameters').result(); + throw new ApiError(error) + .set('forbiddenMnemonic') + .where('message', 'JSONValidationFailed') + .inc( + 'diagnostic.validationError', + 'Forbidden Mnemonic: an example Mnemonic has been submitted' + ) + .set('forbiddenMnemonic') + .where('code', 'invalid_restoration_parameters') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - restoreExportedByronWallet = async (request: RestoreExportedByronWalletRequest): Promise => { + restoreExportedByronWallet = async ( + request: RestoreExportedByronWalletRequest + ): Promise => { logger.debug('AdaApi::restoreExportedByronWallet called', { - name: request.name + name: request.name, }); try { - const legacyWallet: LegacyAdaWallet = await restoreExportedByronWallet(this.config, { - walletInitData: request - }); + const legacyWallet: LegacyAdaWallet = await restoreExportedByronWallet( + this.config, + { + walletInitData: request, + } + ); const extraLegacyWalletProps = { address_pool_gap: 0, // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING - } + status: WalletDelegationStatuses.NOT_DELEGATING, + }, }, - isLegacy: true - }; - const wallet = { ...legacyWallet, - ...extraLegacyWalletProps + isLegacy: true, }; + const wallet = { ...legacyWallet, ...extraLegacyWalletProps }; logger.debug('AdaApi::restoreExportedByronWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreExportedByronWallet error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - importWalletFromKey = async (request: ImportWalletFromKeyRequest): Promise => { + importWalletFromKey = async ( + request: ImportWalletFromKeyRequest + ): Promise => { logger.debug('AdaApi::importWalletFromKey called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - filePath, - spendingPassword - } = request; + const { filePath, spendingPassword } = request; try { const importedWallet: AdaWallet = await importWalletAsKey(this.config, { filePath, - spendingPassword: spendingPassword || '' + spendingPassword: spendingPassword || '', }); logger.debug('AdaApi::importWalletFromKey success', { - importedWallet + importedWallet, }); return _createWalletFromServerData(importedWallet); } catch (error) { logger.error('AdaApi::importWalletFromKey error', { - error + error, }); - throw new ApiError(error).set('walletAlreadyImported', true).where('code', 'wallet_already_exists').result('walletFileImportError'); + throw new ApiError(error) + .set('walletAlreadyImported', true) + .where('code', 'wallet_already_exists') + .result('walletFileImportError'); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - importWalletFromFile = async (request: ImportWalletFromFileRequest): Promise => { + importWalletFromFile = async ( + request: ImportWalletFromFileRequest + ): Promise => { logger.debug('AdaApi::importWalletFromFile called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - filePath, - spendingPassword - } = request; + const { filePath, spendingPassword } = request; const isKeyFile = filePath.split('.').pop().toLowerCase() === 'key'; try { - const importedWallet: AdaWallet = isKeyFile ? await importWalletAsKey(this.config, { - filePath, - spendingPassword - }) : await importWalletAsJSON(this.config, filePath); + const importedWallet: AdaWallet = isKeyFile + ? await importWalletAsKey(this.config, { + filePath, + spendingPassword, + }) + : await importWalletAsJSON(this.config, filePath); logger.debug('AdaApi::importWalletFromFile success', { - importedWallet + importedWallet, }); return _createWalletFromServerData(importedWallet); } catch (error) { logger.error('AdaApi::importWalletFromFile error', { - error + error, }); - throw new ApiError(error).set('walletAlreadyImported', true).where('code', 'wallet_already_exists').result('walletFileImportError'); + throw new ApiError(error) + .set('walletAlreadyImported', true) + .where('code', 'wallet_already_exists') + .result('walletFileImportError'); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message updateWallet = async (request: UpdateWalletRequest): Promise => { logger.debug('AdaApi::updateWallet called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - walletId, - name, - isLegacy - } = request; + const { walletId, name, isLegacy } = request; try { let wallet: AdaWallet; @@ -1856,71 +2103,69 @@ export default class AdaApi { if (isLegacy) { const response = await updateByronWallet(this.config, { walletId, - name + name, }); - wallet = { ...response, + wallet = { + ...response, address_pool_gap: 0, // Not needed for legacy wallets delegation: { active: { - status: WalletDelegationStatuses.NOT_DELEGATING - } + status: WalletDelegationStatuses.NOT_DELEGATING, + }, }, - isLegacy: true + isLegacy: true, }; } else { wallet = await updateWallet(this.config, { walletId, - name + name, }); } logger.debug('AdaApi::updateWallet success', { - wallet + wallet, }); return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::updateWallet error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - updateSpendingPassword = async (request: UpdateSpendingPasswordRequest): Promise => { + updateSpendingPassword = async ( + request: UpdateSpendingPasswordRequest + ): Promise => { logger.debug('AdaApi::updateSpendingPassword called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - walletId, - oldPassword, - newPassword, - isLegacy - } = request; + const { walletId, oldPassword, newPassword, isLegacy } = request; try { if (isLegacy) { await updateByronSpendingPassword(this.config, { walletId, oldPassword, - newPassword + newPassword, }); if (!oldPassword) { // Generate address for the Byron wallet for which password was set for the 1st time const address: Address = await createByronWalletAddress(this.config, { passphrase: newPassword, - walletId + walletId, }); logger.debug('AdaApi::createAddress (Byron) success', { - address + address, }); } } else { await updateSpendingPassword(this.config, { walletId, oldPassword, - newPassword + newPassword, }); } @@ -1928,35 +2173,42 @@ export default class AdaApi { return true; } catch (error) { logger.error('AdaApi::updateSpendingPassword error', { - error + error, }); - throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); + throw new ApiError(error) + .set('wrongEncryptionPassphrase') + .where('code', 'bad_request') + .inc('message', 'passphrase is too short') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - quitStakePool = async (request: QuitStakePoolRequest): Promise => { + quitStakePool = async ( + request: QuitStakePoolRequest + ): Promise => { logger.debug('AdaApi::quitStakePool called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - walletId, - passphrase - } = request; + const { walletId, passphrase } = request; try { const result = await quitStakePool(this.config, { walletId, - passphrase + passphrase, }); logger.debug('AdaApi::quitStakePool success', { - result + result, }); return result; } catch (error) { logger.error('AdaApi::quitStakePool error', { - error + error, }); - throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); + throw new ApiError(error) + .set('wrongEncryptionPassphrase') + .where('code', 'bad_request') + .inc('message', 'passphrase is too short') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message @@ -1965,15 +2217,15 @@ export default class AdaApi { try { const { - pool_metadata_source: poolMetadataSource + pool_metadata_source: poolMetadataSource, } = await getSmashSettings(this.config); logger.debug('AdaApi::getSmashSettings success', { - poolMetadataSource + poolMetadataSource, }); return poolMetadataSource; } catch (error) { logger.error('AdaApi::getSmashSettings error', { - error + error, }); throw new ApiError(error); } @@ -1982,8 +2234,8 @@ export default class AdaApi { checkSmashServerIsValid = async (url: string): Promise => { logger.debug('AdaApi::checkSmashServerIsValid called', { parameters: { - url - } + url, + }, }); try { @@ -1992,74 +2244,91 @@ export default class AdaApi { } const { - health - }: CheckSmashServerHealthApiResponse = await checkSmashServerHealth(this.config, url); + health, + }: CheckSmashServerHealthApiResponse = await checkSmashServerHealth( + this.config, + url + ); const isValid = health === SMASH_SERVER_STATUSES.AVAILABLE; logger.debug('AdaApi::checkSmashServerIsValid success', { - isValid + isValid, }); return isValid; } catch (error) { logger.error('AdaApi::checkSmashServerIsValid error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - updateSmashSettings = async (poolMetadataSource: PoolMetadataSource): Promise => { + updateSmashSettings = async ( + poolMetadataSource: PoolMetadataSource + ): Promise => { logger.debug('AdaApi::updateSmashSettings called', { parameters: { - poolMetadataSource - } + poolMetadataSource, + }, }); try { - const isSmashServerValid = await this.checkSmashServerIsValid(poolMetadataSource); + const isSmashServerValid = await this.checkSmashServerIsValid( + poolMetadataSource + ); if (!isSmashServerValid) { const error = { - code: 'invalid_smash_server' + code: 'invalid_smash_server', }; throw new ApiError(error); } await updateSmashSettings(this.config, poolMetadataSource); logger.debug('AdaApi::updateSmashSettings success', { - poolMetadataSource + poolMetadataSource, }); } catch (error) { const id = get(error, 'id'); const message = get(error, 'values.message'); - if (id === 'api.errors.GenericApiError' && message === 'Error parsing query parameter url failed: URI must not contain a path/query/fragment.') { + if ( + id === 'api.errors.GenericApiError' && + message === + 'Error parsing query parameter url failed: URI must not contain a path/query/fragment.' + ) { throw new ApiError({ - code: 'invalid_smash_server' + code: 'invalid_smash_server', }); } logger.error('AdaApi::updateSmashSettings error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getRedeemItnRewardsFee = async (request: GetRedeemItnRewardsFeeRequest): Promise => { - const { - address, - wallet, - recoveryPhrase: withdrawal - } = request; + getRedeemItnRewardsFee = async ( + request: GetRedeemItnRewardsFeeRequest + ): Promise => { + const { address, wallet, recoveryPhrase: withdrawal } = request; const { id: walletId, amount: walletBalance, availableAmount, - reward: rewardsBalance + reward: rewardsBalance, } = wallet; - const minRewardsReceiverBalance = new BigNumber(MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE); + const minRewardsReceiverBalance = new BigNumber( + MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE + ); // Amount is set to either wallet's balance in case balance is less than 3 ADA or 1 ADA in order to avoid min UTXO affecting transaction fees calculation - const amount = walletBalance.isLessThan(minRewardsReceiverBalance.times(MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE * 3)) ? formattedAmountToLovelace(walletBalance.toString()) : REWARDS_REDEMPTION_FEE_CALCULATION_AMOUNT; + const amount = walletBalance.isLessThan( + minRewardsReceiverBalance.times( + MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE * 3 + ) + ) + ? formattedAmountToLovelace(walletBalance.toString()) + : REWARDS_REDEMPTION_FEE_CALCULATION_AMOUNT; const payload = { address, walletId, @@ -2068,99 +2337,99 @@ export default class AdaApi { rewardsBalance, amount, withdrawal, - isLegacy: false + isLegacy: false, }; try { - const { - fee - } = await this.calculateTransactionFee(payload); + const { fee } = await this.calculateTransactionFee(payload); logger.debug('AdaApi::getRedeemItnRewardsFee success', { - fee + fee, }); return fee; } catch (error) { logger.error('AdaApi::getRedeemItnRewardsFee error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - requestRedeemItnRewards = async (request: RequestRedeemItnRewardsRequest): Promise => { + requestRedeemItnRewards = async ( + request: RequestRedeemItnRewardsRequest + ): Promise => { const { address, walletId, spendingPassword: passphrase, - recoveryPhrase: withdrawal + recoveryPhrase: withdrawal, } = request; const amount = REWARDS_REDEMPTION_FEE_CALCULATION_AMOUNT; try { const data = { - payments: [{ - address, - amount: { - quantity: amount, - unit: WalletUnits.LOVELACE - } - }], + payments: [ + { + address, + amount: { + quantity: amount, + unit: WalletUnits.LOVELACE, + }, + }, + ], passphrase, - withdrawal + withdrawal, }; const transaction = await createTransaction(this.config, { walletId, - data + data, }); const response = _createRedeemItnRewardsFromServerData(transaction); logger.debug('AdaApi::requestRedeemItnRewards success', { - response + response, }); return response; } catch (error) { logger.error('AdaApi::requestRedeemItnRewards error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - exportWalletToFile = async (request: ExportWalletToFileRequest): Promise<[]> => { - const { - walletId, - filePath - } = request; + exportWalletToFile = async ( + request: ExportWalletToFileRequest + ): Promise<[]> => { + const { walletId, filePath } = request; logger.debug('AdaApi::exportWalletToFile called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); try { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message const response: Promise<[]> = await exportWalletAsJSON(this.config, { walletId, - filePath + filePath, }); logger.debug('AdaApi::exportWalletToFile success', { - response + response, }); return response; } catch (error) { logger.error('AdaApi::exportWalletToFile error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getWalletUtxos = async (request: GetWalletUtxosRequest): Promise => { - const { - walletId, - isLegacy - } = request; + getWalletUtxos = async ( + request: GetWalletUtxosRequest + ): Promise => { + const { walletId, isLegacy } = request; logger.debug('AdaApi::getWalletUtxos called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); try { @@ -2168,69 +2437,70 @@ export default class AdaApi { if (isLegacy) { response = await getByronWalletUtxos(this.config, { - walletId + walletId, }); } else { response = await getWalletUtxos(this.config, { - walletId + walletId, }); } logger.debug('AdaApi::getWalletUtxos success', { - response + response, }); return response; } catch (error) { logger.error('AdaApi::getWalletUtxos error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - transferFundsCalculateFee = async (request: TransferFundsCalculateFeeRequest): Promise => { - const { - sourceWalletId - } = request; + transferFundsCalculateFee = async ( + request: TransferFundsCalculateFeeRequest + ): Promise => { + const { sourceWalletId } = request; logger.debug('AdaApi::transferFundsCalculateFee called', { parameters: { - sourceWalletId - } + sourceWalletId, + }, }); try { - const response: TransferFundsCalculateFeeApiResponse = await transferFundsCalculateFee(this.config, { - sourceWalletId - }); + const response: TransferFundsCalculateFeeApiResponse = await transferFundsCalculateFee( + this.config, + { + sourceWalletId, + } + ); logger.debug('AdaApi::transferFundsCalculateFee success', { - response + response, }); return _createMigrationFeeFromServerData(response); } catch (error) { logger.error('AdaApi::transferFundsCalculateFee error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - transferFunds = async (request: TransferFundsRequest): Promise => { - const { - sourceWalletId, - targetWalletAddresses, - passphrase - } = request; + transferFunds = async ( + request: TransferFundsRequest + ): Promise => { + const { sourceWalletId, targetWalletAddresses, passphrase } = request; logger.debug('AdaApi::transferFunds called', { parameters: { sourceWalletId, - targetWalletAddresses - } + targetWalletAddresses, + }, }); if (!targetWalletAddresses) { throw new ApiError({ code: 'no_such_wallet', - message: 'Target wallet does not exist' + message: 'Target wallet does not exist', }).result(); } @@ -2238,45 +2508,53 @@ export default class AdaApi { const response: TransferFundsResponse = await transferFunds(this.config, { sourceWalletId, targetWalletAddresses, - passphrase + passphrase, }); logger.debug('AdaApi::transferFunds success', { - response + response, }); return response; } catch (error) { logger.error('AdaApi::transferFunds error', { - error + error, }); - throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); + throw new ApiError(error) + .set('wrongEncryptionPassphrase') + .where('code', 'bad_request') + .inc('message', 'passphrase is too short') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getStakePools = async (stake: number = 0): Promise> => { logger.debug('AdaApi::getStakePools called', { parameters: { - stake - } + stake, + }, }); try { - const response: AdaApiStakePools = await getStakePools(this.config, stake); - const stakePools = response.filter(({ - metadata - }: AdaApiStakePool) => metadata !== undefined).filter(({ - flags - }: AdaApiStakePool) => !flags.includes('delisted')).filter(({ - margin - }: AdaApiStakePool) => margin !== undefined && margin.quantity < 100).map(_createStakePoolFromServerData); + const response: AdaApiStakePools = await getStakePools( + this.config, + stake + ); + const stakePools = response + .filter(({ metadata }: AdaApiStakePool) => metadata !== undefined) + .filter(({ flags }: AdaApiStakePool) => !flags.includes('delisted')) + .filter( + ({ margin }: AdaApiStakePool) => + margin !== undefined && margin.quantity < 100 + ) + .map(_createStakePoolFromServerData); logger.debug('AdaApi::getStakePools success', { stakePoolsTotal: response.length, stakePoolsWithMetadata: stakePools.length, - unfilteredStakePools: response + unfilteredStakePools: response, }); return stakePools; } catch (error) { logger.error('AdaApi::getStakePools error', { - error + error, }); throw new ApiError(error); } @@ -2288,15 +2566,19 @@ export default class AdaApi { try { const wallets = await this.getWallets(); // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - await Promise.all(wallets.map(wallet => this.deleteWallet({ - walletId: wallet.id, - isLegacy: wallet.isLegacy, - isHardwareWallet: wallet.isHardwareWallet - }))); + await Promise.all( + wallets.map((wallet) => + this.deleteWallet({ + walletId: wallet.id, + isLegacy: wallet.isLegacy, + isHardwareWallet: wallet.isHardwareWallet, + }) + ) + ); logger.debug('AdaApi::testReset success'); } catch (error) { logger.error('AdaApi::testReset error', { - error + error, }); throw new ApiError(error); } @@ -2306,17 +2588,22 @@ export default class AdaApi { logger.debug('AdaApi::getNetworkInfo called'); try { - const networkInfo: NetworkInfoResponse = await getNetworkInfo(this.config); + const networkInfo: NetworkInfoResponse = await getNetworkInfo( + this.config + ); logger.debug('AdaApi::getNetworkInfo success', { - networkInfo + networkInfo, }); const { sync_progress: syncProgressRaw, node_tip: nodeTip, network_tip: networkTip, - next_epoch: nextEpoch + next_epoch: nextEpoch, } = networkInfo; - const syncProgress = get(syncProgressRaw, 'status') === 'ready' ? 100 : get(syncProgressRaw, 'progress.quantity', 0); + const syncProgress = + get(syncProgressRaw, 'status') === 'ready' + ? 100 + : get(syncProgressRaw, 'progress.quantity', 0); const nextEpochNumber = get(nextEpoch, 'epoch_number', null); const nextEpochStartTime = get(nextEpoch, 'epoch_start_time', ''); // extract relevant data before sending to NetworkStatusStore @@ -2325,26 +2612,33 @@ export default class AdaApi { localTip: { epoch: get(nodeTip, 'epoch_number', 0), slot: get(nodeTip, 'slot_number', 0), - absoluteSlotNumber: get(nodeTip, 'absolute_slot_number', 0) + absoluteSlotNumber: get(nodeTip, 'absolute_slot_number', 0), }, - networkTip: networkTip ? { - epoch: get(networkTip, 'epoch_number', 0), - slot: get(networkTip, 'slot_number', 0), - absoluteSlotNumber: get(networkTip, 'absolute_slot_number', 0) - } : null, - nextEpoch: nextEpoch ? { - // N+1 epoch - epochNumber: nextEpochNumber, - epochStart: nextEpochStartTime - } : null + networkTip: networkTip + ? { + epoch: get(networkTip, 'epoch_number', 0), + slot: get(networkTip, 'slot_number', 0), + absoluteSlotNumber: get(networkTip, 'absolute_slot_number', 0), + } + : null, + nextEpoch: nextEpoch + ? { + // N+1 epoch + epochNumber: nextEpochNumber, + epochStart: nextEpochStartTime, + } + : null, }; } catch (error) { logger.error('AdaApi::getNetworkInfo error', { - error + error, }); // Special Error case - if (error.code === TlsCertificateNotValidError.API_ERROR || error.code === 'EPROTO') { + if ( + error.code === TlsCertificateNotValidError.API_ERROR || + error.code === 'EPROTO' + ) { throw new TlsCertificateNotValidError(); } @@ -2352,25 +2646,30 @@ export default class AdaApi { } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getNetworkClock = async (isForceCheck: boolean): Promise => { + getNetworkClock = async ( + isForceCheck: boolean + ): Promise => { logger.debug('AdaApi::getNetworkClock called', { - isForceCheck + isForceCheck, }); try { - const networkClock: NetworkClockResponse = await getNetworkClock(this.config, isForceCheck); + const networkClock: NetworkClockResponse = await getNetworkClock( + this.config, + isForceCheck + ); logger.debug('AdaApi::getNetworkClock success', { networkClock, - isForceCheck + isForceCheck, }); return { status: networkClock.status, - offset: get(networkClock, 'offset.quantity', null) + offset: get(networkClock, 'offset.quantity', null), }; } catch (error) { logger.error('AdaApi::getNetworkClock error', { error, - isForceCheck + isForceCheck, }); throw new ApiError(error); } @@ -2380,9 +2679,11 @@ export default class AdaApi { logger.debug('AdaApi::getNetworkParameters called'); try { - const networkParameters: GetNetworkParametersApiResponse = await getNetworkParameters(this.config); + const networkParameters: GetNetworkParametersApiResponse = await getNetworkParameters( + this.config + ); logger.debug('AdaApi::getNetworkParameters success', { - networkParameters + networkParameters, }); const { genesis_block_hash: genesisBlockHash, @@ -2395,7 +2696,7 @@ export default class AdaApi { decentralization_level: decentralizationLevel, desired_pool_number: desiredPoolNumber, minimum_utxo_value: minimumUtxoValue, - eras + eras, } = networkParameters; const blockchainStartTime = moment(blockchain_start_time).valueOf(); return { @@ -2408,11 +2709,11 @@ export default class AdaApi { decentralizationLevel, desiredPoolNumber, minimumUtxoValue, - eras + eras, }; } catch (error) { logger.error('AdaApi::getNetworkParameters error', { - error + error, }); throw new ApiError(error); } @@ -2430,7 +2731,7 @@ export default class AdaApi { news = JSON.parse(rawNews); } catch (error) { logger.error('AdaApi::getNews error', { - error + error, }); // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Unable to fetch news'); @@ -2445,7 +2746,7 @@ export default class AdaApi { expectedNewsHash = await getNewsHash(news.updatedAt); } catch (error) { logger.error('AdaApi::getNews (hash) error', { - error + error, }); // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Unable to fetch news hash'); @@ -2458,63 +2759,69 @@ export default class AdaApi { logger.debug('AdaApi::getNews success', { updatedAt: news.updatedAt, - items: news.items.length + items: news.items.length, }); return news; }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - calculateDelegationFee = async (request: GetDelegationFeeRequest): Promise => { + calculateDelegationFee = async ( + request: GetDelegationFeeRequest + ): Promise => { logger.debug('AdaApi::calculateDelegationFee called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); try { const response: TransactionFee = await getDelegationFee(this.config, { - walletId: request.walletId + walletId: request.walletId, }); logger.debug('AdaApi::calculateDelegationFee success', { - response + response, }); return _createDelegationFeeFromServerData(response); } catch (error) { logger.error('AdaApi::calculateDelegationFee error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - joinStakePool = async (request: JoinStakePoolRequest): Promise => { + joinStakePool = async ( + request: JoinStakePoolRequest + ): Promise => { logger.debug('AdaApi::joinStakePool called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); - const { - walletId, - stakePoolId, - passphrase - } = request; + const { walletId, stakePoolId, passphrase } = request; try { const response = await joinStakePool(this.config, { walletId, stakePoolId, - passphrase + passphrase, }); logger.debug('AdaApi::joinStakePool success', { - stakePool: response + stakePool: response, }); return response; } catch (error) { logger.error('AdaApi::joinStakePool error', { - error + error, }); - throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').result(); + throw new ApiError(error) + .set('wrongEncryptionPassphrase') + .where('code', 'bad_request') + .inc('message', 'passphrase is too short') + .result(); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - createWalletSignature = async (request: CreateWalletSignatureRequest): Promise => { + createWalletSignature = async ( + request: CreateWalletSignatureRequest + ): Promise => { logger.debug('AdaApi::createWalletSignature called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); const { walletId, @@ -2524,7 +2831,7 @@ export default class AdaApi { votingKey, stakeKey, addressHex, - absoluteSlotNumber + absoluteSlotNumber, } = request; try { @@ -2532,59 +2839,66 @@ export default class AdaApi { passphrase, metadata: { [61284]: { - map: [{ - k: { - int: 1 + map: [ + { + k: { + int: 1, + }, + v: { + bytes: votingKey, + }, }, - v: { - bytes: votingKey - } - }, { - k: { - int: 2 + { + k: { + int: 2, + }, + v: { + bytes: stakeKey, + }, }, - v: { - bytes: stakeKey - } - }, { - k: { - int: 3 + { + k: { + int: 3, + }, + v: { + bytes: addressHex, + }, }, - v: { - bytes: addressHex - } - }, { - k: { - int: 4 + { + k: { + int: 4, + }, + v: { + int: absoluteSlotNumber, + }, }, - v: { - int: absoluteSlotNumber - } - }] - } - } + ], + }, + }, }; const response = await createWalletSignature(this.config, { walletId, role, index, - data + data, }); logger.debug('AdaApi::createWalletSignature success', { - response + response, }); return response; } catch (error) { logger.error('AdaApi::createWalletSignature error', { - error + error, }); throw new ApiError(error); } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - createVotingRegistrationTransaction = async (request: CreateVotingRegistrationRequest): Promise => { + createVotingRegistrationTransaction = async ( + request: CreateVotingRegistrationRequest + ): Promise => { logger.debug('AdaApi::createVotingRegistrationTransaction called', { - parameters: filterLogData(request) + parameters: filterLogData(request), }); const { walletId, @@ -2595,80 +2909,94 @@ export default class AdaApi { votingKey, stakeKey, signature, - absoluteSlotNumber + absoluteSlotNumber, } = request; try { const data = { - payments: [{ - address, - amount: { - quantity: amount, - unit: WalletUnits.LOVELACE - } - }], + payments: [ + { + address, + amount: { + quantity: amount, + unit: WalletUnits.LOVELACE, + }, + }, + ], passphrase, metadata: { [61284]: { - map: [{ - k: { - int: 1 + map: [ + { + k: { + int: 1, + }, + v: { + bytes: votingKey, + }, }, - v: { - bytes: votingKey - } - }, { - k: { - int: 2 + { + k: { + int: 2, + }, + v: { + bytes: stakeKey, + }, }, - v: { - bytes: stakeKey - } - }, { - k: { - int: 3 + { + k: { + int: 3, + }, + v: { + bytes: addressHex, + }, }, - v: { - bytes: addressHex - } - }, { - k: { - int: 4 + { + k: { + int: 4, + }, + v: { + int: absoluteSlotNumber, + }, }, - v: { - int: absoluteSlotNumber - } - }] + ], }, [61285]: { - map: [{ - k: { - int: 1 + map: [ + { + k: { + int: 1, + }, + v: { + bytes: signature, + }, }, - v: { - bytes: signature - } - }] - } - } + ], + }, + }, }; const response: Transaction = await createTransaction(this.config, { walletId, - data: { ...data - } + data: { ...data }, }); logger.debug('AdaApi::createVotingRegistrationTransaction success', { - transaction: response + transaction: response, }); return _createTransactionFromServerData(response); } catch (error) { logger.error('AdaApi::createVotingRegistrationTransaction error', { - error + error, }); - throw new ApiError(error).set('wrongEncryptionPassphrase').where('code', 'bad_request').inc('message', 'passphrase is too short').set('transactionIsTooBig', true, { - linkLabel: 'tooBigTransactionErrorLinkLabel', - linkURL: 'tooBigTransactionErrorLinkURL' - }).where('code', 'transaction_is_too_big').result(); + throw new ApiError(error) + .set('wrongEncryptionPassphrase') + .where('code', 'bad_request') + .inc('message', 'passphrase is too short') + .set('transactionIsTooBig', true, { + linkLabel: 'tooBigTransactionErrorLinkLabel', + linkURL: 'tooBigTransactionErrorLinkURL', + }) + .where('code', 'transaction_is_too_big') + .result(); } }; // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message @@ -2690,120 +3018,134 @@ export default class AdaApi { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setTestingWallets: (testingWalletsData: Array) => void; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. - setTestingWallet: (testingWalletData: Record, walletIndex?: number) => void; + setTestingWallet: ( + testingWalletData: Record, + walletIndex?: number + ) => void; // Stake pools testing utility // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - setFakeStakePoolsJsonForTesting: (fakeStakePoolsJson: Array) => void; + setFakeStakePoolsJsonForTesting: ( + fakeStakePoolsJson: Array + ) => void; setStakePoolsFetchingFailed: () => void; } // ========== TRANSFORM SERVER DATA INTO FRONTEND MODELS ========= -const _createWalletFromServerData = action('AdaApi::_createWalletFromServerData', (wallet: AdaWallet) => { - const { - id: rawWalletId, - address_pool_gap: addressPoolGap, - balance, - name, - assets, - passphrase, - delegation, - state: syncState, - isLegacy = false, - discovery, - isHardwareWallet = false - } = wallet; - const id = isLegacy ? getLegacyWalletId(rawWalletId) : rawWalletId; - const passphraseLastUpdatedAt = get(passphrase, 'last_updated_at', null); - const walletTotalAmount = balance.total.unit === WalletUnits.LOVELACE ? new BigNumber(balance.total.quantity.toString()).dividedBy(LOVELACES_PER_ADA) : new BigNumber(balance.total.quantity.toString()); - const walletAvailableAmount = balance.available.unit === WalletUnits.LOVELACE ? new BigNumber(balance.available.quantity.toString()).dividedBy(LOVELACES_PER_ADA) : new BigNumber(balance.available.quantity.toString()); - let walletRewardAmount = new BigNumber(0); - - if (!isLegacy) { - walletRewardAmount = balance.reward.unit === WalletUnits.LOVELACE ? new BigNumber(balance.reward.quantity.toString()).dividedBy(LOVELACES_PER_ADA) : new BigNumber(balance.reward.quantity.toString()); - } +const _createWalletFromServerData = action( + 'AdaApi::_createWalletFromServerData', + (wallet: AdaWallet) => { + const { + id: rawWalletId, + address_pool_gap: addressPoolGap, + balance, + name, + assets, + passphrase, + delegation, + state: syncState, + isLegacy = false, + discovery, + isHardwareWallet = false, + } = wallet; + const id = isLegacy ? getLegacyWalletId(rawWalletId) : rawWalletId; + const passphraseLastUpdatedAt = get(passphrase, 'last_updated_at', null); + const walletTotalAmount = + balance.total.unit === WalletUnits.LOVELACE + ? new BigNumber(balance.total.quantity.toString()).dividedBy( + LOVELACES_PER_ADA + ) + : new BigNumber(balance.total.quantity.toString()); + const walletAvailableAmount = + balance.available.unit === WalletUnits.LOVELACE + ? new BigNumber(balance.available.quantity.toString()).dividedBy( + LOVELACES_PER_ADA + ) + : new BigNumber(balance.available.quantity.toString()); + let walletRewardAmount = new BigNumber(0); + + if (!isLegacy) { + walletRewardAmount = + balance.reward.unit === WalletUnits.LOVELACE + ? new BigNumber(balance.reward.quantity.toString()).dividedBy( + LOVELACES_PER_ADA + ) + : new BigNumber(balance.reward.quantity.toString()); + } - // Current (Active) - const active = get(delegation, 'active', null); - const target = get(active, 'target', null); - const status = get(active, 'status', null); - const delegatedStakePoolId = isLegacy ? null : target; - const delegationStakePoolStatus = isLegacy ? null : status; - // Last - const next = get(delegation, 'next', null); - const lastPendingStakePool = next ? last(next) : null; - const lastTarget = get(lastPendingStakePool, 'target', null); - const lastStatus = get(lastPendingStakePool, 'status', null); - const lastDelegatedStakePoolId = isLegacy ? null : lastTarget; - const lastDelegationStakePoolStatus = isLegacy ? null : lastStatus; - // Mapping asset items from server data - const walletAssets = { - available: assets.available.map(item => { - const { - policy_id: policyId, - asset_name: assetName, - quantity - } = item; - const uniqueId = `${policyId}${assetName}`; - return { - uniqueId, - policyId, - assetName, - assetNameASCII: hexToString(assetName), - quantity: new BigNumber(quantity.toString()) - }; - }), - total: assets.total.map(item => { - const { - policy_id: policyId, - asset_name: assetName, - quantity - } = item; - const uniqueId = `${policyId}${assetName}`; - return { - uniqueId, - policyId, - assetName, - assetNameASCII: hexToString(assetName), - quantity: new BigNumber(quantity.toString()) - }; - }) - }; - return new Wallet({ - id, - addressPoolGap, - name, - amount: walletTotalAmount, - availableAmount: walletAvailableAmount, - reward: walletRewardAmount, - assets: walletAssets, - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Date'. - passwordUpdateDate: passphraseLastUpdatedAt && new Date(passphraseLastUpdatedAt), - hasPassword: isHardwareWallet || passphraseLastUpdatedAt !== null, - // For HW set that wallet has password - syncState, - isLegacy, - isHardwareWallet, - delegatedStakePoolId, - delegationStakePoolStatus, - lastDelegatedStakePoolId, - lastDelegationStakePoolStatus, - pendingDelegations: next, - discovery - }); -}); - -const _createAddressFromServerData = action('AdaApi::_createAddressFromServerData', (address: Address) => { - const { - id, - state, - derivation_path: derivationPath - } = address; - return new WalletAddress({ - id, - used: state === 'used', - spendingPath: derivationPathToAddressPath(derivationPath) // E.g. "1852'/1815'/0'/0/19", - - }); -}); + // Current (Active) + const active = get(delegation, 'active', null); + const target = get(active, 'target', null); + const status = get(active, 'status', null); + const delegatedStakePoolId = isLegacy ? null : target; + const delegationStakePoolStatus = isLegacy ? null : status; + // Last + const next = get(delegation, 'next', null); + const lastPendingStakePool = next ? last(next) : null; + const lastTarget = get(lastPendingStakePool, 'target', null); + const lastStatus = get(lastPendingStakePool, 'status', null); + const lastDelegatedStakePoolId = isLegacy ? null : lastTarget; + const lastDelegationStakePoolStatus = isLegacy ? null : lastStatus; + // Mapping asset items from server data + const walletAssets = { + available: assets.available.map((item) => { + const { policy_id: policyId, asset_name: assetName, quantity } = item; + const uniqueId = `${policyId}${assetName}`; + return { + uniqueId, + policyId, + assetName, + assetNameASCII: hexToString(assetName), + quantity: new BigNumber(quantity.toString()), + }; + }), + total: assets.total.map((item) => { + const { policy_id: policyId, asset_name: assetName, quantity } = item; + const uniqueId = `${policyId}${assetName}`; + return { + uniqueId, + policyId, + assetName, + assetNameASCII: hexToString(assetName), + quantity: new BigNumber(quantity.toString()), + }; + }), + }; + return new Wallet({ + id, + addressPoolGap, + name, + amount: walletTotalAmount, + availableAmount: walletAvailableAmount, + reward: walletRewardAmount, + assets: walletAssets, + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Date'. + passwordUpdateDate: + passphraseLastUpdatedAt && new Date(passphraseLastUpdatedAt), + hasPassword: isHardwareWallet || passphraseLastUpdatedAt !== null, + // For HW set that wallet has password + syncState, + isLegacy, + isHardwareWallet, + delegatedStakePoolId, + delegationStakePoolStatus, + lastDelegatedStakePoolId, + lastDelegationStakePoolStatus, + pendingDelegations: next, + discovery, + }); + } +); + +const _createAddressFromServerData = action( + 'AdaApi::_createAddressFromServerData', + (address: Address) => { + const { id, state, derivation_path: derivationPath } = address; + return new WalletAddress({ + id, + used: state === 'used', + spendingPath: derivationPathToAddressPath(derivationPath), // E.g. "1852'/1815'/0'/0/19", + }); + } +); const _conditionToTxState = (condition: string) => { switch (condition) { @@ -2818,201 +3160,234 @@ const _conditionToTxState = (condition: string) => { } }; -const _createTransactionFromServerData = action('AdaApi::_createTransactionFromServerData', (data: Transaction) => { - const { - id, - amount, - fee, - deposit, - inserted_at: insertedAt, - pending_since: pendingSince, - depth, - direction, - inputs, - outputs, - withdrawals, - status, - metadata - } = data; - - const state = _conditionToTxState(status); - - const stateInfo = state === TransactionStates.PENDING ? pendingSince : insertedAt; - const date = get(stateInfo, 'time'); - const slotNumber = get(stateInfo, ['block', 'slot_number'], null); - const epochNumber = get(stateInfo, ['block', 'epoch_number'], null); - const confirmations = get(depth, 'quantity', 0); - // Mapping asset items from server data - const outputAssets = flatten(outputs.map(({ - assets, - address - }) => assets ? assets.map(asset => ({ ...asset, - address - })) : [])); - const transactionAssets = map(outputAssets, ({ - policy_id: policyId, - asset_name: assetName, - quantity, - address - }) => ({ - policyId, - assetName, - quantity: new BigNumber(quantity.toString()), - address - })); - return new WalletTransaction({ - id, - confirmations, - slotNumber, - epochNumber, - title: direction === 'outgoing' ? 'Ada sent' : 'Ada received', - type: direction === 'outgoing' ? TransactionTypes.EXPEND : TransactionTypes.INCOME, - amount: new BigNumber(direction === 'outgoing' ? `-${amount.quantity.toString()}` : amount.quantity.toString()).dividedBy(LOVELACES_PER_ADA), - fee: new BigNumber(fee.quantity.toString()).dividedBy(LOVELACES_PER_ADA), - deposit: new BigNumber(deposit.quantity.toString()).dividedBy(LOVELACES_PER_ADA), - assets: transactionAssets, - date: utcStringToDate(date), - description: '', - addresses: { - from: inputs.map(({ - address - }) => address || null), - to: outputs.map(({ - address - }) => address), - withdrawals: withdrawals.map(({ - stake_address: address - }) => address) - }, - state, - metadata - }); -}); - -const _createAssetFromServerData = action('AdaApi::_createAssetFromServerData', (data: ApiAsset, localData: AssetLocalData, storedAssetMetadata: StoredAssetMetadata) => { - const { - policy_id: policyId, - asset_name: assetName, - fingerprint, - metadata - } = data; - const uniqueId = `${policyId}${assetName}`; - const storedMetadata = storedAssetMetadata[uniqueId]; - const { - decimals - } = localData; - const { - decimals: recommendedDecimals = null - } = metadata || storedMetadata || {}; - - if (metadata) { - storedAssetMetadata[uniqueId] = metadata; +const _createTransactionFromServerData = action( + 'AdaApi::_createTransactionFromServerData', + (data: Transaction) => { + const { + id, + amount, + fee, + deposit, + inserted_at: insertedAt, + pending_since: pendingSince, + depth, + direction, + inputs, + outputs, + withdrawals, + status, + metadata, + } = data; + + const state = _conditionToTxState(status); + + const stateInfo = + state === TransactionStates.PENDING ? pendingSince : insertedAt; + const date = get(stateInfo, 'time'); + const slotNumber = get(stateInfo, ['block', 'slot_number'], null); + const epochNumber = get(stateInfo, ['block', 'epoch_number'], null); + const confirmations = get(depth, 'quantity', 0); + // Mapping asset items from server data + const outputAssets = flatten( + outputs.map(({ assets, address }) => + assets ? assets.map((asset) => ({ ...asset, address })) : [] + ) + ); + const transactionAssets = map( + outputAssets, + ({ policy_id: policyId, asset_name: assetName, quantity, address }) => ({ + policyId, + assetName, + quantity: new BigNumber(quantity.toString()), + address, + }) + ); + return new WalletTransaction({ + id, + confirmations, + slotNumber, + epochNumber, + title: direction === 'outgoing' ? 'Ada sent' : 'Ada received', + type: + direction === 'outgoing' + ? TransactionTypes.EXPEND + : TransactionTypes.INCOME, + amount: new BigNumber( + direction === 'outgoing' + ? `-${amount.quantity.toString()}` + : amount.quantity.toString() + ).dividedBy(LOVELACES_PER_ADA), + fee: new BigNumber(fee.quantity.toString()).dividedBy(LOVELACES_PER_ADA), + deposit: new BigNumber(deposit.quantity.toString()).dividedBy( + LOVELACES_PER_ADA + ), + assets: transactionAssets, + date: utcStringToDate(date), + description: '', + addresses: { + from: inputs.map(({ address }) => address || null), + to: outputs.map(({ address }) => address), + withdrawals: withdrawals.map(({ stake_address: address }) => address), + }, + state, + metadata, + }); } +); + +const _createAssetFromServerData = action( + 'AdaApi::_createAssetFromServerData', + ( + data: ApiAsset, + localData: AssetLocalData, + storedAssetMetadata: StoredAssetMetadata + ) => { + const { + policy_id: policyId, + asset_name: assetName, + fingerprint, + metadata, + } = data; + const uniqueId = `${policyId}${assetName}`; + const storedMetadata = storedAssetMetadata[uniqueId]; + const { decimals } = localData; + const { decimals: recommendedDecimals = null } = + metadata || storedMetadata || {}; + + if (metadata) { + storedAssetMetadata[uniqueId] = metadata; + } - return new Asset({ - policyId, - assetName, - fingerprint, - metadata: metadata || storedMetadata, - decimals, - recommendedDecimals, - uniqueId - }); -}); - -const _createTransactionFeeFromServerData = action('AdaApi::_createTransactionFeeFromServerData', (data: TransactionFee) => { - const feeAmount = get(data, ['estimated_max', 'quantity'], 0); - const minimumAdaAmount = get(data, 'minimum_coins.[0].quantity', 0); - const fee = new BigNumber(feeAmount.toString()).dividedBy(LOVELACES_PER_ADA); - const minimumAda = new BigNumber(minimumAdaAmount.toString()).dividedBy(LOVELACES_PER_ADA); - return { - fee, - minimumAda - }; -}); - -const _createMigrationFeeFromServerData = action('AdaApi::_createMigrationFeeFromServerData', (data: TransferFundsCalculateFeeApiResponse) => { - const { - quantity: feeAmount = 0 - } = data.migration_cost; - const fee = new BigNumber(feeAmount.toString()).dividedBy(LOVELACES_PER_ADA); - const { - quantity: leftoversAmount = 0 - } = data.leftovers; - const leftovers = new BigNumber(leftoversAmount.toString()).dividedBy(LOVELACES_PER_ADA); - return { - fee, - leftovers - }; -}); - -const _createDelegationFeeFromServerData = action('AdaApi::_createDelegationFeeFromServerData', (data: TransactionFee) => { - const fee = new BigNumber(get(data, ['estimated_max', 'quantity'], 0).toString()).dividedBy(LOVELACES_PER_ADA); - const deposits = new BigNumber(get(data, ['deposit', 'quantity'], 0).toString()).dividedBy(LOVELACES_PER_ADA); - // @TODO Use api response data when api is ready - const depositsReclaimed = new BigNumber(0); - return { - fee, - deposits, - depositsReclaimed - }; -}); - -const _createStakePoolFromServerData = action('AdaApi::_createStakePoolFromServerData', (stakePool: AdaApiStakePool, index: number) => { - const { - id, - metrics, - cost, - margin: profitMargin, - metadata, - pledge, - retirement - } = stakePool; - const { - relative_stake: relativeStake, - produced_blocks: producedBlocks, - non_myopic_member_rewards: nonMyopicMemberRewards, - saturation - } = metrics; - // eslint-disable-line - const { - name, - description = '', - ticker, - homepage - } = metadata; - const relativeStakePercentage = get(relativeStake, 'quantity', 0); - const producedBlocksCount = get(producedBlocks, 'quantity', 0); - const nonMyopicMemberRewardsQuantity = get(nonMyopicMemberRewards, 'quantity', 0); - const costQuantity = get(cost, 'quantity', 0).toString(); - const pledgeQuantity = get(pledge, 'quantity', 0).toString(); - const profitMarginPercentage = get(profitMargin, 'quantity', 0); - const retiringAt = get(retirement, 'epoch_start_time', null); - return new StakePool({ - id, - relativeStake: relativeStakePercentage, - producedBlocks: producedBlocksCount, - potentialRewards: new BigNumber(nonMyopicMemberRewardsQuantity.toString()).dividedBy(LOVELACES_PER_ADA), - nonMyopicMemberRewards: nonMyopicMemberRewardsQuantity, - ticker, - homepage, - cost: new BigNumber(costQuantity.toString()).dividedBy(LOVELACES_PER_ADA), - description, - isCharity: false, - name, - pledge: new BigNumber(pledgeQuantity.toString()).dividedBy(LOVELACES_PER_ADA), - profitMargin: profitMarginPercentage, - ranking: index + 1, - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Date'. - retiring: retiringAt ? new Date(retiringAt) : null, - saturation: saturation * 100 - }); -}); - -const _createRedeemItnRewardsFromServerData = action('AdaApi::_createRedeemItnRewardsFromServerData', (transaction: Transaction) => { - const { - quantity, - unit - } = get(transaction, 'withdrawals[0].amount'); - return unit === WalletUnits.LOVELACE ? new BigNumber(quantity.toString()).dividedBy(LOVELACES_PER_ADA) : new BigNumber(quantity.toString()); -}); \ No newline at end of file + return new Asset({ + policyId, + assetName, + fingerprint, + metadata: metadata || storedMetadata, + decimals, + recommendedDecimals, + uniqueId, + }); + } +); + +const _createTransactionFeeFromServerData = action( + 'AdaApi::_createTransactionFeeFromServerData', + (data: TransactionFee) => { + const feeAmount = get(data, ['estimated_max', 'quantity'], 0); + const minimumAdaAmount = get(data, 'minimum_coins.[0].quantity', 0); + const fee = new BigNumber(feeAmount.toString()).dividedBy( + LOVELACES_PER_ADA + ); + const minimumAda = new BigNumber(minimumAdaAmount.toString()).dividedBy( + LOVELACES_PER_ADA + ); + return { + fee, + minimumAda, + }; + } +); + +const _createMigrationFeeFromServerData = action( + 'AdaApi::_createMigrationFeeFromServerData', + (data: TransferFundsCalculateFeeApiResponse) => { + const { quantity: feeAmount = 0 } = data.migration_cost; + const fee = new BigNumber(feeAmount.toString()).dividedBy( + LOVELACES_PER_ADA + ); + const { quantity: leftoversAmount = 0 } = data.leftovers; + const leftovers = new BigNumber(leftoversAmount.toString()).dividedBy( + LOVELACES_PER_ADA + ); + return { + fee, + leftovers, + }; + } +); + +const _createDelegationFeeFromServerData = action( + 'AdaApi::_createDelegationFeeFromServerData', + (data: TransactionFee) => { + const fee = new BigNumber( + get(data, ['estimated_max', 'quantity'], 0).toString() + ).dividedBy(LOVELACES_PER_ADA); + const deposits = new BigNumber( + get(data, ['deposit', 'quantity'], 0).toString() + ).dividedBy(LOVELACES_PER_ADA); + // @TODO Use api response data when api is ready + const depositsReclaimed = new BigNumber(0); + return { + fee, + deposits, + depositsReclaimed, + }; + } +); + +const _createStakePoolFromServerData = action( + 'AdaApi::_createStakePoolFromServerData', + (stakePool: AdaApiStakePool, index: number) => { + const { + id, + metrics, + cost, + margin: profitMargin, + metadata, + pledge, + retirement, + } = stakePool; + const { + relative_stake: relativeStake, + produced_blocks: producedBlocks, + non_myopic_member_rewards: nonMyopicMemberRewards, + saturation, + } = metrics; + // eslint-disable-line + const { name, description = '', ticker, homepage } = metadata; + const relativeStakePercentage = get(relativeStake, 'quantity', 0); + const producedBlocksCount = get(producedBlocks, 'quantity', 0); + const nonMyopicMemberRewardsQuantity = get( + nonMyopicMemberRewards, + 'quantity', + 0 + ); + const costQuantity = get(cost, 'quantity', 0).toString(); + const pledgeQuantity = get(pledge, 'quantity', 0).toString(); + const profitMarginPercentage = get(profitMargin, 'quantity', 0); + const retiringAt = get(retirement, 'epoch_start_time', null); + return new StakePool({ + id, + relativeStake: relativeStakePercentage, + producedBlocks: producedBlocksCount, + potentialRewards: new BigNumber( + nonMyopicMemberRewardsQuantity.toString() + ).dividedBy(LOVELACES_PER_ADA), + nonMyopicMemberRewards: nonMyopicMemberRewardsQuantity, + ticker, + homepage, + cost: new BigNumber(costQuantity.toString()).dividedBy(LOVELACES_PER_ADA), + description, + isCharity: false, + name, + pledge: new BigNumber(pledgeQuantity.toString()).dividedBy( + LOVELACES_PER_ADA + ), + profitMargin: profitMarginPercentage, + ranking: index + 1, + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Date'. + retiring: retiringAt ? new Date(retiringAt) : null, + saturation: saturation * 100, + }); + } +); + +const _createRedeemItnRewardsFromServerData = action( + 'AdaApi::_createRedeemItnRewardsFromServerData', + (transaction: Transaction) => { + const { quantity, unit } = get(transaction, 'withdrawals[0].amount'); + return unit === WalletUnits.LOVELACE + ? new BigNumber(quantity.toString()).dividedBy(LOVELACES_PER_ADA) + : new BigNumber(quantity.toString()); + } +); diff --git a/source/renderer/app/api/transactions/types.ts b/source/renderer/app/api/transactions/types.ts index 0272679925..2b5502d6db 100644 --- a/source/renderer/app/api/transactions/types.ts +++ b/source/renderer/app/api/transactions/types.ts @@ -1,17 +1,17 @@ -import BigNumber from "bignumber.js"; -import { WalletTransaction } from "../../domains/WalletTransaction"; -import { WalletUnits } from "../../domains/Wallet"; -import type { DelegationAction } from "../../types/stakingTypes"; -import type { ApiTokens } from "../assets/types"; -import type { TransactionMetadata } from "../../types/TransactionMetadata"; -import type { PathRoleIdentityType } from "../../utils/hardwareWalletUtils"; +import BigNumber from 'bignumber.js'; +import { WalletTransaction } from '../../domains/WalletTransaction'; +import { WalletUnits } from '../../domains/Wallet'; +import type { DelegationAction } from '../../types/stakingTypes'; +import type { ApiTokens } from '../assets/types'; +import type { TransactionMetadata } from '../../types/TransactionMetadata'; +import type { PathRoleIdentityType } from '../../utils/hardwareWalletUtils'; export type TransactionAmount = { quantity: number; unit: WalletUnits.LOVELACE; }; export type TransactionDepth = { quantity: number; - unit: "block"; + unit: 'block'; }; export type TransactionInsertionBlock = { slot_number: number; @@ -44,7 +44,7 @@ export type Transaction = { }; }; depth: TransactionDepth; - direction: "outgoing" | "incoming"; + direction: 'outgoing' | 'incoming'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. inputs: Array; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. @@ -73,8 +73,8 @@ export type TransactionWithdrawals = { amount: TransactionAmount; }; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. -export type TransactionWithdrawalType = "self" | Array; -export type TransactionState = "pending" | "in_ledger" | "expired"; +export type TransactionWithdrawalType = 'self' | Array; +export type TransactionState = 'pending' | 'in_ledger' | 'expired'; export type TransactionAddresses = { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. from: Array; @@ -83,11 +83,11 @@ export type TransactionAddresses = { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. withdrawals: Array; }; -export type TransactionType = "card" | "expend" | "income" | "exchange"; +export type TransactionType = 'card' | 'expend' | 'income' | 'exchange'; // Req / Res Transaction Types export type GetTransactionsRequest = { walletId: string; - order?: "ascending" | "descending"; + order?: 'ascending' | 'descending'; fromDate: string | null | undefined; toDate: string | null | undefined; isLegacy: boolean; @@ -99,7 +99,6 @@ export type GetTransactionsRequest = { // isRestoreActive: boolean, // isRestoreCompleted: boolean, // cachedTransactions: Array, - }; export type GetTransactionRequest = { walletId: string; @@ -115,7 +114,7 @@ export type GetTransactionFeeRequest = { rewardsBalance: BigNumber; isLegacy: boolean; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - withdrawal?: "self" | Array; + withdrawal?: 'self' | Array; }; export type GetTransactionFeeResponse = { fee: BigNumber; @@ -129,7 +128,7 @@ export type CreateTransactionRequest = { isLegacy: boolean; assets?: ApiTokens; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - withdrawal?: "self" | Array; + withdrawal?: 'self' | Array; hasAssetsRemainingAfterTransaction?: boolean; }; export type DeleteTransactionRequest = { @@ -198,7 +197,10 @@ export type CoinSelectionOutput = { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assets?: Array; }; -export type CertificateType = "register_reward_account" | "quit_pool" | "join_pool"; +export type CertificateType = + | 'register_reward_account' + | 'quit_pool' + | 'join_pool'; export type CoinSelectionCertificate = { pool: string; certificateType: CertificateType; @@ -227,7 +229,9 @@ export type CoinSelectionsPaymentRequestType = { assets?: ApiTokens; metadata?: VotingMetadataType; }; -export type CoinSelectionsRequest = CoinSelectionsPaymentRequestType | CoinSelectionsDelegationRequestType; +export type CoinSelectionsRequest = + | CoinSelectionsPaymentRequestType + | CoinSelectionsDelegationRequestType; export type CoinSelectionsResponse = { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. inputs: Array; @@ -259,7 +263,7 @@ export type ICOPublicKeyParams = { index: string; data: { passphrase: string; - format: "extended" | "non_extended"; + format: 'extended' | 'non_extended'; purpose: string; }; }; @@ -271,18 +275,28 @@ export const VotingMetaIndexes: { VOTING_SIGNATURE: VotingMetaIndexType; } = { VOTING_REGISTRATION: 61284, - VOTING_SIGNATURE: 61285 -}; -export type VotingMetaKeyValuePairString = { [key in "string"]?: string }; -export type VotingMetaKeyValuePairInt = { [key in "int"]?: number }; -export type VotingMetaKeyValuePairBytes = { [key in "bytes"]?: string }; -export type VotingMetaKeyValuePairMap = { [key in "int"]?: number }; -export type VotingMetaKeyType = "string" | "int" | "bytes" | "list" | "map"; -export type VotingMetaKeyValuePair = { [key in "k" | "v"]?: VotingMetaKeyValuePairString | VotingMetaKeyValuePairInt | VotingMetaKeyValuePairBytes }; + VOTING_SIGNATURE: 61285, +}; +export type VotingMetaKeyValuePairString = { [key in 'string']?: string }; +export type VotingMetaKeyValuePairInt = { [key in 'int']?: number }; +export type VotingMetaKeyValuePairBytes = { [key in 'bytes']?: string }; +export type VotingMetaKeyValuePairMap = { [key in 'int']?: number }; +export type VotingMetaKeyType = 'string' | 'int' | 'bytes' | 'list' | 'map'; +export type VotingMetaKeyValuePair = { + [key in 'k' | 'v']?: + | VotingMetaKeyValuePairString + | VotingMetaKeyValuePairInt + | VotingMetaKeyValuePairBytes; +}; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. -export type VotingMetaRegistrationType = { [key in "map"]?: Array }; +export type VotingMetaRegistrationType = { + [key in 'map']?: Array; +}; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. -export type VotingMetadataType = Record; +export type VotingMetadataType = Record< + VotingMetaIndexType, + VotingMetaRegistrationType +>; export type VotingDataType = { stakeAddress: string; stakeAddressHex: string; @@ -292,4 +306,4 @@ export type VotingDataType = { index: string; metadata: VotingMetadataType; nonce: number; -}; \ No newline at end of file +}; diff --git a/source/renderer/app/api/utils/apiHelpers.spec.ts b/source/renderer/app/api/utils/apiHelpers.spec.ts index aeae9f0bd1..ca0932943c 100644 --- a/source/renderer/app/api/utils/apiHelpers.spec.ts +++ b/source/renderer/app/api/utils/apiHelpers.spec.ts @@ -1,5 +1,5 @@ // @ts-ignore ts-migrate(2307) FIXME: Cannot find module './apiHelpers' or its correspon... Remove this comment to see the full error message -import { throwErrorIfNotEnoughAdaToSupportTokens } from "./apiHelpers"; +import { throwErrorIfNotEnoughAdaToSupportTokens } from './apiHelpers'; // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { @@ -9,12 +9,16 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { const error = new Error(); error.code = 'other_error'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. - expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).not.toThrow(); + expect(() => + throwErrorIfNotEnoughAdaToSupportTokens(error, true) + ).not.toThrow(); }); // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw error if error code is "cannot_cover_fee" but hasAssetsRemainingAfterTransaction is undefined', () => { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. - const error = new Error('I cannot proceed with transaction, I need approximately 1.6 ada to proceed'); + const error = new Error( + 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' + ); error.code = 'cannot_cover_fee'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error)).not.toThrow(); @@ -25,15 +29,21 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { const error = new Error('other message'); error.code = 'cannot_cover_fee'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. - expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).not.toThrow(); + expect(() => + throwErrorIfNotEnoughAdaToSupportTokens(error, true) + ).not.toThrow(); }); // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw error if error code is not "cannot_cover_fee" and message matches regex', () => { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. - const error = new Error('I cannot proceed with transaction, I need approximately 1.6 ada to proceed'); + const error = new Error( + 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' + ); error.code = 'other_code'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. - expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).not.toThrow(); + expect(() => + throwErrorIfNotEnoughAdaToSupportTokens(error, true) + ).not.toThrow(); }); // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw if there are no tokens remaining in wallet after transaction', () => { @@ -41,28 +51,37 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { const error = new Error(); error.code = 'cannot_cover_fee'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. - expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, false)).not.toThrow(); + expect(() => + throwErrorIfNotEnoughAdaToSupportTokens(error, false) + ).not.toThrow(); }); // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee"', () => { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. - const error = new Error('I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.'); + const error = new Error( + 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.' + ); error.code = 'cannot_cover_fee'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. - expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrowError(new Error({ - additionalValues: { - adaToRemain: 1 - }, - clause: true, - code: undefined, - defaultMessage: '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', - forceSet: true, - id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', - isFinalError: false, - tempError: 'cannotLeaveWalletEmpty', - values: { - adaToRemain: 1 - } - })); + expect(() => + throwErrorIfNotEnoughAdaToSupportTokens(error, true) + ).toThrowError( + new Error({ + additionalValues: { + adaToRemain: 1, + }, + clause: true, + code: undefined, + defaultMessage: + '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', + forceSet: true, + id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', + isFinalError: false, + tempError: 'cannotLeaveWalletEmpty', + values: { + adaToRemain: 1, + }, + }) + ); }); -}); \ No newline at end of file +}); diff --git a/source/renderer/app/api/utils/apiHelpers.ts b/source/renderer/app/api/utils/apiHelpers.ts index 1472796b59..4c65ff1366 100644 --- a/source/renderer/app/api/utils/apiHelpers.ts +++ b/source/renderer/app/api/utils/apiHelpers.ts @@ -1,10 +1,11 @@ -import { ApiMethodNotYetImplementedError } from "../common/errors"; -import ApiError from "../../domains/ApiError"; +import { ApiMethodNotYetImplementedError } from '../common/errors'; +import ApiError from '../../domains/ApiError'; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message -export const notYetImplemented = async () => new Promise((resolve, reject) => { - reject(new ApiMethodNotYetImplementedError()); -}); +export const notYetImplemented = async () => + new Promise((resolve, reject) => { + reject(new ApiMethodNotYetImplementedError()); + }); // helper code for testing async APIs // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. export const testAsync = async (apiMethod: (...args: Array) => any) => { @@ -23,16 +24,30 @@ export const testSync = (apiMethod: (...args: Array) => any) => { }; // helper code for deferring API call execution // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message -export const wait = (ms: number): Promise => new Promise(resolve => setTimeout(resolve, ms)); -export const throwErrorIfNotEnoughAdaToSupportTokens = (error: any, hasAssetsRemainingAfterTransaction?: boolean) => { +export const wait = (ms: number): Promise => + new Promise((resolve) => setTimeout(resolve, ms)); +export const throwErrorIfNotEnoughAdaToSupportTokens = ( + error: any, + hasAssetsRemainingAfterTransaction?: boolean +) => { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'RegExp'. - const adaToProceedRegex = new RegExp(/.*I need approximately([\s\d.,]+)ada to proceed.*/); + const adaToProceedRegex = new RegExp( + /.*I need approximately([\s\d.,]+)ada to proceed.*/ + ); - if (error.code === 'cannot_cover_fee' && hasAssetsRemainingAfterTransaction && adaToProceedRegex.test(error.message)) { + if ( + error.code === 'cannot_cover_fee' && + hasAssetsRemainingAfterTransaction && + adaToProceedRegex.test(error.message) + ) { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Math'. - const adaToRemain = Math.ceil(Number(error.message.replace(adaToProceedRegex, '$1'))); - throw new ApiError().set('cannotLeaveWalletEmpty', true, { - adaToRemain - }).result(); + const adaToRemain = Math.ceil( + Number(error.message.replace(adaToProceedRegex, '$1')) + ); + throw new ApiError() + .set('cannotLeaveWalletEmpty', true, { + adaToRemain, + }) + .result(); } -}; \ No newline at end of file +}; diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx index 68af329263..269a7465a2 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx @@ -1,37 +1,37 @@ -import React, { Component, Fragment } from "react"; -import { observer } from "mobx-react"; -import { Input } from "react-polymorph/lib/components/Input"; -import { InputSkin } from "react-polymorph/lib/skins/simple/InputSkin"; -import { Checkbox } from "react-polymorph/lib/components/Checkbox"; -import { CheckboxSkin } from "react-polymorph/lib/skins/simple/CheckboxSkin"; -import { PopOver } from "react-polymorph/lib/components/PopOver"; -import { get } from "lodash"; -import BigNumber from "bignumber.js"; -import SVGInline from "react-svg-inline"; -import { intlShape, FormattedHTMLMessage } from "react-intl"; -import vjf from "mobx-react-form/lib/validators/VJF"; -import ReactToolboxMobxForm from "../../../utils/ReactToolboxMobxForm"; -import Dialog from "../../widgets/Dialog"; -import DialogCloseButton from "../../widgets/DialogCloseButton"; -import LocalizableError from "../../../i18n/LocalizableError"; +import React, { Component, Fragment } from 'react'; +import { observer } from 'mobx-react'; +import { Input } from 'react-polymorph/lib/components/Input'; +import { InputSkin } from 'react-polymorph/lib/skins/simple/InputSkin'; +import { Checkbox } from 'react-polymorph/lib/components/Checkbox'; +import { CheckboxSkin } from 'react-polymorph/lib/skins/simple/CheckboxSkin'; +import { PopOver } from 'react-polymorph/lib/components/PopOver'; +import { get } from 'lodash'; +import BigNumber from 'bignumber.js'; +import SVGInline from 'react-svg-inline'; +import { intlShape, FormattedHTMLMessage } from 'react-intl'; +import vjf from 'mobx-react-form/lib/validators/VJF'; +import ReactToolboxMobxForm from '../../../utils/ReactToolboxMobxForm'; +import Dialog from '../../widgets/Dialog'; +import DialogCloseButton from '../../widgets/DialogCloseButton'; +import LocalizableError from '../../../i18n/LocalizableError'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module './WalletSendAssetsConfirmation... Remove this comment to see the full error message -import styles from "./WalletSendAssetsConfirmationDialog.scss"; +import styles from './WalletSendAssetsConfirmationDialog.scss'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module '../../../assets/images/questio... Remove this comment to see the full error message -import questionMarkIcon from "../../../assets/images/question-mark.inline.svg"; -import { FORM_VALIDATION_DEBOUNCE_WAIT } from "../../../config/timingConfig"; -import { submitOnEnter } from "../../../utils/form"; -import { formattedTokenWalletAmount } from "../../../utils/formatters"; -import { FormattedHTMLMessageWithLink } from "../../widgets/FormattedHTMLMessageWithLink"; -import HardwareWalletStatus from "../../hardware-wallet/HardwareWalletStatus"; -import LoadingSpinner from "../../widgets/LoadingSpinner"; -import Wallet, { HwDeviceStatuses } from "../../../domains/Wallet"; -import Asset from "../../assets/Asset"; -import type { HwDeviceStatus } from "../../../domains/Wallet"; -import type { AssetToken } from "../../../api/assets/types"; -import { getMessages } from "./WalletSendAssetsConfirmationDialog.messages"; -import { shouldShowEmptyWalletWarning } from "../../../utils/walletUtils"; -import { hasTokensLeftAfterTransaction } from "../../../utils/assets"; -import globalMessages from "../../../i18n/global-messages"; +import questionMarkIcon from '../../../assets/images/question-mark.inline.svg'; +import { FORM_VALIDATION_DEBOUNCE_WAIT } from '../../../config/timingConfig'; +import { submitOnEnter } from '../../../utils/form'; +import { formattedTokenWalletAmount } from '../../../utils/formatters'; +import { FormattedHTMLMessageWithLink } from '../../widgets/FormattedHTMLMessageWithLink'; +import HardwareWalletStatus from '../../hardware-wallet/HardwareWalletStatus'; +import LoadingSpinner from '../../widgets/LoadingSpinner'; +import Wallet, { HwDeviceStatuses } from '../../../domains/Wallet'; +import Asset from '../../assets/Asset'; +import type { HwDeviceStatus } from '../../../domains/Wallet'; +import type { AssetToken } from '../../../api/assets/types'; +import { getMessages } from './WalletSendAssetsConfirmationDialog.messages'; +import { shouldShowEmptyWalletWarning } from '../../../utils/walletUtils'; +import { hasTokensLeftAfterTransaction } from '../../../utils/assets'; +import globalMessages from '../../../i18n/global-messages'; const SHOW_TOTAL_AMOUNT = false; type Props = { @@ -77,12 +77,12 @@ const messages = getMessages(); @observer class WalletSendAssetsConfirmationDialog extends Component { static contextTypes = { - intl: intlShape.isRequired + intl: intlShape.isRequired, }; state = { selectedAssets: [], assetsAmounts: [], - areTermsAccepted: false + areTermsAccepted: false, }; componentDidMount() { @@ -90,66 +90,69 @@ class WalletSendAssetsConfirmationDialog extends Component { // value to avoid losing them after the transaction is confirmed // (this affects only hardware wallets for which we close the dialog // after transaction has been confirmed) - const { - selectedAssets, - assetsAmounts - } = this.props; + const { selectedAssets, assetsAmounts } = this.props; this.setState({ selectedAssets, - assetsAmounts + assetsAmounts, }); } - form = new ReactToolboxMobxForm({ - fields: { - passphrase: { - type: 'password', - label: this.context.intl.formatMessage(messages.passphraseLabel), - placeholder: this.context.intl.formatMessage(messages.passphraseFieldPlaceholder), - value: '', - validators: [({ - field - }) => { - if (this.props.isHardwareWallet) return [true]; + form = new ReactToolboxMobxForm( + { + fields: { + passphrase: { + type: 'password', + label: this.context.intl.formatMessage(messages.passphraseLabel), + placeholder: this.context.intl.formatMessage( + messages.passphraseFieldPlaceholder + ), + value: '', + validators: [ + ({ field }) => { + if (this.props.isHardwareWallet) return [true]; - if (field.value === '') { - return [false, this.context.intl.formatMessage(messages.fieldIsRequired)]; - } + if (field.value === '') { + return [ + false, + this.context.intl.formatMessage(messages.fieldIsRequired), + ]; + } - return [true]; - }] + return [true]; + }, + ], + }, + flightCandidateCheckbox: { + type: 'checkbox', + label: this.context.intl.formatMessage( + messages.flightCandidateCheckboxLabel + ), + }, }, - flightCandidateCheckbox: { - type: 'checkbox', - label: this.context.intl.formatMessage(messages.flightCandidateCheckboxLabel) - } - } - }, { - plugins: { - vjf: vjf() }, - options: { - validateOnChange: true, - validationDebounceWait: FORM_VALIDATION_DEBOUNCE_WAIT + { + plugins: { + vjf: vjf(), + }, + options: { + validateOnChange: true, + validationDebounceWait: FORM_VALIDATION_DEBOUNCE_WAIT, + }, } - }); + ); submit = () => { this.form.submit({ - onSuccess: form => { - const { - selectedAssets, - assetsAmounts - } = this.state; + onSuccess: (form) => { + const { selectedAssets, assetsAmounts } = this.state; const { receiver, amount, amountToNaturalUnits, - isHardwareWallet + isHardwareWallet, } = this.props; - const { - passphrase - } = form.values(); - const hasAssetsRemainingAfterTransaction = this.props.allAvailableTokens?.length > 0; + const { passphrase } = form.values(); + const hasAssetsRemainingAfterTransaction = + this.props.allAvailableTokens?.length > 0; const transactionData = { receiver, amount: amountToNaturalUnits(amount), @@ -157,46 +160,60 @@ class WalletSendAssetsConfirmationDialog extends Component { isHardwareWallet, assets: selectedAssets, assetsAmounts, - hasAssetsRemainingAfterTransaction + hasAssetsRemainingAfterTransaction, }; this.props.onSubmit(transactionData); }, - onError: () => {} + onError: () => {}, }); }; - handleSubmitOnEnter = (event: KeyboardEvent) => (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && submitOnEnter(this.submit, event); - renderConfirmationElement = (isHardwareWallet: boolean): React.ReactElement, any> | null => { + handleSubmitOnEnter = (event: KeyboardEvent) => + (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && + submitOnEnter(this.submit, event); + renderConfirmationElement = ( + isHardwareWallet: boolean + ): React.ReactElement, any> | null => { const passphraseField = this.form.$('passphrase'); - const { - areTermsAccepted - } = this.state; + const { areTermsAccepted } = this.state; const { hwDeviceStatus, isFlight, onExternalLinkClick, wallet, - isTrezor + isTrezor, } = this.props; let returnJSX = null; - if (!isFlight || isFlight && areTermsAccepted) { - const { - name - } = wallet; - returnJSX = isHardwareWallet ?
- -
: ; + if (!isFlight || (isFlight && areTermsAccepted)) { + const { name } = wallet; + returnJSX = isHardwareWallet ? ( +
+ +
+ ) : ( + + ); } return returnJSX; }; onCheckboxClick = (areTermsAccepted: boolean) => { - const { - isHardwareWallet, - onInitiateTransaction - } = this.props; + const { isHardwareWallet, onInitiateTransaction } = this.props; this.setState({ - areTermsAccepted + areTermsAccepted, }); if (isHardwareWallet) { @@ -204,31 +221,25 @@ class WalletSendAssetsConfirmationDialog extends Component { } }; getAssetAmount = (index: number) => { - const { - assetsAmounts - } = this.state; + const { assetsAmounts } = this.state; return get(assetsAmounts, index, 0); }; - getFormattedAssetAmount = ({ - metadata, - decimals - }: AssetToken, index: number) => { + getFormattedAssetAmount = ( + { metadata, decimals }: AssetToken, + index: number + ) => { const assetAmount = this.getAssetAmount(index); - return formattedTokenWalletAmount(new BigNumber(assetAmount), metadata, decimals); + return formattedTokenWalletAmount( + new BigNumber(assetAmount), + metadata, + decimals + ); }; render() { - const { - form - } = this; - const { - intl - } = this.context; - const { - selectedAssets, - areTermsAccepted, - assetsAmounts - } = this.state; + const { form } = this; + const { intl } = this.context; + const { selectedAssets, areTermsAccepted, assetsAmounts } = this.state; const passphraseField = form.$('passphrase'); const flightCandidateCheckboxField = form.$('flightCandidateCheckbox'); const { @@ -246,36 +257,78 @@ class WalletSendAssetsConfirmationDialog extends Component { onCopyAssetParam, wallet, formattedTotalAmount, - totalAmount + totalAmount, } = this.props; - const buttonLabel = !isSubmitting ? intl.formatMessage(messages.sendButtonLabel) : ; - const actions = [{ - label: intl.formatMessage(messages.backButtonLabel), - onClick: !isSubmitting ? onCancel : () => {} - }, { - label: buttonLabel, - onClick: this.submit, - primary: true, - className: 'confirmButton', - disabled: !!error || !isHardwareWallet && !passphraseField.isValid || isHardwareWallet && hwDeviceStatus !== HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED || !areTermsAccepted && isFlight - }]; + const buttonLabel = !isSubmitting ? ( + intl.formatMessage(messages.sendButtonLabel) + ) : ( + + ); + const actions = [ + { + label: intl.formatMessage(messages.backButtonLabel), + onClick: !isSubmitting ? onCancel : () => {}, + }, + { + label: buttonLabel, + onClick: this.submit, + primary: true, + className: 'confirmButton', + disabled: + !!error || + (!isHardwareWallet && !passphraseField.isValid) || + (isHardwareWallet && + hwDeviceStatus !== + HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED) || + (!areTermsAccepted && isFlight), + }, + ]; const assetsSeparatorBasicHeight = 27; // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type '{}'. - const assetsSeparatorCalculatedHeight = selectedAssets.length ? assetsSeparatorBasicHeight * selectedAssets.length * 2 - 18 : assetsSeparatorBasicHeight; + const assetsSeparatorCalculatedHeight = selectedAssets.length + ? assetsSeparatorBasicHeight * selectedAssets.length * 2 - 18 + : assetsSeparatorBasicHeight; let errorElement = null; if (error) { const errorHasLink = !!error.values.linkLabel; - errorElement = errorHasLink ? : ; + errorElement = errorHasLink ? ( + + ) : ( + + ); } - const { - name - } = wallet; - return {}} className={styles.dialog} closeButton={}> - {shouldShowEmptyWalletWarning(totalAmount, wallet, !!allAvailableTokens?.length && allAvailableTokens.length > 0 && hasTokensLeftAfterTransaction(allAvailableTokens, selectedAssets, assetsAmounts)) &&
+ const { name } = wallet; + return ( + {}} + className={styles.dialog} + closeButton={} + > + {shouldShowEmptyWalletWarning( + totalAmount, + wallet, + !!allAvailableTokens?.length && + allAvailableTokens.length > 0 && + hasTokensLeftAfterTransaction( + allAvailableTokens, + selectedAssets, + assetsAmounts + ) + ) && ( +
-
} +
+ )}
@@ -284,11 +337,14 @@ class WalletSendAssetsConfirmationDialog extends Component {

{receiver}

-
+

{intl.formatMessage(globalMessages.adaName)} @@ -301,15 +357,23 @@ class WalletSendAssetsConfirmationDialog extends Component {

{/* @ts-ignore ts-migrate(2339) FIXME: Property 'map' does not exist on type '{}'. */} {selectedAssets.map((asset, assetIndex) => { - const assetAmount = this.getFormattedAssetAmount(asset, assetIndex); - return + const assetAmount = this.getFormattedAssetAmount( + asset, + assetIndex + ); + return ( +

{intl.formatMessage(messages.assetLabel)}  #{assetIndex + 1} - +

{assetAmount}
@@ -318,10 +382,24 @@ class WalletSendAssetsConfirmationDialog extends Component {
- {intl.formatMessage(messages.unformattedAmountLabel)} - - -
} key="tooltip"> + {intl.formatMessage( + messages.unformattedAmountLabel + )} + + +
+ } + key="tooltip" + >
@@ -332,15 +410,17 @@ class WalletSendAssetsConfirmationDialog extends Component { {this.getAssetAmount(assetIndex)}
- ; - })} + + ); + })}
- {SHOW_TOTAL_AMOUNT ? <> + {SHOW_TOTAL_AMOUNT ? ( + <>
@@ -374,7 +454,9 @@ class WalletSendAssetsConfirmationDialog extends Component { {formattedTotalAmount}  {intl.formatMessage(globalMessages.adaUnit)}
- :
+ + ) : ( +
{intl.formatMessage(messages.feesLabel)}
@@ -382,17 +464,30 @@ class WalletSendAssetsConfirmationDialog extends Component { +{transactionFee}  {intl.formatMessage(globalMessages.adaUnit)}
-
} +
+ )} - {isFlight &&
- - -
} + {isFlight && ( +
+ + +
+ )} {this.renderConfirmationElement(isHardwareWallet)} {errorElement ?

{errorElement}

: null} -
; + + ); } - } -export default WalletSendAssetsConfirmationDialog; \ No newline at end of file +export default WalletSendAssetsConfirmationDialog; diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx index 00ed4a655b..446aefeff1 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx @@ -1,29 +1,29 @@ -import React, { Component } from "react"; -import { observer } from "mobx-react"; -import { Input } from "react-polymorph/lib/components/Input"; -import { InputSkin } from "react-polymorph/lib/skins/simple/InputSkin"; -import { Checkbox } from "react-polymorph/lib/components/Checkbox"; -import { CheckboxSkin } from "react-polymorph/lib/skins/simple/CheckboxSkin"; -import { FormattedHTMLMessage, intlShape } from "react-intl"; -import vjf from "mobx-react-form/lib/validators/VJF"; -import BigNumber from "bignumber.js"; -import ReactToolboxMobxForm from "../../../utils/ReactToolboxMobxForm"; -import Dialog from "../../widgets/Dialog"; -import DialogCloseButton from "../../widgets/DialogCloseButton"; -import LocalizableError from "../../../i18n/LocalizableError"; +import React, { Component } from 'react'; +import { observer } from 'mobx-react'; +import { Input } from 'react-polymorph/lib/components/Input'; +import { InputSkin } from 'react-polymorph/lib/skins/simple/InputSkin'; +import { Checkbox } from 'react-polymorph/lib/components/Checkbox'; +import { CheckboxSkin } from 'react-polymorph/lib/skins/simple/CheckboxSkin'; +import { FormattedHTMLMessage, intlShape } from 'react-intl'; +import vjf from 'mobx-react-form/lib/validators/VJF'; +import BigNumber from 'bignumber.js'; +import ReactToolboxMobxForm from '../../../utils/ReactToolboxMobxForm'; +import Dialog from '../../widgets/Dialog'; +import DialogCloseButton from '../../widgets/DialogCloseButton'; +import LocalizableError from '../../../i18n/LocalizableError'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module './WalletSendConfirmationDialog... Remove this comment to see the full error message -import styles from "./WalletSendConfirmationDialog.scss"; -import { FORM_VALIDATION_DEBOUNCE_WAIT } from "../../../config/timingConfig"; -import { submitOnEnter } from "../../../utils/form"; -import { FormattedHTMLMessageWithLink } from "../../widgets/FormattedHTMLMessageWithLink"; -import HardwareWalletStatus from "../../hardware-wallet/HardwareWalletStatus"; -import LoadingSpinner from "../../widgets/LoadingSpinner"; -import type { HwDeviceStatus } from "../../../domains/Wallet"; -import Wallet, { HwDeviceStatuses } from "../../../domains/Wallet"; -import { getMessages } from "./WalletSendAssetsConfirmationDialog.messages"; -import { shouldShowEmptyWalletWarning } from "../../../utils/walletUtils"; -import type { AssetToken } from "../../../api/assets/types"; -import globalMessages from "../../../i18n/global-messages"; +import styles from './WalletSendConfirmationDialog.scss'; +import { FORM_VALIDATION_DEBOUNCE_WAIT } from '../../../config/timingConfig'; +import { submitOnEnter } from '../../../utils/form'; +import { FormattedHTMLMessageWithLink } from '../../widgets/FormattedHTMLMessageWithLink'; +import HardwareWalletStatus from '../../hardware-wallet/HardwareWalletStatus'; +import LoadingSpinner from '../../widgets/LoadingSpinner'; +import type { HwDeviceStatus } from '../../../domains/Wallet'; +import Wallet, { HwDeviceStatuses } from '../../../domains/Wallet'; +import { getMessages } from './WalletSendAssetsConfirmationDialog.messages'; +import { shouldShowEmptyWalletWarning } from '../../../utils/walletUtils'; +import type { AssetToken } from '../../../api/assets/types'; +import globalMessages from '../../../i18n/global-messages'; type Props = { amount: string; @@ -58,101 +58,125 @@ const messages = getMessages(); @observer class WalletSendConfirmationDialog extends Component { static contextTypes = { - intl: intlShape.isRequired + intl: intlShape.isRequired, }; state = { - areTermsAccepted: false + areTermsAccepted: false, }; - form = new ReactToolboxMobxForm({ - fields: { - passphrase: { - type: 'password', - label: this.context.intl.formatMessage(messages.passphraseLabel), - placeholder: this.context.intl.formatMessage(messages.passphraseFieldPlaceholder), - value: '', - validators: [({ - field - }) => { - if (this.props.isHardwareWallet) return [true]; + form = new ReactToolboxMobxForm( + { + fields: { + passphrase: { + type: 'password', + label: this.context.intl.formatMessage(messages.passphraseLabel), + placeholder: this.context.intl.formatMessage( + messages.passphraseFieldPlaceholder + ), + value: '', + validators: [ + ({ field }) => { + if (this.props.isHardwareWallet) return [true]; - if (field.value === '') { - return [false, this.context.intl.formatMessage(messages.fieldIsRequired)]; - } + if (field.value === '') { + return [ + false, + this.context.intl.formatMessage(messages.fieldIsRequired), + ]; + } - return [true]; - }] + return [true]; + }, + ], + }, + flightCandidateCheckbox: { + type: 'checkbox', + label: this.context.intl.formatMessage( + messages.flightCandidateCheckboxLabel + ), + }, }, - flightCandidateCheckbox: { - type: 'checkbox', - label: this.context.intl.formatMessage(messages.flightCandidateCheckboxLabel) - } - } - }, { - plugins: { - vjf: vjf() }, - options: { - validateOnChange: true, - validationDebounceWait: FORM_VALIDATION_DEBOUNCE_WAIT + { + plugins: { + vjf: vjf(), + }, + options: { + validateOnChange: true, + validationDebounceWait: FORM_VALIDATION_DEBOUNCE_WAIT, + }, } - }); + ); submit = () => { this.form.submit({ - onSuccess: form => { + onSuccess: (form) => { const { receiver, amount, amountToNaturalUnits, - isHardwareWallet + isHardwareWallet, } = this.props; - const { - passphrase - } = form.values(); - const hasAssetsRemainingAfterTransaction = this.props.allAvailableTokens?.length && this.props.allAvailableTokens.length > 0; + const { passphrase } = form.values(); + const hasAssetsRemainingAfterTransaction = + this.props.allAvailableTokens?.length && + this.props.allAvailableTokens.length > 0; const transactionData = { receiver, amount: amountToNaturalUnits(amount), passphrase, isHardwareWallet, - hasAssetsRemainingAfterTransaction + hasAssetsRemainingAfterTransaction, }; this.props.onSubmit(transactionData); }, - onError: () => {} + onError: () => {}, }); }; - handleSubmitOnEnter = (event: KeyboardEvent) => (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && submitOnEnter(this.submit, event); - renderConfirmationElement = (isHardwareWallet: boolean): React.ReactElement, any> | null | undefined => { + handleSubmitOnEnter = (event: KeyboardEvent) => + (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && + submitOnEnter(this.submit, event); + renderConfirmationElement = ( + isHardwareWallet: boolean + ): React.ReactElement, any> | null | undefined => { const passphraseField = this.form.$('passphrase'); - const { - areTermsAccepted - } = this.state; + const { areTermsAccepted } = this.state; const { hwDeviceStatus, isFlight, onExternalLinkClick, wallet, - isTrezor + isTrezor, } = this.props; - if (!isFlight || isFlight && areTermsAccepted) { - const { - name - } = wallet; - return isHardwareWallet ?
- -
: ; + if (!isFlight || (isFlight && areTermsAccepted)) { + const { name } = wallet; + return isHardwareWallet ? ( +
+ +
+ ) : ( + + ); } return null; }; onCheckboxClick = (areTermsAccepted: boolean) => { - const { - isHardwareWallet, - onInitiateTransaction - } = this.props; + const { isHardwareWallet, onInitiateTransaction } = this.props; this.setState({ - areTermsAccepted + areTermsAccepted, }); if (isHardwareWallet) { @@ -161,15 +185,9 @@ class WalletSendConfirmationDialog extends Component { }; render() { - const { - form - } = this; - const { - intl - } = this.context; - const { - areTermsAccepted - } = this.state; + const { form } = this; + const { intl } = this.context; + const { areTermsAccepted } = this.state; const passphraseField = form.$('passphrase'); const flightCandidateCheckboxField = form.$('flightCandidateCheckbox'); const { @@ -186,33 +204,67 @@ class WalletSendConfirmationDialog extends Component { isHardwareWallet, wallet, formattedTotalAmount, - totalAmount + totalAmount, } = this.props; - const buttonLabel = !isSubmitting ? intl.formatMessage(messages.sendButtonLabel) : ; - const actions = [{ - label: intl.formatMessage(messages.backButtonLabel), - onClick: !isSubmitting ? onCancel : () => {} - }, { - label: buttonLabel, - onClick: this.submit, - primary: true, - className: 'confirmButton', - disabled: !!error || !isHardwareWallet && !passphraseField.isValid || isHardwareWallet && hwDeviceStatus !== HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED || !areTermsAccepted && isFlight - }]; + const buttonLabel = !isSubmitting ? ( + intl.formatMessage(messages.sendButtonLabel) + ) : ( + + ); + const actions = [ + { + label: intl.formatMessage(messages.backButtonLabel), + onClick: !isSubmitting ? onCancel : () => {}, + }, + { + label: buttonLabel, + onClick: this.submit, + primary: true, + className: 'confirmButton', + disabled: + !!error || + (!isHardwareWallet && !passphraseField.isValid) || + (isHardwareWallet && + hwDeviceStatus !== + HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED) || + (!areTermsAccepted && isFlight), + }, + ]; let errorElement = null; if (error) { const errorHasLink = !!error.values.linkLabel; - errorElement = errorHasLink ? : ; + errorElement = errorHasLink ? ( + + ) : ( + + ); } - const { - name - } = wallet; - return {}} className={styles.dialog} closeButton={}> - {shouldShowEmptyWalletWarning(totalAmount, wallet, !!allAvailableTokens?.length && allAvailableTokens.length > 0) &&
+ const { name } = wallet; + return ( + {}} + className={styles.dialog} + closeButton={} + > + {shouldShowEmptyWalletWarning( + totalAmount, + wallet, + !!allAvailableTokens?.length && allAvailableTokens.length > 0 + ) && ( +
-
} +
+ )}
{intl.formatMessage(messages.addressToLabel)} @@ -250,15 +302,27 @@ class WalletSendConfirmationDialog extends Component {  {intl.formatMessage(globalMessages.adaUnit)}
- {isFlight &&
- - -
} + {isFlight && ( +
+ + +
+ )} {this.renderConfirmationElement(isHardwareWallet)} {errorElement ?

{errorElement}

: null} -
; + + ); } - } -export default WalletSendConfirmationDialog; \ No newline at end of file +export default WalletSendConfirmationDialog; diff --git a/source/renderer/app/stores/WalletsStore.ts b/source/renderer/app/stores/WalletsStore.ts index 134b316c85..3094736540 100644 --- a/source/renderer/app/stores/WalletsStore.ts +++ b/source/renderer/app/stores/WalletsStore.ts @@ -1,40 +1,63 @@ -import { observable, action, computed, runInAction, flow } from "mobx"; -import { get, find, findIndex, isEqual, includes } from "lodash"; -import { BigNumber } from "bignumber.js"; -import Store from "./lib/Store"; -import Request from "./lib/LocalizedRequest"; -import Wallet, { WalletSyncStateStatuses } from "../domains/Wallet"; -import WalletAddress from "../domains/WalletAddress"; -import { WalletTransaction } from "../domains/WalletTransaction"; -import { MAX_ADA_WALLETS_COUNT } from "../config/numbersConfig"; -import { i18nContext } from "../utils/i18nContext"; -import { mnemonicToSeedHex, getScrambledInput } from "../utils/crypto"; -import { paperWalletPdfGenerator } from "../utils/paperWalletPdfGenerator"; -import { addressPDFGenerator } from "../utils/addressPDFGenerator"; -import { downloadCsv } from "../utils/csvGenerator"; -import { buildRoute, matchRoute } from "../utils/routing"; -import { logger } from "../utils/logging"; -import { ROUTES } from "../routes-config"; -import { formattedWalletAmount } from "../utils/formatters"; -import { ellipsis } from "../utils/strings"; -import { bech32EncodePublicKey, isReceiverAddressType } from "../utils/hardwareWalletUtils"; -import { WalletPaperWalletOpenPdfError, WalletRewardsOpenCsvError } from "../i18n/errors"; -import { WALLET_KINDS, WALLET_DAEDALUS_KINDS, WALLET_YOROI_KINDS, WALLET_HARDWARE_KINDS, RESTORE_WALLET_STEPS } from "../config/walletRestoreConfig"; -import { IS_WALLET_PUBLIC_KEY_SHARING_ENABLED } from "../config/walletsConfig"; -import { introspectAddressChannel } from "../ipc/introspect-address"; -import { saveQRCodeImageChannel } from "../ipc/saveQRCodeImageChannel"; -import type { AddressStyle } from "../../../common/types/address-introspection.types"; -import type { AssetToken } from "../api/assets/types"; -import type { WalletKind, WalletDaedalusKind, WalletYoroiKind, WalletHardwareKind } from "../types/walletRestoreTypes"; -import type { CsvFileContent } from "../../../common/types/csv-request.types"; -import type { WalletExportTypeChoices } from "../types/walletExportTypes"; +import { observable, action, computed, runInAction, flow } from 'mobx'; +import { get, find, findIndex, isEqual, includes } from 'lodash'; +import { BigNumber } from 'bignumber.js'; +import Store from './lib/Store'; +import Request from './lib/LocalizedRequest'; +import Wallet, { WalletSyncStateStatuses } from '../domains/Wallet'; +import WalletAddress from '../domains/WalletAddress'; +import { WalletTransaction } from '../domains/WalletTransaction'; +import { MAX_ADA_WALLETS_COUNT } from '../config/numbersConfig'; +import { i18nContext } from '../utils/i18nContext'; +import { mnemonicToSeedHex, getScrambledInput } from '../utils/crypto'; +import { paperWalletPdfGenerator } from '../utils/paperWalletPdfGenerator'; +import { addressPDFGenerator } from '../utils/addressPDFGenerator'; +import { downloadCsv } from '../utils/csvGenerator'; +import { buildRoute, matchRoute } from '../utils/routing'; +import { logger } from '../utils/logging'; +import { ROUTES } from '../routes-config'; +import { formattedWalletAmount } from '../utils/formatters'; +import { ellipsis } from '../utils/strings'; +import { + bech32EncodePublicKey, + isReceiverAddressType, +} from '../utils/hardwareWalletUtils'; +import { + WalletPaperWalletOpenPdfError, + WalletRewardsOpenCsvError, +} from '../i18n/errors'; +import { + WALLET_KINDS, + WALLET_DAEDALUS_KINDS, + WALLET_YOROI_KINDS, + WALLET_HARDWARE_KINDS, + RESTORE_WALLET_STEPS, +} from '../config/walletRestoreConfig'; +import { IS_WALLET_PUBLIC_KEY_SHARING_ENABLED } from '../config/walletsConfig'; +import { introspectAddressChannel } from '../ipc/introspect-address'; +import { saveQRCodeImageChannel } from '../ipc/saveQRCodeImageChannel'; +import type { AddressStyle } from '../../../common/types/address-introspection.types'; +import type { AssetToken } from '../api/assets/types'; +import type { + WalletKind, + WalletDaedalusKind, + WalletYoroiKind, + WalletHardwareKind, +} from '../types/walletRestoreTypes'; +import type { CsvFileContent } from '../../../common/types/csv-request.types'; +import type { WalletExportTypeChoices } from '../types/walletExportTypes'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module '../actions/wallets-actions' or... Remove this comment to see the full error message -import type { WalletImportFromFileParams } from "../actions/wallets-actions"; -import type LocalizableError from "../i18n/LocalizableError"; -import type { TransferFundsCalculateFeeRequest, TransferFundsRequest } from "../api/wallets/types"; -import type { QuitStakePoolRequest } from "../api/staking/types"; -import type { TransportDevice, HardwareWalletExtendedPublicKeyResponse } from "../../../common/types/hardware-wallets.types"; -import { NetworkMagics } from "../../../common/types/cardano-node.types"; +import type { WalletImportFromFileParams } from '../actions/wallets-actions'; +import type LocalizableError from '../i18n/LocalizableError'; +import type { + TransferFundsCalculateFeeRequest, + TransferFundsRequest, +} from '../api/wallets/types'; +import type { QuitStakePoolRequest } from '../api/staking/types'; +import type { + TransportDevice, + HardwareWalletExtendedPublicKeyResponse, +} from '../../../common/types/hardware-wallets.types'; +import { NetworkMagics } from '../../../common/types/cardano-node.types'; /* eslint-disable consistent-return */ /** @@ -53,64 +76,102 @@ export default class WalletsStore extends Store { walletsRequest: Request> = new Request(this.api.ada.getWallets); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - accountPublicKeyRequest: Request = new Request(this.api.ada.getAccountPublicKey); + accountPublicKeyRequest: Request = new Request( + this.api.ada.getAccountPublicKey + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - icoPublicKeyRequest: Request = new Request(this.api.ada.getICOPublicKey); + icoPublicKeyRequest: Request = new Request( + this.api.ada.getICOPublicKey + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - importFromFileRequest: Request = new Request(this.api.ada.importWalletFromFile); + importFromFileRequest: Request = new Request( + this.api.ada.importWalletFromFile + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message createWalletRequest: Request = new Request(this.api.ada.createWallet); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletAddressesRequest: Request> = new Request(this.api.ada.getAddresses); + getWalletAddressesRequest: Request> = new Request( + this.api.ada.getAddresses + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - deleteWalletRequest: Request = new Request(this.api.ada.deleteWallet); + deleteWalletRequest: Request = new Request( + this.api.ada.deleteWallet + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - sendMoneyRequest: Request = new Request(this.api.ada.createTransaction); + sendMoneyRequest: Request = new Request( + this.api.ada.createTransaction + ); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletRecoveryPhraseRequest: Request> = new Request(this.api.ada.getWalletRecoveryPhrase); + getWalletRecoveryPhraseRequest: Request> = new Request( + this.api.ada.getWalletRecoveryPhrase + ); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletCertificateAdditionalMnemonicsRequest: Request> = new Request(this.api.ada.getWalletCertificateAdditionalMnemonics); + getWalletCertificateAdditionalMnemonicsRequest: Request< + Array + > = new Request(this.api.ada.getWalletCertificateAdditionalMnemonics); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletCertificateRecoveryPhraseRequest: Request> = new Request(this.api.ada.getWalletCertificateRecoveryPhrase); + getWalletCertificateRecoveryPhraseRequest: Request< + Array + > = new Request(this.api.ada.getWalletCertificateRecoveryPhrase); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletRecoveryPhraseFromCertificateRequest: Request> = new Request(this.api.ada.getWalletRecoveryPhraseFromCertificate); + getWalletRecoveryPhraseFromCertificateRequest: Request< + Array + > = new Request(this.api.ada.getWalletRecoveryPhraseFromCertificate); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - restoreDaedalusRequest: Request = new Request(this.api.ada.restoreWallet); + restoreDaedalusRequest: Request = new Request( + this.api.ada.restoreWallet + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - restoreLegacyRequest: Request = new Request(this.api.ada.restoreLegacyWallet); + restoreLegacyRequest: Request = new Request( + this.api.ada.restoreLegacyWallet + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - restoreByronRandomWalletRequest: Request = new Request(this.api.ada.restoreByronRandomWallet); + restoreByronRandomWalletRequest: Request = new Request( + this.api.ada.restoreByronRandomWallet + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - restoreByronIcarusWalletRequest: Request = new Request(this.api.ada.restoreByronIcarusWallet); + restoreByronIcarusWalletRequest: Request = new Request( + this.api.ada.restoreByronIcarusWallet + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - restoreByronTrezorWalletRequest: Request = new Request(this.api.ada.restoreByronTrezorWallet); + restoreByronTrezorWalletRequest: Request = new Request( + this.api.ada.restoreByronTrezorWallet + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - restoreByronLedgerWalletRequest: Request = new Request(this.api.ada.restoreByronLedgerWallet); + restoreByronLedgerWalletRequest: Request = new Request( + this.api.ada.restoreByronLedgerWallet + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - transferFundsCalculateFeeRequest: Request = new Request(this.api.ada.transferFundsCalculateFee); + transferFundsCalculateFeeRequest: Request< + TransferFundsCalculateFeeRequest + > = new Request(this.api.ada.transferFundsCalculateFee); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - transferFundsRequest: Request = new Request(this.api.ada.transferFunds); + transferFundsRequest: Request = new Request( + this.api.ada.transferFunds + ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - createHardwareWalletRequest: Request = new Request(this.api.ada.createHardwareWallet); + createHardwareWalletRequest: Request = new Request( + this.api.ada.createHardwareWallet + ); /* ---------- Active Wallet ---------- */ @observable @@ -220,7 +281,7 @@ export default class WalletsStore extends Store { } = { name: '', mnemonic: '', - spendingPassword: '' + spendingPassword: '', }; _pollingBlocked = false; @@ -233,8 +294,8 @@ export default class WalletsStore extends Store { walletBackup, wallets: walletsActions, app, - networkStatus - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message + networkStatus, + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message } = this.actions; // Create Wallet Actions --- walletsActions.createWallet.listen(this._create); @@ -248,15 +309,23 @@ export default class WalletsStore extends Store { walletsActions.restoreWallet.listen(this._restore); walletsActions.restoreWalletBegin.listen(this._restoreWalletBegin); walletsActions.restoreWalletEnd.listen(this._restoreWalletEnd); - walletsActions.restoreWalletChangeStep.listen(this._restoreWalletChangeStep); + walletsActions.restoreWalletChangeStep.listen( + this._restoreWalletChangeStep + ); walletsActions.restoreWalletClose.listen(this._restoreWalletClose); - walletsActions.restoreWalletCancelClose.listen(this._restoreWalletCancelClose); + walletsActions.restoreWalletCancelClose.listen( + this._restoreWalletCancelClose + ); walletsActions.restoreWalletSetKind.listen(this._restoreWalletSetKind); - walletsActions.restoreWalletSetMnemonics.listen(this._restoreWalletSetMnemonics); + walletsActions.restoreWalletSetMnemonics.listen( + this._restoreWalletSetMnemonics + ); walletsActions.restoreWalletSetConfig.listen(this._restoreWalletSetConfig); walletsActions.deleteWallet.listen(this._deleteWallet); walletsActions.undelegateWallet.listen(this._undelegateWallet); - walletsActions.setUndelegateWalletSubmissionSuccess.listen(this._setUndelegateWalletSubmissionSuccess); + walletsActions.setUndelegateWalletSubmissionSuccess.listen( + this._setUndelegateWalletSubmissionSuccess + ); walletsActions.sendMoney.listen(this._sendMoney); walletsActions.importWalletFromFile.listen(this._importWalletFromFile); walletsActions.chooseWalletExportType.listen(this._chooseWalletExportType); @@ -266,9 +335,13 @@ export default class WalletsStore extends Store { walletsActions.generateAddressPDF.listen(this._generateAddressPDF); walletsActions.saveQRCodeImage.listen(this._saveQRCodeImage); walletsActions.updateCertificateStep.listen(this._updateCertificateStep); - walletsActions.closeCertificateGeneration.listen(this._closeCertificateGeneration); + walletsActions.closeCertificateGeneration.listen( + this._closeCertificateGeneration + ); walletsActions.generateCsv.listen(this._generateCsv); - walletsActions.closeRewardsCsvGeneration.listen(this._closeRewardsCsvGeneration); + walletsActions.closeRewardsCsvGeneration.listen( + this._closeRewardsCsvGeneration + ); walletsActions.setCertificateTemplate.listen(this._setCertificateTemplate); walletsActions.finishCertificate.listen(this._finishCertificate); walletsActions.finishRewardsCsv.listen(this._finishRewardsCsv); @@ -280,17 +353,23 @@ export default class WalletsStore extends Store { walletsActions.transferFundsNextStep.listen(this._transferFundsNextStep); walletsActions.transferFundsPrevStep.listen(this._transferFundsPrevStep); walletsActions.transferFunds.listen(this._transferFunds); - walletsActions.transferFundsSetSourceWalletId.listen(this._transferFundsSetSourceWalletId); - walletsActions.transferFundsSetTargetWalletId.listen(this._transferFundsSetTargetWalletId); + walletsActions.transferFundsSetSourceWalletId.listen( + this._transferFundsSetSourceWalletId + ); + walletsActions.transferFundsSetTargetWalletId.listen( + this._transferFundsSetTargetWalletId + ); walletsActions.transferFundsRedeem.listen(this._transferFundsRedeem); walletsActions.transferFundsClose.listen(this._transferFundsClose); - walletsActions.transferFundsCalculateFee.listen(this._transferFundsCalculateFee); + walletsActions.transferFundsCalculateFee.listen( + this._transferFundsCalculateFee + ); } @action // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _getAccountPublicKey = async ({ - spendingPassword: passphrase + spendingPassword: passphrase, }: { spendingPassword: string; }) => { @@ -307,7 +386,7 @@ export default class WalletsStore extends Store { walletId, index, passphrase, - extended + extended, }).promise; runInAction('update account public key', () => { this.activePublicKey = accountPublicKey; @@ -319,7 +398,7 @@ export default class WalletsStore extends Store { @action // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _getICOPublicKey = async ({ - spendingPassword: passphrase + spendingPassword: passphrase, }: { spendingPassword: string; }) => { @@ -339,8 +418,8 @@ export default class WalletsStore extends Store { data: { passphrase, format, - purpose - } + purpose, + }, }).promise; runInAction('update ICO public key', () => { this.icoPublicKey = icoPublicKey; @@ -350,21 +429,22 @@ export default class WalletsStore extends Store { } }; // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message - _create = async (params: { - name: string; - spendingPassword: string; - }) => { + _create = async (params: { name: string; spendingPassword: string }) => { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Object'. Object.assign(this._newWalletDetails, params); try { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const recoveryPhrase: Array | null | undefined = await this.getWalletRecoveryPhraseRequest.execute().promise; + const recoveryPhrase: + | Array + | null + | undefined = await this.getWalletRecoveryPhraseRequest.execute() + .promise; if (recoveryPhrase != null) { // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.walletBackup.initiateWalletBackup.trigger({ - recoveryPhrase + recoveryPhrase, }); } } catch (error) { @@ -384,7 +464,10 @@ export default class WalletsStore extends Store { @action _createWalletChangeStep = (isBack: boolean = false) => { const currrentCreateWalletStep = this.createWalletStep || 0; - this.createWalletStep = isBack === true ? currrentCreateWalletStep - 1 : currrentCreateWalletStep + 1; + this.createWalletStep = + isBack === true + ? currrentCreateWalletStep - 1 + : currrentCreateWalletStep + 1; this.createWalletShowAbortConfirmation = false; }; @action @@ -406,9 +489,7 @@ export default class WalletsStore extends Store { _restoreWalletEnd = async () => { this._resumePolling(); - const { - restoredWallet - } = this; + const { restoredWallet } = this; if (restoredWallet) { await this._patchWalletRequestWithNewWallet(restoredWallet); @@ -431,20 +512,22 @@ export default class WalletsStore extends Store { this._restoreWalletResetData(); } - this.restoreWalletStep = isBack === true ? currrentRestoreWalletStep - 1 : currrentRestoreWalletStep + 1; + this.restoreWalletStep = + isBack === true + ? currrentRestoreWalletStep - 1 + : currrentRestoreWalletStep + 1; this.restoreWalletShowAbortConfirmation = false; }; @action _restoreWalletClose = () => { this._resumePolling(); - const { - mnemonics, - walletName, - spendingPassword - } = this; + const { mnemonics, walletName, spendingPassword } = this; // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type 'string'. - const shouldDisplayAbortAlert = (mnemonics.length || walletName.length || spendingPassword.length) && this.restoreWalletStep !== null && this.restoreWalletStep < RESTORE_WALLET_STEPS.length - 1; + const shouldDisplayAbortAlert = + (mnemonics.length || walletName.length || spendingPassword.length) && + this.restoreWalletStep !== null && + this.restoreWalletStep < RESTORE_WALLET_STEPS.length - 1; if (shouldDisplayAbortAlert && !this.restoreWalletShowAbortConfirmation) { this.restoreWalletShowAbortConfirmation = true; @@ -486,7 +569,7 @@ export default class WalletsStore extends Store { @action _restoreWalletSetKind = ({ param, - kind + kind, }: { param?: string; kind: string; @@ -496,7 +579,7 @@ export default class WalletsStore extends Store { }; @action _restoreWalletSetMnemonics = ({ - mnemonics + mnemonics, }: { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. mnemonics: Array; @@ -506,7 +589,7 @@ export default class WalletsStore extends Store { @action _restoreWalletSetConfig = ({ param, - value + value, }: { param: string; value: string; @@ -526,33 +609,24 @@ export default class WalletsStore extends Store { extendedPublicKey: HardwareWalletExtendedPublicKeyResponse; device: TransportDevice; }) => { - const { - walletName, - extendedPublicKey, - device - } = params; - const { - deviceId, - deviceType, - deviceModel, - deviceName, - path - } = device; - const accountPublicKey = extendedPublicKey.publicKeyHex + extendedPublicKey.chainCodeHex; + const { walletName, extendedPublicKey, device } = params; + const { deviceId, deviceType, deviceModel, deviceName, path } = device; + const accountPublicKey = + extendedPublicKey.publicKeyHex + extendedPublicKey.chainCodeHex; logger.debug('[HW-DEBUG] HWStore - Execute HW create / restore', { deviceId, deviceType, deviceModel, deviceName, path, - walletName + walletName, }); try { await this._pausePolling(); const wallet = await this.createHardwareWalletRequest.execute({ walletName, - accountPublicKey + accountPublicKey, }); // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message await this.stores.hardwareWallets._setHardwareWalletLocalData({ @@ -560,8 +634,8 @@ export default class WalletsStore extends Store { data: { device, extendedPublicKey, - disconnected: false - } + disconnected: false, + }, }); // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message await this.stores.hardwareWallets._setHardwareWalletDevice({ @@ -573,9 +647,8 @@ export default class WalletsStore extends Store { path, paired: wallet.id, // device paired with software wallet - disconnected: false // device physically disconnected - - } + disconnected: false, // device physically disconnected + }, }); if (wallet) { @@ -594,8 +667,12 @@ export default class WalletsStore extends Store { // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _finishWalletBackup = async () => { // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - this._newWalletDetails.mnemonic = this.stores.walletBackup.recoveryPhrase.join(' '); - const wallet = await this.createWalletRequest.execute(this._newWalletDetails).promise; + this._newWalletDetails.mnemonic = this.stores.walletBackup.recoveryPhrase.join( + ' ' + ); + const wallet = await this.createWalletRequest.execute( + this._newWalletDetails + ).promise; if (wallet) { await this._patchWalletRequestWithNewWallet(wallet); @@ -606,10 +683,7 @@ export default class WalletsStore extends Store { } }; // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message - _deleteWallet = async (params: { - walletId: string; - isLegacy: boolean; - }) => { + _deleteWallet = async (params: { walletId: string; isLegacy: boolean }) => { // Pause polling in order to avoid fetching data for wallet we are about to delete runInAction('AdaWalletsStore::isDeleting set', () => { this.isDeleting = true; @@ -627,9 +701,9 @@ export default class WalletsStore extends Store { const indexOfWalletToDelete = this.all.indexOf(walletToDelete); await this.deleteWalletRequest.execute({ walletId: params.walletId, - isLegacy: params.isLegacy || false + isLegacy: params.isLegacy || false, }); - await this.walletsRequest.patch(result => { + await this.walletsRequest.patch((result) => { result.splice(indexOfWalletToDelete, 1); }); runInAction('AdaWalletsStore::_deleteWallet', () => { @@ -645,7 +719,7 @@ export default class WalletsStore extends Store { this.activeValue = null; // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.router.goToRoute.trigger({ - route: ROUTES.WALLETS.ADD + route: ROUTES.WALLETS.ADD, }); } }); @@ -653,11 +727,11 @@ export default class WalletsStore extends Store { this.actions.dialogs.closeActiveDialog.trigger(); // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.walletsLocal.unsetWalletLocalData.trigger({ - walletId: params.walletId + walletId: params.walletId, }); // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message await this.stores.hardwareWallets._unsetHardwareWalletLocalData({ - walletId: params.walletId + walletId: params.walletId, }); this._resumePolling(); @@ -668,12 +742,12 @@ export default class WalletsStore extends Store { // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _undelegateWallet = async (params: QuitStakePoolRequest) => { const { - quitStakePoolRequest - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message + quitStakePoolRequest, + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.staking; const { - quitStakePool - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message + quitStakePool, + // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message } = this.actions.staking; const walletToUndelegate = this.getWalletById(params.walletId); @@ -684,34 +758,34 @@ export default class WalletsStore extends Store { await quitStakePool.trigger(params); this._setUndelegateWalletSubmissionSuccess({ - result: true + result: true, }); quitStakePoolRequest.reset(); this.refreshWalletsData(); }; - _setUndelegateWalletSubmissionSuccess = ({ - result - }: { - result: boolean; - }) => { - runInAction('AdaWalletsStore::_setUndelegateWalletSubmissionSuccess', () => { - this.undelegateWalletSubmissionSuccess = result; - }); + _setUndelegateWalletSubmissionSuccess = ({ result }: { result: boolean }) => { + runInAction( + 'AdaWalletsStore::_setUndelegateWalletSubmissionSuccess', + () => { + this.undelegateWalletSubmissionSuccess = result; + } + ); }; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - _getUnscrambledMnemonics = async (mnemonics: Array): Array => { + _getUnscrambledMnemonics = async ( + mnemonics: Array + ): Array => { // Split recovery phrase to 18 (scrambled mnemonics) + 9 (mnemonics seed) mnemonics - const { - passphrase, - scrambledInput - } = getScrambledInput(mnemonics); + const { passphrase, scrambledInput } = getScrambledInput(mnemonics); // Unscramble 18-word wallet certificate mnemonic to 12-word mnemonic // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const unscrambledRecoveryPhrase: Array = await this.getWalletRecoveryPhraseFromCertificateRequest.execute({ - passphrase, - scrambledInput - }).promise; + const unscrambledRecoveryPhrase: Array = await this.getWalletRecoveryPhraseFromCertificateRequest.execute( + { + passphrase, + scrambledInput, + } + ).promise; this.getWalletRecoveryPhraseFromCertificateRequest.reset(); // @ts-ignore return unscrambledRecoveryPhrase; @@ -730,11 +804,14 @@ export default class WalletsStore extends Store { const data = { recoveryPhrase: this.mnemonics, walletName: this.walletName, - spendingPassword: this.spendingPassword + spendingPassword: this.spendingPassword, }; const request = this.restoreRequest; - if (this.walletKind === WALLET_KINDS.DAEDALUS && this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.BYRON_27_WORD) { + if ( + this.walletKind === WALLET_KINDS.DAEDALUS && + this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.BYRON_27_WORD + ) { // Reset getWalletRecoveryPhraseFromCertificateRequest to clear previous errors this.getWalletRecoveryPhraseFromCertificateRequest.reset(); data.recoveryPhrase = await this._getUnscrambledMnemonics(this.mnemonics); @@ -743,7 +820,8 @@ export default class WalletsStore extends Store { try { const restoredWallet = await request.execute(data).promise; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. - if (!restoredWallet) throw new Error('Restored wallet was not received correctly'); + if (!restoredWallet) + throw new Error('Restored wallet was not received correctly'); runInAction('set restoredWallet', () => { this.restoredWallet = restoredWallet; this.restoreWalletStep = 3; @@ -761,7 +839,7 @@ export default class WalletsStore extends Store { passphrase, assets, assetsAmounts: assetsAmountsStr, - hasAssetsRemainingAfterTransaction + hasAssetsRemainingAfterTransaction, }: { receiver: string; amount: string; @@ -772,16 +850,20 @@ export default class WalletsStore extends Store { assetsAmounts?: Array; hasAssetsRemainingAfterTransaction?: boolean; }) => { - const assetsAmounts = assetsAmountsStr ? assetsAmountsStr.map(assetAmount => new BigNumber(assetAmount)) : null; - const formattedAssets = assets && assets.length ? assets.map( // eslint-disable-next-line - ({ - policyId: policy_id, - assetName: asset_name - }, index) => ({ - policy_id, - asset_name, - quantity: get(assetsAmounts, index, 0) - })) : null; + const assetsAmounts = assetsAmountsStr + ? assetsAmountsStr.map((assetAmount) => new BigNumber(assetAmount)) + : null; + const formattedAssets = + assets && assets.length + ? assets.map( + // eslint-disable-next-line + ({ policyId: policy_id, assetName: asset_name }, index) => ({ + policy_id, + asset_name, + quantity: get(assetsAmounts, index, 0), + }) + ) + : null; const wallet = this.active; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. if (!wallet) throw new Error('Active wallet required before sending.'); @@ -793,7 +875,7 @@ export default class WalletsStore extends Store { walletId: wallet.id, isLegacy: wallet.isLegacy, assets: formattedAssets, - hasAssetsRemainingAfterTransaction + hasAssetsRemainingAfterTransaction, }); this.refreshWalletsData(); // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message @@ -807,7 +889,7 @@ export default class WalletsStore extends Store { const { transferFundsStep, transferFundsSourceWalletId, - transferFundsTargetWalletId + transferFundsTargetWalletId, } = this; let nextStep = 0; @@ -815,9 +897,13 @@ export default class WalletsStore extends Store { nextStep = 1; } - if (transferFundsStep === 1 && transferFundsSourceWalletId && transferFundsTargetWalletId) { + if ( + transferFundsStep === 1 && + transferFundsSourceWalletId && + transferFundsTargetWalletId + ) { await this._transferFundsCalculateFee({ - sourceWalletId: transferFundsSourceWalletId + sourceWalletId: transferFundsSourceWalletId, }); nextStep = 2; } @@ -828,33 +914,30 @@ export default class WalletsStore extends Store { }; @action _transferFundsPrevStep = () => { - const { - transferFundsStep - } = this; + const { transferFundsStep } = this; const prevStep = transferFundsStep > 0 ? transferFundsStep - 1 : 0; this.transferFundsStep = prevStep; }; @action // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _transferFunds = async ({ - spendingPassword + spendingPassword, }: { spendingPassword: string; }) => { - const { - transferFundsSourceWalletId, - transferFundsTargetWalletId - } = this; + const { transferFundsSourceWalletId, transferFundsTargetWalletId } = this; const targetWalletAddresses = await this.getWalletAddressesRequest.execute({ walletId: transferFundsTargetWalletId, queryParams: { - state: 'unused' - } + state: 'unused', + }, }).promise; await this.transferFundsRequest.execute({ sourceWalletId: transferFundsSourceWalletId, - targetWalletAddresses: targetWalletAddresses ? targetWalletAddresses.map(address => address.id).slice(0, 20) : null, - passphrase: spendingPassword + targetWalletAddresses: targetWalletAddresses + ? targetWalletAddresses.map((address) => address.id).slice(0, 20) + : null, + passphrase: spendingPassword, }); this.refreshWalletsData(); @@ -865,22 +948,20 @@ export default class WalletsStore extends Store { }; @action _transferFundsSetSourceWalletId = ({ - sourceWalletId + sourceWalletId, }: { sourceWalletId: string; }) => { this.transferFundsSourceWalletId = sourceWalletId; // Sets the target wallet to the first wallet - const { - allWallets - } = this; + const { allWallets } = this; this.transferFundsTargetWalletId = get(allWallets, [0, 'id'], ''); // Sets to first step this.transferFundsStep = 1; }; @action _transferFundsSetTargetWalletId = ({ - targetWalletId + targetWalletId, }: { targetWalletId: string; }) => { @@ -899,15 +980,15 @@ export default class WalletsStore extends Store { @action // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _transferFundsCalculateFee = async ({ - sourceWalletId + sourceWalletId, }: { sourceWalletId: string; }) => { const { fee, - leftovers + leftovers, } = await this.transferFundsCalculateFeeRequest.execute({ - sourceWalletId + sourceWalletId, }).promise; runInAction('set migration fee and leftovers', () => { this.transferFundsFee = fee; @@ -930,7 +1011,9 @@ export default class WalletsStore extends Store { @computed get hasAnyWallets(): boolean { if (this.walletsRequest.result == null) return false; - return this.walletsRequest.wasExecuted && this.walletsRequest.result.length > 0; + return ( + this.walletsRequest.wasExecuted && this.walletsRequest.result.length > 0 + ); } @computed @@ -952,17 +1035,17 @@ export default class WalletsStore extends Store { @computed // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. get allWallets(): Array { - return this.walletsRequest.result ? this.walletsRequest.result.filter(({ - isLegacy - }: Wallet) => !isLegacy) : []; + return this.walletsRequest.result + ? this.walletsRequest.result.filter(({ isLegacy }: Wallet) => !isLegacy) + : []; } @computed // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. get allLegacyWallets(): Array { - return this.walletsRequest.result ? this.walletsRequest.result.filter(({ - isLegacy - }: Wallet) => isLegacy) : []; + return this.walletsRequest.result + ? this.walletsRequest.result.filter(({ isLegacy }: Wallet) => isLegacy) + : []; } @computed @@ -984,8 +1067,8 @@ export default class WalletsStore extends Store { @computed get isWalletRoute(): boolean { const { - currentRoute - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message + currentRoute, + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.app; return matchRoute(`${ROUTES.WALLETS.ROOT}(/*rest)`, currentRoute); } @@ -994,7 +1077,10 @@ export default class WalletsStore extends Store { get restoreRequest(): Request { switch (this.walletKind) { case WALLET_KINDS.DAEDALUS: - if (this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.SHELLEY_15_WORD || this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.SHELLEY_24_WORD) { + if ( + this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.SHELLEY_15_WORD || + this.walletKindDaedalus === WALLET_DAEDALUS_KINDS.SHELLEY_24_WORD + ) { return this.restoreDaedalusRequest; } @@ -1019,19 +1105,22 @@ export default class WalletsStore extends Store { } } - getWalletById = (id: string): Wallet | null | undefined => this.all.find(w => w.id === id); - getWalletByName = (name: string): Wallet | null | undefined => this.all.find(w => w.name === name); - getWalletRoute = (walletId: string, page: string = 'summary'): string => buildRoute(ROUTES.WALLETS.PAGE, { - id: walletId, - page - }); + getWalletById = (id: string): Wallet | null | undefined => + this.all.find((w) => w.id === id); + getWalletByName = (name: string): Wallet | null | undefined => + this.all.find((w) => w.name === name); + getWalletRoute = (walletId: string, page: string = 'summary'): string => + buildRoute(ROUTES.WALLETS.PAGE, { + id: walletId, + page, + }); // ACTIONS goToWalletRoute(walletId: string) { const route = this.getWalletRoute(walletId); // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.router.goToRoute.trigger({ - route + route, }); } @@ -1039,8 +1128,8 @@ export default class WalletsStore extends Store { @computed get _canRedirectToWallet(): boolean { const { - currentRoute - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message + currentRoute, + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.app; const isRootRoute = matchRoute(ROUTES.WALLETS.ROOT, currentRoute); const isAddWalletRoute = matchRoute(ROUTES.WALLETS.ADD, currentRoute); @@ -1050,10 +1139,12 @@ export default class WalletsStore extends Store { // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _patchWalletRequestWithNewWallet = async (wallet: Wallet) => { // Only add the new wallet if it does not exist yet in the result! - await this.walletsRequest.patch(result => { - if (!find(result, { - id: wallet.id - })) { + await this.walletsRequest.patch((result) => { + if ( + !find(result, { + id: wallet.id, + }) + ) { if (wallet.isLegacy) { // Legacy wallets are always added to the end of the list! result.push(wallet); @@ -1071,36 +1162,40 @@ export default class WalletsStore extends Store { }; _pollRefresh = async () => { const { - isConnected - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message + isConnected, + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.networkStatus; return isConnected && this.refreshWalletsData(); }; _updateActiveWalletOnRouteChanges = () => { const { - currentRoute - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message + currentRoute, + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.app; const hasAnyWalletLoaded = this.hasAnyLoaded; const isWalletAddPage = matchRoute(ROUTES.WALLETS.ADD, currentRoute); runInAction('WalletsStore::_updateActiveWalletOnRouteChanges', () => { // There are not wallets loaded (yet) -> unset active and return - if (isWalletAddPage || !hasAnyWalletLoaded) return this._unsetActiveWallet(); - const match = matchRoute(`${ROUTES.WALLETS.ROOT}/:id(*page)`, currentRoute); + if (isWalletAddPage || !hasAnyWalletLoaded) + return this._unsetActiveWallet(); + const match = matchRoute( + `${ROUTES.WALLETS.ROOT}/:id(*page)`, + currentRoute + ); if (match) { // We have a route for a specific wallet -> let's try to find it - const walletForCurrentRoute = this.all.find(w => w.id === match.id); + const walletForCurrentRoute = this.all.find((w) => w.id === match.id); if (walletForCurrentRoute) { // The wallet exists, we are done this._setActiveWallet({ - walletId: walletForCurrentRoute.id + walletId: walletForCurrentRoute.id, }); } else if (hasAnyWalletLoaded) { // There is no wallet with given id -> pick first wallet this._setActiveWallet({ - walletId: this.all[0].id + walletId: this.all[0].id, }); if (this.active) this.goToWalletRoute(this.active.id); @@ -1109,7 +1204,7 @@ export default class WalletsStore extends Store { // The route does not specify any wallet -> pick first wallet if (!this.hasActiveWallet && hasAnyWalletLoaded) { this._setActiveWallet({ - walletId: this.all[0].id + walletId: this.all[0].id, }); } @@ -1121,8 +1216,8 @@ export default class WalletsStore extends Store { }; isValidAddress = async (address: string) => { const { - network - // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message + network, + // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message } = this.environment; const expectedNetworkTag = get(NetworkMagics, [network]); const validAddressStyles: AddressStyle[] = ['Byron', 'Icarus', 'Shelley']; @@ -1135,26 +1230,39 @@ export default class WalletsStore extends Store { try { const response = await introspectAddressChannel.send({ - input: address + input: address, }); - if (response === 'Invalid' || !isReceiverAddressType(response.introspection.address_type)) { + if ( + response === 'Invalid' || + !isReceiverAddressType(response.introspection.address_type) + ) { return false; } runInAction('check if address is from the same wallet', () => { // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - const walletAddresses = this.stores.addresses.all.slice().map(addr => addr.id); - this.isAddressFromSameWallet = !!walletAddresses.filter(addr => addr === address).length; + const walletAddresses = this.stores.addresses.all + .slice() + .map((addr) => addr.id); + this.isAddressFromSameWallet = !!walletAddresses.filter( + (addr) => addr === address + ).length; }); // @ts-ignore ts-migrate(2339) FIXME: Property 'includes' does not exist on type '{}'. - return validAddressStyles.includes(response.introspection.address_style) && (Array.isArray(expectedNetworkTag) && includes(expectedNetworkTag, response.introspection.network_tag) || expectedNetworkTag === response.introspection.network_tag); + return ( + validAddressStyles.includes(response.introspection.address_style) && + ((Array.isArray(expectedNetworkTag) && + includes(expectedNetworkTag, response.introspection.network_tag)) || + expectedNetworkTag === response.introspection.network_tag) + ); } catch (error) { logger.error(error); } }; // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - isValidCertificateMnemonic = (mnemonic: string) => this.api.ada.isValidCertificateMnemonic(mnemonic); + isValidCertificateMnemonic = (mnemonic: string) => + this.api.ada.isValidCertificateMnemonic(mnemonic); @action // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message refreshWalletsData = async () => { @@ -1165,24 +1273,27 @@ export default class WalletsStore extends Store { if (this.stores.networkStatus.isConnected) { const result = await this.walletsRequest.execute().promise; if (!result) return; - const walletIds = result.filter(({ - syncState - }: Wallet) => syncState.status !== WalletSyncStateStatuses.NOT_RESPONDING).map((wallet: Wallet) => wallet.id); + const walletIds = result + .filter( + ({ syncState }: Wallet) => + syncState.status !== WalletSyncStateStatuses.NOT_RESPONDING + ) + .map((wallet: Wallet) => wallet.id); // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message await this.actions.walletsLocal.refreshWalletsLocalData.trigger(); runInAction('refresh active wallet', () => { if (this.active) { this._setActiveWallet({ - walletId: this.active.id + walletId: this.active.id, }); } }); runInAction('refresh address data', () => { // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - this.stores.addresses.addressesRequests = walletIds.map(walletId => ({ + this.stores.addresses.addressesRequests = walletIds.map((walletId) => ({ walletId, // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - allRequest: this.stores.addresses._getAddressesAllRequest(walletId) + allRequest: this.stores.addresses._getAddressesAllRequest(walletId), })); // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message @@ -1190,15 +1301,23 @@ export default class WalletsStore extends Store { }); runInAction('refresh transaction data', () => { // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - this.stores.transactions.transactionsRequests = walletIds.map(walletId => ({ - walletId, - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - recentRequest: this.stores.transactions._getTransactionsRecentRequest(walletId), - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - allRequest: this.stores.transactions._getTransactionsAllRequest(walletId), - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - withdrawalsRequest: this.stores.transactions._getWithdrawalsRequest(walletId) - })); + this.stores.transactions.transactionsRequests = walletIds.map( + (walletId) => ({ + walletId, + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message + recentRequest: this.stores.transactions._getTransactionsRecentRequest( + walletId + ), + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message + allRequest: this.stores.transactions._getTransactionsAllRequest( + walletId + ), + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message + withdrawalsRequest: this.stores.transactions._getWithdrawalsRequest( + walletId + ), + }) + ); // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.transactions._refreshTransactionData(); @@ -1219,18 +1338,15 @@ export default class WalletsStore extends Store { @action // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _importWalletFromFile = async (params: WalletImportFromFileParams) => { - const { - filePath, - walletName, - spendingPassword - } = params; + const { filePath, walletName, spendingPassword } = params; const importedWallet = await this.importFromFileRequest.execute({ filePath, walletName, - spendingPassword + spendingPassword, }).promise; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. - if (!importedWallet) throw new Error('Imported wallet was not received correctly'); + if (!importedWallet) + throw new Error('Imported wallet was not received correctly'); await this._patchWalletRequestWithNewWallet(importedWallet); // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); @@ -1239,23 +1355,23 @@ export default class WalletsStore extends Store { this.refreshWalletsData(); }; @action - _setActiveWallet = ({ - walletId - }: { - walletId: string; - }) => { + _setActiveWallet = ({ walletId }: { walletId: string }) => { if (this.hasAnyWallets) { const activeWalletId = this.active ? this.active.id : null; - const newActiveWallet = this.all.find(wallet => wallet.id === walletId); + const newActiveWallet = this.all.find((wallet) => wallet.id === walletId); - if ((!this.active || !this.active.isNotResponding) && newActiveWallet && newActiveWallet.isNotResponding) { + if ( + (!this.active || !this.active.isNotResponding) && + newActiveWallet && + newActiveWallet.isNotResponding + ) { // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.router.goToRoute.trigger({ route: ROUTES.WALLETS.PAGE, params: { id: newActiveWallet.id, - page: 'summary' - } + page: 'summary', + }, }); } @@ -1273,15 +1389,16 @@ export default class WalletsStore extends Store { if (this.active && this.active.isHardwareWallet) { const { - hardwareWalletsConnectionData - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message + hardwareWalletsConnectionData, + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.hardwareWallets; - const hardwareWalletConnectionData = get(hardwareWalletsConnectionData, this.active.id); + const hardwareWalletConnectionData = get( + hardwareWalletsConnectionData, + this.active.id + ); if (hardwareWalletConnectionData) { - const { - extendedPublicKey - } = hardwareWalletConnectionData; + const { extendedPublicKey } = hardwareWalletConnectionData; const extendedPublicKeyHex = `${extendedPublicKey.publicKeyHex}${extendedPublicKey.chainCodeHex}`; // @ts-ignore ts-migrate(2580) FIXME: Cannot find name 'Buffer'. Do you need to install ... Remove this comment to see the full error message const xpub = Buffer.from(extendedPublicKeyHex, 'hex'); @@ -1315,7 +1432,9 @@ export default class WalletsStore extends Store { params: Record | null | undefined; }) => { // Reset the send request anytime we visit the send page (e.g: to remove any previous errors) - if (matchRoute(ROUTES.WALLETS.SEND, buildRoute(options.route, options.params))) { + if ( + matchRoute(ROUTES.WALLETS.SEND, buildRoute(options.route, options.params)) + ) { this.sendMoneyRequest.reset(); this.isAddressFromSameWallet = false; } @@ -1352,7 +1471,7 @@ export default class WalletsStore extends Store { _generateCertificate = flow(function* generateCertificate(params: { filePath: string; timestamp: string; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Generator'. + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Generator'. }): Generator { try { // Pause polling in order not to show Paper wallet in the UI @@ -1363,25 +1482,31 @@ export default class WalletsStore extends Store { // Generate wallet recovery phrase // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const recoveryPhrase: Array = yield this.getWalletRecoveryPhraseRequest.execute().promise; + const recoveryPhrase: Array = yield this.getWalletRecoveryPhraseRequest.execute() + .promise; // Generate 9-words (additional) mnemonic // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const additionalMnemonicWords: Array = yield this.getWalletCertificateAdditionalMnemonicsRequest.execute().promise; + const additionalMnemonicWords: Array = yield this.getWalletCertificateAdditionalMnemonicsRequest.execute() + .promise; this.additionalMnemonicWords = additionalMnemonicWords.join(' '); // Generate spending password from 9-word mnemonic and save to store const spendingPassword = mnemonicToSeedHex(this.additionalMnemonicWords); this.walletCertificatePassword = spendingPassword; // Generate paper wallet scrambled mnemonic // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const walletCertificateRecoveryPhrase: Array = yield this.getWalletCertificateRecoveryPhraseRequest.execute({ - passphrase: spendingPassword, - input: recoveryPhrase.join(' ') - }).promise; - this.walletCertificateRecoveryPhrase = walletCertificateRecoveryPhrase.join(' '); + const walletCertificateRecoveryPhrase: Array = yield this.getWalletCertificateRecoveryPhraseRequest.execute( + { + passphrase: spendingPassword, + input: recoveryPhrase.join(' '), + } + ).promise; + this.walletCertificateRecoveryPhrase = walletCertificateRecoveryPhrase.join( + ' ' + ); // Create temporary wallet const walletData = { name: 'Paper Wallet', - mnemonic: recoveryPhrase.join(' ') + mnemonic: recoveryPhrase.join(' '), }; const wallet = yield this.createWalletRequest.execute(walletData).promise; // Get temporary wallet address @@ -1389,12 +1514,12 @@ export default class WalletsStore extends Store { if (wallet) { walletAddresses = yield this.getWalletAddressesRequest.execute({ - walletId: wallet.id + walletId: wallet.id, }).promise; // delete temporary wallet yield this.deleteWalletRequest.execute({ walletId: wallet.id, - isLegacy: wallet.isLegacy + isLegacy: wallet.isLegacy, }); } @@ -1402,26 +1527,36 @@ export default class WalletsStore extends Store { const walletAddress = get(walletAddresses, ['0', 'id'], null); this.walletCertificateAddress = walletAddress; // download pdf certificate - yield this._downloadCertificate(walletAddress, walletCertificateRecoveryPhrase, params.filePath, params.timestamp); + yield this._downloadCertificate( + walletAddress, + walletCertificateRecoveryPhrase, + params.filePath, + params.timestamp + ); } catch (error) { throw error; } finally { this._resumePolling(); } - // @ts-ignore ts-migrate(2339) FIXME: Property 'bind' does not exist on type '(params: {... Remove this comment to see the full error message + // @ts-ignore ts-migrate(2339) FIXME: Property 'bind' does not exist on type '(params: {... Remove this comment to see the full error message }).bind(this); // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message - _downloadCertificate = async (address: string, recoveryPhrase: Array, filePath: string, timestamp: string) => { + _downloadCertificate = async ( + address: string, + recoveryPhrase: Array, + filePath: string, + timestamp: string + ) => { // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message const locale = this.stores.profile.currentLocale; const intl = i18nContext(locale); const { - isMainnet - // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message + isMainnet, + // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message } = this.environment; const { - buildLabel - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. + buildLabel, + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. } = global; try { @@ -1432,7 +1567,7 @@ export default class WalletsStore extends Store { filePath, isMainnet, buildLabel, - timestamp + timestamp, }); runInAction('handle successful certificate download', () => { // Reset progress @@ -1452,7 +1587,7 @@ export default class WalletsStore extends Store { _generateAddressPDF = async ({ note, address, - filePath + filePath, }: { note: string; address: string; @@ -1461,13 +1596,13 @@ export default class WalletsStore extends Store { const { currentLocale, currentDateFormat, - currentTimeFormat - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message + currentTimeFormat, + // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.profile; const { network, - isMainnet - // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message + isMainnet, + // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message } = this.environment; const intl = i18nContext(currentLocale); @@ -1481,12 +1616,12 @@ export default class WalletsStore extends Store { currentTimeFormat, network, isMainnet, - intl + intl, }); const walletAddress = ellipsis(address, 15, 15); // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.wallets.generateAddressPDFSuccess.trigger({ - walletAddress + walletAddress, }); } catch (error) { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. @@ -1496,7 +1631,7 @@ export default class WalletsStore extends Store { // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _saveQRCodeImage = async ({ address, - filePath + filePath, }: { address: string; filePath: string; @@ -1504,12 +1639,12 @@ export default class WalletsStore extends Store { try { await saveQRCodeImageChannel.send({ address, - filePath + filePath, }); const walletAddress = ellipsis(address, 15, 15); // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.wallets.saveQRCodeImageSuccess.trigger({ - walletAddress + walletAddress, }); } catch (error) { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. @@ -1517,20 +1652,24 @@ export default class WalletsStore extends Store { } }; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. - _updateCertificateCreationState = action((state: boolean, error?: Record | null | undefined) => { - this.generatingCertificateInProgress = state; + _updateCertificateCreationState = action( + (state: boolean, error?: Record | null | undefined) => { + this.generatingCertificateInProgress = state; - this._updateGeneratingCertificateError(error); - }); + this._updateGeneratingCertificateError(error); + } + ); // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. - _updateGeneratingCertificateError = action((error?: Record | null | undefined) => { - if (error && error.syscall && error.syscall === 'open') { - // User tries to replace a file that is open - this.generatingCertificateError = new WalletPaperWalletOpenPdfError(); - } else { - this.generatingCertificateError = null; + _updateGeneratingCertificateError = action( + (error?: Record | null | undefined) => { + if (error && error.syscall && error.syscall === 'open') { + // User tries to replace a file that is open + this.generatingCertificateError = new WalletPaperWalletOpenPdfError(); + } else { + this.generatingCertificateError = null; + } } - }); + ); /** * Generates a rewards csv and saves it to the user selected file location. @@ -1540,7 +1679,7 @@ export default class WalletsStore extends Store { */ _generateCsv = flow(function* generateCsv({ fileContent, - filePath + filePath, }: { fileContent: CsvFileContent; filePath: string; @@ -1558,14 +1697,17 @@ export default class WalletsStore extends Store { } finally { this._resumePolling(); } - // @ts-ignore ts-migrate(2339) FIXME: Property 'bind' does not exist on type '(args_0: {... Remove this comment to see the full error message + // @ts-ignore ts-migrate(2339) FIXME: Property 'bind' does not exist on type '(args_0: {... Remove this comment to see the full error message }).bind(this); // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message - _downloadRewardsCsv = async (fileContent: CsvFileContent, filePath: string) => { + _downloadRewardsCsv = async ( + fileContent: CsvFileContent, + filePath: string + ) => { try { await downloadCsv({ fileContent, - filePath + filePath, }); runInAction('handle successful rewards csv download', () => { this._updateRewardsCsvCreationState(false); @@ -1577,24 +1719,26 @@ export default class WalletsStore extends Store { } }; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. - _updateRewardsCsvCreationState = action((state: boolean, error?: Record | null | undefined) => { - this.generatingRewardsCsvInProgress = state; + _updateRewardsCsvCreationState = action( + (state: boolean, error?: Record | null | undefined) => { + this.generatingRewardsCsvInProgress = state; - this._updateGeneratingRewardsCsvError(error); - }); + this._updateGeneratingRewardsCsvError(error); + } + ); // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. - _updateGeneratingRewardsCsvError = action((error?: Record | null | undefined) => { - if (error && error.syscall && error.syscall === 'open') { - // User tries to replace a file that is open - this.generatingRewardsCsvError = new WalletRewardsOpenCsvError(); - } else { - this.generatingRewardsCsvError = null; + _updateGeneratingRewardsCsvError = action( + (error?: Record | null | undefined) => { + if (error && error.syscall && error.syscall === 'open') { + // User tries to replace a file that is open + this.generatingRewardsCsvError = new WalletRewardsOpenCsvError(); + } else { + this.generatingRewardsCsvError = null; + } } - }); + ); @action - _setCertificateTemplate = (params: { - selectedTemplate: string; - }) => { + _setCertificateTemplate = (params: { selectedTemplate: string }) => { this.certificateTemplate = params.selectedTemplate; this._updateCertificateStep(); @@ -1616,7 +1760,9 @@ export default class WalletsStore extends Store { this._updateGeneratingCertificateError(); const currrentCertificateStep = this.certificateStep || 0; - this.certificateStep = isBack ? currrentCertificateStep - 1 : currrentCertificateStep + 1; + this.certificateStep = isBack + ? currrentCertificateStep - 1 + : currrentCertificateStep + 1; }; @action _closeCertificateGeneration = () => { @@ -1649,4 +1795,4 @@ export default class WalletsStore extends Store { this._updateGeneratingRewardsCsvError(); }; -} \ No newline at end of file +} From 1f0038155341ea3303b60ed959925051a96918d9 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 10:25:58 +0000 Subject: [PATCH 22/42] [DDW-827] added ts-ignore annotations and re-formatted files according to tsconfig --- source/renderer/app/api/api.ts | 39 +++++++++++++++++- .../renderer/app/api/utils/apiHelpers.spec.ts | 7 ++++ .../WalletSendAssetsConfirmationDialog.tsx | 8 ++++ .../WalletSendConfirmationDialog.tsx | 8 ++++ source/renderer/app/stores/WalletsStore.ts | 41 +++++++++++++------ 5 files changed, 89 insertions(+), 14 deletions(-) diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 24ee43de32..2fd73b8de7 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -245,6 +245,7 @@ export default class AdaApi { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWallets = async (): Promise> => { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWallets called'); const { getHardwareWalletLocalData, @@ -477,8 +478,10 @@ export default class AdaApi { } ); if (fromDate) + // @ts-ignore ts-migrate(2339) FIXME: Property 'start' does not exist on type '{ order: ... Remove this comment to see the full error message params.start = `${moment.utc(fromDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; if (toDate) + // @ts-ignore ts-migrate(2339) FIXME: Property 'end' does not exist on type '{ order: "a... Remove this comment to see the full error message params.end = `${moment.utc(toDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; try { @@ -746,6 +749,7 @@ export default class AdaApi { try { const walletInitData = { name, + // @ts-ignore ts-migrate(2345) FIXME: Argument of type 'string[]' is not assignable to p... Remove this comment to see the full error message mnemonic_sentence: split(mnemonic, ' '), passphrase: spendingPassword, }; @@ -775,6 +779,7 @@ export default class AdaApi { try { const walletInitData = { name, + // @ts-ignore ts-migrate(2345) FIXME: Argument of type 'string[]' is not assignable to p... Remove this comment to see the full error message mnemonic_sentence: split(mnemonic, ' '), passphrase: spendingPassword, }; @@ -866,6 +871,7 @@ export default class AdaApi { isLegacy, assets, withdrawal = TransactionWithdrawal, + // @ts-ignore ts-migrate(2339) FIXME: Property 'hasAssetsRemainingAfterTransaction' does... Remove this comment to see the full error message hasAssetsRemainingAfterTransaction, } = request; @@ -893,6 +899,7 @@ export default class AdaApi { } else { response = await createTransaction(this.config, { walletId, + // @ts-ignore ts-migrate(2322) FIXME: Type '{ withdrawal: TransactionWithdrawalType; pay... Remove this comment to see the full error message data: { ...data, withdrawal }, }); } @@ -966,6 +973,7 @@ export default class AdaApi { } else { response = await createTransaction(this.config, { walletId, + // @ts-ignore ts-migrate(2322) FIXME: Type '{ withdrawal: any; payments: { address: any;... Remove this comment to see the full error message data: { ...data, withdrawal }, }); } @@ -1035,6 +1043,7 @@ export default class AdaApi { } else { response = await getTransactionFee(this.config, { walletId, + // @ts-ignore ts-migrate(2322) FIXME: Type '{ withdrawal: TransactionWithdrawalType; pay... Remove this comment to see the full error message data: { ...data, withdrawal }, }); } @@ -1087,6 +1096,7 @@ export default class AdaApi { // ApiError with logging showcase throw new ApiError(error, { + // @ts-ignore ts-migrate(2322) FIXME: Type 'boolean' is not assignable to type 'Record> { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletRecoveryPhrase called'); try { @@ -1527,6 +1540,7 @@ export default class AdaApi { const response: Promise> = new Promise((resolve) => resolve(generateAccountMnemonics(WALLET_RECOVERY_PHRASE_WORD_COUNT)) ); + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletRecoveryPhrase success'); return response; } catch (error) { @@ -1539,6 +1553,7 @@ export default class AdaApi { // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletCertificateAdditionalMnemonics(): Promise> { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletCertificateAdditionalMnemonics called'); try { @@ -1546,6 +1561,7 @@ export default class AdaApi { const response: Promise> = new Promise((resolve) => resolve(generateAdditionalMnemonics()) ); + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletCertificateAdditionalMnemonics success'); return response; } catch (error) { @@ -1560,6 +1576,7 @@ export default class AdaApi { getWalletCertificateRecoveryPhrase( request: GetWalletCertificateRecoveryPhraseRequest ): Promise> { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletCertificateRecoveryPhrase called'); const { passphrase, input: scrambledInput } = request; @@ -1573,6 +1590,7 @@ export default class AdaApi { }) ) ); + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletCertificateRecoveryPhrase success'); return response; } catch (error) { @@ -1587,6 +1605,7 @@ export default class AdaApi { getWalletRecoveryPhraseFromCertificate( request: GetWalletRecoveryPhraseFromCertificateRequest ): Promise> { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate called'); const { passphrase, scrambledInput } = request; @@ -1595,6 +1614,7 @@ export default class AdaApi { passphrase, scrambledInput, }); + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate success'); // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return Promise.resolve(response); @@ -1752,6 +1772,7 @@ export default class AdaApi { logger.debug('AdaApi::restoreLegacyWallet success', { wallet, }); + // @ts-ignore ts-migrate(2345) FIXME: Argument of type '{ address_pool_gap: number; dele... Remove this comment to see the full error message return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreLegacyWallet error', { @@ -1815,6 +1836,7 @@ export default class AdaApi { logger.debug('AdaApi::restoreByronRandomWallet success', { wallet, }); + // @ts-ignore ts-migrate(2345) FIXME: Argument of type '{ address_pool_gap: number; dele... Remove this comment to see the full error message return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreByronRandomWallet error', { @@ -1869,6 +1891,7 @@ export default class AdaApi { logger.debug('AdaApi::restoreByronIcarusWallet success', { wallet, }); + // @ts-ignore ts-migrate(2345) FIXME: Argument of type '{ address_pool_gap: number; dele... Remove this comment to see the full error message return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreByronIcarusWallet error', { @@ -1923,6 +1946,7 @@ export default class AdaApi { logger.debug('AdaApi::restoreByronTrezorWallet success', { wallet, }); + // @ts-ignore ts-migrate(2345) FIXME: Argument of type '{ address_pool_gap: number; dele... Remove this comment to see the full error message return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreByronTrezorWallet error', { @@ -1977,6 +2001,7 @@ export default class AdaApi { logger.debug('AdaApi::restoreByronLedgerWallet success', { wallet, }); + // @ts-ignore ts-migrate(2345) FIXME: Argument of type '{ address_pool_gap: number; dele... Remove this comment to see the full error message return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreByronLedgerWallet error', { @@ -2023,6 +2048,7 @@ export default class AdaApi { logger.debug('AdaApi::restoreExportedByronWallet success', { wallet, }); + // @ts-ignore ts-migrate(2345) FIXME: Argument of type '{ address_pool_gap: number; dele... Remove this comment to see the full error message return _createWalletFromServerData(wallet); } catch (error) { logger.error('AdaApi::restoreExportedByronWallet error', { @@ -2169,6 +2195,7 @@ export default class AdaApi { }); } + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::updateSpendingPassword success'); return true; } catch (error) { @@ -2213,6 +2240,7 @@ export default class AdaApi { }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getSmashSettings = async (): Promise => { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getSmashSettings called'); try { @@ -2280,6 +2308,7 @@ export default class AdaApi { const error = { code: 'invalid_smash_server', }; + // @ts-ignore ts-migrate(2345) FIXME: Argument of type '{ code: string; }' is not assign... Remove this comment to see the full error message throw new ApiError(error); } @@ -2526,7 +2555,7 @@ export default class AdaApi { } }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - getStakePools = async (stake: number = 0): Promise> => { + getStakePools = async (stake = 0): Promise> => { logger.debug('AdaApi::getStakePools called', { parameters: { stake, @@ -2561,6 +2590,7 @@ export default class AdaApi { }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message testReset = async (): Promise => { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::testReset called'); try { @@ -2575,6 +2605,7 @@ export default class AdaApi { }) ) ); + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::testReset success'); } catch (error) { logger.error('AdaApi::testReset error', { @@ -2585,6 +2616,7 @@ export default class AdaApi { }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getNetworkInfo = async (): Promise => { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getNetworkInfo called'); try { @@ -2676,6 +2708,7 @@ export default class AdaApi { }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getNetworkParameters = async (): Promise => { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getNetworkParameters called'); try { @@ -2720,6 +2753,7 @@ export default class AdaApi { }; // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getNews = async (): Promise => { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getNews called'); // Fetch news json let rawNews: string; @@ -3221,7 +3255,9 @@ const _createTransactionFromServerData = action( deposit: new BigNumber(deposit.quantity.toString()).dividedBy( LOVELACES_PER_ADA ), + // @ts-ignore ts-migrate(2322) FIXME: Type '{ policyId: string; assetName: string; quant... Remove this comment to see the full error message assets: transactionAssets, + // @ts-ignore ts-migrate(2345) FIXME: Argument of type 'Date' is not assignable to param... Remove this comment to see the full error message date: utcStringToDate(date), description: '', addresses: { @@ -3358,6 +3394,7 @@ const _createStakePoolFromServerData = action( const retiringAt = get(retirement, 'epoch_start_time', null); return new StakePool({ id, + // @ts-ignore ts-migrate(2322) FIXME: Type 'number' is not assignable to type 'BigNumber... Remove this comment to see the full error message relativeStake: relativeStakePercentage, producedBlocks: producedBlocksCount, potentialRewards: new BigNumber( diff --git a/source/renderer/app/api/utils/apiHelpers.spec.ts b/source/renderer/app/api/utils/apiHelpers.spec.ts index ca0932943c..b9ad9e9353 100644 --- a/source/renderer/app/api/utils/apiHelpers.spec.ts +++ b/source/renderer/app/api/utils/apiHelpers.spec.ts @@ -7,6 +7,7 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { it('should not throw if error.code is not "cannot_cover_fee"', () => { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error(); + // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'other_error'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => @@ -19,6 +20,7 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { const error = new Error( 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' ); + // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'cannot_cover_fee'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error)).not.toThrow(); @@ -27,6 +29,7 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { it('should not throw error if error code is "cannot_cover_fee" but message does not match reegex', () => { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error('other message'); + // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'cannot_cover_fee'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => @@ -39,6 +42,7 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { const error = new Error( 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' ); + // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'other_code'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => @@ -49,6 +53,7 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { it('should not throw if there are no tokens remaining in wallet after transaction', () => { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error(); + // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'cannot_cover_fee'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => @@ -61,11 +66,13 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { const error = new Error( 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.' ); + // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'cannot_cover_fee'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true) ).toThrowError( + // @ts-ignore ts-migrate(2345) FIXME: Argument of type '{ additionalValues: { adaToRemai... Remove this comment to see the full error message new Error({ additionalValues: { adaToRemain: 1, diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx index 269a7465a2..3547b67930 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx @@ -98,6 +98,7 @@ class WalletSendAssetsConfirmationDialog extends Component { } form = new ReactToolboxMobxForm( + // @ts-ignore ts-migrate(2554) FIXME: Expected 0 arguments, but got 2. { fields: { passphrase: { @@ -141,6 +142,7 @@ class WalletSendAssetsConfirmationDialog extends Component { } ); submit = () => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'submit' does not exist on type 'ReactToo... Remove this comment to see the full error message this.form.submit({ onSuccess: (form) => { const { selectedAssets, assetsAmounts } = this.state; @@ -168,11 +170,13 @@ class WalletSendAssetsConfirmationDialog extends Component { }); }; handleSubmitOnEnter = (event: KeyboardEvent) => + // @ts-ignore ts-migrate(2339) FIXME: Property '$' does not exist on type 'ReactToolboxM... Remove this comment to see the full error message (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && submitOnEnter(this.submit, event); renderConfirmationElement = ( isHardwareWallet: boolean ): React.ReactElement, any> | null => { + // @ts-ignore ts-migrate(2339) FIXME: Property '$' does not exist on type 'ReactToolboxM... Remove this comment to see the full error message const passphraseField = this.form.$('passphrase'); const { areTermsAccepted } = this.state; const { @@ -240,7 +244,9 @@ class WalletSendAssetsConfirmationDialog extends Component { const { form } = this; const { intl } = this.context; const { selectedAssets, areTermsAccepted, assetsAmounts } = this.state; + // @ts-ignore ts-migrate(2339) FIXME: Property '$' does not exist on type 'ReactToolboxM... Remove this comment to see the full error message const passphraseField = form.$('passphrase'); + // @ts-ignore ts-migrate(2339) FIXME: Property '$' does not exist on type 'ReactToolboxM... Remove this comment to see the full error message const flightCandidateCheckboxField = form.$('flightCandidateCheckbox'); const { onCancel, @@ -291,9 +297,11 @@ class WalletSendAssetsConfirmationDialog extends Component { let errorElement = null; if (error) { + // @ts-ignore ts-migrate(2339) FIXME: Property 'values' does not exist on type 'Localiza... Remove this comment to see the full error message const errorHasLink = !!error.values.linkLabel; errorElement = errorHasLink ? ( diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx index 446aefeff1..eb38af44f6 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx @@ -64,6 +64,7 @@ class WalletSendConfirmationDialog extends Component { areTermsAccepted: false, }; form = new ReactToolboxMobxForm( + // @ts-ignore ts-migrate(2554) FIXME: Expected 0 arguments, but got 2. { fields: { passphrase: { @@ -107,6 +108,7 @@ class WalletSendConfirmationDialog extends Component { } ); submit = () => { + // @ts-ignore ts-migrate(2339) FIXME: Property 'submit' does not exist on type 'ReactToo... Remove this comment to see the full error message this.form.submit({ onSuccess: (form) => { const { @@ -132,11 +134,13 @@ class WalletSendConfirmationDialog extends Component { }); }; handleSubmitOnEnter = (event: KeyboardEvent) => + // @ts-ignore ts-migrate(2339) FIXME: Property '$' does not exist on type 'ReactToolboxM... Remove this comment to see the full error message (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && submitOnEnter(this.submit, event); renderConfirmationElement = ( isHardwareWallet: boolean ): React.ReactElement, any> | null | undefined => { + // @ts-ignore ts-migrate(2339) FIXME: Property '$' does not exist on type 'ReactToolboxM... Remove this comment to see the full error message const passphraseField = this.form.$('passphrase'); const { areTermsAccepted } = this.state; const { @@ -188,7 +192,9 @@ class WalletSendConfirmationDialog extends Component { const { form } = this; const { intl } = this.context; const { areTermsAccepted } = this.state; + // @ts-ignore ts-migrate(2339) FIXME: Property '$' does not exist on type 'ReactToolboxM... Remove this comment to see the full error message const passphraseField = form.$('passphrase'); + // @ts-ignore ts-migrate(2339) FIXME: Property '$' does not exist on type 'ReactToolboxM... Remove this comment to see the full error message const flightCandidateCheckboxField = form.$('flightCandidateCheckbox'); const { onCancel, @@ -233,9 +239,11 @@ class WalletSendConfirmationDialog extends Component { let errorElement = null; if (error) { + // @ts-ignore ts-migrate(2339) FIXME: Property 'values' does not exist on type 'Localiza... Remove this comment to see the full error message const errorHasLink = !!error.values.linkLabel; errorElement = errorHasLink ? ( diff --git a/source/renderer/app/stores/WalletsStore.ts b/source/renderer/app/stores/WalletsStore.ts index 3094736540..cafff947a3 100644 --- a/source/renderer/app/stores/WalletsStore.ts +++ b/source/renderer/app/stores/WalletsStore.ts @@ -69,7 +69,7 @@ export default class WalletsStore extends Store { @observable undelegateWalletSubmissionSuccess: boolean | null | undefined = null; @observable - isAddressFromSameWallet: boolean = false; + isAddressFromSameWallet = false; // REQUESTS @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. @@ -212,11 +212,11 @@ export default class WalletsStore extends Store { mnemonics: Array = []; // STEP: CONFIGURATION @observable - walletName: string = ''; + walletName = ''; @observable - spendingPassword: string = ''; + spendingPassword = ''; @observable - repeatPassword: string = ''; + repeatPassword = ''; // TODO: Remove once the new restore creation process is ready @observable restoreWalletUseNewProcess = true; @@ -231,11 +231,11 @@ export default class WalletsStore extends Store { /* ---------- Delete Wallet ---------- */ @observable - isDeleting: boolean = false; + isDeleting = false; /* ---------- Restore Wallet ---------- */ @observable - isRestoring: boolean = false; + isRestoring = false; /* ---------- Paper Wallet ---------- */ @observable @@ -263,11 +263,11 @@ export default class WalletsStore extends Store { /* ---------- Transfer Funds ---------- */ @observable - transferFundsSourceWalletId: string = ''; + transferFundsSourceWalletId = ''; @observable - transferFundsTargetWalletId: string = ''; + transferFundsTargetWalletId = ''; @observable - transferFundsStep: number = 0; + transferFundsStep = 0; @observable transferFundsFee: BigNumber | null | undefined = null; @observable @@ -462,7 +462,7 @@ export default class WalletsStore extends Store { this.createWalletShowAbortConfirmation = false; }; @action - _createWalletChangeStep = (isBack: boolean = false) => { + _createWalletChangeStep = (isBack = false) => { const currrentCreateWalletStep = this.createWalletStep || 0; this.createWalletStep = isBack === true @@ -502,7 +502,7 @@ export default class WalletsStore extends Store { } }; @action - _restoreWalletChangeStep = (isBack: boolean = false) => { + _restoreWalletChangeStep = (isBack = false) => { // Reset restore requests to clear previous errors const currrentRestoreWalletStep = this.restoreWalletStep || 0; @@ -624,6 +624,7 @@ export default class WalletsStore extends Store { try { await this._pausePolling(); + // @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 const wallet = await this.createHardwareWalletRequest.execute({ walletName, accountPublicKey, @@ -699,10 +700,12 @@ export default class WalletsStore extends Store { } const indexOfWalletToDelete = this.all.indexOf(walletToDelete); + // @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 await this.deleteWalletRequest.execute({ walletId: params.walletId, isLegacy: params.isLegacy || false, }); + // @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 await this.walletsRequest.patch((result) => { result.splice(indexOfWalletToDelete, 1); }); @@ -775,6 +778,7 @@ export default class WalletsStore extends Store { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. _getUnscrambledMnemonics = async ( mnemonics: Array + // @ts-ignore ts-migrate(1064) FIXME: The return type of an async function or method mus... Remove this comment to see the full error message ): Array => { // Split recovery phrase to 18 (scrambled mnemonics) + 9 (mnemonics seed) mnemonics const { passphrase, scrambledInput } = getScrambledInput(mnemonics); @@ -867,6 +871,7 @@ export default class WalletsStore extends Store { const wallet = this.active; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. 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 await this.sendMoneyRequest.execute({ address: receiver, // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'parseInt'. @@ -932,6 +937,7 @@ export default class WalletsStore extends Store { state: 'unused', }, }).promise; + // @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 await this.transferFundsRequest.execute({ sourceWalletId: transferFundsSourceWalletId, targetWalletAddresses: targetWalletAddresses @@ -985,7 +991,9 @@ export default class WalletsStore extends Store { sourceWalletId: string; }) => { const { + // @ts-ignore ts-migrate(2339) FIXME: Property 'fee' does not exist on type 'TransferFun... Remove this comment to see the full error message fee, + // @ts-ignore ts-migrate(2339) FIXME: Property 'leftovers' does not exist on type 'Trans... Remove this comment to see the full error message leftovers, } = await this.transferFundsCalculateFeeRequest.execute({ sourceWalletId, @@ -1074,6 +1082,7 @@ export default class WalletsStore extends Store { } @computed + // @ts-ignore ts-migrate(2314) FIXME: Generic type 'LocalizedRequest' requires 1... Remove this comment to see the full error message get restoreRequest(): Request { switch (this.walletKind) { case WALLET_KINDS.DAEDALUS: @@ -1109,7 +1118,7 @@ export default class WalletsStore extends Store { this.all.find((w) => w.id === id); getWalletByName = (name: string): Wallet | null | undefined => this.all.find((w) => w.name === name); - getWalletRoute = (walletId: string, page: string = 'summary'): string => + getWalletRoute = (walletId: string, page = 'summary'): string => buildRoute(ROUTES.WALLETS.PAGE, { id: walletId, page, @@ -1139,6 +1148,7 @@ export default class WalletsStore extends Store { // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _patchWalletRequestWithNewWallet = async (wallet: Wallet) => { // Only add the new wallet if it does not exist yet in the result! + // @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 await this.walletsRequest.patch((result) => { if ( !find(result, { @@ -1257,6 +1267,7 @@ export default class WalletsStore extends Store { expectedNetworkTag === response.introspection.network_tag) ); } catch (error) { + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.error(error); } }; @@ -1385,6 +1396,7 @@ export default class WalletsStore extends Store { this.stores.addresses.lastGeneratedAddress = null; if (this.active) { + // @ts-ignore ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'BigNumber... Remove this comment to see the full error message this.activeValue = formattedWalletAmount(this.active.amount); if (this.active && this.active.isHardwareWallet) { @@ -1450,6 +1462,7 @@ export default class WalletsStore extends Store { @action // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _pausePolling = async () => { + // @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 if (this.walletsRequest.isExecuting) await this.walletsRequest; runInAction('AdaWalletsStore::_pausePolling', () => { this._pollingBlocked = true; @@ -1490,6 +1503,7 @@ export default class WalletsStore extends Store { .promise; this.additionalMnemonicWords = additionalMnemonicWords.join(' '); // Generate spending password from 9-word mnemonic and save to store + // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. const spendingPassword = mnemonicToSeedHex(this.additionalMnemonicWords); this.walletCertificatePassword = spendingPassword; // Generate paper wallet scrambled mnemonic @@ -1555,6 +1569,7 @@ export default class WalletsStore extends Store { // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message } = this.environment; const { + // @ts-ignore ts-migrate(2339) FIXME: Property 'buildLabel' does not exist on type 'type... Remove this comment to see the full error message buildLabel, // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. } = global; @@ -1756,7 +1771,7 @@ export default class WalletsStore extends Store { this._closeRewardsCsvGeneration(); }; @action - _updateCertificateStep = (isBack: boolean = false) => { + _updateCertificateStep = (isBack = false) => { this._updateGeneratingCertificateError(); const currrentCertificateStep = this.certificateStep || 0; From 55ac37916ddffe98e861541582e74f1f108464af Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Mon, 31 Jan 2022 10:30:43 +0000 Subject: [PATCH 23/42] [DDW-827] update message translations --- source/renderer/app/i18n/locales/defaultMessages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index 77e294942a..f195bfb6c2 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -293,7 +293,7 @@ "column": 3, "line": 120 }, - "file": "source/renderer/app/api/errors.js", + "file": "source/renderer/app/api/errors.ts", "id": "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens", "start": { "column": 26, From c29fd47f527e2c7d141bd837d6af8cc80f02ced6 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Wed, 9 Feb 2022 09:39:04 +0000 Subject: [PATCH 24/42] [DDW-827] Update test conditions and minimum ada to remain --- source/renderer/app/api/api.ts | 39 +++++++--------- .../renderer/app/api/utils/apiHelpers.spec.ts | 44 +++++++++++++------ source/renderer/app/api/utils/apiHelpers.ts | 3 +- source/renderer/app/stores/StakingStore.ts | 4 +- yarn.lock | 4 ++ 5 files changed, 55 insertions(+), 39 deletions(-) diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 2fd73b8de7..f1a2adcbbe 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -677,7 +677,8 @@ export default class AdaApi { assets: response, }); // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. - const assetsLocaldata = await global.daedalus.api.localStorage.getAssetsLocalData(); + const assetsLocaldata = + await global.daedalus.api.localStorage.getAssetsLocalData(); logger.debug('AdaApi::getAssetsLocalData success', { assetsLocaldata, }); @@ -1702,9 +1703,8 @@ export default class AdaApi { getCurrencyList = async (): Promise => { try { const apiResponse = await getCurrencyList(); - const response: GetCurrencyListResponse = currencyConfig.responses.list( - apiResponse - ); + const response: GetCurrencyListResponse = + currencyConfig.responses.list(apiResponse); logger.debug('AdaApi::getCurrencyList success', { response, }); @@ -1722,9 +1722,8 @@ export default class AdaApi { ): Promise => { try { const apiResponse = await getCurrencyRate(currency); - const response: GetCurrencyRateResponse = currencyConfig.responses.rate( - apiResponse - ); + const response: GetCurrencyRateResponse = + currencyConfig.responses.rate(apiResponse); logger.debug('AdaApi::getCurrencyRate success', { response, }); @@ -2244,9 +2243,8 @@ export default class AdaApi { logger.debug('AdaApi::getSmashSettings called'); try { - const { - pool_metadata_source: poolMetadataSource, - } = await getSmashSettings(this.config); + const { pool_metadata_source: poolMetadataSource } = + await getSmashSettings(this.config); logger.debug('AdaApi::getSmashSettings success', { poolMetadataSource, }); @@ -2271,12 +2269,8 @@ export default class AdaApi { return true; } - const { - health, - }: CheckSmashServerHealthApiResponse = await checkSmashServerHealth( - this.config, - url - ); + const { health }: CheckSmashServerHealthApiResponse = + await checkSmashServerHealth(this.config, url); const isValid = health === SMASH_SERVER_STATUSES.AVAILABLE; logger.debug('AdaApi::checkSmashServerIsValid success', { isValid, @@ -2497,12 +2491,10 @@ export default class AdaApi { }); try { - const response: TransferFundsCalculateFeeApiResponse = await transferFundsCalculateFee( - this.config, - { + const response: TransferFundsCalculateFeeApiResponse = + await transferFundsCalculateFee(this.config, { sourceWalletId, - } - ); + }); logger.debug('AdaApi::transferFundsCalculateFee success', { response, }); @@ -2712,9 +2704,8 @@ export default class AdaApi { logger.debug('AdaApi::getNetworkParameters called'); try { - const networkParameters: GetNetworkParametersApiResponse = await getNetworkParameters( - this.config - ); + const networkParameters: GetNetworkParametersApiResponse = + await getNetworkParameters(this.config); logger.debug('AdaApi::getNetworkParameters success', { networkParameters, }); diff --git a/source/renderer/app/api/utils/apiHelpers.spec.ts b/source/renderer/app/api/utils/apiHelpers.spec.ts index b9ad9e9353..e10fa6e1d3 100644 --- a/source/renderer/app/api/utils/apiHelpers.spec.ts +++ b/source/renderer/app/api/utils/apiHelpers.spec.ts @@ -1,5 +1,5 @@ -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './apiHelpers' or its correspon... Remove this comment to see the full error message import { throwErrorIfNotEnoughAdaToSupportTokens } from './apiHelpers'; +import ApiError from '../../domains/ApiError'; // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { @@ -61,7 +61,7 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { ).not.toThrow(); }); // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message - it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee"', () => { + it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee" and round to 2 minimum ada', () => { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error( 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.' @@ -69,14 +69,34 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'cannot_cover_fee'; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. - expect(() => - throwErrorIfNotEnoughAdaToSupportTokens(error, true) - ).toThrowError( - // @ts-ignore ts-migrate(2345) FIXME: Argument of type '{ additionalValues: { adaToRemai... Remove this comment to see the full error message - new Error({ - additionalValues: { - adaToRemain: 1, - }, + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrow( + expect.objectContaining({ + additionalValues: { adaToRemain: 2 }, + clause: true, + code: undefined, + defaultMessage: + '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', + forceSet: true, + id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', + isFinalError: false, + tempError: 'cannotLeaveWalletEmpty', + values: { adaToRemain: 2 }, + }) + ); + }); + + // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message + it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee" and round to 2 nearest whole value provided by error', () => { + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. + const error = new Error( + 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 2.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.' + ); + // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. + error.code = 'cannot_cover_fee'; + // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrow( + expect.objectContaining({ + additionalValues: { adaToRemain: 3 }, clause: true, code: undefined, defaultMessage: @@ -85,9 +105,7 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', isFinalError: false, tempError: 'cannotLeaveWalletEmpty', - values: { - adaToRemain: 1, - }, + values: { adaToRemain: 3 }, }) ); }); diff --git a/source/renderer/app/api/utils/apiHelpers.ts b/source/renderer/app/api/utils/apiHelpers.ts index d065b846cb..6e2048214d 100644 --- a/source/renderer/app/api/utils/apiHelpers.ts +++ b/source/renderer/app/api/utils/apiHelpers.ts @@ -39,9 +39,10 @@ export const throwErrorIfNotEnoughAdaToSupportTokens = ( adaToProceedRegex.test(error.message) ) { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Math'. - const adaToRemain = Math.ceil( + const roundedAda = Math.ceil( Number(error.message.replace(adaToProceedRegex, '$1')) ); + const adaToRemain = roundedAda > 2 ? roundedAda : 2; throw new ApiError() .set('cannotLeaveWalletEmpty', true, { adaToRemain, diff --git a/source/renderer/app/stores/StakingStore.ts b/source/renderer/app/stores/StakingStore.ts index 87fd3b11c5..d80b506816 100644 --- a/source/renderer/app/stores/StakingStore.ts +++ b/source/renderer/app/stores/StakingStore.ts @@ -488,7 +488,9 @@ export default class StakingStore extends Store { try { const delegationFee: DelegationCalculateFeeResponse = await this.calculateDelegationFeeRequest.execute( - { ...delegationFeeRequest } + { + ...delegationFeeRequest, + } ).promise; if (this._delegationFeeCalculationWalletId !== walletId) { diff --git a/yarn.lock b/yarn.lock index 4b5c21cfa8..3520869cf7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3682,6 +3682,10 @@ version "1.0.0" resolved "https://registry.yarnpkg.com/@types/is-function/-/is-function-1.0.0.tgz#1b0b819b1636c7baf0d6785d030d12edf70c3e83" +"@types/istanbul-lib-coverage@*": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" + "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" From 81a0af9e94e501359933d416230abc4fe5266b32 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Wed, 9 Feb 2022 10:00:53 +0000 Subject: [PATCH 25/42] [DDW-827] updated prettier formatting --- source/main/ipc/downloadManagerChannel.ts | 2 +- source/renderer/app/api/api.ts | 39 ++++++++++++++--------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/source/main/ipc/downloadManagerChannel.ts b/source/main/ipc/downloadManagerChannel.ts index dac186fd71..95ab0aa7c5 100644 --- a/source/main/ipc/downloadManagerChannel.ts +++ b/source/main/ipc/downloadManagerChannel.ts @@ -211,8 +211,8 @@ const getDownloadLocalData = async ({ const getDownloadsLocalData = async (): Promise< DownloadsLocalDataMainResponse - // @ts-ignore ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'Download... Remove this comment to see the full error message > => localStorage.getAll(); +// @ts-ignore ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'Download... Remove this comment to see the full error message const clearDownloadLocalData = async ({ fileName, diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index f1a2adcbbe..2fd73b8de7 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -677,8 +677,7 @@ export default class AdaApi { assets: response, }); // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. - const assetsLocaldata = - await global.daedalus.api.localStorage.getAssetsLocalData(); + const assetsLocaldata = await global.daedalus.api.localStorage.getAssetsLocalData(); logger.debug('AdaApi::getAssetsLocalData success', { assetsLocaldata, }); @@ -1703,8 +1702,9 @@ export default class AdaApi { getCurrencyList = async (): Promise => { try { const apiResponse = await getCurrencyList(); - const response: GetCurrencyListResponse = - currencyConfig.responses.list(apiResponse); + const response: GetCurrencyListResponse = currencyConfig.responses.list( + apiResponse + ); logger.debug('AdaApi::getCurrencyList success', { response, }); @@ -1722,8 +1722,9 @@ export default class AdaApi { ): Promise => { try { const apiResponse = await getCurrencyRate(currency); - const response: GetCurrencyRateResponse = - currencyConfig.responses.rate(apiResponse); + const response: GetCurrencyRateResponse = currencyConfig.responses.rate( + apiResponse + ); logger.debug('AdaApi::getCurrencyRate success', { response, }); @@ -2243,8 +2244,9 @@ export default class AdaApi { logger.debug('AdaApi::getSmashSettings called'); try { - const { pool_metadata_source: poolMetadataSource } = - await getSmashSettings(this.config); + const { + pool_metadata_source: poolMetadataSource, + } = await getSmashSettings(this.config); logger.debug('AdaApi::getSmashSettings success', { poolMetadataSource, }); @@ -2269,8 +2271,12 @@ export default class AdaApi { return true; } - const { health }: CheckSmashServerHealthApiResponse = - await checkSmashServerHealth(this.config, url); + const { + health, + }: CheckSmashServerHealthApiResponse = await checkSmashServerHealth( + this.config, + url + ); const isValid = health === SMASH_SERVER_STATUSES.AVAILABLE; logger.debug('AdaApi::checkSmashServerIsValid success', { isValid, @@ -2491,10 +2497,12 @@ export default class AdaApi { }); try { - const response: TransferFundsCalculateFeeApiResponse = - await transferFundsCalculateFee(this.config, { + const response: TransferFundsCalculateFeeApiResponse = await transferFundsCalculateFee( + this.config, + { sourceWalletId, - }); + } + ); logger.debug('AdaApi::transferFundsCalculateFee success', { response, }); @@ -2704,8 +2712,9 @@ export default class AdaApi { logger.debug('AdaApi::getNetworkParameters called'); try { - const networkParameters: GetNetworkParametersApiResponse = - await getNetworkParameters(this.config); + const networkParameters: GetNetworkParametersApiResponse = await getNetworkParameters( + this.config + ); logger.debug('AdaApi::getNetworkParameters success', { networkParameters, }); From b590c6bbc4d16f5e20b16c4bfc23e17de22f7fbc Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Wed, 9 Feb 2022 10:08:39 +0000 Subject: [PATCH 26/42] [DDW-827] update ts-ignore messsage location --- source/main/ipc/downloadManagerChannel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/main/ipc/downloadManagerChannel.ts b/source/main/ipc/downloadManagerChannel.ts index 95ab0aa7c5..dac186fd71 100644 --- a/source/main/ipc/downloadManagerChannel.ts +++ b/source/main/ipc/downloadManagerChannel.ts @@ -211,8 +211,8 @@ const getDownloadLocalData = async ({ const getDownloadsLocalData = async (): Promise< DownloadsLocalDataMainResponse + // @ts-ignore ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'Download... Remove this comment to see the full error message > => localStorage.getAll(); -// @ts-ignore ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'Download... Remove this comment to see the full error message const clearDownloadLocalData = async ({ fileName, From 00f0fb8b5c8cd7ac9f08901efe465856f8daf349 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Wed, 9 Feb 2022 10:13:15 +0000 Subject: [PATCH 27/42] [DDW-827] Update message locations --- .../app/i18n/locales/defaultMessages.json | 316 +++++++++--------- 1 file changed, 158 insertions(+), 158 deletions(-) diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index 9c8a331eaa..7de641c383 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -6419,13 +6419,13 @@ "description": "All wallets item of dropdown.", "end": { "column": 3, - "line": 44 + "line": 43 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingAllWallets", "start": { "column": 21, - "line": 40 + "line": 39 } }, { @@ -6433,13 +6433,13 @@ "description": "All wallets description after dropdown.", "end": { "column": 3, - "line": 49 + "line": 48 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingAllWalletsEnd", "start": { "column": 24, - "line": 45 + "line": 44 } }, { @@ -6447,13 +6447,13 @@ "description": "All wallets description before dropdown.", "end": { "column": 3, - "line": 55 + "line": 54 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingAllWalletsStart", "start": { "column": 26, - "line": 50 + "line": 49 } }, { @@ -6461,13 +6461,13 @@ "description": "Ranking description.", "end": { "column": 3, - "line": 61 + "line": 60 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingDescription", "start": { "column": 22, - "line": 56 + "line": 55 } }, { @@ -6475,13 +6475,13 @@ "description": "Ranking learn more url.", "end": { "column": 3, - "line": 66 + "line": 65 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingLearnMoreUrl", "start": { "column": 23, - "line": 62 + "line": 61 } }, { @@ -6489,13 +6489,13 @@ "description": "One wallet description after dropdown.", "end": { "column": 3, - "line": 71 + "line": 70 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingOneWalletEnd", "start": { "column": 23, - "line": 67 + "line": 66 } }, { @@ -6503,13 +6503,13 @@ "description": "One wallet description before dropdown.", "end": { "column": 3, - "line": 77 + "line": 76 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingOneWalletStart", "start": { "column": 25, - "line": 72 + "line": 71 } }, { @@ -6517,13 +6517,13 @@ "description": "Select wallet item of dropdown.", "end": { "column": 3, - "line": 82 + "line": 81 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingSelectWallet", "start": { "column": 23, - "line": 78 + "line": 77 } }, { @@ -6531,13 +6531,13 @@ "description": "Select wallet description after dropdown.", "end": { "column": 3, - "line": 87 + "line": 86 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingSelectWalletEnd", "start": { "column": 26, - "line": 83 + "line": 82 } }, { @@ -6545,13 +6545,13 @@ "description": "Select wallet description before dropdown.", "end": { "column": 3, - "line": 92 + "line": 91 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingSelectWalletStart", "start": { "column": 28, - "line": 88 + "line": 87 } }, { @@ -6559,13 +6559,13 @@ "description": "Circulating supply slider tooltip.", "end": { "column": 3, - "line": 97 + "line": 96 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingExtraTooltip", "start": { "column": 23, - "line": 93 + "line": 92 } }, { @@ -6573,13 +6573,13 @@ "description": "Saturation point slider tooltip.", "end": { "column": 3, - "line": 102 + "line": 101 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingMaxTooltip", "start": { "column": 21, - "line": 98 + "line": 97 } }, { @@ -6587,13 +6587,13 @@ "description": "Minimum ADA required for staking slider tooltip.", "end": { "column": 3, - "line": 107 + "line": 106 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.rankingMinTooltip", "start": { "column": 21, - "line": 103 + "line": 102 } }, { @@ -6601,13 +6601,13 @@ "description": "Learn more action of ranking panel.", "end": { "column": 3, - "line": 112 + "line": 111 }, "file": "source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx", "id": "staking.stakePools.learnMore", "start": { "column": 19, - "line": 108 + "line": 107 } } ], @@ -8991,13 +8991,13 @@ "description": "Description on the voting registration \"enter pin code\" step.", "end": { "column": 3, - "line": 27 + "line": 26 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.description", "start": { "column": 15, - "line": 21 + "line": 20 } }, { @@ -9005,13 +9005,13 @@ "description": "Reminder on the voting registration \"enter pin code\" step.", "end": { "column": 3, - "line": 33 + "line": 32 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.reminder", "start": { "column": 12, - "line": 28 + "line": 27 } }, { @@ -9019,13 +9019,13 @@ "description": "Label for pin code input on the voting registration \"enter pin code\" step.", "end": { "column": 3, - "line": 39 + "line": 38 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.enterPinCodeLabel", "start": { "column": 21, - "line": 34 + "line": 33 } }, { @@ -9033,13 +9033,13 @@ "description": "Label for repeat pin code on the voting registration \"enter pin code\" step.", "end": { "column": 3, - "line": 45 + "line": 44 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.repeatPinCodeLabel", "start": { "column": 22, - "line": 40 + "line": 39 } }, { @@ -9047,13 +9047,13 @@ "description": "Error message shown when repeat pin code is invalid.", "end": { "column": 3, - "line": 50 + "line": 49 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.errors.invalidPinCode", "start": { "column": 18, - "line": 46 + "line": 45 } }, { @@ -9061,13 +9061,13 @@ "description": "Error message shown when repeat pin code is invalid.", "end": { "column": 3, - "line": 56 + "line": 55 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.errors.invalidRepeatPinCode", "start": { "column": 24, - "line": 51 + "line": 50 } }, { @@ -9075,13 +9075,13 @@ "description": "Label for continue button on the voting registration \"enter pin code\" step.", "end": { "column": 3, - "line": 62 + "line": 61 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.continueButtonLabel", "start": { "column": 23, - "line": 57 + "line": 56 } } ], @@ -9638,13 +9638,13 @@ "description": "Instructions for verifying wallet recovery phrase on dialog for entering wallet recovery phrase.", "end": { "column": 3, - "line": 35 + "line": 34 }, "file": "source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx", "id": "wallet.backup.recovery.phrase.entry.dialog.verification.instructions", "start": { "column": 28, - "line": 29 + "line": 28 } }, { @@ -9652,13 +9652,13 @@ "description": "Label for the recovery phrase input on dialog for entering wallet recovery phrase.", "end": { "column": 3, - "line": 41 + "line": 40 }, "file": "source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx", "id": "wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputLabel", "start": { "column": 28, - "line": 36 + "line": 35 } }, { @@ -9666,13 +9666,13 @@ "description": "Placeholder hint for the mnemonics autocomplete.", "end": { "column": 3, - "line": 46 + "line": 45 }, "file": "source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx", "id": "wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputHint", "start": { "column": 27, - "line": 42 + "line": 41 } }, { @@ -9680,13 +9680,13 @@ "description": "Placeholder for the mnemonics autocomplete.", "end": { "column": 3, - "line": 52 + "line": 51 }, "file": "source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx", "id": "wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputPlaceholder", "start": { "column": 34, - "line": 47 + "line": 46 } }, { @@ -9694,13 +9694,13 @@ "description": "\"No results\" message for the recovery phrase input search results.", "end": { "column": 3, - "line": 59 + "line": 58 }, "file": "source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx", "id": "wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputNoResults", "start": { "column": 27, - "line": 53 + "line": 52 } }, { @@ -9708,13 +9708,13 @@ "description": "Error message shown when invalid recovery phrase was entered.", "end": { "column": 3, - "line": 66 + "line": 65 }, "file": "source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx", "id": "wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInvalidMnemonics", "start": { "column": 34, - "line": 60 + "line": 59 } }, { @@ -9722,13 +9722,13 @@ "description": "Label for button \"Confirm\" on wallet backup dialog", "end": { "column": 3, - "line": 71 + "line": 70 }, "file": "source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx", "id": "wallet.recovery.phrase.show.entry.dialog.button.labelConfirm", "start": { "column": 22, - "line": 67 + "line": 66 } }, { @@ -9736,13 +9736,13 @@ "description": "Term on wallet creation to store recovery phrase offline", "end": { "column": 3, - "line": 78 + "line": 77 }, "file": "source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx", "id": "wallet.backup.recovery.phrase.entry.dialog.terms.and.condition.offline", "start": { "column": 15, - "line": 72 + "line": 71 } }, { @@ -9750,13 +9750,13 @@ "description": "Term and condition on wallet backup dialog describing that wallet can only be recovered with a security phrase", "end": { "column": 3, - "line": 86 + "line": 85 }, "file": "source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx", "id": "wallet.backup.recovery.phrase.entry.dialog.terms.and.condition.recovery", "start": { "column": 16, - "line": 79 + "line": 78 } } ], @@ -10476,13 +10476,13 @@ "description": "Headline for the \"Paper wallet create certificate verification dialog\".", "end": { "column": 3, - "line": 31 + "line": 30 }, "file": "source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx", "id": "paper.wallet.create.certificate.verification.dialog.headline", "start": { "column": 12, - "line": 26 + "line": 25 } }, { @@ -10490,13 +10490,13 @@ "description": "\"Paper wallet create certificate verification dialog\" subtitle.", "end": { "column": 3, - "line": 38 + "line": 37 }, "file": "source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx", "id": "paper.wallet.create.certificate.verification.dialog.subtitle", "start": { "column": 12, - "line": 32 + "line": 31 } }, { @@ -10504,13 +10504,13 @@ "description": "\"Paper wallet create certificate verification dialog\" subtitle.", "end": { "column": 3, - "line": 45 + "line": 44 }, "file": "source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx", "id": "paper.wallet.create.certificate.verification.dialog.instructions", "start": { "column": 16, - "line": 39 + "line": 38 } }, { @@ -10518,13 +10518,13 @@ "description": "\"Paper wallet create certificate verification dialog\" recovery phrase label.", "end": { "column": 3, - "line": 52 + "line": 51 }, "file": "source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx", "id": "paper.wallet.create.certificate.verification.dialog.recoveryPhrase.label", "start": { "column": 23, - "line": 46 + "line": 45 } }, { @@ -10532,13 +10532,13 @@ "description": "\"Paper wallet create certificate verification dialog\" recovery phrase hint.", "end": { "column": 3, - "line": 59 + "line": 58 }, "file": "source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx", "id": "paper.wallet.create.certificate.verification.dialog.recoveryPhrase.hint", "start": { "column": 22, - "line": 53 + "line": 52 } }, { @@ -10546,13 +10546,13 @@ "description": "\"Paper wallet create certificate verification dialog\" recovery phrase no results label.", "end": { "column": 3, - "line": 66 + "line": 65 }, "file": "source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx", "id": "paper.wallet.create.certificate.verification.dialog.recoveryPhrase.noResults", "start": { "column": 27, - "line": 60 + "line": 59 } }, { @@ -10560,13 +10560,13 @@ "description": "\"Paper wallet create certificate verification dialog\" button clear label.", "end": { "column": 3, - "line": 72 + "line": 71 }, "file": "source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx", "id": "paper.wallet.create.certificate.verification.dialog.button.clearLabel", "start": { "column": 20, - "line": 67 + "line": 66 } }, { @@ -10574,13 +10574,13 @@ "description": "\"Paper wallet create certificate verification dialog\" storing understandance confirmation.", "end": { "column": 3, - "line": 80 + "line": 79 }, "file": "source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx", "id": "paper.wallet.create.certificate.verification.dialog.storingUnderstandanceConfirmationLabel", "start": { "column": 30, - "line": 73 + "line": 72 } }, { @@ -10588,13 +10588,13 @@ "description": "\"Paper wallet create certificate verification dialog\" recovering understandance confirmation.", "end": { "column": 3, - "line": 88 + "line": 87 }, "file": "source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx", "id": "paper.wallet.create.certificate.verification.dialog.recoveringUnderstandanceConfirmationLabel", "start": { "column": 33, - "line": 81 + "line": 80 } } ], @@ -10696,13 +10696,13 @@ "description": "placeholder on the wallet \"Share Address\" dialog", "end": { "column": 3, - "line": 38 + "line": 36 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.inputLabel", "start": { "column": 14, - "line": 34 + "line": 32 } }, { @@ -10710,13 +10710,13 @@ "description": "inputPlaceholder on the wallet \"Share Address\" dialog", "end": { "column": 3, - "line": 43 + "line": 41 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.inputPlaceholder", "start": { "column": 20, - "line": 39 + "line": 37 } }, { @@ -10724,13 +10724,13 @@ "description": "saveQRCodeImage on the wallet \"Share Address\" dialog", "end": { "column": 3, - "line": 48 + "line": 46 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.saveQRCodeImage", "start": { "column": 19, - "line": 44 + "line": 42 } }, { @@ -10738,13 +10738,13 @@ "description": "downloadPDFButton on the wallet \"Share Address\" dialog", "end": { "column": 3, - "line": 53 + "line": 51 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.downloadPDFButton", "start": { "column": 21, - "line": 49 + "line": 47 } }, { @@ -10752,13 +10752,13 @@ "description": "dialogTitle on the wallet \"Share Address\" dialog", "end": { "column": 3, - "line": 58 + "line": 56 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.dialogTitle", "start": { "column": 15, - "line": 54 + "line": 52 } }, { @@ -10766,13 +10766,13 @@ "description": "Label for \"Copy address\" link on the wallet \"Receive page\"", "end": { "column": 3, - "line": 63 + "line": 61 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.copyAddressLabel", "start": { "column": 20, - "line": 59 + "line": 57 } }, { @@ -10780,13 +10780,13 @@ "description": "Tooltip for the receiving address path", "end": { "column": 3, - "line": 68 + "line": 66 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.spendingPathTooltip", "start": { "column": 23, - "line": 64 + "line": 62 } }, { @@ -10794,13 +10794,13 @@ "description": "Tooltip for the rewards address path", "end": { "column": 3, - "line": 73 + "line": 71 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.stakingPathTooltip", "start": { "column": 22, - "line": 69 + "line": 67 } }, { @@ -10808,13 +10808,13 @@ "description": "Support request button label", "end": { "column": 3, - "line": 78 + "line": 76 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.supportRequestButtonLabel", "start": { "column": 29, - "line": 74 + "line": 72 } }, { @@ -10822,13 +10822,13 @@ "description": "Support request link URL", "end": { "column": 3, - "line": 83 + "line": 81 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.supportRequestLinkUrl", "start": { "column": 25, - "line": 79 + "line": 77 } }, { @@ -10836,13 +10836,13 @@ "description": "Invalid address confirmation checkbox label", "end": { "column": 3, - "line": 89 + "line": 87 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.invalidAddressConfirmationLabel", "start": { "column": 35, - "line": 84 + "line": 82 } }, { @@ -10850,13 +10850,13 @@ "description": "Verification options section label", "end": { "column": 3, - "line": 94 + "line": 92 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.verificationCheckOptionsLabel", "start": { "column": 33, - "line": 90 + "line": 88 } }, { @@ -10864,13 +10864,13 @@ "description": "Verification option \"Valid\" label", "end": { "column": 3, - "line": 99 + "line": 97 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.verificationCheckOptionValid", "start": { "column": 32, - "line": 95 + "line": 93 } }, { @@ -10878,13 +10878,13 @@ "description": "Verification option \"Invalid\" label", "end": { "column": 3, - "line": 105 + "line": 103 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.verificationCheckOptionInvalid", "start": { "column": 34, - "line": 100 + "line": 98 } }, { @@ -10892,13 +10892,13 @@ "description": "Verification option \"Reverify\" label", "end": { "column": 3, - "line": 110 + "line": 108 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.verificationCheckOptionReverify", "start": { "column": 35, - "line": 106 + "line": 104 } }, { @@ -10906,13 +10906,13 @@ "description": "Daedalus verification status check label", "end": { "column": 3, - "line": 115 + "line": 113 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.softwareCheckLabel", "start": { "column": 22, - "line": 111 + "line": 109 } }, { @@ -10920,13 +10920,13 @@ "description": "User verification status check label", "end": { "column": 3, - "line": 120 + "line": 118 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.confirmationCheckLabel", "start": { "column": 26, - "line": 116 + "line": 114 } }, { @@ -10934,13 +10934,13 @@ "description": "Address verification instructions", "end": { "column": 3, - "line": 126 + "line": 124 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.addressVerificationInstructions", "start": { "column": 35, - "line": 121 + "line": 119 } }, { @@ -10948,13 +10948,13 @@ "description": "Invalid address \"Warning\" title", "end": { "column": 3, - "line": 131 + "line": 129 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.invalidAddressWarningTitle", "start": { "column": 30, - "line": 127 + "line": 125 } }, { @@ -10962,13 +10962,13 @@ "description": "Invalid address \"Warning\" description", "end": { "column": 3, - "line": 137 + "line": 135 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx", "id": "wallet.receive.dialog.invalidAddressWarningDescription", "start": { "column": 36, - "line": 132 + "line": 130 } } ], @@ -10981,13 +10981,13 @@ "description": "Label for wallet address on the wallet \"Receive page\"", "end": { "column": 3, - "line": 32 + "line": 30 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveRandom.tsx", "id": "wallet.receive.page.walletAddressLabel", "start": { "column": 22, - "line": 28 + "line": 26 } }, { @@ -10995,13 +10995,13 @@ "description": "Wallet receive payments instructions on the wallet \"Receive page\"", "end": { "column": 3, - "line": 39 + "line": 37 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveRandom.tsx", "id": "wallet.receive.page.walletReceiveInstructions", "start": { "column": 29, - "line": 33 + "line": 31 } }, { @@ -11009,13 +11009,13 @@ "description": "Label for \"Generate new address\" button on the wallet \"Receive page\"", "end": { "column": 3, - "line": 45 + "line": 43 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveRandom.tsx", "id": "wallet.receive.page.generateNewAddressButtonLabel", "start": { "column": 33, - "line": 40 + "line": 38 } }, { @@ -11023,13 +11023,13 @@ "description": "\"Generated addresses\" section title on the wallet \"Receive page\"", "end": { "column": 3, - "line": 51 + "line": 49 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveRandom.tsx", "id": "wallet.receive.page.receivingAddressesSectionTitle", "start": { "column": 34, - "line": 46 + "line": 44 } }, { @@ -11037,13 +11037,13 @@ "description": "Label for \"show used\" wallet addresses link on the wallet \"Receive page\"", "end": { "column": 3, - "line": 57 + "line": 55 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveRandom.tsx", "id": "wallet.receive.page.showUsedLabel", "start": { "column": 17, - "line": 52 + "line": 50 } }, { @@ -11051,13 +11051,13 @@ "description": "Placeholder for \"spending password\" on the wallet \"Receive page\"", "end": { "column": 3, - "line": 63 + "line": 61 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveRandom.tsx", "id": "wallet.receive.page.spendingPasswordPlaceholder", "start": { "column": 31, - "line": 58 + "line": 56 } }, { @@ -11065,13 +11065,13 @@ "description": "Label for \"Copy address\" link on the wallet \"Receive page\"", "end": { "column": 3, - "line": 68 + "line": 66 }, "file": "source/renderer/app/components/wallet/receive/WalletReceiveRandom.tsx", "id": "wallet.receive.page.copyAddressLabel", "start": { "column": 20, - "line": 64 + "line": 62 } } ], @@ -12292,13 +12292,13 @@ "description": "Title for the \"Undelegate wallet\" dialog.", "end": { "column": 3, - "line": 31 + "line": 30 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.title", "start": { "column": 9, - "line": 27 + "line": 26 } }, { @@ -12306,13 +12306,13 @@ "description": "Label for the \"Undelegate\" button in the undelegate wallet dialog.", "end": { "column": 3, - "line": 37 + "line": 36 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.confirmButtonLabel", "start": { "column": 22, - "line": 32 + "line": 31 } }, { @@ -12320,13 +12320,13 @@ "description": "Description of current delegation of wallet in the \"Undelegate wallet\" dialog.", "end": { "column": 3, - "line": 44 + "line": 43 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.descriptionWithTicker", "start": { "column": 25, - "line": 38 + "line": 37 } }, { @@ -12334,13 +12334,13 @@ "description": "Description of current delegation of wallet in the \"Undelegate wallet\" dialog.", "end": { "column": 3, - "line": 51 + "line": 50 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.descriptionWithUnknownTicker", "start": { "column": 32, - "line": 45 + "line": 44 } }, { @@ -12348,13 +12348,13 @@ "description": "unknown stake pool label in the \"Undelegate wallet\" dialog.", "end": { "column": 3, - "line": 56 + "line": 55 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.unknownStakePoolLabel", "start": { "column": 25, - "line": 52 + "line": 51 } }, { @@ -12362,13 +12362,13 @@ "description": "Notice to confirm if the user understands unsupporting Cardano network after undelegation", "end": { "column": 3, - "line": 63 + "line": 62 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.confirmUnsupportNotice", "start": { "column": 26, - "line": 57 + "line": 56 } }, { @@ -12376,13 +12376,13 @@ "description": "Notice to confirm if the user understands non-earning rewards after undelegation", "end": { "column": 3, - "line": 70 + "line": 69 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.confirmIneligibleNotice", "start": { "column": 27, - "line": 64 + "line": 63 } }, { @@ -12390,13 +12390,13 @@ "description": "Fees label in the \"Undelegate wallet\" dialog.", "end": { "column": 3, - "line": 75 + "line": 74 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.feesLabel", "start": { "column": 13, - "line": 71 + "line": 70 } }, { @@ -12404,13 +12404,13 @@ "description": "Deposits reclaimed label in the \"Undelegate wallet\" dialog.", "end": { "column": 3, - "line": 80 + "line": 79 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.depositLabel", "start": { "column": 16, - "line": 76 + "line": 75 } }, { @@ -12418,13 +12418,13 @@ "description": "Spending password label in the \"Undelegate wallet\" dialog.", "end": { "column": 3, - "line": 85 + "line": 84 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.spendingPasswordLabel", "start": { "column": 25, - "line": 81 + "line": 80 } }, { @@ -12432,13 +12432,13 @@ "description": "Spending password placeholder in the \"Undelegate wallet\" dialog.", "end": { "column": 3, - "line": 91 + "line": 90 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.spendingPasswordPlaceholder", "start": { "column": 31, - "line": 86 + "line": 85 } }, { @@ -12446,13 +12446,13 @@ "description": "Label for password error in the \"Undelegate wallet\" dialog.", "end": { "column": 3, - "line": 96 + "line": 95 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.passwordError", "start": { "column": 24, - "line": 92 + "line": 91 } }, { @@ -12460,13 +12460,13 @@ "description": "\"Calculating fees\" message in the \"Undelegate wallet\" dialog.", "end": { "column": 3, - "line": 102 + "line": 101 }, "file": "source/renderer/app/components/wallet/settings/UndelegateWalletConfirmationDialog.tsx", "id": "wallet.settings.undelegate.dialog.calculatingFees", "start": { "column": 19, - "line": 97 + "line": 96 } } ], From c78c937c619b72721ab9bed0eeb18c6a602717ee Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Wed, 9 Feb 2022 10:18:10 +0000 Subject: [PATCH 28/42] [DDW-827] fixed lockfile --- yarn.lock | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6dff08f822..adff8b0799 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2553,7 +2553,6 @@ dependencies: "@storybook/client-logger" "5.3.14" "@storybook/theming" "5.3.14" - "@types/react-syntax-highlighter" "11.0.2" "@types/react-textarea-autosize" "^4.3.3" core-js "^3.0.1" global "^4.3.2" @@ -2667,7 +2666,6 @@ version "5.3.14" resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.3.14.tgz#5e4e02585b37754bbebb8810ffb17c8ce706a1f8" dependencies: - "@types/npmlog" "^4.1.2" chalk "^3.0.0" core-js "^3.0.1" npmlog "^4.1.2" @@ -2890,7 +2888,6 @@ dependencies: "@babel/code-frame" "^7.10.4" "@babel/runtime" "^7.12.5" - "@types/aria-query" "^4.2.0" aria-query "^5.0.0" chalk "^4.1.0" dom-accessibility-api "^0.5.9" @@ -3075,7 +3072,7 @@ version "3.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" dependencies: - "@types/istanbul-lib-report" "*" + "@types/jest@*": version "27.0.3" @@ -3190,7 +3187,6 @@ resolved "https://registry.yarnpkg.com/@types/react-color/-/react-color-3.0.4.tgz#c63daf012ad067ac0127bdd86725f079d02082bd" dependencies: "@types/react" "*" - "@types/reactcss" "*" "@types/react-svg-inline@^2.1.3": version "2.1.3" @@ -3270,7 +3266,6 @@ "@types/anymatch" "*" "@types/node" "*" "@types/tapable" "*" - "@types/uglify-js" "*" "@types/webpack-sources" "*" source-map "^0.6.0" @@ -6109,7 +6104,6 @@ cosmiconfig@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982" dependencies: - "@types/parse-json" "^4.0.0" import-fresh "^3.1.0" parse-json "^5.0.0" path-type "^4.0.0" @@ -6119,7 +6113,6 @@ cosmiconfig@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3" dependencies: - "@types/parse-json" "^4.0.0" import-fresh "^3.2.1" parse-json "^5.0.0" path-type "^4.0.0" @@ -9484,7 +9477,6 @@ html-webpack-plugin@^4.0.0-beta.2: version "4.5.0" resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.5.0.tgz#625097650886b97ea5dae331c320e3238f6c121c" dependencies: - "@types/html-minifier-terser" "^5.0.0" "@types/tapable" "^1.0.5" "@types/webpack" "^4.41.8" html-minifier-terser "^5.0.1" @@ -11711,7 +11703,6 @@ meow@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/meow/-/meow-7.1.1.tgz#7c01595e3d337fcb0ec4e8eed1666ea95903d306" dependencies: - "@types/minimist" "^1.2.0" camelcase-keys "^6.2.2" decamelize-keys "^1.1.0" hard-rejection "^2.1.0" From c12f1591787cc3671daaf38c2cd1f722759e6547 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Wed, 9 Feb 2022 20:04:25 +0000 Subject: [PATCH 29/42] [DDW-827] updated ts-ignore statement location --- source/main/ipc/downloadManagerChannel.ts | 39 ++++++++--------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/source/main/ipc/downloadManagerChannel.ts b/source/main/ipc/downloadManagerChannel.ts index dac186fd71..aba083db40 100644 --- a/source/main/ipc/downloadManagerChannel.ts +++ b/source/main/ipc/downloadManagerChannel.ts @@ -183,9 +183,7 @@ const requestResumeDownload = async ( const deleteDownloadedFile = async ({ id, -}: DeleteDownloadedFileRendererRequest): Promise< - DeleteDownloadedFileMainResponse -> => { +}: DeleteDownloadedFileRendererRequest): Promise => { const downloadLocalData = await getDownloadLocalData({ id, }); @@ -201,25 +199,22 @@ const deleteDownloadedFile = async ({ const getDownloadLocalData = async ({ fileName, id = fileName, -}: DownloadLocalDataRendererRequest): Promise< - DownloadLocalDataMainResponse -> => { +}: DownloadLocalDataRendererRequest): Promise => { if (!id) throw new Error('Requires `id` or `fileName`'); const downloadId: string = getIdFromFileName(String(id)); return localStorage.get(downloadId); }; -const getDownloadsLocalData = async (): Promise< - DownloadsLocalDataMainResponse - // @ts-ignore ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'Download... Remove this comment to see the full error message -> => localStorage.getAll(); +const getDownloadsLocalData = + async (): Promise => { + // @ts-ignore ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'Download... Remove this comment to see the full error message + return localStorage.getAll(); + }; const clearDownloadLocalData = async ({ fileName, id = fileName, -}: ClearDownloadLocalDataRendererRequest): Promise< - ClearDownloadLocalDataMainResponse -> => { +}: ClearDownloadLocalDataRendererRequest): Promise => { if (!id) throw new Error('Requires `id` or `fileName`'); const downloadId: string = getIdFromFileName(String(id)); return localStorage.unset(downloadId); @@ -242,15 +237,11 @@ const checkFileExists = async ({ }; const requestDownloadChannel: // IpcChannel -MainIpcChannel< - DownloadRendererRequest, - DownloadMainResponse -> = new MainIpcChannel(REQUEST_DOWNLOAD); +MainIpcChannel = + new MainIpcChannel(REQUEST_DOWNLOAD); const requestResumeDownloadChannel: // IpcChannel -MainIpcChannel< - ResumeDownloadRendererRequest, - ResumeDownloadMainResponse -> = new MainIpcChannel(RESUME_DOWNLOAD); +MainIpcChannel = + new MainIpcChannel(RESUME_DOWNLOAD); const deleteDownloadedFileChannel: // IpcChannel MainIpcChannel< DeleteDownloadedFileRendererRequest, @@ -272,10 +263,8 @@ MainIpcChannel< ClearDownloadLocalDataMainResponse > = new MainIpcChannel(CLEAR_DOWNLOAD_LOCAL_DATA); const checkFileExistsChannel: // IpcChannel -MainIpcChannel< - CheckFileExistsRendererRequest, - CheckFileExistsMainResponse -> = new MainIpcChannel(CHECK_FILE_EXISTS); +MainIpcChannel = + new MainIpcChannel(CHECK_FILE_EXISTS); export const downloadManagerChannel = (window: BrowserWindow) => { requestDownloadChannel.onRequest( (downloadRequestPayload: DownloadRendererRequest) => From f822a0376790ce8558cb92469a3958bac4b63d02 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Wed, 9 Feb 2022 20:05:15 +0000 Subject: [PATCH 30/42] [DDW-827] formatted files with prettier --- source/common/ipc/api.ts | 27 ++-- source/common/types/hardware-wallets.types.ts | 10 +- source/common/utils/files.ts | 16 +- .../main/cardano/CardanoSelfnodeLauncher.ts | 8 +- source/main/cardano/utils.ts | 9 +- source/main/config.ts | 5 +- source/main/ipc/generateCsvChannel.ts | 6 +- source/main/ipc/generateFileMetaChannel.ts | 6 +- source/main/ipc/getHardwareWalletChannel.ts | 7 +- source/main/ipc/manageAppUpdateChannel.ts | 6 +- source/main/ipc/rebuild-application-menu.ts | 6 +- source/main/ipc/saveQRCodeImageChannel.ts | 6 +- source/main/ipc/show-file-dialog-channels.ts | 12 +- source/main/utils/getContentMinimumSize.ts | 6 +- source/main/utils/logging.ts | 17 +-- source/main/utils/setupLogging.ts | 9 +- source/renderer/app/api/api.ts | 39 ++--- .../assets/AssetTransactionConfirmation.tsx | 6 +- .../dapp/DappTransactionRequest.tsx | 10 +- .../ToggleRTSFlagsDialog.tsx | 3 +- .../app/components/layout/SidebarLayout.tsx | 9 +- .../no-disk-space-error/NoDiskSpaceError.tsx | 7 +- .../SyncingConnectingStatus.tsx | 6 +- .../profile/terms-of-use/TermsOfUseForm.tsx | 8 +- .../sidebar/wallets/SidebarWalletsMenu.tsx | 6 +- .../staking/countdown/StakingCountdown.tsx | 7 +- .../staking/delegation-center/WalletRow.tsx | 9 +- ...tionStepsChooseStakePoolDialog.messages.ts | 33 ++--- .../DelegationStepsChooseWalletDialog.tsx | 12 +- ...egationStepsConfirmationDialog.messages.ts | 6 +- .../DelegationStepsNotAvailableDialog.tsx | 4 +- .../DelegationStepsSuccessDialog.tsx | 8 +- .../OversaturationText.tsx | 3 +- .../staking/epochs/StakingEpochsDataTable.tsx | 9 +- .../staking/info/StakingInfoCountdown.tsx | 7 +- .../staking/navigation/StakingNavigation.tsx | 8 +- .../staking/stake-pools/StakePoolsRanking.tsx | 7 +- .../components/staking/widgets/ThumbPool.tsx | 8 +- .../staking/widgets/ThumbPoolContent.tsx | 7 +- .../staking/widgets/ThumbSelectedPool.tsx | 7 +- .../components/status/DaedalusDiagnostics.tsx | 6 +- .../VotingRegistrationStepsChooseWallet.tsx | 6 +- .../VotingRegistrationStepsEnterPinCode.tsx | 3 +- .../widgets/ConfirmationDialog.tsx | 6 +- .../app/components/wallet/WalletSendForm.tsx | 7 +- .../WalletRecoveryPhraseDisplayDialog.tsx | 6 +- .../WalletRecoveryPhraseEntryDialog.tsx | 15 +- .../CompletionDialog.tsx | 8 +- .../InstructionsDialog.tsx | 40 ++--- .../paper-wallet-certificate/PrintDialog.tsx | 9 +- .../SecuringPasswordDialog.tsx | 3 +- .../VerificationDialog.tsx | 22 +-- .../wallet/receive/WalletReceiveDialog.tsx | 5 +- ...etSendAssetsConfirmationDialog.messages.ts | 6 +- .../WalletSendAssetsConfirmationDialog.tsx | 17 +-- .../WalletSendConfirmationDialog.tsx | 17 +-- .../wallet/settings/ICOPublicKeyBox.tsx | 9 +- .../wallet/settings/PublicKeyField.tsx | 7 +- ...WalletRecoveryPhraseVerificationWidget.tsx | 11 +- .../wallet/settings/WalletSettings.tsx | 7 +- .../WalletTokenPickerCheckbox.tsx | 8 +- .../wallet-tokens-list/WalletTokensList.tsx | 18 +-- .../wallet/transactions/Transaction.tsx | 13 +- .../transactions/WalletTransactions.tsx | 5 +- .../transactions/WalletTransactionsList.tsx | 9 +- .../metadata/MetadataValueView.tsx | 36 +++-- .../SimpleTransactionList.tsx | 18 ++- .../WalletSelectImportDialog.tsx | 4 +- .../wallet-restore/ConfigurationDialog.tsx | 3 +- .../wallet/wallet-restore/MnemonicsDialog.tsx | 6 +- .../wallet-restore/WalletTypeDialog.tsx | 18 +-- .../app/components/widgets/BorderedBox.tsx | 9 +- .../app/components/widgets/forms/PinCode.tsx | 12 +- source/renderer/app/config/currencyConfig.ts | 40 ++--- .../app/config/walletRestoreConfig.ts | 28 ++-- .../app/containers/TopBarContainer.tsx | 11 +- .../appUpdate/AppUpdateContainer.tsx | 7 +- .../app/containers/loading/LoadingPage.tsx | 7 +- .../loading/NoDiskSpaceErrorPage.tsx | 7 +- .../loading/SyncingConnectingPage.tsx | 9 +- .../loading/SystemTimeErrorPage.tsx | 6 +- .../app/containers/news/NewsFeedContainer.tsx | 7 +- .../notifications/NotificationsContainer.tsx | 16 +- .../profile/DataLayerMigrationPage.tsx | 5 +- .../categories/StakePoolsSettingsPage.tsx | 7 +- .../staking/RedeemItnRewardsContainer.tsx | 7 +- .../containers/staking/StakePoolsListPage.tsx | 10 +- .../app/containers/staking/Staking.tsx | 8 +- .../DelegationSetupWizardDialogContainer.tsx | 18 +-- .../Step1ConfigurationContainer.tsx | 13 +- .../Step3ResultContainer.tsx | 8 +- .../VotingRegistrationDialogContainer.tsx | 26 +--- .../containers/wallet/TransferFundsPage.tsx | 7 +- .../renderer/app/containers/wallet/Wallet.tsx | 7 +- .../containers/wallet/WalletReceivePage.tsx | 15 +- .../app/containers/wallet/WalletSendPage.tsx | 32 ++-- .../containers/wallet/WalletSummaryPage.tsx | 18 +-- .../containers/wallet/WalletTokensPage.tsx | 15 +- .../dialogs/WalletCreateDialogContainer.tsx | 12 +- .../dialogs/WalletRestoreDialogContainer.tsx | 6 +- .../InstructionsDialogContainer.tsx | 6 +- .../VerificationDialogContainer.tsx | 6 +- .../UndelegateWalletDialogContainer.tsx | 15 +- .../WalletSelectImportStepContainer.tsx | 7 +- .../StepConfigurationContainer.tsx | 13 +- source/renderer/app/ipc/cardano.ipc.ts | 12 +- .../app/ipc/downloadManagerChannel.ts | 12 +- source/renderer/app/ipc/generateCsvChannel.ts | 6 +- .../app/ipc/rebuild-application-menu.ts | 5 +- .../app/ipc/saveQRCodeImageChannel.ts | 6 +- .../app/ipc/show-file-dialog-channels.ts | 12 +- source/renderer/app/stores/AddressesStore.ts | 7 +- source/renderer/app/stores/AppUpdateStore.ts | 17 ++- .../app/stores/HardwareWalletsStore.ts | 66 ++++----- .../renderer/app/stores/NetworkStatusStore.ts | 21 ++- source/renderer/app/stores/ProfileStore.ts | 5 +- source/renderer/app/stores/SidebarStore.ts | 19 +-- source/renderer/app/stores/StakingStore.ts | 34 ++--- .../renderer/app/stores/TransactionsStore.ts | 11 +- .../app/stores/UiNotificationsStore.ts | 7 +- source/renderer/app/stores/VotingStore.ts | 29 ++-- .../app/stores/WalletMigrationStore.ts | 24 ++- .../app/stores/WalletSettingsStore.ts | 14 +- source/renderer/app/stores/WalletsStore.ts | 75 ++++------ source/renderer/app/stores/index.ts | 82 +++++----- source/renderer/app/types/sidebarTypes.ts | 12 +- source/renderer/app/utils/assets.ts | 98 ++++++------ .../renderer/app/utils/hardwareWalletUtils.ts | 10 +- source/renderer/app/utils/logging.ts | 27 ++-- storybook/stories/_support/utils.ts | 14 +- .../stories/news/_utils/fakeDataUpdate.ts | 9 +- .../import/WalletImportFile.stories.tsx | 6 +- .../transactions/TransactionsList.stories.tsx | 140 +++++++++--------- 133 files changed, 750 insertions(+), 1183 deletions(-) diff --git a/source/common/ipc/api.ts b/source/common/ipc/api.ts index 578626b2d1..e17002102a 100644 --- a/source/common/ipc/api.ts +++ b/source/common/ipc/api.ts @@ -315,7 +315,8 @@ export type ExportWalletsMainResponse = { */ export const GENERATE_WALLET_MIGRATION_REPORT_CHANNEL = 'GENERATE_WALLET_MIGRATION_REPORT_CHANNEL'; -export type GenerateWalletMigrationReportRendererRequest = WalletMigrationReportData; +export type GenerateWalletMigrationReportRendererRequest = + WalletMigrationReportData; export type GenerateWalletMigrationReportMainResponse = void; /** @@ -364,7 +365,8 @@ export type ResumeDownloadMainResponse = ResumeDownloadResponse | void; */ export const DELETE_DOWNLOADED_FILE = 'DELETE_DOWNLOADED_FILE'; export type DeleteDownloadedFileRendererRequest = DeleteDownloadedFileRequest; -export type DeleteDownloadedFileMainResponse = DeleteDownloadedFileResponse | void; +export type DeleteDownloadedFileMainResponse = + DeleteDownloadedFileResponse | void; /** * Channel for initiating the download manager @@ -377,14 +379,16 @@ export type DownloadLocalDataMainResponse = DownloadLocalDataResponse; * Channel for initiating the download manager */ export const GET_DOWNLOADS_LOCAL_DATA = 'GET_DOWNLOADS_LOCAL_DATA'; -export type DownloadsLocalDataRendererRequest = DownloadsLocalDataRequest | void; +export type DownloadsLocalDataRendererRequest = + DownloadsLocalDataRequest | void; export type DownloadsLocalDataMainResponse = DownloadsLocalDataResponse | void; /** * Channel for initiating the download manager */ export const CLEAR_DOWNLOAD_LOCAL_DATA = 'CLEAR_DOWNLOAD_LOCAL_DATA'; -export type ClearDownloadLocalDataRendererRequest = ClearDownloadLocalDataRequest; +export type ClearDownloadLocalDataRendererRequest = + ClearDownloadLocalDataRequest; export type ClearDownloadLocalDataMainResponse = ClearDownloadLocalDataResponse; /** @@ -464,12 +468,16 @@ export type GetBlockSyncProgressMainResponse = { */ export const GET_HARDWARE_WALLET_TRANSPORT_CHANNEL = 'GET_HARDWARE_WALLET_TRANSPORT_CHANNEL'; -export type getHardwareWalletTransportRendererRequest = HardwareWalletTransportDeviceRequest; -export type getHardwareWalletTransportMainResponse = HardwareWalletTransportDeviceResponse; +export type getHardwareWalletTransportRendererRequest = + HardwareWalletTransportDeviceRequest; +export type getHardwareWalletTransportMainResponse = + HardwareWalletTransportDeviceResponse; export const GET_EXTENDED_PUBLIC_KEY_CHANNEL = 'GET_EXTENDED_PUBLIC_KEY_CHANNEL'; -export type getExtendedPublicKeyRendererRequest = HardwareWalletExtendedPublicKeyRequest; -export type getExtendedPublicKeyMainResponse = HardwareWalletExtendedPublicKeyResponse; +export type getExtendedPublicKeyRendererRequest = + HardwareWalletExtendedPublicKeyRequest; +export type getExtendedPublicKeyMainResponse = + HardwareWalletExtendedPublicKeyResponse; export const GET_CARDANO_ADA_APP_CHANNEL = 'GET_CARDANO_ADA_APP_CHANNEL'; export type getCardanoAdaAppRendererRequest = { path: string | null | undefined; @@ -477,7 +485,8 @@ export type getCardanoAdaAppRendererRequest = { export type getCardanoAdaAppMainResponse = HardwareWalletCardanoAdaAppResponse; export const GET_HARDWARE_WALLET_CONNECTION_CHANNEL = 'GET_HARDWARE_WALLET_CONNECTION_CHANNEL'; -export type getHardwareWalletConnectiontMainRequest = HardwareWalletConnectionRequest; +export type getHardwareWalletConnectiontMainRequest = + HardwareWalletConnectionRequest; export type getHardwareWalletConnectiontRendererResponse = Record; export const SIGN_TRANSACTION_LEDGER_CHANNEL = 'SIGN_TRANSACTION_LEDGER_CHANNEL'; diff --git a/source/common/types/hardware-wallets.types.ts b/source/common/types/hardware-wallets.types.ts index 1cf779b407..43c78c500a 100644 --- a/source/common/types/hardware-wallets.types.ts +++ b/source/common/types/hardware-wallets.types.ts @@ -141,9 +141,8 @@ export type StakingBlockchainPointer = { txIndex: number; certificateIndex: number; }; -export type LedgerSignTransactionInputsType = Array< - LedgerSignTransactionInputType ->; +export type LedgerSignTransactionInputsType = + Array; export type LedgerSignTransactionOutputsType = | [] | Array; @@ -189,9 +188,8 @@ export type TrezorOutputTypeChange = { stakingPath: string; }; }; -export type TrezorSignTransactionInputsType = Array< - TrezorSignTransactionInputType ->; +export type TrezorSignTransactionInputsType = + Array; export type TrezorSignTransactionOutputsType = Array< TrezorOutputTypeAddress | TrezorOutputTypeChange >; diff --git a/source/common/utils/files.ts b/source/common/utils/files.ts index f13d4beb75..45ce947195 100644 --- a/source/common/utils/files.ts +++ b/source/common/utils/files.ts @@ -32,14 +32,14 @@ export const generateFileNameWithTimestamp = (props: Props = {}) => { if (sanitize) fileName = sanitizeFilename(fileName); return fileName; }; -export const isFileNameWithTimestamp = (prefix = 'logs', extension = 'zip') => ( - fileName: string -) => - fileName.match( - RegExp( - `(${prefix}-)([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{6}.0[0-9]{3}Z)(.${extension})` - ) - ); +export const isFileNameWithTimestamp = + (prefix = 'logs', extension = 'zip') => + (fileName: string) => + fileName.match( + RegExp( + `(${prefix}-)([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{6}.0[0-9]{3}Z)(.${extension})` + ) + ); export const getPathSlash = (path: string) => path.indexOf('/') > -1 ? '/' : '\\'; export const extractFileNameFromPath = (path: string) => diff --git a/source/main/cardano/CardanoSelfnodeLauncher.ts b/source/main/cardano/CardanoSelfnodeLauncher.ts index 1676f89f85..be1d6498ec 100644 --- a/source/main/cardano/CardanoSelfnodeLauncher.ts +++ b/source/main/cardano/CardanoSelfnodeLauncher.ts @@ -41,12 +41,8 @@ export async function CardanoSelfnodeLauncher( replyPort: number; }> { return new Promise(async (resolve, reject) => { - const { - selfnodeBin, - mockTokenMetadataServerBin, - processName, - onStop, - } = selfnodeOptions; + const { selfnodeBin, mockTokenMetadataServerBin, processName, onStop } = + selfnodeOptions; setupMockTokenMetadataServer(mockTokenMetadataServerBin); // @ts-ignore ts-migrate(2322) FIXME: Type '{ pid: number; ppid?: number; uid?: number; ... Remove this comment to see the full error message const processList: Array = await find('port', CARDANO_WALLET_PORT); diff --git a/source/main/cardano/utils.ts b/source/main/cardano/utils.ts index adb190b67e..b81ede4251 100644 --- a/source/main/cardano/utils.ts +++ b/source/main/cardano/utils.ts @@ -174,13 +174,8 @@ export const exportWallets = async ( mainWindow: BrowserWindow, locale: string ): Promise => { - const { - legacySecretKey, - legacyWalletDB, - stateDir, - cluster, - isFlight, - } = launcherConfig; + const { legacySecretKey, legacyWalletDB, stateDir, cluster, isFlight } = + launcherConfig; logger.info('ipcMain: Starting wallets export...', { exportSourcePath, legacySecretKey, diff --git a/source/main/config.ts b/source/main/config.ts index f5b24e03b0..9b6255ae27 100644 --- a/source/main/config.ts +++ b/source/main/config.ts @@ -109,9 +109,8 @@ export const windowOptions: WindowOptionsType = { }, useContentSize: true, }; -export const launcherConfig: LauncherConfig = readLauncherConfig( - LAUNCHER_CONFIG -); +export const launcherConfig: LauncherConfig = + readLauncherConfig(LAUNCHER_CONFIG); export const { cluster, nodeImplementation, diff --git a/source/main/ipc/generateCsvChannel.ts b/source/main/ipc/generateCsvChannel.ts index b09037cd72..8bc5a8d51d 100644 --- a/source/main/ipc/generateCsvChannel.ts +++ b/source/main/ipc/generateCsvChannel.ts @@ -8,10 +8,8 @@ import type { } from '../../common/ipc/api'; export const generateCsvChannel: // IpcChannel -MainIpcChannel< - GenerateCsvRendererRequest, - GenerateCsvMainResponse -> = new MainIpcChannel(GENERATE_CSV_CHANNEL); +MainIpcChannel = + new MainIpcChannel(GENERATE_CSV_CHANNEL); export const handleRewardsCsvRequests = () => { generateCsvChannel.onReceive( (request: GenerateCsvRendererRequest) => diff --git a/source/main/ipc/generateFileMetaChannel.ts b/source/main/ipc/generateFileMetaChannel.ts index 965662cfbd..edb66d84e7 100644 --- a/source/main/ipc/generateFileMetaChannel.ts +++ b/source/main/ipc/generateFileMetaChannel.ts @@ -8,10 +8,8 @@ import type { } from '../../common/ipc/api'; export const generateFileMetaChannel: // IpcChannel -MainIpcChannel< - GenerateFileMetaRendererRequest, - GenerateFileMetaMainResponse -> = new MainIpcChannel(GENERATE_FILE_META_CHANNEL); +MainIpcChannel = + new MainIpcChannel(GENERATE_FILE_META_CHANNEL); export const handleFileMetaRequests = () => { generateFileMetaChannel.onReceive( (request: GenerateFileMetaRendererRequest) => diff --git a/source/main/ipc/getHardwareWalletChannel.ts b/source/main/ipc/getHardwareWalletChannel.ts index d4ff461f55..6bfa2adddf 100644 --- a/source/main/ipc/getHardwareWalletChannel.ts +++ b/source/main/ipc/getHardwareWalletChannel.ts @@ -748,12 +748,11 @@ export const handleHardwareWalletRequests = async ( }); if (deviceFeatures.success) { - const extendedPublicKeyResponse = await TrezorConnect.cardanoGetPublicKey( - { + const extendedPublicKeyResponse = + await TrezorConnect.cardanoGetPublicKey({ path: `m/${path}`, showOnTrezor: true, - } - ); + }); if (!extendedPublicKeyResponse.success) { throw extendedPublicKeyResponse.payload; diff --git a/source/main/ipc/manageAppUpdateChannel.ts b/source/main/ipc/manageAppUpdateChannel.ts index f4f7b0c218..0aaa69df9b 100644 --- a/source/main/ipc/manageAppUpdateChannel.ts +++ b/source/main/ipc/manageAppUpdateChannel.ts @@ -15,10 +15,8 @@ import { safeExitWithCode } from '../utils/safeExitWithCode'; import { logger } from '../utils/logging'; import { launcherConfig } from '../config'; // IpcChannel -const manageAppUpdateChannel: MainIpcChannel< - Request, - Response -> = new MainIpcChannel(MANAGE_APP_UPDATE); +const manageAppUpdateChannel: MainIpcChannel = + new MainIpcChannel(MANAGE_APP_UPDATE); const logPrefix = 'appUpdateInstall'; const getMessage = (functionPrefix: string, message?: string): string => { diff --git a/source/main/ipc/rebuild-application-menu.ts b/source/main/ipc/rebuild-application-menu.ts index 47f90cba93..155af3b028 100644 --- a/source/main/ipc/rebuild-application-menu.ts +++ b/source/main/ipc/rebuild-application-menu.ts @@ -6,7 +6,5 @@ import type { } from '../../common/ipc/api'; export const rebuildApplicationMenu: // IpcChannel -MainIpcChannel< - RebuildAppMenuRendererRequest, - RebuildAppMenuMainResponse -> = new MainIpcChannel(REBUILD_APP_MENU_CHANNEL); +MainIpcChannel = + new MainIpcChannel(REBUILD_APP_MENU_CHANNEL); diff --git a/source/main/ipc/saveQRCodeImageChannel.ts b/source/main/ipc/saveQRCodeImageChannel.ts index e7aea53da6..1123c087b3 100644 --- a/source/main/ipc/saveQRCodeImageChannel.ts +++ b/source/main/ipc/saveQRCodeImageChannel.ts @@ -8,10 +8,8 @@ import type { } from '../../common/ipc/api'; export const saveQRCodeImageChannel: // IpcChannel -MainIpcChannel< - GenerateQRCodeRendererRequest, - GenerateQRCodeMainResponse -> = new MainIpcChannel(GENERATE_QRCODE_CHANNEL); +MainIpcChannel = + new MainIpcChannel(GENERATE_QRCODE_CHANNEL); export const saveQRCodeImageRequests = () => { saveQRCodeImageChannel.onReceive( (request: GenerateQRCodeRendererRequest) => diff --git a/source/main/ipc/show-file-dialog-channels.ts b/source/main/ipc/show-file-dialog-channels.ts index c8b0525924..1e32743d90 100644 --- a/source/main/ipc/show-file-dialog-channels.ts +++ b/source/main/ipc/show-file-dialog-channels.ts @@ -13,15 +13,11 @@ import type { } from '../../common/ipc/api'; export const showOpenDialogChannel: // IpcChannel -MainIpcChannel< - ShowOpenDialogRendererRequest, - ShowOpenDialogMainResponse -> = new MainIpcChannel(SHOW_OPEN_DIALOG_CHANNEL); +MainIpcChannel = + new MainIpcChannel(SHOW_OPEN_DIALOG_CHANNEL); export const showSaveDialogChannel: // IpcChannel -MainIpcChannel< - ShowSaveDialogRendererRequest, - ShowSaveDialogMainResponse -> = new MainIpcChannel(SHOW_SAVE_DIALOG_CHANNEL); +MainIpcChannel = + new MainIpcChannel(SHOW_SAVE_DIALOG_CHANNEL); export const handleFileDialogRequests = (window: BrowserWindow) => { showOpenDialogChannel.onReceive((request: ShowOpenDialogRendererRequest) => // @ts-ignore ts-migrate(2345) FIXME: Argument of type 'FileDialogRequestParams' is not ... Remove this comment to see the full error message diff --git a/source/main/utils/getContentMinimumSize.ts b/source/main/utils/getContentMinimumSize.ts index 29d5ca9b5c..83f0aad541 100644 --- a/source/main/utils/getContentMinimumSize.ts +++ b/source/main/utils/getContentMinimumSize.ts @@ -23,10 +23,8 @@ export const getContentMinimumSize = ( ): getContentMinimumSizeResponse => { const { isWindows } = environment; const { width: frameWidth, height: frameHeight } = window.getBounds(); - const { - width: contentWidth, - height: contentHeight, - } = window.getContentBounds(); + const { width: contentWidth, height: contentHeight } = + window.getContentBounds(); const paddingWidth = frameWidth - contentWidth || 0; let paddingHeight = frameHeight - contentHeight || 0; diff --git a/source/main/utils/logging.ts b/source/main/utils/logging.ts index a8d7cfe3b1..b365da17b8 100644 --- a/source/main/utils/logging.ts +++ b/source/main/utils/logging.ts @@ -23,15 +23,14 @@ const environmentData = { version, }; -const logToLevel = (level: string) => ( - message: string, - data: Record | null | undefined -) => - log[level](formatContext({ ...messageContext, level }), { - message, - data: toJS(data), - environmentData, - }); +const logToLevel = + (level: string) => + (message: string, data: Record | null | undefined) => + log[level](formatContext({ ...messageContext, level }), { + message, + data: toJS(data), + environmentData, + }); export const logger: Logger = { debug: logToLevel('debug'), diff --git a/source/main/utils/setupLogging.ts b/source/main/utils/setupLogging.ts index de382842d5..1518b415b2 100644 --- a/source/main/utils/setupLogging.ts +++ b/source/main/utils/setupLogging.ts @@ -122,13 +122,8 @@ export const logStateSnapshot = ( ): MessageBody => { const { ...data } = props; const { currentTime: at, systemInfo, coreInfo } = data; - const { - platform, - platformVersion, - cpu, - ram, - availableDiskSpace, - } = systemInfo; + const { platform, platformVersion, cpu, ram, availableDiskSpace } = + systemInfo; const { daedalusVersion, daedalusProcessID, diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 2fd73b8de7..f1a2adcbbe 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -677,7 +677,8 @@ export default class AdaApi { assets: response, }); // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. - const assetsLocaldata = await global.daedalus.api.localStorage.getAssetsLocalData(); + const assetsLocaldata = + await global.daedalus.api.localStorage.getAssetsLocalData(); logger.debug('AdaApi::getAssetsLocalData success', { assetsLocaldata, }); @@ -1702,9 +1703,8 @@ export default class AdaApi { getCurrencyList = async (): Promise => { try { const apiResponse = await getCurrencyList(); - const response: GetCurrencyListResponse = currencyConfig.responses.list( - apiResponse - ); + const response: GetCurrencyListResponse = + currencyConfig.responses.list(apiResponse); logger.debug('AdaApi::getCurrencyList success', { response, }); @@ -1722,9 +1722,8 @@ export default class AdaApi { ): Promise => { try { const apiResponse = await getCurrencyRate(currency); - const response: GetCurrencyRateResponse = currencyConfig.responses.rate( - apiResponse - ); + const response: GetCurrencyRateResponse = + currencyConfig.responses.rate(apiResponse); logger.debug('AdaApi::getCurrencyRate success', { response, }); @@ -2244,9 +2243,8 @@ export default class AdaApi { logger.debug('AdaApi::getSmashSettings called'); try { - const { - pool_metadata_source: poolMetadataSource, - } = await getSmashSettings(this.config); + const { pool_metadata_source: poolMetadataSource } = + await getSmashSettings(this.config); logger.debug('AdaApi::getSmashSettings success', { poolMetadataSource, }); @@ -2271,12 +2269,8 @@ export default class AdaApi { return true; } - const { - health, - }: CheckSmashServerHealthApiResponse = await checkSmashServerHealth( - this.config, - url - ); + const { health }: CheckSmashServerHealthApiResponse = + await checkSmashServerHealth(this.config, url); const isValid = health === SMASH_SERVER_STATUSES.AVAILABLE; logger.debug('AdaApi::checkSmashServerIsValid success', { isValid, @@ -2497,12 +2491,10 @@ export default class AdaApi { }); try { - const response: TransferFundsCalculateFeeApiResponse = await transferFundsCalculateFee( - this.config, - { + const response: TransferFundsCalculateFeeApiResponse = + await transferFundsCalculateFee(this.config, { sourceWalletId, - } - ); + }); logger.debug('AdaApi::transferFundsCalculateFee success', { response, }); @@ -2712,9 +2704,8 @@ export default class AdaApi { logger.debug('AdaApi::getNetworkParameters called'); try { - const networkParameters: GetNetworkParametersApiResponse = await getNetworkParameters( - this.config - ); + const networkParameters: GetNetworkParametersApiResponse = + await getNetworkParameters(this.config); logger.debug('AdaApi::getNetworkParameters success', { networkParameters, }); diff --git a/source/renderer/app/components/assets/AssetTransactionConfirmation.tsx b/source/renderer/app/components/assets/AssetTransactionConfirmation.tsx index 8226fad7b1..e33da64432 100644 --- a/source/renderer/app/components/assets/AssetTransactionConfirmation.tsx +++ b/source/renderer/app/components/assets/AssetTransactionConfirmation.tsx @@ -31,16 +31,14 @@ const messages = defineMessages({ '"unformattedAmountLabel" item on AssetTransactionConfirmation.', }, unformattedAmountMessageForHardwareWallets: { - id: - 'asset.transactionConfirmation.unformattedAmountMessageForHardwareWallets', + id: 'asset.transactionConfirmation.unformattedAmountMessageForHardwareWallets', defaultMessage: '!!!Native assets may specify a number of decimal places, as defined in the Cardano token registry. Daedalus uses this information to format the amount that is being sent in the transaction.

The native token unformatted amount is the amount without these decimal places. Please ensure that you verify both amounts, as some wallet software may not yet use the Cardano token registry.', description: '"unformattedAmountMessageForHardwareWallets" item on AssetTransactionConfirmation.', }, unformattedAmountMessageForSoftwareWallets: { - id: - 'asset.transactionConfirmation.unformattedAmountMessageForSoftwareWallets', + id: 'asset.transactionConfirmation.unformattedAmountMessageForSoftwareWallets', defaultMessage: '!!!Native assets may specify a number of decimal places, as defined in the Cardano token registry. Daedalus uses this information to format the amount that is being sent in the transaction.

The native token unformatted amount is the amount without these decimal places. Please ensure that you verify both amounts, as some wallet software may not yet use the Cardano token registry.

The native token unformatted amount will be displayed on the hardware wallet device during transaction confirmation.', description: diff --git a/source/renderer/app/components/dapp/DappTransactionRequest.tsx b/source/renderer/app/components/dapp/DappTransactionRequest.tsx index 850812c180..fb6a635d47 100644 --- a/source/renderer/app/components/dapp/DappTransactionRequest.tsx +++ b/source/renderer/app/components/dapp/DappTransactionRequest.tsx @@ -93,9 +93,8 @@ type Props = { wallets: Array; }; const DappTransactionRequest = observer((props: Props) => { - const [isAdditionalDataVisible, toggleAdditionalData] = useState( - false - ); + const [isAdditionalDataVisible, toggleAdditionalData] = + useState(false); const [isMetadataVisible, toggleMetadata] = useState(false); // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. const getToggleLabel = useCallback((isVisible: boolean) => @@ -134,9 +133,8 @@ const DappTransactionRequest = observer((props: Props) => { [assets, selectedWallet] ); const adaBalanceRequired = adaAmount.plus(transactionFee); - const walletsDropdownHasError = selectedWallet?.amount.isLessThan( - adaBalanceRequired - ); + const walletsDropdownHasError = + selectedWallet?.amount.isLessThan(adaBalanceRequired); if (walletsDropdownHasError) { hasAmountError = true; diff --git a/source/renderer/app/components/knownIssues/ToggleRTSFlagsDialog/ToggleRTSFlagsDialog.tsx b/source/renderer/app/components/knownIssues/ToggleRTSFlagsDialog/ToggleRTSFlagsDialog.tsx index b69e769681..f5f59ac9c4 100644 --- a/source/renderer/app/components/knownIssues/ToggleRTSFlagsDialog/ToggleRTSFlagsDialog.tsx +++ b/source/renderer/app/components/knownIssues/ToggleRTSFlagsDialog/ToggleRTSFlagsDialog.tsx @@ -42,8 +42,7 @@ const messages = defineMessages({ description: 'Disable RTS flags button label', }, manualRelaunchConfirmationCheckboxLabel: { - id: - 'knownIssues.dialog.toggleRtsFlagsMode.manualRelaunchConfirmationCheckboxLabel', + id: 'knownIssues.dialog.toggleRtsFlagsMode.manualRelaunchConfirmationCheckboxLabel', defaultMessage: '!!!I understand that I will need to launch Daedalus manually', description: 'Manual relaunch confirmation checkbox label', diff --git a/source/renderer/app/components/layout/SidebarLayout.tsx b/source/renderer/app/components/layout/SidebarLayout.tsx index dc27f7785e..2c71a30f07 100644 --- a/source/renderer/app/components/layout/SidebarLayout.tsx +++ b/source/renderer/app/components/layout/SidebarLayout.tsx @@ -20,13 +20,8 @@ class SidebarLayout extends Component { }; render() { - const { - children, - sidebar, - topbar, - notification, - contentDialogs, - } = this.props; + const { children, sidebar, topbar, notification, contentDialogs } = + this.props; return (
{sidebar}
diff --git a/source/renderer/app/components/loading/no-disk-space-error/NoDiskSpaceError.tsx b/source/renderer/app/components/loading/no-disk-space-error/NoDiskSpaceError.tsx index c73023c97d..377a754fc0 100644 --- a/source/renderer/app/components/loading/no-disk-space-error/NoDiskSpaceError.tsx +++ b/source/renderer/app/components/loading/no-disk-space-error/NoDiskSpaceError.tsx @@ -34,11 +34,8 @@ class NoDiskSpaceError extends Component { render() { const { intl } = this.context; - const { - diskSpaceRequired, - diskSpaceMissing, - diskSpaceRecommended, - } = this.props; + const { diskSpaceRequired, diskSpaceMissing, diskSpaceRecommended } = + this.props; return (
diff --git a/source/renderer/app/components/loading/syncing-connecting/SyncingConnectingStatus.tsx b/source/renderer/app/components/loading/syncing-connecting/SyncingConnectingStatus.tsx index 309a9d4426..165c5ef1d0 100644 --- a/source/renderer/app/components/loading/syncing-connecting/SyncingConnectingStatus.tsx +++ b/source/renderer/app/components/loading/syncing-connecting/SyncingConnectingStatus.tsx @@ -234,10 +234,8 @@ export default class SyncingConnectingStatus extends Component { showEllipsis ? styles.withoutAnimation : null, ]); - const { - connectingMessage, - connectingDescription, - } = this._getConnectingMessage(); + const { connectingMessage, connectingDescription } = + this._getConnectingMessage(); return (
diff --git a/source/renderer/app/components/profile/terms-of-use/TermsOfUseForm.tsx b/source/renderer/app/components/profile/terms-of-use/TermsOfUseForm.tsx index 210d827639..52015b4ab9 100644 --- a/source/renderer/app/components/profile/terms-of-use/TermsOfUseForm.tsx +++ b/source/renderer/app/components/profile/terms-of-use/TermsOfUseForm.tsx @@ -60,12 +60,8 @@ class TermsOfUseForm extends Component { render() { const { intl } = this.context; - const { - isSubmitting, - error, - localizedTermsOfUse, - onOpenExternalLink, - } = this.props; + const { isSubmitting, error, localizedTermsOfUse, onOpenExternalLink } = + this.props; const { areTermsOfUseAccepted } = this.state; const buttonClasses = classnames([ 'primary', diff --git a/source/renderer/app/components/sidebar/wallets/SidebarWalletsMenu.tsx b/source/renderer/app/components/sidebar/wallets/SidebarWalletsMenu.tsx index 0e0098e5ed..2716cfadf9 100644 --- a/source/renderer/app/components/sidebar/wallets/SidebarWalletsMenu.tsx +++ b/source/renderer/app/components/sidebar/wallets/SidebarWalletsMenu.tsx @@ -86,10 +86,8 @@ class SidebarWalletsMenu extends Component {
); walletSort = (sortBy: WalletSortByOptions) => { - const { - sortOrder = WalletSortOrder.asc, - onWalletSortBy = noop, - } = this.props; + const { sortOrder = WalletSortOrder.asc, onWalletSortBy = noop } = + this.props; return onWalletSortBy({ sortBy, sortOrder, diff --git a/source/renderer/app/components/staking/countdown/StakingCountdown.tsx b/source/renderer/app/components/staking/countdown/StakingCountdown.tsx index 2a4b7b89ea..f1cd67b8d9 100644 --- a/source/renderer/app/components/staking/countdown/StakingCountdown.tsx +++ b/source/renderer/app/components/staking/countdown/StakingCountdown.tsx @@ -43,11 +43,8 @@ class StakingCountdown extends Component { }; render() { - const { - redirectToStakingInfo, - startDateTime, - onLearnMoreClick, - } = this.props; + const { redirectToStakingInfo, startDateTime, onLearnMoreClick } = + this.props; const { intl } = this.context; const heading = intl.formatMessage(messages.heading); const description = intl.formatMessage(messages.description); diff --git a/source/renderer/app/components/staking/delegation-center/WalletRow.tsx b/source/renderer/app/components/staking/delegation-center/WalletRow.tsx index 5116e983c4..289a5b6ae3 100644 --- a/source/renderer/app/components/staking/delegation-center/WalletRow.tsx +++ b/source/renderer/app/components/staking/delegation-center/WalletRow.tsx @@ -238,10 +238,11 @@ class WalletRow extends Component { const nextPendingDelegatedStakePool = nextPendingDelegatedStakePoolId ? getStakePoolById(nextPendingDelegatedStakePoolId) : null; - const futurePendingDelegatedStakePoolId = this.getPendingDelegatedStakePoolId( - futureEpochNumber, - nextPendingDelegatedStakePoolId - ); + const futurePendingDelegatedStakePoolId = + this.getPendingDelegatedStakePoolId( + futureEpochNumber, + nextPendingDelegatedStakePoolId + ); const futurePendingDelegatedStakePool = futurePendingDelegatedStakePoolId ? getStakePoolById(futurePendingDelegatedStakePoolId) : null; diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseStakePoolDialog.messages.ts b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseStakePoolDialog.messages.ts index 8751d17a54..a5a3267e38 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseStakePoolDialog.messages.ts +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseStakePoolDialog.messages.ts @@ -17,84 +17,73 @@ export const getMessages = () => { 'Description on the delegation setup "choose stake pool" dialog.', }, selectStakePoolLabel: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.selectStakePoolLabel', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.selectStakePoolLabel', defaultMessage: '!!!Select a stake pool to receive your delegated funds in the {selectedWalletName} wallet.', description: 'Select / Selected pool section label on the delegation setup "choose stake pool" dialog.', }, selectedStakePoolLabel: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.selectedStakePoolLabel', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.selectedStakePoolLabel', defaultMessage: '!!!You have selected [{selectedPoolTicker}] stake pool to delegate to for {selectedWalletName} wallet.', description: '"Selected Pools" Selected pool label on the delegation setup "choose stake pool" dialog.', }, selectedStakePoolLabelRetiring: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.selectedStakePoolLabelRetiring', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.selectedStakePoolLabelRetiring', defaultMessage: '!!!The [{selectedPoolTicker}] stake pool which you have selected to delegate your {selectedWalletName} wallet funds is about to retire.', description: '"Selected Pools" Selected pool label on the delegation setup "choose stake pool" dialog.', }, delegatedStakePoolLabel: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.delegatedStakePoolLabel', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.delegatedStakePoolLabel', defaultMessage: '!!!You are already delegating {selectedWalletName} wallet to [{selectedPoolTicker}] stake pool. If you wish to re-delegate your stake, please select a different pool.', description: '"You are already delegating to stake pool" label on the delegation setup "choose stake pool" dialog.', }, delegatedStakePoolNextLabel: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.delegatedStakePoolNextLabel', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.delegatedStakePoolNextLabel', defaultMessage: '!!!You are already pending delegation {selectedWalletName} wallet to [{selectedPoolTicker}] stake pool. If you wish to re-delegate your stake, please select a different pool.', description: '"You are already delegating to stake pool" label on the delegation setup "choose stake pool" dialog.', }, recentPoolsLabel: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.recentPoolsLabel', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.recentPoolsLabel', defaultMessage: '!!!Choose one of your recent stake pool choices:', description: 'Recent "Pool" choice section label on the delegation setup "choose stake pool" dialog.', }, searchInputLabel: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.searchInput.label', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.searchInput.label', defaultMessage: '!!!Or select a stake pool from the list of all available stake pools:', description: 'Search "Pools" input label on the delegation setup "choose stake pool" dialog.', }, searchInputPlaceholder: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.searchInput.placeholder', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.searchInput.placeholder', defaultMessage: '!!!Search stake pools', description: 'Search "Pools" input placeholder on the delegation setup "choose stake pool" dialog.', }, continueButtonLabel: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.continueButtonLabel', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.continueButtonLabel', defaultMessage: '!!!Continue', description: 'Label for continue button on the delegation setup "choose stake pool" dialog.', }, stepIndicatorLabel: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.stepIndicatorLabel', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.stepIndicatorLabel', defaultMessage: '!!!STEP {currentStep} OF {totalSteps}', description: 'Step indicator label on the delegation setup "choose wallet" step dialog.', }, retiringPoolFooter: { - id: - 'staking.delegationSetup.chooseStakePool.step.dialog.retiringPoolFooter', + id: 'staking.delegationSetup.chooseStakePool.step.dialog.retiringPoolFooter', defaultMessage: '!!!The stake pool you have selected is about to be retired. If you continue the delegation process, you will need to delegate your stake to another pool at least one complete epoch before the current pool’s retirement date to avoid losing rewards.', description: diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx index 20211f3069..aa21c2e533 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx @@ -33,15 +33,13 @@ const messages = defineMessages({ 'Description on the delegation setup "choose wallet" step dialog.', }, selectWalletInputLabel: { - id: - 'staking.delegationSetup.chooseWallet.step.dialog.selectWalletInputLabel', + id: 'staking.delegationSetup.chooseWallet.step.dialog.selectWalletInputLabel', defaultMessage: '!!!Wallet', description: 'Label "Wallet" for select input on the delegation setup "choose wallet" step dialog.', }, selectWalletInputPlaceholder: { - id: - 'staking.delegationSetup.chooseWallet.step.dialog.selectWalletInputPlaceholder', + id: 'staking.delegationSetup.chooseWallet.step.dialog.selectWalletInputPlaceholder', defaultMessage: '!!!Select Wallet', description: 'Placeholder "Select Wallet" for select input on the delegation setup "choose wallet" step dialog.', @@ -53,16 +51,14 @@ const messages = defineMessages({ 'Step indicator label on the delegation setup "choose wallet" step dialog.', }, errorMinDelegationFunds: { - id: - 'staking.delegationSetup.chooseWallet.step.dialog.errorMinDelegationFunds', + id: 'staking.delegationSetup.chooseWallet.step.dialog.errorMinDelegationFunds', defaultMessage: '!!!This wallet does not contain the minimum amount of {minDelegationFunds} ADA which is required for delegation to be available. Please select a wallet with a minimum amount of {minDelegationFunds} ADA and click continue.', description: 'errorMinDelegationFunds Error Label on the delegation setup "choose wallet" step dialog.', }, errorMinDelegationFundsRewardsOnly: { - id: - 'staking.delegationSetup.chooseWallet.step.dialog.errorMinDelegationFundsRewardsOnly', + id: 'staking.delegationSetup.chooseWallet.step.dialog.errorMinDelegationFundsRewardsOnly', defaultMessage: '!!!This wallet contains only rewards balances so it cannot be delegated.', description: diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsConfirmationDialog.messages.ts b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsConfirmationDialog.messages.ts index 69b3165524..8a7fa2a014 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsConfirmationDialog.messages.ts +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsConfirmationDialog.messages.ts @@ -42,14 +42,12 @@ export const getMessages = () => { 'Deposit label on the delegation setup "confirmation" step dialog.', }, spendingPasswordPlaceholder: { - id: - 'staking.delegationSetup.confirmation.step.dialog.spendingPasswordPlaceholder', + id: 'staking.delegationSetup.confirmation.step.dialog.spendingPasswordPlaceholder', defaultMessage: '!!!Spending password', description: 'Placeholder for "spending password"', }, spendingPasswordLabel: { - id: - 'staking.delegationSetup.confirmation.step.dialog.spendingPasswordLabel', + id: 'staking.delegationSetup.confirmation.step.dialog.spendingPasswordLabel', defaultMessage: '!!!Spending password', description: 'Label for "spending password"', }, diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsNotAvailableDialog.tsx b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsNotAvailableDialog.tsx index 19acaf3616..780c6a624b 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsNotAvailableDialog.tsx +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsNotAvailableDialog.tsx @@ -35,9 +35,7 @@ const messages = defineMessages({ 'Label for close button on the delegation setup not available dialog.', }, }); -export default class DelegationStepsNotAvailableDialog extends Component< - Props -> { +export default class DelegationStepsNotAvailableDialog extends Component { static contextTypes = { intl: intlShape.isRequired, }; diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsSuccessDialog.tsx b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsSuccessDialog.tsx index 6166330005..68c3fe47cf 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsSuccessDialog.tsx +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsSuccessDialog.tsx @@ -97,12 +97,8 @@ class DelegationStepsSuccessDialog extends Component { render() { const { intl } = this.context; - const { - delegatedWallet, - delegatedStakePool, - currentLocale, - onClose, - } = this.props; + const { delegatedWallet, delegatedStakePool, currentLocale, onClose } = + this.props; const actions = [ { className: 'closeButton', diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/OversaturationText.tsx b/source/renderer/app/components/staking/delegation-setup-wizard/OversaturationText.tsx index 36b69a3a93..50bd2d30ca 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/OversaturationText.tsx +++ b/source/renderer/app/components/staking/delegation-setup-wizard/OversaturationText.tsx @@ -12,8 +12,7 @@ import styles from './OversaturationText.scss'; const messages: Record = defineMessages({ oversaturationWarning: { - id: - 'staking.delegationSetup.confirmation.step.dialog.oversaturationWarning', + id: 'staking.delegationSetup.confirmation.step.dialog.oversaturationWarning', defaultMessage: '!!!The selected stake pool will become oversaturated by {oversaturationPercentage}%, which will reduce future rewards for all delegators to that pool.', description: diff --git a/source/renderer/app/components/staking/epochs/StakingEpochsDataTable.tsx b/source/renderer/app/components/staking/epochs/StakingEpochsDataTable.tsx index 8320c8b2ae..be482fb97c 100644 --- a/source/renderer/app/components/staking/epochs/StakingEpochsDataTable.tsx +++ b/source/renderer/app/components/staking/epochs/StakingEpochsDataTable.tsx @@ -25,13 +25,8 @@ type Props = { @observer class StakingEpochsDataTable extends Component { render() { - const { - tableHeaders, - tableBody, - order, - sortBy, - handleDataSort, - } = this.props; + const { tableHeaders, tableBody, order, sortBy, handleDataSort } = + this.props; return ( diff --git a/source/renderer/app/components/staking/info/StakingInfoCountdown.tsx b/source/renderer/app/components/staking/info/StakingInfoCountdown.tsx index 808c2c1f46..80c3707feb 100644 --- a/source/renderer/app/components/staking/info/StakingInfoCountdown.tsx +++ b/source/renderer/app/components/staking/info/StakingInfoCountdown.tsx @@ -69,11 +69,8 @@ class StakingInfoCountdown extends Component { } checkIfShouldSetStakingInfoWasOpen = () => { - const { - onSetStakingInfoWasOpen, - isAlonzoActivated, - stakingInfoWasOpen, - } = this.props; + const { onSetStakingInfoWasOpen, isAlonzoActivated, stakingInfoWasOpen } = + this.props; if (isAlonzoActivated && !stakingInfoWasOpen) { onSetStakingInfoWasOpen(); diff --git a/source/renderer/app/components/staking/navigation/StakingNavigation.tsx b/source/renderer/app/components/staking/navigation/StakingNavigation.tsx index f39f3564b9..05aec41b8f 100644 --- a/source/renderer/app/components/staking/navigation/StakingNavigation.tsx +++ b/source/renderer/app/components/staking/navigation/StakingNavigation.tsx @@ -46,12 +46,8 @@ class StakingNavigation extends Component { }; render() { - const { - onNavItemClick, - activeItem, - isActiveNavItem, - showInfoTab, - } = this.props; + const { onNavItemClick, activeItem, isActiveNavItem, showInfoTab } = + this.props; const { intl } = this.context; const navigationItems = [ { diff --git a/source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx b/source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx index 4a1b474d23..9916ca0bcc 100644 --- a/source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx +++ b/source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx @@ -218,11 +218,8 @@ class StakePoolsRanking extends Component { rankStakePools(); }; onSliderChange = (sliderValue: number) => { - const { - updateDelegatingStake, - maxDelegationFunds, - maxDelegationFundsLog, - } = this.props; + const { updateDelegatingStake, maxDelegationFunds, maxDelegationFundsLog } = + this.props; let amountValue = null; if ( diff --git a/source/renderer/app/components/staking/widgets/ThumbPool.tsx b/source/renderer/app/components/staking/widgets/ThumbPool.tsx index ede4596c07..7f5fc3b46b 100644 --- a/source/renderer/app/components/staking/widgets/ThumbPool.tsx +++ b/source/renderer/app/components/staking/widgets/ThumbPool.tsx @@ -30,12 +30,8 @@ export function ThumbPool(props: { disabledStakePoolId: string | null | undefined; isGridRewardsView?: boolean; }) { - const { - isGridRewardsView, - isSelected, - numberOfRankedStakePools, - stakePool, - } = props; + const { isGridRewardsView, isSelected, numberOfRankedStakePools, stakePool } = + props; const { ranking, id } = stakePool; const color = getColorFromRange(ranking, numberOfRankedStakePools); const isDisabled = props.disabledStakePoolId === id; diff --git a/source/renderer/app/components/staking/widgets/ThumbPoolContent.tsx b/source/renderer/app/components/staking/widgets/ThumbPoolContent.tsx index 521cb32471..82b9610bdd 100644 --- a/source/renderer/app/components/staking/widgets/ThumbPoolContent.tsx +++ b/source/renderer/app/components/staking/widgets/ThumbPoolContent.tsx @@ -47,11 +47,8 @@ class ThumbPoolContent extends Component { }; render() { - const { - stakePool, - numberOfRankedStakePools, - isGridRewardsView, - } = this.props; + const { stakePool, numberOfRankedStakePools, isGridRewardsView } = + this.props; const { ranking, nonMyopicMemberRewards, diff --git a/source/renderer/app/components/staking/widgets/ThumbSelectedPool.tsx b/source/renderer/app/components/staking/widgets/ThumbSelectedPool.tsx index 5d1377f742..cc67c667a1 100644 --- a/source/renderer/app/components/staking/widgets/ThumbSelectedPool.tsx +++ b/source/renderer/app/components/staking/widgets/ThumbSelectedPool.tsx @@ -23,11 +23,8 @@ type Props = { @observer class ThumbSelectedPool extends Component { render() { - const { - stakePool, - alreadyDelegated, - numberOfRankedStakePools, - } = this.props; + const { stakePool, alreadyDelegated, numberOfRankedStakePools } = + this.props; const { ticker, retiring, ranking } = stakePool || {}; const rankColor = stakePool && !retiring && IS_RANKING_DATA_AVAILABLE diff --git a/source/renderer/app/components/status/DaedalusDiagnostics.tsx b/source/renderer/app/components/status/DaedalusDiagnostics.tsx index 4cda4ae705..c2b9a266d0 100644 --- a/source/renderer/app/components/status/DaedalusDiagnostics.tsx +++ b/source/renderer/app/components/status/DaedalusDiagnostics.tsx @@ -89,16 +89,14 @@ const messages = defineMessages({ 'Displayed on the right of the Recommended system requirements status row when hardware requirements are ok', }, hasMetHardwareRequirementsStatusLowTooltip: { - id: - 'daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusLowTooltip', + id: 'daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusLowTooltip', defaultMessage: '!!!Your system specifications do not meet Daedalus’ recommended hardware requirements. We suggest using a machine with at least 16 GB of RAM', description: 'Visible on hovering over Recommended system requirement status when status is Low', }, hasMetHardwareRequirementsStatusGoodTooltip: { - id: - 'daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusGoodTooltip', + id: 'daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusGoodTooltip', defaultMessage: '!!!Your system specifications meet Daedalus’ recommended hardware requirements', description: diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx index 284f7e49a7..234cd68dad 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx @@ -22,8 +22,7 @@ const messages = defineMessages({ 'Label "Wallet" for select input on the voting registration "choose wallet" step.', }, selectWalletInputPlaceholder: { - id: - 'voting.votingRegistration.chooseWallet.step.selectWalletInputPlaceholder', + id: 'voting.votingRegistration.chooseWallet.step.selectWalletInputPlaceholder', defaultMessage: '!!!Select a wallet', description: 'Placeholder "Select Wallet" for select input on the voting registration "choose wallet" step.', @@ -36,8 +35,7 @@ const messages = defineMessages({ 'errorMinVotingFunds Error Label on the voting registration "choose wallet" step.', }, errorMinVotingFundsRewardsOnly: { - id: - 'voting.votingRegistration.chooseWallet.step.errorMinVotingFundsRewardsOnly', + id: 'voting.votingRegistration.chooseWallet.step.errorMinVotingFundsRewardsOnly', defaultMessage: '!!!This wallet cannot be registered for voting as it contains rewards balance only.', description: diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx index 4f6a2271ca..d6d999febb 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx @@ -48,8 +48,7 @@ const messages = defineMessages({ description: 'Error message shown when repeat pin code is invalid.', }, invalidRepeatPinCode: { - id: - 'voting.votingRegistration.enterPinCode.step.errors.invalidRepeatPinCode', + id: 'voting.votingRegistration.enterPinCode.step.errors.invalidRepeatPinCode', defaultMessage: '!!!PIN doesn’t match', description: 'Error message shown when repeat pin code is invalid.', }, diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx index 6e96094b99..f607bd00d7 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx @@ -22,15 +22,13 @@ const messages = defineMessages({ 'Content for the voting registration cancellation confirmation dialog.', }, cancelButtonLabel: { - id: - 'voting.votingRegistration.dialog.confirmation.button.cancelButtonLabel', + id: 'voting.votingRegistration.dialog.confirmation.button.cancelButtonLabel', defaultMessage: '!!!Cancel registration', description: '"Cancel registration" button label for the voting registration cancellation confirmation dialog.', }, confirmButtonLabel: { - id: - 'voting.votingRegistration.dialog.confirmation.button.confirmButtonLabel', + id: 'voting.votingRegistration.dialog.confirmation.button.confirmButtonLabel', defaultMessage: '!!!Continue registration', description: '"Continue registration" button label for the voting registration cancellation confirmation dialog.', diff --git a/source/renderer/app/components/wallet/WalletSendForm.tsx b/source/renderer/app/components/wallet/WalletSendForm.tsx index a231353171..5f84da7319 100755 --- a/source/renderer/app/components/wallet/WalletSendForm.tsx +++ b/source/renderer/app/components/wallet/WalletSendForm.tsx @@ -593,11 +593,8 @@ class WalletSendForm extends Component { adaAmount: BigNumber, minimumAda: BigNumber ): Promise => { - const { - adaAmountInputTrack, - selectedAssetUniqueIds, - adaInputState, - } = this.state; + const { adaAmountInputTrack, selectedAssetUniqueIds, adaInputState } = + this.state; if ( adaAmountInputTrack.gt(minimumAda) && diff --git a/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.tsx b/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.tsx index 61335941db..4376b7735d 100644 --- a/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.tsx +++ b/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.tsx @@ -21,8 +21,7 @@ const messages = defineMessages({ 'Instructions for backing up wallet recovery phrase on dialog that displays wallet recovery phrase.', }, buttonLabelIHaveWrittenItDown: { - id: - 'wallet.backup.recovery.phrase.display.dialog.button.label.iHaveWrittenItDown', + id: 'wallet.backup.recovery.phrase.display.dialog.button.label.iHaveWrittenItDown', defaultMessage: '!!!Yes, I have written down my wallet recovery phrase.', description: 'Label for button "Yes, I have written down my wallet recovery phrase." on wallet backup dialog', @@ -79,7 +78,8 @@ class WalletRecoveryPhraseDisplayDialog extends Component { } diff --git a/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx b/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx index 66213e592f..33b091bdb0 100644 --- a/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx +++ b/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx @@ -44,21 +44,18 @@ const messages = defineMessages({ description: 'Placeholder hint for the mnemonics autocomplete.', }, recoveryPhraseInputPlaceholder: { - id: - 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputPlaceholder', + id: 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputPlaceholder', defaultMessage: '!!!Enter word #{wordNumber}', description: 'Placeholder for the mnemonics autocomplete.', }, recoveryPhraseNoResults: { - id: - 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputNoResults', + id: 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputNoResults', defaultMessage: '!!!No results', description: '"No results" message for the recovery phrase input search results.', }, recoveryPhraseInvalidMnemonics: { - id: - 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInvalidMnemonics', + id: 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInvalidMnemonics', defaultMessage: '!!!Invalid recovery phrase', description: 'Error message shown when invalid recovery phrase was entered.', @@ -69,15 +66,13 @@ const messages = defineMessages({ description: 'Label for button "Confirm" on wallet backup dialog', }, termOffline: { - id: - 'wallet.backup.recovery.phrase.entry.dialog.terms.and.condition.offline', + id: 'wallet.backup.recovery.phrase.entry.dialog.terms.and.condition.offline', defaultMessage: '!!!I understand that the simplest way to keep my wallet recovery phrase secure is to never store it digitally or online. If I decide to use an online service, such as a password manager with an encrypted database, it is my responsibility to make sure that I use it correctly.', description: 'Term on wallet creation to store recovery phrase offline', }, termRecovery: { - id: - 'wallet.backup.recovery.phrase.entry.dialog.terms.and.condition.recovery', + id: 'wallet.backup.recovery.phrase.entry.dialog.terms.and.condition.recovery', defaultMessage: '!!!I understand that the only way to recover my wallet if my computer is lost, broken, stolen, or stops working is to use my wallet recovery phrase.', description: diff --git a/source/renderer/app/components/wallet/paper-wallet-certificate/CompletionDialog.tsx b/source/renderer/app/components/wallet/paper-wallet-certificate/CompletionDialog.tsx index 4b1bead432..4b703488d2 100644 --- a/source/renderer/app/components/wallet/paper-wallet-certificate/CompletionDialog.tsx +++ b/source/renderer/app/components/wallet/paper-wallet-certificate/CompletionDialog.tsx @@ -111,12 +111,8 @@ class CompletionDialog extends Component { render() { const { intl } = this.context; - const { - onClose, - walletCertificateAddress, - onOpenExternalLink, - network, - } = this.props; + const { onClose, walletCertificateAddress, onOpenExternalLink, network } = + this.props; const { showCopyNotification } = this.state; const dialogClasses = classnames([styles.component, 'completionDialog']); const actions = [ diff --git a/source/renderer/app/components/wallet/paper-wallet-certificate/InstructionsDialog.tsx b/source/renderer/app/components/wallet/paper-wallet-certificate/InstructionsDialog.tsx index 70efcad940..4ee7b33d71 100644 --- a/source/renderer/app/components/wallet/paper-wallet-certificate/InstructionsDialog.tsx +++ b/source/renderer/app/components/wallet/paper-wallet-certificate/InstructionsDialog.tsx @@ -40,15 +40,13 @@ const messages = defineMessages({ 'subtitle2 for the "Paper wallet create certificate instructions dialog".', }, instructionsListLabel: { - id: - 'paper.wallet.create.certificate.instructions.dialog.instructionsList.label', + id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.label', defaultMessage: '!!!Instructions', description: 'Instructions list label for the "Paper wallet create certificate instructions dialog".', }, instructionsListDefinition1: { - id: - 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition1', + id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition1', defaultMessage: `!!!Your printed certificate will include your paper wallet recovery phrase of {paperWalletRecoveryPhraseWordCount} words. Note that your paper wallet recovery phrase is different to the {walletRecoveryPhraseWordCount}-word recovery phrases used to restore your @@ -56,37 +54,32 @@ const messages = defineMessages({ description: 'Wallet certificate create instructions dialog definition 1.', }, instructionsListDefinition2: { - id: - 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition2', + id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition2', defaultMessage: `!!!For security reasons, the last {paperWalletWrittenWordsCount} words of your paper wallet recovery phrase will not be printed on the paper wallet certificate itself. You will need to write them on your certificate by hand in a moment.`, description: 'Wallet certificate create instructions dialog definition 2.', }, instructionsListDefinition3: { - id: - 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition3', + id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition3', defaultMessage: '!!!Use the address on your certificate to send funds to your paper wallet.', description: 'Wallet certificate create instructions dialog definition 3.', }, instructionsListDefinition4: { - id: - 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition4', + id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition4', defaultMessage: `!!!Your paper wallet will be offline so will not be held in Daedalus. To check the balance of the wallet, input the address on the certificate into`, description: 'Wallet certificate create instructions dialog definition 4.', }, instructionsListDefinition5: { - id: - 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition5', + id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition5', defaultMessage: '!!!Store your certificate containing your paper wallet recovery phrase in a safe place.', description: 'Wallet certificate create instructions dialog definition 5.', }, printingInstructions: { - id: - 'paper.wallet.create.certificate.instructions.dialog.printingInstructions', + id: 'paper.wallet.create.certificate.instructions.dialog.printingInstructions', defaultMessage: `!!!When you click “Save PDF file for printing” you will be prompted to choose a location on your computer where the PDF file will be saved. After that open the saved PDF file and print it.`, @@ -134,14 +127,8 @@ class InstructionsDialog extends Component { render() { const { intl } = this.context; - const { - onClose, - onPrint, - inProgress, - onOpenExternalLink, - network, - error, - } = this.props; + const { onClose, onPrint, inProgress, onOpenExternalLink, network, error } = + this.props; const dialogClasses = classnames([styles.component, 'instructionsDialog']); const printButtonClasses = classnames([ 'printButton', @@ -191,13 +178,16 @@ class InstructionsDialog extends Component {
  • {intl.formatMessage(messages.instructionsListDefinition1, { - paperWalletRecoveryPhraseWordCount: PAPER_WALLET_RECOVERY_PHRASE_WORD_COUNT, - walletRecoveryPhraseWordCount: WALLET_RECOVERY_PHRASE_WORD_COUNT, + paperWalletRecoveryPhraseWordCount: + PAPER_WALLET_RECOVERY_PHRASE_WORD_COUNT, + walletRecoveryPhraseWordCount: + WALLET_RECOVERY_PHRASE_WORD_COUNT, })}
  • {intl.formatMessage(messages.instructionsListDefinition2, { - paperWalletWrittenWordsCount: PAPER_WALLET_WRITTEN_WORDS_COUNT, + paperWalletWrittenWordsCount: + PAPER_WALLET_WRITTEN_WORDS_COUNT, })}
  • diff --git a/source/renderer/app/components/wallet/paper-wallet-certificate/PrintDialog.tsx b/source/renderer/app/components/wallet/paper-wallet-certificate/PrintDialog.tsx index 2b5eadff39..1cc84cdb0a 100644 --- a/source/renderer/app/components/wallet/paper-wallet-certificate/PrintDialog.tsx +++ b/source/renderer/app/components/wallet/paper-wallet-certificate/PrintDialog.tsx @@ -36,16 +36,14 @@ const messages = defineMessages({ description: '"Paper wallet create certificate print dialog" info.', }, certificatePrintedConfirmationLabel: { - id: - 'paper.wallet.create.certificate.print.dialog.certificatePrintedConfirmation', + id: 'paper.wallet.create.certificate.print.dialog.certificatePrintedConfirmation', defaultMessage: '!!!Yes, the paper wallet certificate printed successfully.', description: '"Paper wallet create certificate print dialog" certificate printed confirmation.', }, certificateReadableConfirmationLabel: { - id: - 'paper.wallet.create.certificate.print.dialog.certificateReadableConfirmation', + id: 'paper.wallet.create.certificate.print.dialog.certificateReadableConfirmation', defaultMessage: '!!!Yes, first {paperWalletPrintedWordsCount} words of the paper wallet recovery phrase are readable.', description: @@ -154,7 +152,8 @@ class PrintDialog extends Component { label={intl.formatMessage( messages.certificateReadableConfirmationLabel, { - paperWalletPrintedWordsCount: PAPER_WALLET_PRINTED_WORDS_COUNT, + paperWalletPrintedWordsCount: + PAPER_WALLET_PRINTED_WORDS_COUNT, } )} onChange={this.onConfirmReadable} diff --git a/source/renderer/app/components/wallet/paper-wallet-certificate/SecuringPasswordDialog.tsx b/source/renderer/app/components/wallet/paper-wallet-certificate/SecuringPasswordDialog.tsx index 5b1cb7bc49..b1d8ff9b6f 100644 --- a/source/renderer/app/components/wallet/paper-wallet-certificate/SecuringPasswordDialog.tsx +++ b/source/renderer/app/components/wallet/paper-wallet-certificate/SecuringPasswordDialog.tsx @@ -35,8 +35,7 @@ const messages = defineMessages({ description: 'You may write the remaining words here:', }, securingPasswordConfirmation: { - id: - 'paper.wallet.create.certificate.securingPassword.dialog.securingPasswordConfirmation', + id: 'paper.wallet.create.certificate.securingPassword.dialog.securingPasswordConfirmation', defaultMessage: '!!!I have written the remaining {paperWalletWrittenWordsCount} words on the certificate.', description: diff --git a/source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx b/source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx index 2787e9129b..7e23d0814c 100644 --- a/source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx +++ b/source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx @@ -43,22 +43,19 @@ const messages = defineMessages({ '"Paper wallet create certificate verification dialog" subtitle.', }, recoveryPhraseLabel: { - id: - 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.label', + id: 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.label', defaultMessage: '!!!Paper wallet recovery phrase', description: '"Paper wallet create certificate verification dialog" recovery phrase label.', }, recoveryPhraseHint: { - id: - 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.hint', + id: 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.hint', defaultMessage: '!!!Enter recovery phrase', description: '"Paper wallet create certificate verification dialog" recovery phrase hint.', }, recoveryPhraseNoResults: { - id: - 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.noResults', + id: 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.noResults', defaultMessage: '!!!No results', description: '"Paper wallet create certificate verification dialog" recovery phrase no results label.', @@ -70,16 +67,14 @@ const messages = defineMessages({ '"Paper wallet create certificate verification dialog" button clear label.', }, storingUnderstandanceLabel: { - id: - 'paper.wallet.create.certificate.verification.dialog.storingUnderstandanceConfirmationLabel', + id: 'paper.wallet.create.certificate.verification.dialog.storingUnderstandanceConfirmationLabel', defaultMessage: '!!!I understand that the paper wallet I create will not be stored in Daedalus.', description: '"Paper wallet create certificate verification dialog" storing understandance confirmation.', }, recoveringUnderstandanceLabel: { - id: - 'paper.wallet.create.certificate.verification.dialog.recoveringUnderstandanceConfirmationLabel', + id: 'paper.wallet.create.certificate.verification.dialog.recoveringUnderstandanceConfirmationLabel', defaultMessage: '!!!I understand that my paper wallet can be recovered only by using my paper wallet certificate.', description: @@ -226,11 +221,8 @@ class VerificationDialog extends Component { const { intl } = this.context; const { form, resetForm } = this; const { suggestedMnemonics, onClose } = this.props; - const { - storingConfirmed, - recoveringConfirmed, - isRecoveryPhraseValid, - } = this.state; + const { storingConfirmed, recoveringConfirmed, isRecoveryPhraseValid } = + this.state; const recoveryPhraseField = form.$('recoveryPhrase'); const dialogClasses = classnames([styles.dialog, 'verificationDialog']); const storingUnderstandanceCheckboxClasses = classnames([ diff --git a/source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx b/source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx index a24d008938..690cad5ad9 100644 --- a/source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx +++ b/source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx @@ -197,9 +197,8 @@ class WalletReceiveDialog extends Component { }; constructPaths = (address: WalletAddress) => { const hardenedSpendingPath = utils.str_to_path(address.spendingPath); - const derivationSpendingPath = hardenedPathToDerivationPath( - hardenedSpendingPath - ); + const derivationSpendingPath = + hardenedPathToDerivationPath(hardenedSpendingPath); const spendingPath = map( derivationSpendingPath.constructed, (constructeSpendingPathChunk, index) => { diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.messages.ts b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.messages.ts index f224536b3c..319ace9ef8 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.messages.ts +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.messages.ts @@ -93,15 +93,13 @@ export const getMessages = () => { description: 'Label for "unformated amount"', }, unformattedAmountMessageForSoftwareWallets: { - id: - 'wallet.send.confirmationDialog.unformattedAmountMessageForSoftwareWallets', + id: 'wallet.send.confirmationDialog.unformattedAmountMessageForSoftwareWallets', defaultMessage: '!!!Native assets may specify a number of decimal places, as defined in the Cardano token registry. Daedalus uses this information to format the amount that is being sent in the transaction.

    The native token unformatted amount is the amount without these decimal places. Please ensure that you verify both amounts, as some wallet software may not yet use the Cardano token registry.', description: 'Message for "unformated amount"', }, unformattedAmountMessageForHardwareWallets: { - id: - 'wallet.send.confirmationDialog.unformattedAmountMessageForHardwareWallets', + id: 'wallet.send.confirmationDialog.unformattedAmountMessageForHardwareWallets', defaultMessage: '!!!Native assets may specify a number of decimal places, as defined in the Cardano token registry. Daedalus uses this information to format the amount that is being sent in the transaction.

    The native token unformatted amount is the amount without these decimal places. Please ensure that you verify both amounts, as some wallet software may not yet use the Cardano token registry.

    The native token unformatted amount will be displayed on the hardware wallet device during transaction confirmation.', description: 'Message for "unformated amount"', diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx index 7d5710b5f4..65f1f73fc7 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx @@ -150,12 +150,8 @@ class WalletSendAssetsConfirmationDialog extends Component { this.form.submit({ onSuccess: (form) => { const { selectedAssets, assetsAmounts } = this.state; - const { - receiver, - amount, - amountToNaturalUnits, - isHardwareWallet, - } = this.props; + const { receiver, amount, amountToNaturalUnits, isHardwareWallet } = + this.props; const { passphrase } = form.values(); const hasAssetsRemainingAfterTransaction = this.props.allAvailableTokens?.length > 0; @@ -181,13 +177,8 @@ class WalletSendAssetsConfirmationDialog extends Component { ): React.ReactElement, any> | null => { const passphraseField = this.form.$('passphrase'); const { areTermsAccepted } = this.state; - const { - hwDeviceStatus, - isFlight, - onExternalLinkClick, - wallet, - isTrezor, - } = this.props; + const { hwDeviceStatus, isFlight, onExternalLinkClick, wallet, isTrezor } = + this.props; let returnJSX = null; if (!isFlight || (isFlight && areTermsAccepted)) { diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx index 33285cb7d8..44d07836be 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx @@ -115,12 +115,8 @@ class WalletSendConfirmationDialog extends Component { submit = () => { this.form.submit({ onSuccess: (form) => { - const { - receiver, - amount, - amountToNaturalUnits, - isHardwareWallet, - } = this.props; + const { receiver, amount, amountToNaturalUnits, isHardwareWallet } = + this.props; const { passphrase } = form.values(); const hasAssetsRemainingAfterTransaction = this.props.allAvailableTokens?.length && @@ -145,13 +141,8 @@ class WalletSendConfirmationDialog extends Component { ): React.ReactElement, any> | null | undefined => { const passphraseField = this.form.$('passphrase'); const { areTermsAccepted } = this.state; - const { - hwDeviceStatus, - isFlight, - onExternalLinkClick, - wallet, - isTrezor, - } = this.props; + const { hwDeviceStatus, isFlight, onExternalLinkClick, wallet, isTrezor } = + this.props; if (!isFlight || (isFlight && areTermsAccepted)) { const { name } = wallet; diff --git a/source/renderer/app/components/wallet/settings/ICOPublicKeyBox.tsx b/source/renderer/app/components/wallet/settings/ICOPublicKeyBox.tsx index 1e9ed96333..ec2bec5458 100644 --- a/source/renderer/app/components/wallet/settings/ICOPublicKeyBox.tsx +++ b/source/renderer/app/components/wallet/settings/ICOPublicKeyBox.tsx @@ -42,13 +42,8 @@ type Props = { }; const ICOPublicKeyBox = (props: Props) => { - const { - publicKey, - locale, - onCopyICOPublicKey, - openDialogAction, - intl, - } = props; + const { publicKey, locale, onCopyICOPublicKey, openDialogAction, intl } = + props; return ( <> diff --git a/source/renderer/app/components/wallet/settings/PublicKeyField.tsx b/source/renderer/app/components/wallet/settings/PublicKeyField.tsx index c3bb21dc35..45f26e9258 100644 --- a/source/renderer/app/components/wallet/settings/PublicKeyField.tsx +++ b/source/renderer/app/components/wallet/settings/PublicKeyField.tsx @@ -58,9 +58,10 @@ const PublicKeyField = (props: Props) => { useEffect(() => { setPublicKeyHidden(true); }, []); - const handleCopyPublicKey = useCallback(() => onCopyPublicKey(publicKey), [ - publicKey, - ]); + const handleCopyPublicKey = useCallback( + () => onCopyPublicKey(publicKey), + [publicKey] + ); const fieldStyles = classnames([ styles.field, publicKeyHidden || !publicKey ? styles.valueHidden : styles.valueShown, diff --git a/source/renderer/app/components/wallet/settings/WalletRecoveryPhraseVerificationWidget.tsx b/source/renderer/app/components/wallet/settings/WalletRecoveryPhraseVerificationWidget.tsx index b73d5c6cdf..623a021270 100644 --- a/source/renderer/app/components/wallet/settings/WalletRecoveryPhraseVerificationWidget.tsx +++ b/source/renderer/app/components/wallet/settings/WalletRecoveryPhraseVerificationWidget.tsx @@ -119,8 +119,7 @@ export const messages = defineMessages({ 'Label for the recoveryPhraseVerificationButton on wallet settings.', }, timeUntilWarningReplacement: { - id: - 'wallet.settings.recoveryPhraseVerification.timeUntilWarningReplacement', + id: 'wallet.settings.recoveryPhraseVerification.timeUntilWarningReplacement', defaultMessage: '!!!ヶ月,か月', description: 'Label for the recoveryPhraseVerificationButton on wallet settings.', @@ -227,12 +226,8 @@ class WalletRecoveryPhraseVerificationWidget extends Component { recoveryPhraseVerificationDate, isLegacy, } = this.props; - const { - icon, - message, - timeAgo, - timeUntilWarning, - } = this.recoveryPhraseStatus; + const { icon, message, timeAgo, timeUntilWarning } = + this.recoveryPhraseStatus; const { recoveryPhraseVerificationStatus } = getStatusFromWalletData({ creationDate, recoveryPhraseVerificationDate, diff --git a/source/renderer/app/components/wallet/settings/WalletSettings.tsx b/source/renderer/app/components/wallet/settings/WalletSettings.tsx index 069d74dded..665c14ef03 100644 --- a/source/renderer/app/components/wallet/settings/WalletSettings.tsx +++ b/source/renderer/app/components/wallet/settings/WalletSettings.tsx @@ -182,11 +182,8 @@ class WalletSettings extends Component { }); }; onUndelegateWalletClick = async () => { - const { - walletId, - openDialogAction, - updateDataForActiveDialogAction, - } = this.props; + const { walletId, openDialogAction, updateDataForActiveDialogAction } = + this.props; this.onBlockForm(); openDialogAction({ dialog: UndelegateWalletConfirmationDialog, diff --git a/source/renderer/app/components/wallet/tokens/wallet-token-picker/WalletTokenPickerCheckbox.tsx b/source/renderer/app/components/wallet/tokens/wallet-token-picker/WalletTokenPickerCheckbox.tsx index 98749792f2..a9aa9998af 100644 --- a/source/renderer/app/components/wallet/tokens/wallet-token-picker/WalletTokenPickerCheckbox.tsx +++ b/source/renderer/app/components/wallet/tokens/wallet-token-picker/WalletTokenPickerCheckbox.tsx @@ -17,10 +17,10 @@ const WalletTokenPickerCheckbox = ({ }: Props) => { const checked = isChecked || isPreviouslyChecked; const toolTipDisabled = !isMaxCount || checked; - const onChange = useCallback(() => toggleCheckbox(uniqueId), [ - toggleCheckbox, - uniqueId, - ]); + const onChange = useCallback( + () => toggleCheckbox(uniqueId), + [toggleCheckbox, uniqueId] + ); return (
    { }, [sortDirection, hasSorting, sortBy] ); - const onSortByToken = useCallback(() => onSortBy('token'), [ - sortDirection, - sortBy, - hasSorting, - ]); - const onSortByAmount = useCallback(() => onSortBy('quantity'), [ - sortDirection, - sortBy, - hasSorting, - ]); + const onSortByToken = useCallback( + () => onSortBy('token'), + [sortDirection, sortBy, hasSorting] + ); + const onSortByAmount = useCallback( + () => onSortBy('quantity'), + [sortDirection, sortBy, hasSorting] + ); const hasTokens = assets.length || isLoadingAssets; if (!hasTokens) return ( diff --git a/source/renderer/app/components/wallet/transactions/Transaction.tsx b/source/renderer/app/components/wallet/transactions/Transaction.tsx index eae102b850..fe26205f94 100644 --- a/source/renderer/app/components/wallet/transactions/Transaction.tsx +++ b/source/renderer/app/components/wallet/transactions/Transaction.tsx @@ -402,12 +402,8 @@ export default class Transaction extends Component { } get assetsList(): Array { - const { - assetTokens, - data, - isInternalAddress, - hasAssetsEnabled, - } = this.props; + const { assetTokens, data, isInternalAddress, hasAssetsEnabled } = + this.props; if (!hasAssetsEnabled) { return []; @@ -424,9 +420,8 @@ export default class Transaction extends Component { const type = this.hasAssets ? data.type : null; if (addresses && addresses.length > 0) { - const hasUnresolvedAddresses = this.includesUnresolvedAddresses( - addresses - ); + const hasUnresolvedAddresses = + this.includesUnresolvedAddresses(addresses); return type !== TransactionTypes.EXPEND && hasUnresolvedAddresses ? (
    { if (!filterOptions || !activeWallet) return null; let walletTransactions = null; // const { searchLimit } = filterOptions; - const numberOfFilterDimensionsApplied = getNumberOfFilterDimensionsApplied( - filterOptions - ); + const numberOfFilterDimensionsApplied = + getNumberOfFilterDimensionsApplied(filterOptions); const noTransactionsLabel = intl.formatMessage(messages.noTransactions); const isRestoreActive = activeWallet && activeWallet.isRestoring; const isFilterDisabled = diff --git a/source/renderer/app/components/wallet/transactions/WalletTransactionsList.tsx b/source/renderer/app/components/wallet/transactions/WalletTransactionsList.tsx index 0e892bfb3f..f0a17bb0f4 100644 --- a/source/renderer/app/components/wallet/transactions/WalletTransactionsList.tsx +++ b/source/renderer/app/components/wallet/transactions/WalletTransactionsList.tsx @@ -45,11 +45,10 @@ const messages = defineMessages({ export type ScrollContextType = { setIsScrolling: (...args: Array) => any; }; -export const WalletTransactionsListScrollContext = React.createContext< - ScrollContextType ->({ - setIsScrolling: () => null, -}); +export const WalletTransactionsListScrollContext = + React.createContext({ + setIsScrolling: () => null, + }); type Props = { deletePendingTransaction: (...args: Array) => any; formattedWalletAmount: (...args: Array) => any; diff --git a/source/renderer/app/components/wallet/transactions/metadata/MetadataValueView.tsx b/source/renderer/app/components/wallet/transactions/metadata/MetadataValueView.tsx index e9246fc5f1..2d87be1e69 100644 --- a/source/renderer/app/components/wallet/transactions/metadata/MetadataValueView.tsx +++ b/source/renderer/app/components/wallet/transactions/metadata/MetadataValueView.tsx @@ -31,14 +31,16 @@ function BytesView({ value }: { value: MetadataBytes }) { function ListView({ value }: { value: MetadataList }) { return (
      - {value.list.map(( - v, - index // eslint-disable-next-line react/no-array-index-key - ) => ( -
    1. - -
    2. - ))} + {value.list.map( + ( + v, + index // eslint-disable-next-line react/no-array-index-key + ) => ( +
    3. + +
    4. + ) + )}
    ); } @@ -46,14 +48,16 @@ function ListView({ value }: { value: MetadataList }) { function MapView({ value }: { value: MetadataMap }) { return (
      - {value.map.map(( - v, - index // eslint-disable-next-line react/no-array-index-key - ) => ( -
    1. - : -
    2. - ))} + {value.map.map( + ( + v, + index // eslint-disable-next-line react/no-array-index-key + ) => ( +
    3. + : +
    4. + ) + )}
    ); } diff --git a/source/renderer/app/components/wallet/transactions/render-strategies/SimpleTransactionList.tsx b/source/renderer/app/components/wallet/transactions/render-strategies/SimpleTransactionList.tsx index 5838a3b57a..20f064db9d 100644 --- a/source/renderer/app/components/wallet/transactions/render-strategies/SimpleTransactionList.tsx +++ b/source/renderer/app/components/wallet/transactions/render-strategies/SimpleTransactionList.tsx @@ -40,14 +40,16 @@ class SimpleTransactionList extends Component { className={styles.component} onScroll={(evt) => this.onListScroll(context, evt)} > - {rows.map(( - row, - index // eslint-disable-next-line react/no-array-index-key - ) => ( -
    - {renderRow(row)} -
    - ))} + {rows.map( + ( + row, + index // eslint-disable-next-line react/no-array-index-key + ) => ( +
    + {renderRow(row)} +
    + ) + )}
    )} diff --git a/source/renderer/app/components/wallet/wallet-import/WalletSelectImportDialog.tsx b/source/renderer/app/components/wallet/wallet-import/WalletSelectImportDialog.tsx index c00eda2ead..2449b3b106 100644 --- a/source/renderer/app/components/wallet/wallet-import/WalletSelectImportDialog.tsx +++ b/source/renderer/app/components/wallet/wallet-import/WalletSelectImportDialog.tsx @@ -187,8 +187,8 @@ class WalletSelectImportDialog extends Component { ); if (checkboxes[index] && topWrapper.length) { - const checkboxTopOffset = checkboxes[index].getBoundingClientRect() - .top; + const checkboxTopOffset = + checkboxes[index].getBoundingClientRect().top; const topWrapperTopOffset = topWrapper[0].getBoundingClientRect().top; const topPart = topWrapperTopOffset + 121; const spaceForTooltip = checkboxTopOffset - topPart; diff --git a/source/renderer/app/components/wallet/wallet-restore/ConfigurationDialog.tsx b/source/renderer/app/components/wallet/wallet-restore/ConfigurationDialog.tsx index f09b4bdd13..6d39d22eed 100644 --- a/source/renderer/app/components/wallet/wallet-restore/ConfigurationDialog.tsx +++ b/source/renderer/app/components/wallet/wallet-restore/ConfigurationDialog.tsx @@ -62,8 +62,7 @@ const messages = defineMessages({ 'Label for the "Repeat password" input in the wallet restore dialog.', }, passwordFieldsPlaceholder: { - id: - 'wallet.restore.dialog.step.configuration.input.passwordFields.placeholder', + id: 'wallet.restore.dialog.step.configuration.input.passwordFields.placeholder', defaultMessage: '!!!Password', description: 'Placeholder for the "Password" inputs in the wallet restore dialog.', diff --git a/source/renderer/app/components/wallet/wallet-restore/MnemonicsDialog.tsx b/source/renderer/app/components/wallet/wallet-restore/MnemonicsDialog.tsx index 10c768e8e2..6b25a34bb2 100644 --- a/source/renderer/app/components/wallet/wallet-restore/MnemonicsDialog.tsx +++ b/source/renderer/app/components/wallet/wallet-restore/MnemonicsDialog.tsx @@ -26,8 +26,7 @@ const messages = defineMessages({ description: 'Placeholder for the mnemonics autocomplete.', }, autocompleteMultiLengthPhrase: { - id: - 'wallet.restore.dialog.step.mnemonics.autocomplete.multiLengthPhrase.placeholder', + id: 'wallet.restore.dialog.step.mnemonics.autocomplete.multiLengthPhrase.placeholder', defaultMessage: '!!!Enter your 12, 18 or 24-word recovery phrase', description: 'Placeholder for the multi-length mnemonics autocomplete.', }, @@ -43,8 +42,7 @@ const messages = defineMessages({ description: 'Label for the mnemonics Continue button.', }, invalidRecoveryPhrase: { - id: - 'wallet.restore.dialog.step.mnemonics.autocomplete.invalidRecoveryPhrase', + id: 'wallet.restore.dialog.step.mnemonics.autocomplete.invalidRecoveryPhrase', defaultMessage: '!!!Invalid recovery phrase', description: 'Label for invalid recovery phrase', }, diff --git a/source/renderer/app/components/wallet/wallet-restore/WalletTypeDialog.tsx b/source/renderer/app/components/wallet/wallet-restore/WalletTypeDialog.tsx index c59cb1d97a..c60e57d430 100644 --- a/source/renderer/app/components/wallet/wallet-restore/WalletTypeDialog.tsx +++ b/source/renderer/app/components/wallet/wallet-restore/WalletTypeDialog.tsx @@ -51,29 +51,25 @@ const messages = defineMessages({ description: 'Label for the "labelDaedalusWalletKind" checkbox.', }, labelDaedalusWalletKind12WordByron: { - id: - 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind12WordByron', + id: 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind12WordByron', defaultMessage: '!!!12 words (Byron legacy wallet)', description: 'Label for the "labelDaedalusWalletKind12WordByron" checkbox.', }, labelDaedalusWalletKind15WordShelley: { - id: - 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind15WordShelley', + id: 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind15WordShelley', defaultMessage: '!!!15 words (Incentivized Testnet Rewards wallet)', description: 'Label for the "labelDaedalusWalletKind15WordShelley" checkbox.', }, labelDaedalusWalletKind24WordShelley: { - id: - 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind24WordShelley', + id: 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind24WordShelley', defaultMessage: '!!!24 words (Shelley wallet)', description: 'Label for the "labelDaedalusWalletKind24WordShelley" checkbox.', }, labelDaedalusWalletKind27WordPaper: { - id: - 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind27WordPaper', + id: 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind27WordPaper', defaultMessage: '!!!27 words - paper wallet (Byron legacy wallet)', description: 'Label for the "labelDaedalusWalletKind27WordPaper" checkbox.', }, @@ -83,14 +79,12 @@ const messages = defineMessages({ description: 'Label for the "labelYoroiWalletKind" checkbox.', }, labelYoroiWalletKind15WordByron: { - id: - 'wallet.restore.dialog.step.walletKind.label.yoroiWalletKindByronLegacy15Word', + id: 'wallet.restore.dialog.step.walletKind.label.yoroiWalletKindByronLegacy15Word', defaultMessage: '!!!15 words (Byron legacy wallet)', description: 'Label for the "labelDaedalusWalletKind15WordByron" checkbox.', }, labelYoroiWalletKind15WordShelley: { - id: - 'wallet.restore.dialog.step.walletKind.label.yoroiWalletKindShelley15Word', + id: 'wallet.restore.dialog.step.walletKind.label.yoroiWalletKindShelley15Word', defaultMessage: '!!!15 words (Shelley wallet)', description: 'Label for the "labelDaedalusWalletKind15WordShelley" checkbox.', diff --git a/source/renderer/app/components/widgets/BorderedBox.tsx b/source/renderer/app/components/widgets/BorderedBox.tsx index af929902cf..5b600865d0 100644 --- a/source/renderer/app/components/widgets/BorderedBox.tsx +++ b/source/renderer/app/components/widgets/BorderedBox.tsx @@ -17,13 +17,8 @@ type Props = { @observer class BorderedBox extends Component { render() { - const { - children, - className, - fullHeight, - onMouseEnter, - onMouseLeave, - } = this.props; + const { children, className, fullHeight, onMouseEnter, onMouseLeave } = + this.props; const componentClasses = classnames([ styles.component, fullHeight ? styles.fullHeight : null, diff --git a/source/renderer/app/components/widgets/forms/PinCode.tsx b/source/renderer/app/components/widgets/forms/PinCode.tsx index bd34c32997..d4b430a12e 100644 --- a/source/renderer/app/components/widgets/forms/PinCode.tsx +++ b/source/renderer/app/components/widgets/forms/PinCode.tsx @@ -67,16 +67,8 @@ export default class PinCode extends Component { } generatePinCodeInput = () => { - const { - id, - name, - type, - autoFocus, - length, - error, - value, - disabled, - } = this.props; + const { id, name, type, autoFocus, length, error, value, disabled } = + this.props; const pinCodeClasses = classNames([ styles.pinCode, error ? styles.error : null, diff --git a/source/renderer/app/config/currencyConfig.ts b/source/renderer/app/config/currencyConfig.ts index 33503780f3..efcfc8857a 100644 --- a/source/renderer/app/config/currencyConfig.ts +++ b/source/renderer/app/config/currencyConfig.ts @@ -27,29 +27,31 @@ export const CURRENCY_DEFAULT_SELECTED = currenciesList.usd; export const CURRENCY_REQUEST_RATE_INTERVAL = 60 * 1000; // 1 minute | unit: milliseconds // Generic function for all the Currency requests -export const genericCurrencyRequest = ( - requestName: RequestName - // @ts-ignore ts-migrate(1064) FIXME: The return type of an async function or method mus... Remove this comment to see the full error message -): ((...args: Array) => any) => async (payload?: any): any => { - const request = currencyConfig.requests[requestName]; - let response; +export const genericCurrencyRequest = + ( + requestName: RequestName + // @ts-ignore ts-migrate(1064) FIXME: The return type of an async function or method mus... Remove this comment to see the full error message + ): ((...args: Array) => any) => + async (payload?: any): any => { + const request = currencyConfig.requests[requestName]; + let response; - if (Array.isArray(request)) { - response = []; + if (Array.isArray(request)) { + response = []; - for (const req of request) { - const responseItem = await externalRequest(req); - response.push(responseItem); + for (const req of request) { + const responseItem = await externalRequest(req); + response.push(responseItem); + } + } else if (typeof request === 'function') { + const req = request(payload); + response = await externalRequest(req); + } else if (request) { + response = await externalRequest(request); } - } else if (typeof request === 'function') { - const req = request(payload); - response = await externalRequest(req); - } else if (request) { - response = await externalRequest(request); - } - return response; -}; + return response; + }; export const getLocalizedCurrenciesList = ( rawCurrencyList: Array, currentLocale: Locale diff --git a/source/renderer/app/config/walletRestoreConfig.ts b/source/renderer/app/config/walletRestoreConfig.ts index cd958e840c..87f48eec24 100644 --- a/source/renderer/app/config/walletRestoreConfig.ts +++ b/source/renderer/app/config/walletRestoreConfig.ts @@ -26,21 +26,19 @@ export const WALLET_KINDS: EnumMap = { YOROI: 'Yoroi', // HARDWARE: 'Hardware', }; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'EnumMap'. -export const WALLET_DAEDALUS_KINDS: EnumMap< - string, - WalletDaedalusKind -> = isMainnet - ? { - BYRON_12_WORD: '12WordByron', - SHELLEY_24_WORD: '24WordShelley', - BYRON_27_WORD: '27WordPaper', - } - : { - BYRON_12_WORD: '12WordByron', - SHELLEY_15_WORD: '15WordShelley', - SHELLEY_24_WORD: '24WordShelley', - BYRON_27_WORD: '27WordPaper', - }; +export const WALLET_DAEDALUS_KINDS: EnumMap = + isMainnet + ? { + BYRON_12_WORD: '12WordByron', + SHELLEY_24_WORD: '24WordShelley', + BYRON_27_WORD: '27WordPaper', + } + : { + BYRON_12_WORD: '12WordByron', + SHELLEY_15_WORD: '15WordShelley', + SHELLEY_24_WORD: '24WordShelley', + BYRON_27_WORD: '27WordPaper', + }; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'EnumMap'. export const WALLET_YOROI_KINDS: EnumMap = { BYRON_15_WORD: '15WordByron', diff --git a/source/renderer/app/containers/TopBarContainer.tsx b/source/renderer/app/containers/TopBarContainer.tsx index 7504832db1..bd1a353903 100644 --- a/source/renderer/app/containers/TopBarContainer.tsx +++ b/source/renderer/app/containers/TopBarContainer.tsx @@ -24,15 +24,8 @@ const TopBarContainer = ( stores: null, } ) => { - const { - sidebar, - app, - networkStatus, - wallets, - newsFeed, - appUpdate, - staking, - } = stores; + const { sidebar, app, networkStatus, wallets, newsFeed, appUpdate, staking } = + stores; const { isSynced, syncPercentage, diff --git a/source/renderer/app/containers/appUpdate/AppUpdateContainer.tsx b/source/renderer/app/containers/appUpdate/AppUpdateContainer.tsx index 2861e4c4e4..176acf97c9 100644 --- a/source/renderer/app/containers/appUpdate/AppUpdateContainer.tsx +++ b/source/renderer/app/containers/appUpdate/AppUpdateContainer.tsx @@ -30,11 +30,8 @@ class AppUpdateContainer extends Component { isWaitingToQuitDaedalus, installationProgress, } = appUpdate; - const { - installUpdate, - closeAppUpdateOverlay, - postponeUpdate, - } = actions.appUpdate; + const { installUpdate, closeAppUpdateOverlay, postponeUpdate } = + actions.appUpdate; if (!availableUpdate) return null; return ( { } get isSystemTimeError() { - const { - isSystemTimeCorrect, - isNodeStopping, - isNodeStopped, - } = this.networkStatus; + const { isSystemTimeCorrect, isNodeStopping, isNodeStopped } = + this.networkStatus; return !isSystemTimeCorrect && !isNodeStopping && !isNodeStopped; } diff --git a/source/renderer/app/containers/loading/NoDiskSpaceErrorPage.tsx b/source/renderer/app/containers/loading/NoDiskSpaceErrorPage.tsx index 626b4923ee..e54b91aa96 100644 --- a/source/renderer/app/containers/loading/NoDiskSpaceErrorPage.tsx +++ b/source/renderer/app/containers/loading/NoDiskSpaceErrorPage.tsx @@ -14,11 +14,8 @@ class NoDiskSpaceErrorPage extends Component { render() { const { stores } = this.props; - const { - diskSpaceRequired, - diskSpaceMissing, - diskSpaceRecommended, - } = stores.networkStatus; + const { diskSpaceRequired, diskSpaceMissing, diskSpaceRecommended } = + stores.networkStatus; return ( { }; render() { - const { - newsFeed, - appUpdate, - networkStatus, - profile, - app, - } = this.props.stores; + const { newsFeed, appUpdate, networkStatus, profile, app } = + this.props.stores; const { cardanoNodeState, isNodeResponding, diff --git a/source/renderer/app/containers/loading/SystemTimeErrorPage.tsx b/source/renderer/app/containers/loading/SystemTimeErrorPage.tsx index 320aab74fd..fbede1c78d 100644 --- a/source/renderer/app/containers/loading/SystemTimeErrorPage.tsx +++ b/source/renderer/app/containers/loading/SystemTimeErrorPage.tsx @@ -15,10 +15,8 @@ class SystemTimeErrorPage extends Component { render() { const { actions, stores } = this.props; - const { - localTimeDifference, - ignoreSystemTimeChecks, - } = stores.networkStatus; + const { localTimeDifference, ignoreSystemTimeChecks } = + stores.networkStatus; const { forceCheckNetworkClock } = actions.networkStatus; const { app, networkStatus, profile } = stores; const { openExternalLink } = app; diff --git a/source/renderer/app/containers/news/NewsFeedContainer.tsx b/source/renderer/app/containers/news/NewsFeedContainer.tsx index 50a6339eb2..f0ae4f9666 100644 --- a/source/renderer/app/containers/news/NewsFeedContainer.tsx +++ b/source/renderer/app/containers/news/NewsFeedContainer.tsx @@ -21,11 +21,8 @@ class NewsFeedContainer extends Component { const { app, profile, appUpdate, newsFeed } = stores; const { newsFeedData, isLoadingNews, proceedNewsAction } = newsFeed; const { openAppUpdateOverlay } = actions.appUpdate; - const { - downloadProgress, - displayAppUpdateNewsItem, - isUpdatePostponed, - } = appUpdate; + const { downloadProgress, displayAppUpdateNewsItem, isUpdatePostponed } = + appUpdate; const { toggleNewsFeed } = actions.app; const { openExternalLink, newsFeedIsOpen } = app; const { currentDateFormat } = profile; diff --git a/source/renderer/app/containers/notifications/NotificationsContainer.tsx b/source/renderer/app/containers/notifications/NotificationsContainer.tsx index e0a1d2c97f..75219a0537 100644 --- a/source/renderer/app/containers/notifications/NotificationsContainer.tsx +++ b/source/renderer/app/containers/notifications/NotificationsContainer.tsx @@ -127,8 +127,8 @@ class NotificationsContainer extends Component { }, { id: 'downloadTransactionsCSVSuccess', - actionToListenAndOpen: this.props.actions.transactions - .requestCSVFileSuccess, + actionToListenAndOpen: + this.props.actions.transactions.requestCSVFileSuccess, actionToListenAndClose: this.props.actions.transactions.requestCSVFile, }, { @@ -145,8 +145,8 @@ class NotificationsContainer extends Component { }, { id: 'downloadAddressPDFSuccess', - actionToListenAndOpen: this.props.actions.wallets - .generateAddressPDFSuccess, + actionToListenAndOpen: + this.props.actions.wallets.generateAddressPDFSuccess, actionToListenAndClose: this.props.actions.wallets.generateAddressPDF, }, { @@ -161,13 +161,13 @@ class NotificationsContainer extends Component { }, { id: 'copyStateDirectoryPath', - actionToListenAndOpen: this.props.actions.networkStatus - .copyStateDirectoryPath, + actionToListenAndOpen: + this.props.actions.networkStatus.copyStateDirectoryPath, }, { id: 'copyAssetParam', - actionToListenAndOpen: this.props.actions.assets - .copyAssetParamNotification, + actionToListenAndOpen: + this.props.actions.assets.copyAssetParamNotification, }, ]; // @ts-ignore ts-migrate(2740) FIXME: Type '{ downloadLogsProgress: { icon: string; hasE... Remove this comment to see the full error message diff --git a/source/renderer/app/containers/profile/DataLayerMigrationPage.tsx b/source/renderer/app/containers/profile/DataLayerMigrationPage.tsx index c1ecd45076..ab006bad6c 100644 --- a/source/renderer/app/containers/profile/DataLayerMigrationPage.tsx +++ b/source/renderer/app/containers/profile/DataLayerMigrationPage.tsx @@ -16,9 +16,8 @@ class DataLayerMigrationPage extends Component { }; render() { - const { - setDataLayerMigrationAcceptanceRequest, - } = this.props.stores.profile; + const { setDataLayerMigrationAcceptanceRequest } = + this.props.stores.profile; return ( { render() { const { stores, actions } = this.props; - const { - smashServerUrl, - smashServerUrlError, - smashServerLoading, - } = stores.staking; + const { smashServerUrl, smashServerUrlError, smashServerLoading } = + stores.staking; const { isSynced, syncPercentage } = stores.networkStatus; const { openExternalLink } = stores.app; const { resetSmashServerError } = actions.staking; diff --git a/source/renderer/app/containers/staking/RedeemItnRewardsContainer.tsx b/source/renderer/app/containers/staking/RedeemItnRewardsContainer.tsx index 5a433a2a54..95097c1409 100644 --- a/source/renderer/app/containers/staking/RedeemItnRewardsContainer.tsx +++ b/source/renderer/app/containers/staking/RedeemItnRewardsContainer.tsx @@ -30,11 +30,8 @@ class RedeemItnRewardsContainer extends Component { render() { const { stores, actions } = this.props; const { allWallets } = stores.wallets; - const { - redeemStep, - isSubmittingReedem, - isCalculatingReedemFees, - } = stores.staking; + const { redeemStep, isSubmittingReedem, isCalculatingReedemFees } = + stores.staking; const { isSynced } = stores.networkStatus; const { onRedeemStart, closeRedeemDialog } = actions.staking; if (!redeemStep) return null; diff --git a/source/renderer/app/containers/staking/StakePoolsListPage.tsx b/source/renderer/app/containers/staking/StakePoolsListPage.tsx index d60a5e6154..cf627057c1 100644 --- a/source/renderer/app/containers/staking/StakePoolsListPage.tsx +++ b/source/renderer/app/containers/staking/StakePoolsListPage.tsx @@ -48,14 +48,8 @@ class StakePoolsListPage extends Component { }; render() { - const { - uiDialogs, - staking, - app, - networkStatus, - profile, - wallets, - } = this.props.stores; + const { uiDialogs, staking, app, networkStatus, profile, wallets } = + this.props.stores; const { currentTheme, currentLocale } = profile; const { isSynced } = networkStatus; const { diff --git a/source/renderer/app/containers/staking/Staking.tsx b/source/renderer/app/containers/staking/Staking.tsx index 3b8b538eb3..2d87a55f10 100644 --- a/source/renderer/app/containers/staking/Staking.tsx +++ b/source/renderer/app/containers/staking/Staking.tsx @@ -82,12 +82,8 @@ class Staking extends Component { stores: { app, staking, networkStatus, uiDialogs }, children, } = this.props; - const { - isSynced, - syncPercentage, - isAlonzoPending, - isAlonzoActivated, - } = networkStatus; + const { isSynced, syncPercentage, isAlonzoPending, isAlonzoActivated } = + networkStatus; const { isStakingDelegationCountdown } = staking; const shouldShowInfoTab = isAlonzoPending || isAlonzoActivated; const isDelegationWizardOpen = uiDialogs.isOpen( diff --git a/source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.tsx b/source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.tsx index 41e4819678..1c7751355b 100644 --- a/source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.tsx +++ b/source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.tsx @@ -165,20 +165,10 @@ class DelegationSetupWizardDialogContainer extends Component { }; render() { - const { - activeStep, - selectedWalletId, - selectedPoolId, - stakePoolJoinFee, - } = this.state; - const { - app, - staking, - wallets, - profile, - networkStatus, - hardwareWallets, - } = this.props.stores; + const { activeStep, selectedWalletId, selectedPoolId, stakePoolJoinFee } = + this.state; + const { app, staking, wallets, profile, networkStatus, hardwareWallets } = + this.props.stores; const { futureEpoch } = networkStatus; const { currentTheme, currentLocale } = profile; const { diff --git a/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx b/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx index 3a41d7f117..0a1d8c246f 100644 --- a/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx +++ b/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx @@ -45,16 +45,11 @@ class Step1ConfigurationContainer extends Component { const { actions, stores, onBack, onClose } = this.props; const { app, staking, wallets } = stores; const { allWallets } = wallets; - const { - redeemWallet, - isCalculatingReedemFees, - redeemRecoveryPhrase, - } = staking; + const { redeemWallet, isCalculatingReedemFees, redeemRecoveryPhrase } = + staking; const { openExternalLink } = app; - const { - onConfigurationContinue, - onCalculateRedeemWalletFees, - } = actions.staking; + const { onConfigurationContinue, onCalculateRedeemWalletFees } = + actions.staking; const selectedWalletId = get(redeemWallet, 'id', null); const selectedWallet: Wallet | null | undefined = allWallets.find( (current: Wallet) => current && current.id === selectedWalletId diff --git a/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step3ResultContainer.tsx b/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step3ResultContainer.tsx index 6747fd4325..53d8d29112 100644 --- a/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step3ResultContainer.tsx +++ b/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step3ResultContainer.tsx @@ -15,12 +15,8 @@ class Step3ResultContainer extends Component { render() { const { onBack, onClose, stores, actions } = this.props; - const { - redeemWallet, - transactionFees, - redeemedRewards, - redeemSuccess, - } = stores.staking; + const { redeemWallet, transactionFees, redeemedRewards, redeemSuccess } = + stores.staking; const { onResultContinue } = actions.staking; if (!redeemWallet) throw new Error('Redeem wallet required'); diff --git a/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx b/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx index 20f99ba2d9..233f9be29d 100644 --- a/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx +++ b/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx @@ -145,18 +145,10 @@ class VotingRegistrationDialogContainer extends Component { }; render() { - const { - selectedWalletId, - transactionFee, - transactionFeeError, - } = this.state; - const { - wallets, - staking, - voting, - app, - hardwareWallets, - } = this.props.stores; + const { selectedWalletId, transactionFee, transactionFeeError } = + this.state; + const { wallets, staking, voting, app, hardwareWallets } = + this.props.stores; const { closeConfirmationDialog, saveAsPDF } = this.props.actions.voting; const { all } = wallets; const { stakePools, getStakePoolById } = staking; @@ -241,14 +233,8 @@ class VotingRegistrationDialogContainer extends Component { } async _handleCalculateTransactionFee() { - const { - transactions, - addresses, - app, - wallets, - hardwareWallets, - voting, - } = this.props.stores; + const { transactions, addresses, app, wallets, hardwareWallets, voting } = + this.props.stores; const { calculateTransactionFee } = transactions; const { getAddressesByWalletId } = addresses; const { getWalletById } = wallets; diff --git a/source/renderer/app/containers/wallet/TransferFundsPage.tsx b/source/renderer/app/containers/wallet/TransferFundsPage.tsx index c82fd1ef9f..44be12f46d 100644 --- a/source/renderer/app/containers/wallet/TransferFundsPage.tsx +++ b/source/renderer/app/containers/wallet/TransferFundsPage.tsx @@ -18,11 +18,8 @@ class TransferFundsPage extends Component { const { actions, stores } = this.props; const { wallets: walletsActions } = actions; const { wallets: walletsStore } = stores; - const { - transferFundsNextStep, - transferFundsPrevStep, - transferFundsClose, - } = walletsActions; + const { transferFundsNextStep, transferFundsPrevStep, transferFundsClose } = + walletsActions; const { transferFundsStep } = walletsStore; if (!transferFundsStep) return null; let Container; diff --git a/source/renderer/app/containers/wallet/Wallet.tsx b/source/renderer/app/containers/wallet/Wallet.tsx index 767df04818..830d708f5e 100644 --- a/source/renderer/app/containers/wallet/Wallet.tsx +++ b/source/renderer/app/containers/wallet/Wallet.tsx @@ -70,11 +70,8 @@ class Wallet extends Component { ); } - const { - hasNotification, - } = walletSettings.getWalletsRecoveryPhraseVerificationData( - activeWallet.id - ); + const { hasNotification } = + walletSettings.getWalletsRecoveryPhraseVerificationData(activeWallet.id); const { isRestoring, isLegacy, diff --git a/source/renderer/app/containers/wallet/WalletReceivePage.tsx b/source/renderer/app/containers/wallet/WalletReceivePage.tsx index e028f5070c..e29a7fdcef 100755 --- a/source/renderer/app/containers/wallet/WalletReceivePage.tsx +++ b/source/renderer/app/containers/wallet/WalletReceivePage.tsx @@ -173,13 +173,8 @@ class WalletReceivePage extends Component { render() { const { actions, stores } = this.props; - const { - uiDialogs, - addresses, - sidebar, - hardwareWallets, - walletSettings, - } = stores; + const { uiDialogs, addresses, sidebar, hardwareWallets, walletSettings } = + stores; const { activeWallet } = this; const { addressToShare } = this.state; const { toggleSubMenus } = actions.sidebar; @@ -192,10 +187,8 @@ class WalletReceivePage extends Component { checkIsTrezorByWalletId, } = hardwareWallets; const { getLocalWalletDataById } = walletSettings; - const localWalletData: - | WalletLocalData - | null - | undefined = getLocalWalletDataById(activeWallet ? activeWallet.id : ''); + const localWalletData: WalletLocalData | null | undefined = + getLocalWalletDataById(activeWallet ? activeWallet.id : ''); const { showUsedAddresses } = localWalletData || {}; // Guard against potential null values if (!activeWallet) diff --git a/source/renderer/app/containers/wallet/WalletSendPage.tsx b/source/renderer/app/containers/wallet/WalletSendPage.tsx index b129b7ebc2..f445397d52 100755 --- a/source/renderer/app/containers/wallet/WalletSendPage.tsx +++ b/source/renderer/app/containers/wallet/WalletSendPage.tsx @@ -29,36 +29,28 @@ class WalletSendPage extends Component { isHardwareWallet: boolean; selectedAssets?: ApiTokens; }) => { - const { - walletId, - address, - amount, - isHardwareWallet, - selectedAssets, - } = params; + const { walletId, address, amount, isHardwareWallet, selectedAssets } = + params; let fee; let minimumAda; if (isHardwareWallet) { - const coinsSelection = await this.props.stores.hardwareWallets.selectCoins( - { + const coinsSelection = + await this.props.stores.hardwareWallets.selectCoins({ walletId, address, amount, assets: selectedAssets, - } - ); + }); fee = coinsSelection.fee; } else { - ({ - fee, - minimumAda, - } = await this.props.stores.transactions.calculateTransactionFee({ - walletId, - address, - amount, - assets: selectedAssets, - })); + ({ fee, minimumAda } = + await this.props.stores.transactions.calculateTransactionFee({ + walletId, + address, + amount, + assets: selectedAssets, + })); } return { diff --git a/source/renderer/app/containers/wallet/WalletSummaryPage.tsx b/source/renderer/app/containers/wallet/WalletSummaryPage.tsx index 861b5fad32..17d42147f0 100755 --- a/source/renderer/app/containers/wallet/WalletSummaryPage.tsx +++ b/source/renderer/app/containers/wallet/WalletSummaryPage.tsx @@ -79,22 +79,12 @@ class WalletSummaryPage extends Component { render() { const { intl } = this.context; const { stores, actions } = this.props; - const { - app, - wallets, - addresses, - transactions, - profile, - assets, - currency, - } = stores; + const { app, wallets, addresses, transactions, profile, assets, currency } = + stores; const { all, getAsset, favorites } = assets; const { isInternalAddress } = addresses; - const { - onOpenAssetSend, - onCopyAssetParam, - onToggleFavorite, - } = actions.assets; + const { onOpenAssetSend, onCopyAssetParam, onToggleFavorite } = + actions.assets; const { openExternalLink, environment: { network }, diff --git a/source/renderer/app/containers/wallet/WalletTokensPage.tsx b/source/renderer/app/containers/wallet/WalletTokensPage.tsx index 5cdc9f1cfc..35e94f2345 100644 --- a/source/renderer/app/containers/wallet/WalletTokensPage.tsx +++ b/source/renderer/app/containers/wallet/WalletTokensPage.tsx @@ -17,17 +17,10 @@ const WalletTokensPage = inject( observer((props: Props) => { const { actions, stores } = props; const { assets, profile, wallets, app } = stores; - const { - all, - favorites, - insertingAssetUniqueId, - removingAssetUniqueId, - } = assets; - const { - setEditedAsset, - onOpenAssetSend, - onToggleFavorite, - } = actions.assets; + const { all, favorites, insertingAssetUniqueId, removingAssetUniqueId } = + assets; + const { setEditedAsset, onOpenAssetSend, onToggleFavorite } = + actions.assets; const { open } = actions.dialogs; const { active: activeWallet } = wallets; const { currentLocale } = profile; diff --git a/source/renderer/app/containers/wallet/dialogs/WalletCreateDialogContainer.tsx b/source/renderer/app/containers/wallet/dialogs/WalletCreateDialogContainer.tsx index 6568bc664d..e95a6637ae 100644 --- a/source/renderer/app/containers/wallet/dialogs/WalletCreateDialogContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/WalletCreateDialogContainer.tsx @@ -45,10 +45,8 @@ class WalletCreateDialogContainer extends Component { } onContinue = () => { - const { - createWalletChangeStep, - createWalletClose, - } = this.props.actions.wallets; + const { createWalletChangeStep, createWalletClose } = + this.props.actions.wallets; if (this.currentStep !== null) { if (this.currentStep < CREATE_WALLET_STEPS.length - 1) { @@ -73,10 +71,8 @@ class WalletCreateDialogContainer extends Component { onAbort = () => this.props.actions.wallets.createWalletAbort.trigger(); render() { - const { - createWalletStep, - createWalletShowAbortConfirmation, - } = this.props.stores.wallets; + const { createWalletStep, createWalletShowAbortConfirmation } = + this.props.stores.wallets; if (createWalletStep === null) { return null; diff --git a/source/renderer/app/containers/wallet/dialogs/WalletRestoreDialogContainer.tsx b/source/renderer/app/containers/wallet/dialogs/WalletRestoreDialogContainer.tsx index c26e4aca0a..2a8109287e 100644 --- a/source/renderer/app/containers/wallet/dialogs/WalletRestoreDialogContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/WalletRestoreDialogContainer.tsx @@ -29,10 +29,8 @@ class WalletRestoreContainer extends Component { render() { const { stores, actions } = this.props; - const { - restoreWalletStep, - restoreWalletShowAbortConfirmation, - } = stores.wallets; + const { restoreWalletStep, restoreWalletShowAbortConfirmation } = + stores.wallets; const { restoreWalletClose, restoreWalletCancelClose, diff --git a/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/InstructionsDialogContainer.tsx b/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/InstructionsDialogContainer.tsx index 14badd20dc..ab0d4c7990 100644 --- a/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/InstructionsDialogContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/InstructionsDialogContainer.tsx @@ -20,10 +20,8 @@ class InstructionsDialogContainer extends Component { onClose: () => {}, }; onPrint = async () => { - const { - currentDateFormat, - currentTimeFormatShort, - } = this.props.stores.profile; + const { currentDateFormat, currentTimeFormatShort } = + this.props.stores.profile; const date = moment(); const formattedDate = date.format(currentDateFormat); const formattedTime = date.format(currentTimeFormatShort); diff --git a/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/VerificationDialogContainer.tsx b/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/VerificationDialogContainer.tsx index 2df67f190c..8118117629 100644 --- a/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/VerificationDialogContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/VerificationDialogContainer.tsx @@ -21,10 +21,8 @@ class VerificationDialogContainer extends Component { render() { const { wallets } = this.props.stores; - const { - walletCertificateRecoveryPhrase, - additionalMnemonicWords, - } = wallets; + const { walletCertificateRecoveryPhrase, additionalMnemonicWords } = + wallets; if (!walletCertificateRecoveryPhrase || !additionalMnemonicWords) { throw new Error( diff --git a/source/renderer/app/containers/wallet/dialogs/settings/UndelegateWalletDialogContainer.tsx b/source/renderer/app/containers/wallet/dialogs/settings/UndelegateWalletDialogContainer.tsx index 17a496dccc..0e08884ae5 100644 --- a/source/renderer/app/containers/wallet/dialogs/settings/UndelegateWalletDialogContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/settings/UndelegateWalletDialogContainer.tsx @@ -94,13 +94,8 @@ class UndelegateWalletDialogContainer extends Component { render() { const { actions, stores, onExternalLinkClick } = this.props; - const { - wallets, - staking, - networkStatus, - profile, - hardwareWallets, - } = stores; + const { wallets, staking, networkStatus, profile, hardwareWallets } = + stores; const { futureEpoch } = networkStatus; const { currentLocale } = profile; const { @@ -121,10 +116,8 @@ class UndelegateWalletDialogContainer extends Component { if (!walletToBeUndelegated) return null; const isTrezor = checkIsTrezorByWalletId(walletToBeUndelegated.id); const { name: walletName } = walletToBeUndelegated; - const { - lastDelegatedStakePoolId, - delegatedStakePoolId, - } = walletToBeUndelegated; + const { lastDelegatedStakePoolId, delegatedStakePoolId } = + walletToBeUndelegated; const stakePoolId = lastDelegatedStakePoolId || delegatedStakePoolId || ''; if ( diff --git a/source/renderer/app/containers/wallet/dialogs/wallet-import/WalletSelectImportStepContainer.tsx b/source/renderer/app/containers/wallet/dialogs/wallet-import/WalletSelectImportStepContainer.tsx index b870981099..dcb73500a9 100644 --- a/source/renderer/app/containers/wallet/dialogs/wallet-import/WalletSelectImportStepContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/wallet-import/WalletSelectImportStepContainer.tsx @@ -33,11 +33,8 @@ class WalletSelectImportStepContainer extends Component { render() { const { onClose, onContinue, stores } = this.props; const { walletMigration, app } = stores; - const { - exportedWallets, - pendingImportWalletsCount, - isRestorationRunning, - } = walletMigration; + const { exportedWallets, pendingImportWalletsCount, isRestorationRunning } = + walletMigration; const { openExternalLink } = app; let walletsCount = this.state.existingWalletsCount + pendingImportWalletsCount; diff --git a/source/renderer/app/containers/wallet/dialogs/wallet-restore/StepConfigurationContainer.tsx b/source/renderer/app/containers/wallet/dialogs/wallet-restore/StepConfigurationContainer.tsx index c74e0699ee..a2f0573bb7 100644 --- a/source/renderer/app/containers/wallet/dialogs/wallet-restore/StepConfigurationContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/wallet-restore/StepConfigurationContainer.tsx @@ -25,15 +25,10 @@ class ConfigurationDialogContainer extends Component { const { wallets, profile } = stores; const { currentLocale } = profile; const { error } = wallets.restoreRequest; - const { - walletName, - spendingPassword, - repeatPassword, - isRestoring, - } = wallets; - const { - error: certificateError, - } = stores.wallets.getWalletRecoveryPhraseFromCertificateRequest; + const { walletName, spendingPassword, repeatPassword, isRestoring } = + wallets; + const { error: certificateError } = + stores.wallets.getWalletRecoveryPhraseFromCertificateRequest; return ( = new RendererIpcChannel(CARDANO_TLS_CONFIG_CHANNEL); -export const restartCardanoNodeChannel: RendererIpcChannel< - void, - void -> = new RendererIpcChannel(CARDANO_RESTART_CHANNEL); +export const restartCardanoNodeChannel: RendererIpcChannel = + new RendererIpcChannel(CARDANO_RESTART_CHANNEL); export const cardanoStateChangeChannel: RendererIpcChannel< CardanoNodeState, void > = new RendererIpcChannel(CARDANO_STATE_CHANNEL); -export const awaitUpdateChannel: RendererIpcChannel< - void, - void -> = new RendererIpcChannel(CARDANO_AWAIT_UPDATE_CHANNEL); +export const awaitUpdateChannel: RendererIpcChannel = + new RendererIpcChannel(CARDANO_AWAIT_UPDATE_CHANNEL); export const cardanoFaultInjectionChannel: RendererIpcChannel< void, FaultInjectionIpcRequest diff --git a/source/renderer/app/ipc/downloadManagerChannel.ts b/source/renderer/app/ipc/downloadManagerChannel.ts index 72174c26ca..c68b40aac9 100644 --- a/source/renderer/app/ipc/downloadManagerChannel.ts +++ b/source/renderer/app/ipc/downloadManagerChannel.ts @@ -26,15 +26,11 @@ import type { import { RendererIpcChannel } from './lib/RendererIpcChannel'; export const requestDownloadChannel: // IpcChannel -RendererIpcChannel< - DownloadMainResponse, - DownloadRendererRequest -> = new RendererIpcChannel(REQUEST_DOWNLOAD); +RendererIpcChannel = + new RendererIpcChannel(REQUEST_DOWNLOAD); export const requestResumeDownloadChannel: // IpcChannel -RendererIpcChannel< - ResumeDownloadMainResponse, - ResumeDownloadRendererRequest -> = new RendererIpcChannel(RESUME_DOWNLOAD); +RendererIpcChannel = + new RendererIpcChannel(RESUME_DOWNLOAD); export const deleteDownloadedFile: // IpcChannel RendererIpcChannel< DeleteDownloadedFileMainResponse, diff --git a/source/renderer/app/ipc/generateCsvChannel.ts b/source/renderer/app/ipc/generateCsvChannel.ts index bccab8ddb7..485b847837 100644 --- a/source/renderer/app/ipc/generateCsvChannel.ts +++ b/source/renderer/app/ipc/generateCsvChannel.ts @@ -6,7 +6,5 @@ import type { import { RendererIpcChannel } from './lib/RendererIpcChannel'; export const generateCsvChannel: // IpcChannel -RendererIpcChannel< - GenerateCsvMainResponse, - GenerateCsvRendererRequest -> = new RendererIpcChannel(GENERATE_CSV_CHANNEL); +RendererIpcChannel = + new RendererIpcChannel(GENERATE_CSV_CHANNEL); diff --git a/source/renderer/app/ipc/rebuild-application-menu.ts b/source/renderer/app/ipc/rebuild-application-menu.ts index 8194d027e4..957c20e501 100644 --- a/source/renderer/app/ipc/rebuild-application-menu.ts +++ b/source/renderer/app/ipc/rebuild-application-menu.ts @@ -9,6 +9,5 @@ export type RebuildApplicationMenu = RendererIpcChannel< RebuildAppMenuMainResponse, RebuildAppMenuRendererRequest >; -export const rebuildApplicationMenu: RebuildApplicationMenu = new RendererIpcChannel( - REBUILD_APP_MENU_CHANNEL -); +export const rebuildApplicationMenu: RebuildApplicationMenu = + new RendererIpcChannel(REBUILD_APP_MENU_CHANNEL); diff --git a/source/renderer/app/ipc/saveQRCodeImageChannel.ts b/source/renderer/app/ipc/saveQRCodeImageChannel.ts index ffd0e2eac8..fbbb210054 100644 --- a/source/renderer/app/ipc/saveQRCodeImageChannel.ts +++ b/source/renderer/app/ipc/saveQRCodeImageChannel.ts @@ -6,7 +6,5 @@ import type { import { RendererIpcChannel } from './lib/RendererIpcChannel'; export const saveQRCodeImageChannel: // IpcChannel -RendererIpcChannel< - GenerateQRCodeMainResponse, - GenerateQRCodeRendererRequest -> = new RendererIpcChannel(GENERATE_QRCODE_CHANNEL); +RendererIpcChannel = + new RendererIpcChannel(GENERATE_QRCODE_CHANNEL); diff --git a/source/renderer/app/ipc/show-file-dialog-channels.ts b/source/renderer/app/ipc/show-file-dialog-channels.ts index 0a6bd437ff..1c0cb81406 100644 --- a/source/renderer/app/ipc/show-file-dialog-channels.ts +++ b/source/renderer/app/ipc/show-file-dialog-channels.ts @@ -11,12 +11,8 @@ import type { } from '../../../common/ipc/api'; export const showOpenDialogChannel: // IpcChannel -RendererIpcChannel< - ShowOpenDialogMainResponse, - ShowOpenDialogRendererRequest -> = new RendererIpcChannel(SHOW_OPEN_DIALOG_CHANNEL); +RendererIpcChannel = + new RendererIpcChannel(SHOW_OPEN_DIALOG_CHANNEL); export const showSaveDialogChannel: // IpcChannel -RendererIpcChannel< - ShowSaveDialogMainResponse, - ShowSaveDialogRendererRequest -> = new RendererIpcChannel(SHOW_SAVE_DIALOG_CHANNEL); +RendererIpcChannel = + new RendererIpcChannel(SHOW_SAVE_DIALOG_CHANNEL); diff --git a/source/renderer/app/stores/AddressesStore.ts b/source/renderer/app/stores/AddressesStore.ts index e0ad276dd5..fb63b822a0 100644 --- a/source/renderer/app/stores/AddressesStore.ts +++ b/source/renderer/app/stores/AddressesStore.ts @@ -45,13 +45,12 @@ export default class AddressesStore extends Store { const { walletId, passphrase } = params; const accountIndex = await this.getAccountIndexByWalletId(walletId); // @ts-ignore ts-migrate(2739) FIXME: Type 'Address' is missing the following properties... Remove this comment to see the full error message - const address: WalletAddress = await this.createByronWalletAddressRequest.execute( - { + const address: WalletAddress = + await this.createByronWalletAddressRequest.execute({ addressIndex: accountIndex, passphrase, walletId, - } - ).promise; + }).promise; if (address != null) { this._refreshAddresses(); diff --git a/source/renderer/app/stores/AppUpdateStore.ts b/source/renderer/app/stores/AppUpdateStore.ts index caca5e2650..a74007f6a0 100644 --- a/source/renderer/app/stores/AppUpdateStore.ts +++ b/source/renderer/app/stores/AppUpdateStore.ts @@ -178,7 +178,8 @@ export default class AppUpdateStore extends Store { _checkNewAppUpdate = async (update: News) => { const { version, url } = this.getUpdateInfo(update); // @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 - const appUpdateCompleted = await this.getAppUpdateCompletedRequest.execute(); + const appUpdateCompleted = + await this.getAppUpdateCompletedRequest.execute(); /* * The update was already installed and the installer was already deleted. @@ -208,7 +209,8 @@ export default class AppUpdateStore extends Store { if (this.isUpdateDownloading) return false; // Is there an 'Automatic Update Failed' flag? // @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 - const isAutomaticUpdateFailed = await this.getAppAutomaticUpdateFailedRequest.execute(); + const isAutomaticUpdateFailed = + await this.getAppAutomaticUpdateFailedRequest.execute(); if (isAutomaticUpdateFailed) { runInAction(() => { @@ -271,12 +273,11 @@ export default class AppUpdateStore extends Store { id: APP_UPDATE_DOWNLOAD_ID, }); }; - _getUpdateDownloadLocalData = async (): Promise< - DownloadLocalDataMainResponse - > => - getDownloadLocalDataChannel.request({ - id: APP_UPDATE_DOWNLOAD_ID, - }); + _getUpdateDownloadLocalData = + async (): Promise => + getDownloadLocalDataChannel.request({ + id: APP_UPDATE_DOWNLOAD_ID, + }); _checkFileExists = async (): Promise => checkFileExistsChannel.request({ id: APP_UPDATE_DOWNLOAD_ID, diff --git a/source/renderer/app/stores/HardwareWalletsStore.ts b/source/renderer/app/stores/HardwareWalletsStore.ts index eb4f09557b..b342efd426 100644 --- a/source/renderer/app/stores/HardwareWalletsStore.ts +++ b/source/renderer/app/stores/HardwareWalletsStore.ts @@ -169,13 +169,13 @@ export default class HardwareWalletsStore extends Store { this.api.ada.constructAddress ); @observable - hardwareWalletsLocalDataRequest: Request< - HardwareWalletsLocalData - > = new Request(this.api.localStorage.getHardwareWalletsLocalData); + hardwareWalletsLocalDataRequest: Request = new Request( + this.api.localStorage.getHardwareWalletsLocalData + ); @observable - setHardwareWalletLocalDataRequest: Request< - HardwareWalletLocalData - > = new Request(this.api.localStorage.setHardwareWalletLocalData); + setHardwareWalletLocalDataRequest: Request = new Request( + this.api.localStorage.setHardwareWalletLocalData + ); @observable unsetHardwareWalletLocalDataRequest: Request = new Request( this.api.localStorage.unsetHardwareWalletLocalData @@ -185,25 +185,25 @@ export default class HardwareWalletsStore extends Store { this.api.localStorage.getHardwareWalletDevices ); @observable - setHardwareWalletDeviceRequest: Request< - HardwareWalletLocalData - > = new Request(this.api.localStorage.setHardwareWalletDevice); + setHardwareWalletDeviceRequest: Request = new Request( + this.api.localStorage.setHardwareWalletDevice + ); @observable - overrideHardwareWalletDevicesRequest: Request< - HardwareWalletDevicesType - > = new Request(this.api.localStorage.overrideHardwareWalletDevices); + overrideHardwareWalletDevicesRequest: Request = new Request( + this.api.localStorage.overrideHardwareWalletDevices + ); @observable - unsetHardwareWalletDeviceRequest: Request< - HardwareWalletLocalData - > = new Request(this.api.localStorage.unsetHardwareWalletDevice); + unsetHardwareWalletDeviceRequest: Request = new Request( + this.api.localStorage.unsetHardwareWalletDevice + ); @observable unsetHardwareWalletDevicesAllRequest: Request = new Request( this.api.localStorage.unsetHardwareWalletDevicesAll ); @observable - unsetHardwareWalletLocalDataAllRequest: Request< - HardwareWalletLocalData - > = new Request(this.api.localStorage.unsetHardwareWalletLocalDataAll); + unsetHardwareWalletLocalDataAllRequest: Request = new Request( + this.api.localStorage.unsetHardwareWalletLocalDataAll + ); @observable hwDeviceStatus: HwDeviceStatus = HwDeviceStatuses.CONNECTING; @observable @@ -438,15 +438,11 @@ export default class HardwareWalletsStore extends Store { walletId: string; isVotingRegistrationTransaction: boolean; }) => { - const { - transactionId, - walletId, - isVotingRegistrationTransaction, - } = request; + const { transactionId, walletId, isVotingRegistrationTransaction } = + request; - const recentTransactionsResponse = this.stores.transactions._getTransactionsRecentRequest( - walletId - ).result; + const recentTransactionsResponse = + this.stores.transactions._getTransactionsRecentRequest(walletId).result; const recentTransactions = recentTransactionsResponse ? recentTransactionsResponse.transactions @@ -1847,11 +1843,10 @@ export default class HardwareWalletsStore extends Store { const outputsData = []; for (const output of outputs) { - const { - address_style: addressStyle, - } = await this.stores.addresses._inspectAddress({ - addressId: output.address, - }); + const { address_style: addressStyle } = + await this.stores.addresses._inspectAddress({ + addressId: output.address, + }); const shelleyTxOutput = ShelleyTxOutput(output, addressStyle); unsignedTxOutputs.push(shelleyTxOutput); const ledgerOutput = prepareTrezorOutput(output); @@ -2169,11 +2164,10 @@ export default class HardwareWalletsStore extends Store { const outputsData = []; for (const output of outputs) { - const { - address_style: addressStyle, - } = await this.stores.addresses._inspectAddress({ - addressId: output.address, - }); + const { address_style: addressStyle } = + await this.stores.addresses._inspectAddress({ + addressId: output.address, + }); const shelleyTxOutput = ShelleyTxOutput(output, addressStyle); unsignedTxOutputs.push(shelleyTxOutput); const ledgerOutput = prepareLedgerOutput(output, addressStyle); diff --git a/source/renderer/app/stores/NetworkStatusStore.ts b/source/renderer/app/stores/NetworkStatusStore.ts index 87d9ea0e13..d592b46304 100644 --- a/source/renderer/app/stores/NetworkStatusStore.ts +++ b/source/renderer/app/stores/NetworkStatusStore.ts @@ -144,9 +144,9 @@ export default class NetworkStatusStore extends Store { this.api.ada.getNetworkClock ); @observable - getNetworkParametersRequest: Request< - GetNetworkParametersResponse - > = new Request(this.api.ada.getNetworkParameters); + getNetworkParametersRequest: Request = new Request( + this.api.ada.getNetworkParameters + ); @observable isNotEnoughDiskSpace = false; @observable @@ -509,11 +509,10 @@ export default class NetworkStatusStore extends Store { }); try { - const networkClock: GetNetworkClockResponse = await this.getNetworkClockRequest.execute( - { + const networkClock: GetNetworkClockResponse = + await this.getNetworkClockRequest.execute({ isForceCheck, - } - ).promise; + }).promise; // System time is correct if local time difference is below allowed threshold runInAction('update localTimeDifference and isNodeTimeCorrect', () => { // Update localTimeDifference only in case NTP check status is not still pending @@ -543,8 +542,8 @@ export default class NetworkStatusStore extends Store { const wasConnected = this.isConnected; try { - const networkStatus: GetNetworkInfoResponse = await this.getNetworkInfoRequest.execute() - .promise; + const networkStatus: GetNetworkInfoResponse = + await this.getNetworkInfoRequest.execute().promise; // In case we no longer have TLS config we ignore all API call responses // as this means we are in the Cardano shutdown (stopping|exiting|updating) sequence @@ -707,8 +706,8 @@ export default class NetworkStatusStore extends Store { if (!this.isNodeResponding) return; try { - const networkParameters: GetNetworkParametersResponse = await this.getNetworkParametersRequest.execute() - .promise; + const networkParameters: GetNetworkParametersResponse = + await this.getNetworkParametersRequest.execute().promise; let { isShelleyActivated, isShelleyPending, diff --git a/source/renderer/app/stores/ProfileStore.ts b/source/renderer/app/stores/ProfileStore.ts index 6be759acb9..ed0e70383d 100644 --- a/source/renderer/app/stores/ProfileStore.ts +++ b/source/renderer/app/stores/ProfileStore.ts @@ -488,9 +488,8 @@ export default class ProfileStore extends Store { } }; _compressLogs = action(async ({ logs }) => { - const { - fileName = generateFileNameWithTimestamp(), - } = this.compressedLogsStatus; + const { fileName = generateFileNameWithTimestamp() } = + this.compressedLogsStatus; try { const outputPath = await compressLogsChannel.request({ diff --git a/source/renderer/app/stores/SidebarStore.ts b/source/renderer/app/stores/SidebarStore.ts index 702f8288fd..f2dd4d150e 100644 --- a/source/renderer/app/stores/SidebarStore.ts +++ b/source/renderer/app/stores/SidebarStore.ts @@ -47,12 +47,8 @@ export default class SidebarStore extends Store { // https://alexhisen.gitbooks.io/mobx-recipes/content/use-computedstruct-for-computed-objects.html @computed.struct get wallets(): Array { - const { - networkStatus, - wallets, - walletSettings, - hardwareWallets, - } = this.stores; + const { networkStatus, wallets, walletSettings, hardwareWallets } = + this.stores; const { hardwareWalletsConnectionData } = hardwareWallets; const shelleyWallets = sortWallets({ wallets: wallets.all.filter((w) => !w.isLegacy), @@ -71,9 +67,8 @@ export default class SidebarStore extends Store { [wallet.id, 'disconnected'], true ); - const { - hasNotification, - } = walletSettings.getWalletsRecoveryPhraseVerificationData(wallet.id); + const { hasNotification } = + walletSettings.getWalletsRecoveryPhraseVerificationData(wallet.id); return { id: wallet.id, title: wallet.name, @@ -110,10 +105,8 @@ export default class SidebarStore extends Store { // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'typ... Remove this comment to see the full error message environment: { isDev, isMainnet }, } = global; - const { - CATEGORIES_BY_NAME: categories, - CATEGORIES_LIST: list, - } = sidebarConfig; + const { CATEGORIES_BY_NAME: categories, CATEGORIES_LIST: list } = + sidebarConfig; const categoryValidation: Record< string, boolean | ((...args: Array) => any) diff --git a/source/renderer/app/stores/StakingStore.ts b/source/renderer/app/stores/StakingStore.ts index d80b506816..39d2ecc357 100644 --- a/source/renderer/app/stores/StakingStore.ts +++ b/source/renderer/app/stores/StakingStore.ts @@ -101,10 +101,8 @@ export default class StakingStore extends Store { _delegationFeeCalculationWalletId: string | null | undefined = null; setup() { - const { - staking: stakingActions, - networkStatus: networkStatusActions, - } = this.actions; + const { staking: stakingActions, networkStatus: networkStatusActions } = + this.actions; this.refreshPolling = setInterval( this.getStakePoolsData, STAKE_POOLS_FAST_INTERVAL @@ -159,9 +157,9 @@ export default class StakingStore extends Store { this.api.ada.getStakePools ); @observable - calculateDelegationFeeRequest: Request< - DelegationCalculateFeeResponse - > = new Request(this.api.ada.calculateDelegationFee); + calculateDelegationFeeRequest: Request = new Request( + this.api.ada.calculateDelegationFee + ); // @REDEEM TODO: Proper type it when the API endpoint is implemented. @observable getRedeemItnRewardsFeeRequest: Request = new Request( @@ -269,7 +267,8 @@ export default class StakingStore extends Store { }; @action _getStakingInfoWasOpen = async () => { - const stakingInfoWasOpen = await this.api.localStorage.getStakingInfoWasOpen(); + const stakingInfoWasOpen = + await this.api.localStorage.getStakingInfoWasOpen(); runInAction(() => { this.stakingInfoWasOpen = stakingInfoWasOpen; }); @@ -401,9 +400,8 @@ export default class StakingStore extends Store { }) => { const { transactionId, walletId } = request; - const recentTransactionsResponse = this.stores.transactions._getTransactionsRecentRequest( - walletId - ).result; + const recentTransactionsResponse = + this.stores.transactions._getTransactionsRecentRequest(walletId).result; const recentTransactions = recentTransactionsResponse ? recentTransactionsResponse.transactions @@ -487,11 +485,10 @@ export default class StakingStore extends Store { } try { - const delegationFee: DelegationCalculateFeeResponse = await this.calculateDelegationFeeRequest.execute( - { + const delegationFee: DelegationCalculateFeeResponse = + await this.calculateDelegationFeeRequest.execute({ ...delegationFeeRequest, - } - ).promise; + }).promise; if (this._delegationFeeCalculationWalletId !== walletId) { return null; @@ -577,11 +574,8 @@ export default class StakingStore extends Store { @action getStakePoolsData = async (isSmash?: boolean) => { - const { - isConnected, - isSynced, - isShelleyActivated, - } = this.stores.networkStatus; + const { isConnected, isSynced, isShelleyActivated } = + this.stores.networkStatus; if (!isShelleyActivated || !isConnected || !isSynced) { this._resetIsRanking(); diff --git a/source/renderer/app/stores/TransactionsStore.ts b/source/renderer/app/stores/TransactionsStore.ts index 8f003da4f6..dd6fca7cf3 100644 --- a/source/renderer/app/stores/TransactionsStore.ts +++ b/source/renderer/app/stores/TransactionsStore.ts @@ -94,15 +94,14 @@ export default class TransactionsStore extends Store { this.api.ada.deleteTransaction ); @observable - createExternalTransactionRequest: Request< - CreateExternalTransactionRequest - > = new Request(this.api.ada.createExternalTransaction); + createExternalTransactionRequest: Request = + new Request(this.api.ada.createExternalTransaction); @observable _filterOptionsForWallets = {}; @observable - calculateTransactionFeeRequest: Request< - GetTransactionFeeRequest - > = new Request(this.api.ada.calculateTransactionFee); + calculateTransactionFeeRequest: Request = new Request( + this.api.ada.calculateTransactionFee + ); setup() { const { diff --git a/source/renderer/app/stores/UiNotificationsStore.ts b/source/renderer/app/stores/UiNotificationsStore.ts index 4457b76221..6640aba242 100644 --- a/source/renderer/app/stores/UiNotificationsStore.ts +++ b/source/renderer/app/stores/UiNotificationsStore.ts @@ -30,11 +30,8 @@ export default class UiNotificationsStore extends Store { isOpen = (id: NotificationId): boolean => !!this.activeNotifications[id]; @action _registerNotification = (notificationConfig: NotificationConfig) => { - const { - id, - actionToListenAndOpen, - actionToListenAndClose, - } = notificationConfig; + const { id, actionToListenAndOpen, actionToListenAndClose } = + notificationConfig; actionToListenAndOpen.listen((labelValues?: Record) => this._openNotification(notificationConfig, labelValues) ); diff --git a/source/renderer/app/stores/VotingStore.ts b/source/renderer/app/stores/VotingStore.ts index 13e13f7bb4..e3f34fe14a 100644 --- a/source/renderer/app/stores/VotingStore.ts +++ b/source/renderer/app/stores/VotingStore.ts @@ -97,9 +97,9 @@ export default class VotingStore extends Store { this.api.ada.getWalletPublicKey ); @observable - createVotingRegistrationTransactionRequest: Request< - WalletTransaction - > = new Request(this.api.ada.createVotingRegistrationTransaction); + createVotingRegistrationTransactionRequest: Request = new Request( + this.api.ada.createVotingRegistrationTransaction + ); @observable signMetadataRequest: Request = new Request( this.api.ada.createWalletSignature @@ -319,13 +319,8 @@ export default class VotingStore extends Store { const votingData = await this.prepareVotingData({ walletId, }); - const { - stakeAddressHex, - votingKey, - stakeKey, - role, - index, - } = votingData; + const { stakeAddressHex, votingKey, stakeKey, role, index } = + votingData; // @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 const signature = await this.signMetadataRequest.execute({ addressHex: stakeAddressHex, @@ -338,8 +333,8 @@ export default class VotingStore extends Store { absoluteSlotNumber, }); // @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 - transaction = await this.createVotingRegistrationTransactionRequest.execute( - { + transaction = + await this.createVotingRegistrationTransactionRequest.execute({ address: address.id, addressHex: stakeAddressHex, amount, @@ -349,8 +344,7 @@ export default class VotingStore extends Store { stakeKey, signature: signature.toString('hex'), absoluteSlotNumber, - } - ); + }); } this._setTransactionId(transaction.id); @@ -401,11 +395,8 @@ export default class VotingStore extends Store { if (!selectedWallet) return; const { name: walletName } = selectedWallet; const { desktopDirectoryPath } = this.stores.profile; - const { - currentLocale, - currentDateFormat, - currentTimeFormat, - } = this.stores.profile; + const { currentLocale, currentDateFormat, currentTimeFormat } = + this.stores.profile; const nextVotingFundNumber = NEXT_VOTING_FUND_NUMBER; const { network, isMainnet } = this.environment; const intl = i18nContext(currentLocale); diff --git a/source/renderer/app/stores/WalletMigrationStore.ts b/source/renderer/app/stores/WalletMigrationStore.ts index a593f1e5e7..487c40ad7f 100644 --- a/source/renderer/app/stores/WalletMigrationStore.ts +++ b/source/renderer/app/stores/WalletMigrationStore.ts @@ -232,13 +232,11 @@ export default class WalletMigrationStore extends Store { // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('WalletMigrationStore: Starting wallet export...'); this.isExportRunning = true; - const { - wallets, - errors, - }: ExportWalletsMainResponse = await exportWalletsChannel.request({ - exportSourcePath: this.exportSourcePath || this.defaultExportSourcePath, - locale: this.stores.profile.currentLocale, - }); + const { wallets, errors }: ExportWalletsMainResponse = + await exportWalletsChannel.request({ + exportSourcePath: this.exportSourcePath || this.defaultExportSourcePath, + locale: this.stores.profile.currentLocale, + }); runInAction('update exportedWallets and exportErrors', () => { this.exportedWallets = orderBy( wallets.map((wallet) => { @@ -369,8 +367,8 @@ export default class WalletMigrationStore extends Store { }; @action _generateMigrationReport = async () => { - const finalMigrationStatus = await this.getWalletMigrationStatusRequest.execute() - .promise; + const finalMigrationStatus = + await this.getWalletMigrationStatusRequest.execute().promise; const walletMigrationReportData: WalletMigrationReportData = { exportedWalletsData: this.exportedWalletsData, exportedWalletsCount: this.exportedWalletsCount, @@ -411,8 +409,8 @@ export default class WalletMigrationStore extends Store { // Reset migration data this._resetMigration(); - const walletMigrationStatus = await this.getWalletMigrationStatusRequest.execute() - .promise; + const walletMigrationStatus = + await this.getWalletMigrationStatusRequest.execute().promise; if (walletMigrationStatus === WalletMigrationStatuses.UNSTARTED) { // Wait for wallets to load as we need to match existing and exported wallets @@ -503,8 +501,8 @@ export default class WalletMigrationStore extends Store { this.actions.dialogs.closeActiveDialog.trigger(); } - const walletMigrationStatus = await this.getWalletMigrationStatusRequest.execute() - .promise; + const walletMigrationStatus = + await this.getWalletMigrationStatusRequest.execute().promise; if (walletMigrationStatus === WalletMigrationStatuses.RUNNING) { // Update migration status diff --git a/source/renderer/app/stores/WalletSettingsStore.ts b/source/renderer/app/stores/WalletSettingsStore.ts index 7a0c407278..23e1b9266c 100644 --- a/source/renderer/app/stores/WalletSettingsStore.ts +++ b/source/renderer/app/stores/WalletSettingsStore.ts @@ -39,10 +39,8 @@ export default class WalletSettingsStore extends Store { pollingApiInterval: IntervalID | null | undefined = null; setup() { - const { - walletSettings: walletSettingsActions, - sidebar: sidebarActions, - } = this.actions; + const { walletSettings: walletSettingsActions, sidebar: sidebarActions } = + this.actions; walletSettingsActions.startEditingWalletField.listen( this._startEditingWalletField ); @@ -305,12 +303,8 @@ export default class WalletSettingsStore extends Store { throw new Error( 'Active wallet required before checking show used addresses statuses.' ); - const localWalletData: - | WalletLocalData - | null - | undefined = this.getLocalWalletDataById( - activeWallet ? activeWallet.id : '' - ); + const localWalletData: WalletLocalData | null | undefined = + this.getLocalWalletDataById(activeWallet ? activeWallet.id : ''); const { showUsedAddresses } = localWalletData || {}; await this.actions.walletsLocal.setWalletLocalData.trigger({ walletId: activeWallet.id, diff --git a/source/renderer/app/stores/WalletsStore.ts b/source/renderer/app/stores/WalletsStore.ts index cafff947a3..6b3d21126b 100644 --- a/source/renderer/app/stores/WalletsStore.ts +++ b/source/renderer/app/stores/WalletsStore.ts @@ -114,19 +114,16 @@ export default class WalletsStore extends Store { ); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletCertificateAdditionalMnemonicsRequest: Request< - Array - > = new Request(this.api.ada.getWalletCertificateAdditionalMnemonics); + getWalletCertificateAdditionalMnemonicsRequest: Request> = + new Request(this.api.ada.getWalletCertificateAdditionalMnemonics); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletCertificateRecoveryPhraseRequest: Request< - Array - > = new Request(this.api.ada.getWalletCertificateRecoveryPhrase); + getWalletCertificateRecoveryPhraseRequest: Request> = + new Request(this.api.ada.getWalletCertificateRecoveryPhrase); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletRecoveryPhraseFromCertificateRequest: Request< - Array - > = new Request(this.api.ada.getWalletRecoveryPhraseFromCertificate); + getWalletRecoveryPhraseFromCertificateRequest: Request> = + new Request(this.api.ada.getWalletRecoveryPhraseFromCertificate); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreDaedalusRequest: Request = new Request( @@ -159,9 +156,8 @@ export default class WalletsStore extends Store { ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - transferFundsCalculateFeeRequest: Request< - TransferFundsCalculateFeeRequest - > = new Request(this.api.ada.transferFundsCalculateFee); + transferFundsCalculateFeeRequest: Request = + new Request(this.api.ada.transferFundsCalculateFee); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message transferFundsRequest: Request = new Request( @@ -435,11 +431,8 @@ export default class WalletsStore extends Store { try { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const recoveryPhrase: - | Array - | null - | undefined = await this.getWalletRecoveryPhraseRequest.execute() - .promise; + const recoveryPhrase: Array | null | undefined = + await this.getWalletRecoveryPhraseRequest.execute().promise; if (recoveryPhrase != null) { // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message @@ -668,9 +661,8 @@ export default class WalletsStore extends Store { // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _finishWalletBackup = async () => { // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - this._newWalletDetails.mnemonic = this.stores.walletBackup.recoveryPhrase.join( - ' ' - ); + this._newWalletDetails.mnemonic = + this.stores.walletBackup.recoveryPhrase.join(' '); const wallet = await this.createWalletRequest.execute( this._newWalletDetails ).promise; @@ -784,12 +776,11 @@ export default class WalletsStore extends Store { const { passphrase, scrambledInput } = getScrambledInput(mnemonics); // Unscramble 18-word wallet certificate mnemonic to 12-word mnemonic // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const unscrambledRecoveryPhrase: Array = await this.getWalletRecoveryPhraseFromCertificateRequest.execute( - { + const unscrambledRecoveryPhrase: Array = + await this.getWalletRecoveryPhraseFromCertificateRequest.execute({ passphrase, scrambledInput, - } - ).promise; + }).promise; this.getWalletRecoveryPhraseFromCertificateRequest.reset(); // @ts-ignore return unscrambledRecoveryPhrase; @@ -1316,17 +1307,14 @@ export default class WalletsStore extends Store { (walletId) => ({ walletId, // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - recentRequest: this.stores.transactions._getTransactionsRecentRequest( - walletId - ), + recentRequest: + this.stores.transactions._getTransactionsRecentRequest(walletId), // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - allRequest: this.stores.transactions._getTransactionsAllRequest( - walletId - ), + allRequest: + this.stores.transactions._getTransactionsAllRequest(walletId), // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - withdrawalsRequest: this.stores.transactions._getWithdrawalsRequest( - walletId - ), + withdrawalsRequest: + this.stores.transactions._getWithdrawalsRequest(walletId), }) ); @@ -1495,12 +1483,13 @@ export default class WalletsStore extends Store { // Generate wallet recovery phrase // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const recoveryPhrase: Array = yield this.getWalletRecoveryPhraseRequest.execute() - .promise; + const recoveryPhrase: Array = + yield this.getWalletRecoveryPhraseRequest.execute().promise; // Generate 9-words (additional) mnemonic // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const additionalMnemonicWords: Array = yield this.getWalletCertificateAdditionalMnemonicsRequest.execute() - .promise; + const additionalMnemonicWords: Array = + yield this.getWalletCertificateAdditionalMnemonicsRequest.execute() + .promise; this.additionalMnemonicWords = additionalMnemonicWords.join(' '); // Generate spending password from 9-word mnemonic and save to store // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. @@ -1508,15 +1497,13 @@ export default class WalletsStore extends Store { this.walletCertificatePassword = spendingPassword; // Generate paper wallet scrambled mnemonic // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const walletCertificateRecoveryPhrase: Array = yield this.getWalletCertificateRecoveryPhraseRequest.execute( - { + const walletCertificateRecoveryPhrase: Array = + yield this.getWalletCertificateRecoveryPhraseRequest.execute({ passphrase: spendingPassword, input: recoveryPhrase.join(' '), - } - ).promise; - this.walletCertificateRecoveryPhrase = walletCertificateRecoveryPhrase.join( - ' ' - ); + }).promise; + this.walletCertificateRecoveryPhrase = + walletCertificateRecoveryPhrase.join(' '); // Create temporary wallet const walletData = { name: 'Paper Wallet', diff --git a/source/renderer/app/stores/index.ts b/source/renderer/app/stores/index.ts index f19c566371..558067c87d 100644 --- a/source/renderer/app/stores/index.ts +++ b/source/renderer/app/stores/index.ts @@ -82,47 +82,43 @@ function executeOnEveryStore(fn: (store: Store) => void) { }); } // Set up and return the stores for this app -> also used to reset all stores to defaults -export default action( - (api, actions, router): StoresMap => { - function createStoreInstanceOf( - StoreSubClass: Class - ): T { - return new StoreSubClass(api, actions); - } - - // Teardown existing stores - if (stores) executeOnEveryStore((store) => store.teardown()); - // Create fresh instances of all stores - // @ts-ignore ts-migrate(2322) FIXME: Type '{ addresses: Store; app: Store; assets: Stor... Remove this comment to see the full error message - stores = observable({ - addresses: createStoreInstanceOf(AddressesStore), - app: createStoreInstanceOf(AppStore), - assets: createStoreInstanceOf(AssetsStore), - currency: createStoreInstanceOf(CurrencyStore), - appUpdate: createStoreInstanceOf(AppUpdateStore), - hardwareWallets: createStoreInstanceOf(HardwareWalletsStore), - networkStatus: createStoreInstanceOf(NetworkStatusStore), - newsFeed: createStoreInstanceOf(NewsFeedStore), - profile: createStoreInstanceOf(ProfileStore), - router, - sidebar: createStoreInstanceOf(SidebarStore), - staking: createStoreInstanceOf(StakingStore), - transactions: createStoreInstanceOf(TransactionsStore), - uiDialogs: createStoreInstanceOf(UiDialogsStore), - uiNotifications: createStoreInstanceOf(UiNotificationsStore), - voting: createStoreInstanceOf(VotingStore), - wallets: createStoreInstanceOf(WalletsStore), - walletsLocal: createStoreInstanceOf(WalletsLocalStore), - walletBackup: createStoreInstanceOf(WalletBackupStore), - walletMigration: createStoreInstanceOf(WalletMigrationStore), - walletSettings: createStoreInstanceOf(WalletSettingsStore), - window: createStoreInstanceOf(WindowStore), - }); - // Configure and initialize all stores - executeOnEveryStore((store) => { - if (stores) store.configure(stores); - }); - executeOnEveryStore((store) => store.initialize()); - return stores; +export default action((api, actions, router): StoresMap => { + function createStoreInstanceOf(StoreSubClass: Class): T { + return new StoreSubClass(api, actions); } -); + + // Teardown existing stores + if (stores) executeOnEveryStore((store) => store.teardown()); + // Create fresh instances of all stores + // @ts-ignore ts-migrate(2322) FIXME: Type '{ addresses: Store; app: Store; assets: Stor... Remove this comment to see the full error message + stores = observable({ + addresses: createStoreInstanceOf(AddressesStore), + app: createStoreInstanceOf(AppStore), + assets: createStoreInstanceOf(AssetsStore), + currency: createStoreInstanceOf(CurrencyStore), + appUpdate: createStoreInstanceOf(AppUpdateStore), + hardwareWallets: createStoreInstanceOf(HardwareWalletsStore), + networkStatus: createStoreInstanceOf(NetworkStatusStore), + newsFeed: createStoreInstanceOf(NewsFeedStore), + profile: createStoreInstanceOf(ProfileStore), + router, + sidebar: createStoreInstanceOf(SidebarStore), + staking: createStoreInstanceOf(StakingStore), + transactions: createStoreInstanceOf(TransactionsStore), + uiDialogs: createStoreInstanceOf(UiDialogsStore), + uiNotifications: createStoreInstanceOf(UiNotificationsStore), + voting: createStoreInstanceOf(VotingStore), + wallets: createStoreInstanceOf(WalletsStore), + walletsLocal: createStoreInstanceOf(WalletsLocalStore), + walletBackup: createStoreInstanceOf(WalletBackupStore), + walletMigration: createStoreInstanceOf(WalletMigrationStore), + walletSettings: createStoreInstanceOf(WalletSettingsStore), + window: createStoreInstanceOf(WindowStore), + }); + // Configure and initialize all stores + executeOnEveryStore((store) => { + if (stores) store.configure(stores); + }); + executeOnEveryStore((store) => store.initialize()); + return stores; +}); diff --git a/source/renderer/app/types/sidebarTypes.ts b/source/renderer/app/types/sidebarTypes.ts index 169c82054c..b0c8355976 100644 --- a/source/renderer/app/types/sidebarTypes.ts +++ b/source/renderer/app/types/sidebarTypes.ts @@ -21,13 +21,11 @@ export const WalletSortBy: EnumMap = { None: 'NONE', }; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'EnumMap'. -export const WalletSortOrder: EnumMap< - string, - WalletSortOrderOptions -> = Object.freeze({ - Desc: 'desc', - Asc: 'asc', -}); +export const WalletSortOrder: EnumMap = + Object.freeze({ + Desc: 'desc', + Asc: 'asc', + }); export type WalletSortConfig = { sortBy: WalletSortByOptions; sortOrder: WalletSortOrderOptions; diff --git a/source/renderer/app/utils/assets.ts b/source/renderer/app/utils/assets.ts index e6c208ea70..392b4819f3 100644 --- a/source/renderer/app/utils/assets.ts +++ b/source/renderer/app/utils/assets.ts @@ -153,64 +153,63 @@ export const getNonZeroAssetTokens = ( * @param sortBy - sorting parameter * @param sortDirection - should it sort in ascending or descending direction */ -export const sortAssets = (sortBy: SortBy, sortDirection: SortDirection) => ( - asset1: AssetToken, - asset2: AssetToken -) => { - const { - quantity: unformattedQuantity1, - fingerprint: fingerprint1, - metadata: metadata1, - decimals: decimals1, - } = asset1; - const quantity1 = formattedTokenDecimals(unformattedQuantity1, decimals1); - const { name: name1 } = metadata1 || {}; - const { - quantity: unformattedQuantity2, - fingerprint: fingerprint2, - metadata: metadata2, - decimals: decimals2, - } = asset2; - const quantity2 = formattedTokenDecimals(unformattedQuantity2, decimals2); - const { name: name2 } = metadata2 || {}; +export const sortAssets = + (sortBy: SortBy, sortDirection: SortDirection) => + (asset1: AssetToken, asset2: AssetToken) => { + const { + quantity: unformattedQuantity1, + fingerprint: fingerprint1, + metadata: metadata1, + decimals: decimals1, + } = asset1; + const quantity1 = formattedTokenDecimals(unformattedQuantity1, decimals1); + const { name: name1 } = metadata1 || {}; + const { + quantity: unformattedQuantity2, + fingerprint: fingerprint2, + metadata: metadata2, + decimals: decimals2, + } = asset2; + const quantity2 = formattedTokenDecimals(unformattedQuantity2, decimals2); + const { name: name2 } = metadata2 || {}; - if (sortBy === 'token') { - if (name1 && !name2) return -1; - if (!name1 && name2) return 1; + if (sortBy === 'token') { + if (name1 && !name2) return -1; + if (!name1 && name2) return 1; - if (name1 && name2) { - if (sortDirection === 'asc') { - return name1.localeCompare(name2); + if (name1 && name2) { + if (sortDirection === 'asc') { + return name1.localeCompare(name2); + } + + return name2.localeCompare(name1); } - return name2.localeCompare(name1); - } + if (sortDirection === 'asc') { + return fingerprint1.localeCompare(fingerprint2); + } - if (sortDirection === 'asc') { - return fingerprint1.localeCompare(fingerprint2); + return fingerprint2.localeCompare(fingerprint1); } - return fingerprint2.localeCompare(fingerprint1); - } + if (sortBy === 'fingerprint') { + if (sortDirection === 'asc') { + return fingerprint1.localeCompare(fingerprint2); + } - if (sortBy === 'fingerprint') { - if (sortDirection === 'asc') { - return fingerprint1.localeCompare(fingerprint2); + return fingerprint2.localeCompare(fingerprint1); } - return fingerprint2.localeCompare(fingerprint1); - } + if (sortBy === 'quantity') { + if (sortDirection === 'asc') { + return quantity1.isLessThan(quantity2) ? -1 : 1; + } - if (sortBy === 'quantity') { - if (sortDirection === 'asc') { - return quantity1.isLessThan(quantity2) ? -1 : 1; + return quantity1.isLessThan(quantity2) ? 1 : -1; } - return quantity1.isLessThan(quantity2) ? 1 : -1; - } - - return 0; -}; + return 0; + }; /** * Check if after the transactions your wallet has some assets left @@ -267,13 +266,8 @@ export const searchAssets = ( } return filter(assets, (asset) => { - const { - policyId, - assetName, - assetNameASCII, - fingerprint, - metadata, - } = asset; + const { policyId, assetName, assetNameASCII, fingerprint, metadata } = + asset; const { name, ticker, description } = metadata || {}; const checkList = [ policyId, diff --git a/source/renderer/app/utils/hardwareWalletUtils.ts b/source/renderer/app/utils/hardwareWalletUtils.ts index 6741e47c69..85307f8953 100644 --- a/source/renderer/app/utils/hardwareWalletUtils.ts +++ b/source/renderer/app/utils/hardwareWalletUtils.ts @@ -37,15 +37,7 @@ export const KEY_PREFIXES = { }; // Helpers const receiverAddressTypes: Set = new Set([ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, + 0, 1, 2, 3, 4, 5, 6, 7, 8, ]); export const isReceiverAddressType = (addressType: AddressType) => receiverAddressTypes.has(addressType); diff --git a/source/renderer/app/utils/logging.ts b/source/renderer/app/utils/logging.ts index 0587a45412..7b194b762f 100644 --- a/source/renderer/app/utils/logging.ts +++ b/source/renderer/app/utils/logging.ts @@ -23,20 +23,19 @@ const environmentData = { version, }; -const logToLevel = (level: LoggingLevel) => ( - message: string, - data: Record | null | undefined -) => { - const args = [ - formatContext({ ...messageContext, level }), - { - message, - data, - environmentData, - }, - ]; - electronLog[level](...args); -}; +const logToLevel = + (level: LoggingLevel) => + (message: string, data: Record | null | undefined) => { + const args = [ + formatContext({ ...messageContext, level }), + { + message, + data, + environmentData, + }, + ]; + electronLog[level](...args); + }; export const logger: Logger = { debug: logToLevel('debug'), diff --git a/storybook/stories/_support/utils.ts b/storybook/stories/_support/utils.ts index 8281be8564..365cadc494 100644 --- a/storybook/stories/_support/utils.ts +++ b/storybook/stories/_support/utils.ts @@ -240,11 +240,13 @@ export const generateAddress = (used = false): WalletAddress => used, spendingPath: "1852'/1815'/0'/0/19", }); -export const promise = (returnValue: any): (() => Promise) => () => - new Promise((resolve) => { - setTimeout(() => { - resolve(returnValue); - }, 2000); - }); +export const promise = + (returnValue: any): (() => Promise) => + () => + new Promise((resolve) => { + setTimeout(() => { + resolve(returnValue); + }, 2000); + }); export const isShelleyTestnetTheme = (currentTheme: string) => currentTheme === 'shelley-testnet'; diff --git a/storybook/stories/news/_utils/fakeDataUpdate.ts b/storybook/stories/news/_utils/fakeDataUpdate.ts index bca564264e..c8c4092d5c 100644 --- a/storybook/stories/news/_utils/fakeDataUpdate.ts +++ b/storybook/stories/news/_utils/fakeDataUpdate.ts @@ -15,20 +15,17 @@ const commonUpdateData = { darwin: { version: availableAppVersion, hash: '97d336d45b022b0390446497dbe8b43bb6174436df12d43c4fc2b953ce22b703', - url: - 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.pkg', + url: 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.pkg', }, win32: { version: availableAppVersion, hash: '97d336d45b022b0390446497dbe8b43bb6174436df12d43c4fc2b953ce22b703', - url: - 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.exe', + url: 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.exe', }, linux: { version: availableAppVersion, hash: '97d336d45b022b0390446497dbe8b43bb6174436df12d43c4fc2b953ce22b703', - url: - 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.bin', + url: 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.bin', }, }, type: 'software-update', diff --git a/storybook/stories/wallets/import/WalletImportFile.stories.tsx b/storybook/stories/wallets/import/WalletImportFile.stories.tsx index e1d8881f11..38c04af3fe 100644 --- a/storybook/stories/wallets/import/WalletImportFile.stories.tsx +++ b/storybook/stories/wallets/import/WalletImportFile.stories.tsx @@ -57,9 +57,9 @@ storiesOf('Wallets|Import File', module) ...Array(number('Wallets with name', 5)), // @ts-ignore ts-migrate(2345) FIXME: Argument of type 'string' is not assignable to par... Remove this comment to see the full error message ].map((x, index: number) => getWallet(index, true, statusSelect)); - const unnamedWallets = [ - ...Array(number('Wallets with no name', 5)), - ].map((x, index: number) => getWallet(index, false)); + const unnamedWallets = [...Array(number('Wallets with no name', 5))].map( + (x, index: number) => getWallet(index, false) + ); return ( Date: Wed, 9 Feb 2022 20:11:13 +0000 Subject: [PATCH 31/42] [DDW-827] applied prettier formatting --- source/common/ipc/api.ts | 27 ++-- source/common/types/hardware-wallets.types.ts | 10 +- source/common/utils/files.ts | 16 +- .../main/cardano/CardanoSelfnodeLauncher.ts | 8 +- source/main/cardano/utils.ts | 9 +- source/main/config.ts | 5 +- source/main/ipc/downloadManagerChannel.ts | 41 +++-- source/main/ipc/generateCsvChannel.ts | 6 +- source/main/ipc/generateFileMetaChannel.ts | 6 +- source/main/ipc/getHardwareWalletChannel.ts | 7 +- source/main/ipc/manageAppUpdateChannel.ts | 6 +- source/main/ipc/rebuild-application-menu.ts | 6 +- source/main/ipc/saveQRCodeImageChannel.ts | 6 +- source/main/ipc/show-file-dialog-channels.ts | 12 +- source/main/utils/getContentMinimumSize.ts | 6 +- source/main/utils/logging.ts | 17 ++- source/main/utils/setupLogging.ts | 9 +- source/renderer/app/api/api.ts | 39 +++-- .../assets/AssetTransactionConfirmation.tsx | 6 +- .../dapp/DappTransactionRequest.tsx | 10 +- .../ToggleRTSFlagsDialog.tsx | 3 +- .../app/components/layout/SidebarLayout.tsx | 9 +- .../no-disk-space-error/NoDiskSpaceError.tsx | 7 +- .../SyncingConnectingStatus.tsx | 6 +- .../profile/terms-of-use/TermsOfUseForm.tsx | 8 +- .../sidebar/wallets/SidebarWalletsMenu.tsx | 6 +- .../staking/countdown/StakingCountdown.tsx | 7 +- .../staking/delegation-center/WalletRow.tsx | 9 +- ...tionStepsChooseStakePoolDialog.messages.ts | 33 +++-- .../DelegationStepsChooseWalletDialog.tsx | 12 +- ...egationStepsConfirmationDialog.messages.ts | 6 +- .../DelegationStepsNotAvailableDialog.tsx | 4 +- .../DelegationStepsSuccessDialog.tsx | 8 +- .../OversaturationText.tsx | 3 +- .../staking/epochs/StakingEpochsDataTable.tsx | 9 +- .../staking/info/StakingInfoCountdown.tsx | 7 +- .../staking/navigation/StakingNavigation.tsx | 8 +- .../staking/stake-pools/StakePoolsRanking.tsx | 7 +- .../components/staking/widgets/ThumbPool.tsx | 8 +- .../staking/widgets/ThumbPoolContent.tsx | 7 +- .../staking/widgets/ThumbSelectedPool.tsx | 7 +- .../components/status/DaedalusDiagnostics.tsx | 6 +- .../VotingRegistrationStepsChooseWallet.tsx | 6 +- .../VotingRegistrationStepsEnterPinCode.tsx | 3 +- .../widgets/ConfirmationDialog.tsx | 6 +- .../app/components/wallet/WalletSendForm.tsx | 7 +- .../WalletRecoveryPhraseDisplayDialog.tsx | 6 +- .../WalletRecoveryPhraseEntryDialog.tsx | 15 +- .../CompletionDialog.tsx | 8 +- .../InstructionsDialog.tsx | 40 +++-- .../paper-wallet-certificate/PrintDialog.tsx | 9 +- .../SecuringPasswordDialog.tsx | 3 +- .../VerificationDialog.tsx | 22 ++- .../wallet/receive/WalletReceiveDialog.tsx | 5 +- ...etSendAssetsConfirmationDialog.messages.ts | 6 +- .../WalletSendAssetsConfirmationDialog.tsx | 17 ++- .../WalletSendConfirmationDialog.tsx | 17 ++- .../wallet/settings/ICOPublicKeyBox.tsx | 9 +- .../wallet/settings/PublicKeyField.tsx | 7 +- ...WalletRecoveryPhraseVerificationWidget.tsx | 11 +- .../wallet/settings/WalletSettings.tsx | 7 +- .../WalletTokenPickerCheckbox.tsx | 8 +- .../wallet-tokens-list/WalletTokensList.tsx | 18 ++- .../wallet/transactions/Transaction.tsx | 13 +- .../transactions/WalletTransactions.tsx | 5 +- .../transactions/WalletTransactionsList.tsx | 9 +- .../metadata/MetadataValueView.tsx | 36 ++--- .../SimpleTransactionList.tsx | 18 +-- .../WalletSelectImportDialog.tsx | 4 +- .../wallet-restore/ConfigurationDialog.tsx | 3 +- .../wallet/wallet-restore/MnemonicsDialog.tsx | 6 +- .../wallet-restore/WalletTypeDialog.tsx | 18 ++- .../app/components/widgets/BorderedBox.tsx | 9 +- .../app/components/widgets/forms/PinCode.tsx | 12 +- source/renderer/app/config/currencyConfig.ts | 40 +++-- .../app/config/walletRestoreConfig.ts | 28 ++-- .../app/containers/TopBarContainer.tsx | 11 +- .../appUpdate/AppUpdateContainer.tsx | 7 +- .../app/containers/loading/LoadingPage.tsx | 7 +- .../loading/NoDiskSpaceErrorPage.tsx | 7 +- .../loading/SyncingConnectingPage.tsx | 9 +- .../loading/SystemTimeErrorPage.tsx | 6 +- .../app/containers/news/NewsFeedContainer.tsx | 7 +- .../notifications/NotificationsContainer.tsx | 16 +- .../profile/DataLayerMigrationPage.tsx | 5 +- .../categories/StakePoolsSettingsPage.tsx | 7 +- .../staking/RedeemItnRewardsContainer.tsx | 7 +- .../containers/staking/StakePoolsListPage.tsx | 10 +- .../app/containers/staking/Staking.tsx | 8 +- .../DelegationSetupWizardDialogContainer.tsx | 18 ++- .../Step1ConfigurationContainer.tsx | 13 +- .../Step3ResultContainer.tsx | 8 +- .../VotingRegistrationDialogContainer.tsx | 26 +++- .../containers/wallet/TransferFundsPage.tsx | 7 +- .../renderer/app/containers/wallet/Wallet.tsx | 7 +- .../containers/wallet/WalletReceivePage.tsx | 15 +- .../app/containers/wallet/WalletSendPage.tsx | 32 ++-- .../containers/wallet/WalletSummaryPage.tsx | 18 ++- .../containers/wallet/WalletTokensPage.tsx | 15 +- .../dialogs/WalletCreateDialogContainer.tsx | 12 +- .../dialogs/WalletRestoreDialogContainer.tsx | 6 +- .../InstructionsDialogContainer.tsx | 6 +- .../VerificationDialogContainer.tsx | 6 +- .../UndelegateWalletDialogContainer.tsx | 15 +- .../WalletSelectImportStepContainer.tsx | 7 +- .../StepConfigurationContainer.tsx | 13 +- source/renderer/app/ipc/cardano.ipc.ts | 12 +- .../app/ipc/downloadManagerChannel.ts | 12 +- source/renderer/app/ipc/generateCsvChannel.ts | 6 +- .../app/ipc/rebuild-application-menu.ts | 5 +- .../app/ipc/saveQRCodeImageChannel.ts | 6 +- .../app/ipc/show-file-dialog-channels.ts | 12 +- source/renderer/app/stores/AddressesStore.ts | 7 +- source/renderer/app/stores/AppUpdateStore.ts | 17 +-- .../app/stores/HardwareWalletsStore.ts | 66 +++++---- .../renderer/app/stores/NetworkStatusStore.ts | 21 +-- source/renderer/app/stores/ProfileStore.ts | 5 +- source/renderer/app/stores/SidebarStore.ts | 19 ++- source/renderer/app/stores/StakingStore.ts | 34 +++-- .../renderer/app/stores/TransactionsStore.ts | 11 +- .../app/stores/UiNotificationsStore.ts | 7 +- source/renderer/app/stores/VotingStore.ts | 29 ++-- .../app/stores/WalletMigrationStore.ts | 24 +-- .../app/stores/WalletSettingsStore.ts | 14 +- source/renderer/app/stores/WalletsStore.ts | 75 ++++++---- source/renderer/app/stores/index.ts | 82 +++++----- source/renderer/app/types/sidebarTypes.ts | 12 +- source/renderer/app/utils/assets.ts | 98 ++++++------ .../renderer/app/utils/hardwareWalletUtils.ts | 10 +- source/renderer/app/utils/logging.ts | 27 ++-- storybook/stories/_support/utils.ts | 14 +- .../stories/news/_utils/fakeDataUpdate.ts | 9 +- .../import/WalletImportFile.stories.tsx | 6 +- .../transactions/TransactionsList.stories.tsx | 140 +++++++++--------- 134 files changed, 1210 insertions(+), 764 deletions(-) diff --git a/source/common/ipc/api.ts b/source/common/ipc/api.ts index e17002102a..578626b2d1 100644 --- a/source/common/ipc/api.ts +++ b/source/common/ipc/api.ts @@ -315,8 +315,7 @@ export type ExportWalletsMainResponse = { */ export const GENERATE_WALLET_MIGRATION_REPORT_CHANNEL = 'GENERATE_WALLET_MIGRATION_REPORT_CHANNEL'; -export type GenerateWalletMigrationReportRendererRequest = - WalletMigrationReportData; +export type GenerateWalletMigrationReportRendererRequest = WalletMigrationReportData; export type GenerateWalletMigrationReportMainResponse = void; /** @@ -365,8 +364,7 @@ export type ResumeDownloadMainResponse = ResumeDownloadResponse | void; */ export const DELETE_DOWNLOADED_FILE = 'DELETE_DOWNLOADED_FILE'; export type DeleteDownloadedFileRendererRequest = DeleteDownloadedFileRequest; -export type DeleteDownloadedFileMainResponse = - DeleteDownloadedFileResponse | void; +export type DeleteDownloadedFileMainResponse = DeleteDownloadedFileResponse | void; /** * Channel for initiating the download manager @@ -379,16 +377,14 @@ export type DownloadLocalDataMainResponse = DownloadLocalDataResponse; * Channel for initiating the download manager */ export const GET_DOWNLOADS_LOCAL_DATA = 'GET_DOWNLOADS_LOCAL_DATA'; -export type DownloadsLocalDataRendererRequest = - DownloadsLocalDataRequest | void; +export type DownloadsLocalDataRendererRequest = DownloadsLocalDataRequest | void; export type DownloadsLocalDataMainResponse = DownloadsLocalDataResponse | void; /** * Channel for initiating the download manager */ export const CLEAR_DOWNLOAD_LOCAL_DATA = 'CLEAR_DOWNLOAD_LOCAL_DATA'; -export type ClearDownloadLocalDataRendererRequest = - ClearDownloadLocalDataRequest; +export type ClearDownloadLocalDataRendererRequest = ClearDownloadLocalDataRequest; export type ClearDownloadLocalDataMainResponse = ClearDownloadLocalDataResponse; /** @@ -468,16 +464,12 @@ export type GetBlockSyncProgressMainResponse = { */ export const GET_HARDWARE_WALLET_TRANSPORT_CHANNEL = 'GET_HARDWARE_WALLET_TRANSPORT_CHANNEL'; -export type getHardwareWalletTransportRendererRequest = - HardwareWalletTransportDeviceRequest; -export type getHardwareWalletTransportMainResponse = - HardwareWalletTransportDeviceResponse; +export type getHardwareWalletTransportRendererRequest = HardwareWalletTransportDeviceRequest; +export type getHardwareWalletTransportMainResponse = HardwareWalletTransportDeviceResponse; export const GET_EXTENDED_PUBLIC_KEY_CHANNEL = 'GET_EXTENDED_PUBLIC_KEY_CHANNEL'; -export type getExtendedPublicKeyRendererRequest = - HardwareWalletExtendedPublicKeyRequest; -export type getExtendedPublicKeyMainResponse = - HardwareWalletExtendedPublicKeyResponse; +export type getExtendedPublicKeyRendererRequest = HardwareWalletExtendedPublicKeyRequest; +export type getExtendedPublicKeyMainResponse = HardwareWalletExtendedPublicKeyResponse; export const GET_CARDANO_ADA_APP_CHANNEL = 'GET_CARDANO_ADA_APP_CHANNEL'; export type getCardanoAdaAppRendererRequest = { path: string | null | undefined; @@ -485,8 +477,7 @@ export type getCardanoAdaAppRendererRequest = { export type getCardanoAdaAppMainResponse = HardwareWalletCardanoAdaAppResponse; export const GET_HARDWARE_WALLET_CONNECTION_CHANNEL = 'GET_HARDWARE_WALLET_CONNECTION_CHANNEL'; -export type getHardwareWalletConnectiontMainRequest = - HardwareWalletConnectionRequest; +export type getHardwareWalletConnectiontMainRequest = HardwareWalletConnectionRequest; export type getHardwareWalletConnectiontRendererResponse = Record; export const SIGN_TRANSACTION_LEDGER_CHANNEL = 'SIGN_TRANSACTION_LEDGER_CHANNEL'; diff --git a/source/common/types/hardware-wallets.types.ts b/source/common/types/hardware-wallets.types.ts index 43c78c500a..1cf779b407 100644 --- a/source/common/types/hardware-wallets.types.ts +++ b/source/common/types/hardware-wallets.types.ts @@ -141,8 +141,9 @@ export type StakingBlockchainPointer = { txIndex: number; certificateIndex: number; }; -export type LedgerSignTransactionInputsType = - Array; +export type LedgerSignTransactionInputsType = Array< + LedgerSignTransactionInputType +>; export type LedgerSignTransactionOutputsType = | [] | Array; @@ -188,8 +189,9 @@ export type TrezorOutputTypeChange = { stakingPath: string; }; }; -export type TrezorSignTransactionInputsType = - Array; +export type TrezorSignTransactionInputsType = Array< + TrezorSignTransactionInputType +>; export type TrezorSignTransactionOutputsType = Array< TrezorOutputTypeAddress | TrezorOutputTypeChange >; diff --git a/source/common/utils/files.ts b/source/common/utils/files.ts index 45ce947195..f13d4beb75 100644 --- a/source/common/utils/files.ts +++ b/source/common/utils/files.ts @@ -32,14 +32,14 @@ export const generateFileNameWithTimestamp = (props: Props = {}) => { if (sanitize) fileName = sanitizeFilename(fileName); return fileName; }; -export const isFileNameWithTimestamp = - (prefix = 'logs', extension = 'zip') => - (fileName: string) => - fileName.match( - RegExp( - `(${prefix}-)([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{6}.0[0-9]{3}Z)(.${extension})` - ) - ); +export const isFileNameWithTimestamp = (prefix = 'logs', extension = 'zip') => ( + fileName: string +) => + fileName.match( + RegExp( + `(${prefix}-)([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{6}.0[0-9]{3}Z)(.${extension})` + ) + ); export const getPathSlash = (path: string) => path.indexOf('/') > -1 ? '/' : '\\'; export const extractFileNameFromPath = (path: string) => diff --git a/source/main/cardano/CardanoSelfnodeLauncher.ts b/source/main/cardano/CardanoSelfnodeLauncher.ts index be1d6498ec..1676f89f85 100644 --- a/source/main/cardano/CardanoSelfnodeLauncher.ts +++ b/source/main/cardano/CardanoSelfnodeLauncher.ts @@ -41,8 +41,12 @@ export async function CardanoSelfnodeLauncher( replyPort: number; }> { return new Promise(async (resolve, reject) => { - const { selfnodeBin, mockTokenMetadataServerBin, processName, onStop } = - selfnodeOptions; + const { + selfnodeBin, + mockTokenMetadataServerBin, + processName, + onStop, + } = selfnodeOptions; setupMockTokenMetadataServer(mockTokenMetadataServerBin); // @ts-ignore ts-migrate(2322) FIXME: Type '{ pid: number; ppid?: number; uid?: number; ... Remove this comment to see the full error message const processList: Array = await find('port', CARDANO_WALLET_PORT); diff --git a/source/main/cardano/utils.ts b/source/main/cardano/utils.ts index b81ede4251..adb190b67e 100644 --- a/source/main/cardano/utils.ts +++ b/source/main/cardano/utils.ts @@ -174,8 +174,13 @@ export const exportWallets = async ( mainWindow: BrowserWindow, locale: string ): Promise => { - const { legacySecretKey, legacyWalletDB, stateDir, cluster, isFlight } = - launcherConfig; + const { + legacySecretKey, + legacyWalletDB, + stateDir, + cluster, + isFlight, + } = launcherConfig; logger.info('ipcMain: Starting wallets export...', { exportSourcePath, legacySecretKey, diff --git a/source/main/config.ts b/source/main/config.ts index 9b6255ae27..f5b24e03b0 100644 --- a/source/main/config.ts +++ b/source/main/config.ts @@ -109,8 +109,9 @@ export const windowOptions: WindowOptionsType = { }, useContentSize: true, }; -export const launcherConfig: LauncherConfig = - readLauncherConfig(LAUNCHER_CONFIG); +export const launcherConfig: LauncherConfig = readLauncherConfig( + LAUNCHER_CONFIG +); export const { cluster, nodeImplementation, diff --git a/source/main/ipc/downloadManagerChannel.ts b/source/main/ipc/downloadManagerChannel.ts index aba083db40..07ef3ab99d 100644 --- a/source/main/ipc/downloadManagerChannel.ts +++ b/source/main/ipc/downloadManagerChannel.ts @@ -183,7 +183,9 @@ const requestResumeDownload = async ( const deleteDownloadedFile = async ({ id, -}: DeleteDownloadedFileRendererRequest): Promise => { +}: DeleteDownloadedFileRendererRequest): Promise< + DeleteDownloadedFileMainResponse +> => { const downloadLocalData = await getDownloadLocalData({ id, }); @@ -199,22 +201,27 @@ const deleteDownloadedFile = async ({ const getDownloadLocalData = async ({ fileName, id = fileName, -}: DownloadLocalDataRendererRequest): Promise => { +}: DownloadLocalDataRendererRequest): Promise< + DownloadLocalDataMainResponse +> => { if (!id) throw new Error('Requires `id` or `fileName`'); const downloadId: string = getIdFromFileName(String(id)); return localStorage.get(downloadId); }; -const getDownloadsLocalData = - async (): Promise => { - // @ts-ignore ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'Download... Remove this comment to see the full error message - return localStorage.getAll(); - }; +const getDownloadsLocalData = async (): Promise< + DownloadsLocalDataMainResponse +> => { + // @ts-ignore ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'Download... Remove this comment to see the full error message + return localStorage.getAll(); +}; const clearDownloadLocalData = async ({ fileName, id = fileName, -}: ClearDownloadLocalDataRendererRequest): Promise => { +}: ClearDownloadLocalDataRendererRequest): Promise< + ClearDownloadLocalDataMainResponse +> => { if (!id) throw new Error('Requires `id` or `fileName`'); const downloadId: string = getIdFromFileName(String(id)); return localStorage.unset(downloadId); @@ -237,11 +244,15 @@ const checkFileExists = async ({ }; const requestDownloadChannel: // IpcChannel -MainIpcChannel = - new MainIpcChannel(REQUEST_DOWNLOAD); +MainIpcChannel< + DownloadRendererRequest, + DownloadMainResponse +> = new MainIpcChannel(REQUEST_DOWNLOAD); const requestResumeDownloadChannel: // IpcChannel -MainIpcChannel = - new MainIpcChannel(RESUME_DOWNLOAD); +MainIpcChannel< + ResumeDownloadRendererRequest, + ResumeDownloadMainResponse +> = new MainIpcChannel(RESUME_DOWNLOAD); const deleteDownloadedFileChannel: // IpcChannel MainIpcChannel< DeleteDownloadedFileRendererRequest, @@ -263,8 +274,10 @@ MainIpcChannel< ClearDownloadLocalDataMainResponse > = new MainIpcChannel(CLEAR_DOWNLOAD_LOCAL_DATA); const checkFileExistsChannel: // IpcChannel -MainIpcChannel = - new MainIpcChannel(CHECK_FILE_EXISTS); +MainIpcChannel< + CheckFileExistsRendererRequest, + CheckFileExistsMainResponse +> = new MainIpcChannel(CHECK_FILE_EXISTS); export const downloadManagerChannel = (window: BrowserWindow) => { requestDownloadChannel.onRequest( (downloadRequestPayload: DownloadRendererRequest) => diff --git a/source/main/ipc/generateCsvChannel.ts b/source/main/ipc/generateCsvChannel.ts index 8bc5a8d51d..b09037cd72 100644 --- a/source/main/ipc/generateCsvChannel.ts +++ b/source/main/ipc/generateCsvChannel.ts @@ -8,8 +8,10 @@ import type { } from '../../common/ipc/api'; export const generateCsvChannel: // IpcChannel -MainIpcChannel = - new MainIpcChannel(GENERATE_CSV_CHANNEL); +MainIpcChannel< + GenerateCsvRendererRequest, + GenerateCsvMainResponse +> = new MainIpcChannel(GENERATE_CSV_CHANNEL); export const handleRewardsCsvRequests = () => { generateCsvChannel.onReceive( (request: GenerateCsvRendererRequest) => diff --git a/source/main/ipc/generateFileMetaChannel.ts b/source/main/ipc/generateFileMetaChannel.ts index edb66d84e7..965662cfbd 100644 --- a/source/main/ipc/generateFileMetaChannel.ts +++ b/source/main/ipc/generateFileMetaChannel.ts @@ -8,8 +8,10 @@ import type { } from '../../common/ipc/api'; export const generateFileMetaChannel: // IpcChannel -MainIpcChannel = - new MainIpcChannel(GENERATE_FILE_META_CHANNEL); +MainIpcChannel< + GenerateFileMetaRendererRequest, + GenerateFileMetaMainResponse +> = new MainIpcChannel(GENERATE_FILE_META_CHANNEL); export const handleFileMetaRequests = () => { generateFileMetaChannel.onReceive( (request: GenerateFileMetaRendererRequest) => diff --git a/source/main/ipc/getHardwareWalletChannel.ts b/source/main/ipc/getHardwareWalletChannel.ts index 6bfa2adddf..d4ff461f55 100644 --- a/source/main/ipc/getHardwareWalletChannel.ts +++ b/source/main/ipc/getHardwareWalletChannel.ts @@ -748,11 +748,12 @@ export const handleHardwareWalletRequests = async ( }); if (deviceFeatures.success) { - const extendedPublicKeyResponse = - await TrezorConnect.cardanoGetPublicKey({ + const extendedPublicKeyResponse = await TrezorConnect.cardanoGetPublicKey( + { path: `m/${path}`, showOnTrezor: true, - }); + } + ); if (!extendedPublicKeyResponse.success) { throw extendedPublicKeyResponse.payload; diff --git a/source/main/ipc/manageAppUpdateChannel.ts b/source/main/ipc/manageAppUpdateChannel.ts index 0aaa69df9b..f4f7b0c218 100644 --- a/source/main/ipc/manageAppUpdateChannel.ts +++ b/source/main/ipc/manageAppUpdateChannel.ts @@ -15,8 +15,10 @@ import { safeExitWithCode } from '../utils/safeExitWithCode'; import { logger } from '../utils/logging'; import { launcherConfig } from '../config'; // IpcChannel -const manageAppUpdateChannel: MainIpcChannel = - new MainIpcChannel(MANAGE_APP_UPDATE); +const manageAppUpdateChannel: MainIpcChannel< + Request, + Response +> = new MainIpcChannel(MANAGE_APP_UPDATE); const logPrefix = 'appUpdateInstall'; const getMessage = (functionPrefix: string, message?: string): string => { diff --git a/source/main/ipc/rebuild-application-menu.ts b/source/main/ipc/rebuild-application-menu.ts index 155af3b028..47f90cba93 100644 --- a/source/main/ipc/rebuild-application-menu.ts +++ b/source/main/ipc/rebuild-application-menu.ts @@ -6,5 +6,7 @@ import type { } from '../../common/ipc/api'; export const rebuildApplicationMenu: // IpcChannel -MainIpcChannel = - new MainIpcChannel(REBUILD_APP_MENU_CHANNEL); +MainIpcChannel< + RebuildAppMenuRendererRequest, + RebuildAppMenuMainResponse +> = new MainIpcChannel(REBUILD_APP_MENU_CHANNEL); diff --git a/source/main/ipc/saveQRCodeImageChannel.ts b/source/main/ipc/saveQRCodeImageChannel.ts index 1123c087b3..e7aea53da6 100644 --- a/source/main/ipc/saveQRCodeImageChannel.ts +++ b/source/main/ipc/saveQRCodeImageChannel.ts @@ -8,8 +8,10 @@ import type { } from '../../common/ipc/api'; export const saveQRCodeImageChannel: // IpcChannel -MainIpcChannel = - new MainIpcChannel(GENERATE_QRCODE_CHANNEL); +MainIpcChannel< + GenerateQRCodeRendererRequest, + GenerateQRCodeMainResponse +> = new MainIpcChannel(GENERATE_QRCODE_CHANNEL); export const saveQRCodeImageRequests = () => { saveQRCodeImageChannel.onReceive( (request: GenerateQRCodeRendererRequest) => diff --git a/source/main/ipc/show-file-dialog-channels.ts b/source/main/ipc/show-file-dialog-channels.ts index 1e32743d90..c8b0525924 100644 --- a/source/main/ipc/show-file-dialog-channels.ts +++ b/source/main/ipc/show-file-dialog-channels.ts @@ -13,11 +13,15 @@ import type { } from '../../common/ipc/api'; export const showOpenDialogChannel: // IpcChannel -MainIpcChannel = - new MainIpcChannel(SHOW_OPEN_DIALOG_CHANNEL); +MainIpcChannel< + ShowOpenDialogRendererRequest, + ShowOpenDialogMainResponse +> = new MainIpcChannel(SHOW_OPEN_DIALOG_CHANNEL); export const showSaveDialogChannel: // IpcChannel -MainIpcChannel = - new MainIpcChannel(SHOW_SAVE_DIALOG_CHANNEL); +MainIpcChannel< + ShowSaveDialogRendererRequest, + ShowSaveDialogMainResponse +> = new MainIpcChannel(SHOW_SAVE_DIALOG_CHANNEL); export const handleFileDialogRequests = (window: BrowserWindow) => { showOpenDialogChannel.onReceive((request: ShowOpenDialogRendererRequest) => // @ts-ignore ts-migrate(2345) FIXME: Argument of type 'FileDialogRequestParams' is not ... Remove this comment to see the full error message diff --git a/source/main/utils/getContentMinimumSize.ts b/source/main/utils/getContentMinimumSize.ts index 83f0aad541..29d5ca9b5c 100644 --- a/source/main/utils/getContentMinimumSize.ts +++ b/source/main/utils/getContentMinimumSize.ts @@ -23,8 +23,10 @@ export const getContentMinimumSize = ( ): getContentMinimumSizeResponse => { const { isWindows } = environment; const { width: frameWidth, height: frameHeight } = window.getBounds(); - const { width: contentWidth, height: contentHeight } = - window.getContentBounds(); + const { + width: contentWidth, + height: contentHeight, + } = window.getContentBounds(); const paddingWidth = frameWidth - contentWidth || 0; let paddingHeight = frameHeight - contentHeight || 0; diff --git a/source/main/utils/logging.ts b/source/main/utils/logging.ts index b365da17b8..a8d7cfe3b1 100644 --- a/source/main/utils/logging.ts +++ b/source/main/utils/logging.ts @@ -23,14 +23,15 @@ const environmentData = { version, }; -const logToLevel = - (level: string) => - (message: string, data: Record | null | undefined) => - log[level](formatContext({ ...messageContext, level }), { - message, - data: toJS(data), - environmentData, - }); +const logToLevel = (level: string) => ( + message: string, + data: Record | null | undefined +) => + log[level](formatContext({ ...messageContext, level }), { + message, + data: toJS(data), + environmentData, + }); export const logger: Logger = { debug: logToLevel('debug'), diff --git a/source/main/utils/setupLogging.ts b/source/main/utils/setupLogging.ts index 1518b415b2..de382842d5 100644 --- a/source/main/utils/setupLogging.ts +++ b/source/main/utils/setupLogging.ts @@ -122,8 +122,13 @@ export const logStateSnapshot = ( ): MessageBody => { const { ...data } = props; const { currentTime: at, systemInfo, coreInfo } = data; - const { platform, platformVersion, cpu, ram, availableDiskSpace } = - systemInfo; + const { + platform, + platformVersion, + cpu, + ram, + availableDiskSpace, + } = systemInfo; const { daedalusVersion, daedalusProcessID, diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index f1a2adcbbe..2fd73b8de7 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -677,8 +677,7 @@ export default class AdaApi { assets: response, }); // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. - const assetsLocaldata = - await global.daedalus.api.localStorage.getAssetsLocalData(); + const assetsLocaldata = await global.daedalus.api.localStorage.getAssetsLocalData(); logger.debug('AdaApi::getAssetsLocalData success', { assetsLocaldata, }); @@ -1703,8 +1702,9 @@ export default class AdaApi { getCurrencyList = async (): Promise => { try { const apiResponse = await getCurrencyList(); - const response: GetCurrencyListResponse = - currencyConfig.responses.list(apiResponse); + const response: GetCurrencyListResponse = currencyConfig.responses.list( + apiResponse + ); logger.debug('AdaApi::getCurrencyList success', { response, }); @@ -1722,8 +1722,9 @@ export default class AdaApi { ): Promise => { try { const apiResponse = await getCurrencyRate(currency); - const response: GetCurrencyRateResponse = - currencyConfig.responses.rate(apiResponse); + const response: GetCurrencyRateResponse = currencyConfig.responses.rate( + apiResponse + ); logger.debug('AdaApi::getCurrencyRate success', { response, }); @@ -2243,8 +2244,9 @@ export default class AdaApi { logger.debug('AdaApi::getSmashSettings called'); try { - const { pool_metadata_source: poolMetadataSource } = - await getSmashSettings(this.config); + const { + pool_metadata_source: poolMetadataSource, + } = await getSmashSettings(this.config); logger.debug('AdaApi::getSmashSettings success', { poolMetadataSource, }); @@ -2269,8 +2271,12 @@ export default class AdaApi { return true; } - const { health }: CheckSmashServerHealthApiResponse = - await checkSmashServerHealth(this.config, url); + const { + health, + }: CheckSmashServerHealthApiResponse = await checkSmashServerHealth( + this.config, + url + ); const isValid = health === SMASH_SERVER_STATUSES.AVAILABLE; logger.debug('AdaApi::checkSmashServerIsValid success', { isValid, @@ -2491,10 +2497,12 @@ export default class AdaApi { }); try { - const response: TransferFundsCalculateFeeApiResponse = - await transferFundsCalculateFee(this.config, { + const response: TransferFundsCalculateFeeApiResponse = await transferFundsCalculateFee( + this.config, + { sourceWalletId, - }); + } + ); logger.debug('AdaApi::transferFundsCalculateFee success', { response, }); @@ -2704,8 +2712,9 @@ export default class AdaApi { logger.debug('AdaApi::getNetworkParameters called'); try { - const networkParameters: GetNetworkParametersApiResponse = - await getNetworkParameters(this.config); + const networkParameters: GetNetworkParametersApiResponse = await getNetworkParameters( + this.config + ); logger.debug('AdaApi::getNetworkParameters success', { networkParameters, }); diff --git a/source/renderer/app/components/assets/AssetTransactionConfirmation.tsx b/source/renderer/app/components/assets/AssetTransactionConfirmation.tsx index e33da64432..8226fad7b1 100644 --- a/source/renderer/app/components/assets/AssetTransactionConfirmation.tsx +++ b/source/renderer/app/components/assets/AssetTransactionConfirmation.tsx @@ -31,14 +31,16 @@ const messages = defineMessages({ '"unformattedAmountLabel" item on AssetTransactionConfirmation.', }, unformattedAmountMessageForHardwareWallets: { - id: 'asset.transactionConfirmation.unformattedAmountMessageForHardwareWallets', + id: + 'asset.transactionConfirmation.unformattedAmountMessageForHardwareWallets', defaultMessage: '!!!Native assets may specify a number of decimal places, as defined in the Cardano token registry. Daedalus uses this information to format the amount that is being sent in the transaction.

    The native token unformatted amount is the amount without these decimal places. Please ensure that you verify both amounts, as some wallet software may not yet use the Cardano token registry.', description: '"unformattedAmountMessageForHardwareWallets" item on AssetTransactionConfirmation.', }, unformattedAmountMessageForSoftwareWallets: { - id: 'asset.transactionConfirmation.unformattedAmountMessageForSoftwareWallets', + id: + 'asset.transactionConfirmation.unformattedAmountMessageForSoftwareWallets', defaultMessage: '!!!Native assets may specify a number of decimal places, as defined in the Cardano token registry. Daedalus uses this information to format the amount that is being sent in the transaction.

    The native token unformatted amount is the amount without these decimal places. Please ensure that you verify both amounts, as some wallet software may not yet use the Cardano token registry.

    The native token unformatted amount will be displayed on the hardware wallet device during transaction confirmation.', description: diff --git a/source/renderer/app/components/dapp/DappTransactionRequest.tsx b/source/renderer/app/components/dapp/DappTransactionRequest.tsx index fb6a635d47..850812c180 100644 --- a/source/renderer/app/components/dapp/DappTransactionRequest.tsx +++ b/source/renderer/app/components/dapp/DappTransactionRequest.tsx @@ -93,8 +93,9 @@ type Props = { wallets: Array; }; const DappTransactionRequest = observer((props: Props) => { - const [isAdditionalDataVisible, toggleAdditionalData] = - useState(false); + const [isAdditionalDataVisible, toggleAdditionalData] = useState( + false + ); const [isMetadataVisible, toggleMetadata] = useState(false); // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. const getToggleLabel = useCallback((isVisible: boolean) => @@ -133,8 +134,9 @@ const DappTransactionRequest = observer((props: Props) => { [assets, selectedWallet] ); const adaBalanceRequired = adaAmount.plus(transactionFee); - const walletsDropdownHasError = - selectedWallet?.amount.isLessThan(adaBalanceRequired); + const walletsDropdownHasError = selectedWallet?.amount.isLessThan( + adaBalanceRequired + ); if (walletsDropdownHasError) { hasAmountError = true; diff --git a/source/renderer/app/components/knownIssues/ToggleRTSFlagsDialog/ToggleRTSFlagsDialog.tsx b/source/renderer/app/components/knownIssues/ToggleRTSFlagsDialog/ToggleRTSFlagsDialog.tsx index f5f59ac9c4..b69e769681 100644 --- a/source/renderer/app/components/knownIssues/ToggleRTSFlagsDialog/ToggleRTSFlagsDialog.tsx +++ b/source/renderer/app/components/knownIssues/ToggleRTSFlagsDialog/ToggleRTSFlagsDialog.tsx @@ -42,7 +42,8 @@ const messages = defineMessages({ description: 'Disable RTS flags button label', }, manualRelaunchConfirmationCheckboxLabel: { - id: 'knownIssues.dialog.toggleRtsFlagsMode.manualRelaunchConfirmationCheckboxLabel', + id: + 'knownIssues.dialog.toggleRtsFlagsMode.manualRelaunchConfirmationCheckboxLabel', defaultMessage: '!!!I understand that I will need to launch Daedalus manually', description: 'Manual relaunch confirmation checkbox label', diff --git a/source/renderer/app/components/layout/SidebarLayout.tsx b/source/renderer/app/components/layout/SidebarLayout.tsx index 2c71a30f07..dc27f7785e 100644 --- a/source/renderer/app/components/layout/SidebarLayout.tsx +++ b/source/renderer/app/components/layout/SidebarLayout.tsx @@ -20,8 +20,13 @@ class SidebarLayout extends Component { }; render() { - const { children, sidebar, topbar, notification, contentDialogs } = - this.props; + const { + children, + sidebar, + topbar, + notification, + contentDialogs, + } = this.props; return (
    {sidebar}
    diff --git a/source/renderer/app/components/loading/no-disk-space-error/NoDiskSpaceError.tsx b/source/renderer/app/components/loading/no-disk-space-error/NoDiskSpaceError.tsx index 377a754fc0..c73023c97d 100644 --- a/source/renderer/app/components/loading/no-disk-space-error/NoDiskSpaceError.tsx +++ b/source/renderer/app/components/loading/no-disk-space-error/NoDiskSpaceError.tsx @@ -34,8 +34,11 @@ class NoDiskSpaceError extends Component { render() { const { intl } = this.context; - const { diskSpaceRequired, diskSpaceMissing, diskSpaceRecommended } = - this.props; + const { + diskSpaceRequired, + diskSpaceMissing, + diskSpaceRecommended, + } = this.props; return (
    diff --git a/source/renderer/app/components/loading/syncing-connecting/SyncingConnectingStatus.tsx b/source/renderer/app/components/loading/syncing-connecting/SyncingConnectingStatus.tsx index 165c5ef1d0..309a9d4426 100644 --- a/source/renderer/app/components/loading/syncing-connecting/SyncingConnectingStatus.tsx +++ b/source/renderer/app/components/loading/syncing-connecting/SyncingConnectingStatus.tsx @@ -234,8 +234,10 @@ export default class SyncingConnectingStatus extends Component { showEllipsis ? styles.withoutAnimation : null, ]); - const { connectingMessage, connectingDescription } = - this._getConnectingMessage(); + const { + connectingMessage, + connectingDescription, + } = this._getConnectingMessage(); return (
    diff --git a/source/renderer/app/components/profile/terms-of-use/TermsOfUseForm.tsx b/source/renderer/app/components/profile/terms-of-use/TermsOfUseForm.tsx index 52015b4ab9..210d827639 100644 --- a/source/renderer/app/components/profile/terms-of-use/TermsOfUseForm.tsx +++ b/source/renderer/app/components/profile/terms-of-use/TermsOfUseForm.tsx @@ -60,8 +60,12 @@ class TermsOfUseForm extends Component { render() { const { intl } = this.context; - const { isSubmitting, error, localizedTermsOfUse, onOpenExternalLink } = - this.props; + const { + isSubmitting, + error, + localizedTermsOfUse, + onOpenExternalLink, + } = this.props; const { areTermsOfUseAccepted } = this.state; const buttonClasses = classnames([ 'primary', diff --git a/source/renderer/app/components/sidebar/wallets/SidebarWalletsMenu.tsx b/source/renderer/app/components/sidebar/wallets/SidebarWalletsMenu.tsx index 2716cfadf9..0e0098e5ed 100644 --- a/source/renderer/app/components/sidebar/wallets/SidebarWalletsMenu.tsx +++ b/source/renderer/app/components/sidebar/wallets/SidebarWalletsMenu.tsx @@ -86,8 +86,10 @@ class SidebarWalletsMenu extends Component {
    ); walletSort = (sortBy: WalletSortByOptions) => { - const { sortOrder = WalletSortOrder.asc, onWalletSortBy = noop } = - this.props; + const { + sortOrder = WalletSortOrder.asc, + onWalletSortBy = noop, + } = this.props; return onWalletSortBy({ sortBy, sortOrder, diff --git a/source/renderer/app/components/staking/countdown/StakingCountdown.tsx b/source/renderer/app/components/staking/countdown/StakingCountdown.tsx index f1cd67b8d9..2a4b7b89ea 100644 --- a/source/renderer/app/components/staking/countdown/StakingCountdown.tsx +++ b/source/renderer/app/components/staking/countdown/StakingCountdown.tsx @@ -43,8 +43,11 @@ class StakingCountdown extends Component { }; render() { - const { redirectToStakingInfo, startDateTime, onLearnMoreClick } = - this.props; + const { + redirectToStakingInfo, + startDateTime, + onLearnMoreClick, + } = this.props; const { intl } = this.context; const heading = intl.formatMessage(messages.heading); const description = intl.formatMessage(messages.description); diff --git a/source/renderer/app/components/staking/delegation-center/WalletRow.tsx b/source/renderer/app/components/staking/delegation-center/WalletRow.tsx index 289a5b6ae3..5116e983c4 100644 --- a/source/renderer/app/components/staking/delegation-center/WalletRow.tsx +++ b/source/renderer/app/components/staking/delegation-center/WalletRow.tsx @@ -238,11 +238,10 @@ class WalletRow extends Component { const nextPendingDelegatedStakePool = nextPendingDelegatedStakePoolId ? getStakePoolById(nextPendingDelegatedStakePoolId) : null; - const futurePendingDelegatedStakePoolId = - this.getPendingDelegatedStakePoolId( - futureEpochNumber, - nextPendingDelegatedStakePoolId - ); + const futurePendingDelegatedStakePoolId = this.getPendingDelegatedStakePoolId( + futureEpochNumber, + nextPendingDelegatedStakePoolId + ); const futurePendingDelegatedStakePool = futurePendingDelegatedStakePoolId ? getStakePoolById(futurePendingDelegatedStakePoolId) : null; diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseStakePoolDialog.messages.ts b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseStakePoolDialog.messages.ts index a5a3267e38..8751d17a54 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseStakePoolDialog.messages.ts +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseStakePoolDialog.messages.ts @@ -17,73 +17,84 @@ export const getMessages = () => { 'Description on the delegation setup "choose stake pool" dialog.', }, selectStakePoolLabel: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.selectStakePoolLabel', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.selectStakePoolLabel', defaultMessage: '!!!Select a stake pool to receive your delegated funds in the {selectedWalletName} wallet.', description: 'Select / Selected pool section label on the delegation setup "choose stake pool" dialog.', }, selectedStakePoolLabel: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.selectedStakePoolLabel', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.selectedStakePoolLabel', defaultMessage: '!!!You have selected [{selectedPoolTicker}] stake pool to delegate to for {selectedWalletName} wallet.', description: '"Selected Pools" Selected pool label on the delegation setup "choose stake pool" dialog.', }, selectedStakePoolLabelRetiring: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.selectedStakePoolLabelRetiring', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.selectedStakePoolLabelRetiring', defaultMessage: '!!!The [{selectedPoolTicker}] stake pool which you have selected to delegate your {selectedWalletName} wallet funds is about to retire.', description: '"Selected Pools" Selected pool label on the delegation setup "choose stake pool" dialog.', }, delegatedStakePoolLabel: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.delegatedStakePoolLabel', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.delegatedStakePoolLabel', defaultMessage: '!!!You are already delegating {selectedWalletName} wallet to [{selectedPoolTicker}] stake pool. If you wish to re-delegate your stake, please select a different pool.', description: '"You are already delegating to stake pool" label on the delegation setup "choose stake pool" dialog.', }, delegatedStakePoolNextLabel: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.delegatedStakePoolNextLabel', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.delegatedStakePoolNextLabel', defaultMessage: '!!!You are already pending delegation {selectedWalletName} wallet to [{selectedPoolTicker}] stake pool. If you wish to re-delegate your stake, please select a different pool.', description: '"You are already delegating to stake pool" label on the delegation setup "choose stake pool" dialog.', }, recentPoolsLabel: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.recentPoolsLabel', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.recentPoolsLabel', defaultMessage: '!!!Choose one of your recent stake pool choices:', description: 'Recent "Pool" choice section label on the delegation setup "choose stake pool" dialog.', }, searchInputLabel: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.searchInput.label', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.searchInput.label', defaultMessage: '!!!Or select a stake pool from the list of all available stake pools:', description: 'Search "Pools" input label on the delegation setup "choose stake pool" dialog.', }, searchInputPlaceholder: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.searchInput.placeholder', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.searchInput.placeholder', defaultMessage: '!!!Search stake pools', description: 'Search "Pools" input placeholder on the delegation setup "choose stake pool" dialog.', }, continueButtonLabel: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.continueButtonLabel', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.continueButtonLabel', defaultMessage: '!!!Continue', description: 'Label for continue button on the delegation setup "choose stake pool" dialog.', }, stepIndicatorLabel: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.stepIndicatorLabel', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.stepIndicatorLabel', defaultMessage: '!!!STEP {currentStep} OF {totalSteps}', description: 'Step indicator label on the delegation setup "choose wallet" step dialog.', }, retiringPoolFooter: { - id: 'staking.delegationSetup.chooseStakePool.step.dialog.retiringPoolFooter', + id: + 'staking.delegationSetup.chooseStakePool.step.dialog.retiringPoolFooter', defaultMessage: '!!!The stake pool you have selected is about to be retired. If you continue the delegation process, you will need to delegate your stake to another pool at least one complete epoch before the current pool’s retirement date to avoid losing rewards.', description: diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx index aa21c2e533..20211f3069 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx @@ -33,13 +33,15 @@ const messages = defineMessages({ 'Description on the delegation setup "choose wallet" step dialog.', }, selectWalletInputLabel: { - id: 'staking.delegationSetup.chooseWallet.step.dialog.selectWalletInputLabel', + id: + 'staking.delegationSetup.chooseWallet.step.dialog.selectWalletInputLabel', defaultMessage: '!!!Wallet', description: 'Label "Wallet" for select input on the delegation setup "choose wallet" step dialog.', }, selectWalletInputPlaceholder: { - id: 'staking.delegationSetup.chooseWallet.step.dialog.selectWalletInputPlaceholder', + id: + 'staking.delegationSetup.chooseWallet.step.dialog.selectWalletInputPlaceholder', defaultMessage: '!!!Select Wallet', description: 'Placeholder "Select Wallet" for select input on the delegation setup "choose wallet" step dialog.', @@ -51,14 +53,16 @@ const messages = defineMessages({ 'Step indicator label on the delegation setup "choose wallet" step dialog.', }, errorMinDelegationFunds: { - id: 'staking.delegationSetup.chooseWallet.step.dialog.errorMinDelegationFunds', + id: + 'staking.delegationSetup.chooseWallet.step.dialog.errorMinDelegationFunds', defaultMessage: '!!!This wallet does not contain the minimum amount of {minDelegationFunds} ADA which is required for delegation to be available. Please select a wallet with a minimum amount of {minDelegationFunds} ADA and click continue.', description: 'errorMinDelegationFunds Error Label on the delegation setup "choose wallet" step dialog.', }, errorMinDelegationFundsRewardsOnly: { - id: 'staking.delegationSetup.chooseWallet.step.dialog.errorMinDelegationFundsRewardsOnly', + id: + 'staking.delegationSetup.chooseWallet.step.dialog.errorMinDelegationFundsRewardsOnly', defaultMessage: '!!!This wallet contains only rewards balances so it cannot be delegated.', description: diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsConfirmationDialog.messages.ts b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsConfirmationDialog.messages.ts index 8a7fa2a014..69b3165524 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsConfirmationDialog.messages.ts +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsConfirmationDialog.messages.ts @@ -42,12 +42,14 @@ export const getMessages = () => { 'Deposit label on the delegation setup "confirmation" step dialog.', }, spendingPasswordPlaceholder: { - id: 'staking.delegationSetup.confirmation.step.dialog.spendingPasswordPlaceholder', + id: + 'staking.delegationSetup.confirmation.step.dialog.spendingPasswordPlaceholder', defaultMessage: '!!!Spending password', description: 'Placeholder for "spending password"', }, spendingPasswordLabel: { - id: 'staking.delegationSetup.confirmation.step.dialog.spendingPasswordLabel', + id: + 'staking.delegationSetup.confirmation.step.dialog.spendingPasswordLabel', defaultMessage: '!!!Spending password', description: 'Label for "spending password"', }, diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsNotAvailableDialog.tsx b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsNotAvailableDialog.tsx index 780c6a624b..19acaf3616 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsNotAvailableDialog.tsx +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsNotAvailableDialog.tsx @@ -35,7 +35,9 @@ const messages = defineMessages({ 'Label for close button on the delegation setup not available dialog.', }, }); -export default class DelegationStepsNotAvailableDialog extends Component { +export default class DelegationStepsNotAvailableDialog extends Component< + Props +> { static contextTypes = { intl: intlShape.isRequired, }; diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsSuccessDialog.tsx b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsSuccessDialog.tsx index 68c3fe47cf..6166330005 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsSuccessDialog.tsx +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsSuccessDialog.tsx @@ -97,8 +97,12 @@ class DelegationStepsSuccessDialog extends Component { render() { const { intl } = this.context; - const { delegatedWallet, delegatedStakePool, currentLocale, onClose } = - this.props; + const { + delegatedWallet, + delegatedStakePool, + currentLocale, + onClose, + } = this.props; const actions = [ { className: 'closeButton', diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/OversaturationText.tsx b/source/renderer/app/components/staking/delegation-setup-wizard/OversaturationText.tsx index 50bd2d30ca..36b69a3a93 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/OversaturationText.tsx +++ b/source/renderer/app/components/staking/delegation-setup-wizard/OversaturationText.tsx @@ -12,7 +12,8 @@ import styles from './OversaturationText.scss'; const messages: Record = defineMessages({ oversaturationWarning: { - id: 'staking.delegationSetup.confirmation.step.dialog.oversaturationWarning', + id: + 'staking.delegationSetup.confirmation.step.dialog.oversaturationWarning', defaultMessage: '!!!The selected stake pool will become oversaturated by {oversaturationPercentage}%, which will reduce future rewards for all delegators to that pool.', description: diff --git a/source/renderer/app/components/staking/epochs/StakingEpochsDataTable.tsx b/source/renderer/app/components/staking/epochs/StakingEpochsDataTable.tsx index be482fb97c..8320c8b2ae 100644 --- a/source/renderer/app/components/staking/epochs/StakingEpochsDataTable.tsx +++ b/source/renderer/app/components/staking/epochs/StakingEpochsDataTable.tsx @@ -25,8 +25,13 @@ type Props = { @observer class StakingEpochsDataTable extends Component { render() { - const { tableHeaders, tableBody, order, sortBy, handleDataSort } = - this.props; + const { + tableHeaders, + tableBody, + order, + sortBy, + handleDataSort, + } = this.props; return (
diff --git a/source/renderer/app/components/staking/info/StakingInfoCountdown.tsx b/source/renderer/app/components/staking/info/StakingInfoCountdown.tsx index 80c3707feb..808c2c1f46 100644 --- a/source/renderer/app/components/staking/info/StakingInfoCountdown.tsx +++ b/source/renderer/app/components/staking/info/StakingInfoCountdown.tsx @@ -69,8 +69,11 @@ class StakingInfoCountdown extends Component { } checkIfShouldSetStakingInfoWasOpen = () => { - const { onSetStakingInfoWasOpen, isAlonzoActivated, stakingInfoWasOpen } = - this.props; + const { + onSetStakingInfoWasOpen, + isAlonzoActivated, + stakingInfoWasOpen, + } = this.props; if (isAlonzoActivated && !stakingInfoWasOpen) { onSetStakingInfoWasOpen(); diff --git a/source/renderer/app/components/staking/navigation/StakingNavigation.tsx b/source/renderer/app/components/staking/navigation/StakingNavigation.tsx index 05aec41b8f..f39f3564b9 100644 --- a/source/renderer/app/components/staking/navigation/StakingNavigation.tsx +++ b/source/renderer/app/components/staking/navigation/StakingNavigation.tsx @@ -46,8 +46,12 @@ class StakingNavigation extends Component { }; render() { - const { onNavItemClick, activeItem, isActiveNavItem, showInfoTab } = - this.props; + const { + onNavItemClick, + activeItem, + isActiveNavItem, + showInfoTab, + } = this.props; const { intl } = this.context; const navigationItems = [ { diff --git a/source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx b/source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx index 9916ca0bcc..4a1b474d23 100644 --- a/source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx +++ b/source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx @@ -218,8 +218,11 @@ class StakePoolsRanking extends Component { rankStakePools(); }; onSliderChange = (sliderValue: number) => { - const { updateDelegatingStake, maxDelegationFunds, maxDelegationFundsLog } = - this.props; + const { + updateDelegatingStake, + maxDelegationFunds, + maxDelegationFundsLog, + } = this.props; let amountValue = null; if ( diff --git a/source/renderer/app/components/staking/widgets/ThumbPool.tsx b/source/renderer/app/components/staking/widgets/ThumbPool.tsx index 7f5fc3b46b..ede4596c07 100644 --- a/source/renderer/app/components/staking/widgets/ThumbPool.tsx +++ b/source/renderer/app/components/staking/widgets/ThumbPool.tsx @@ -30,8 +30,12 @@ export function ThumbPool(props: { disabledStakePoolId: string | null | undefined; isGridRewardsView?: boolean; }) { - const { isGridRewardsView, isSelected, numberOfRankedStakePools, stakePool } = - props; + const { + isGridRewardsView, + isSelected, + numberOfRankedStakePools, + stakePool, + } = props; const { ranking, id } = stakePool; const color = getColorFromRange(ranking, numberOfRankedStakePools); const isDisabled = props.disabledStakePoolId === id; diff --git a/source/renderer/app/components/staking/widgets/ThumbPoolContent.tsx b/source/renderer/app/components/staking/widgets/ThumbPoolContent.tsx index 82b9610bdd..521cb32471 100644 --- a/source/renderer/app/components/staking/widgets/ThumbPoolContent.tsx +++ b/source/renderer/app/components/staking/widgets/ThumbPoolContent.tsx @@ -47,8 +47,11 @@ class ThumbPoolContent extends Component { }; render() { - const { stakePool, numberOfRankedStakePools, isGridRewardsView } = - this.props; + const { + stakePool, + numberOfRankedStakePools, + isGridRewardsView, + } = this.props; const { ranking, nonMyopicMemberRewards, diff --git a/source/renderer/app/components/staking/widgets/ThumbSelectedPool.tsx b/source/renderer/app/components/staking/widgets/ThumbSelectedPool.tsx index cc67c667a1..5d1377f742 100644 --- a/source/renderer/app/components/staking/widgets/ThumbSelectedPool.tsx +++ b/source/renderer/app/components/staking/widgets/ThumbSelectedPool.tsx @@ -23,8 +23,11 @@ type Props = { @observer class ThumbSelectedPool extends Component { render() { - const { stakePool, alreadyDelegated, numberOfRankedStakePools } = - this.props; + const { + stakePool, + alreadyDelegated, + numberOfRankedStakePools, + } = this.props; const { ticker, retiring, ranking } = stakePool || {}; const rankColor = stakePool && !retiring && IS_RANKING_DATA_AVAILABLE diff --git a/source/renderer/app/components/status/DaedalusDiagnostics.tsx b/source/renderer/app/components/status/DaedalusDiagnostics.tsx index c2b9a266d0..4cda4ae705 100644 --- a/source/renderer/app/components/status/DaedalusDiagnostics.tsx +++ b/source/renderer/app/components/status/DaedalusDiagnostics.tsx @@ -89,14 +89,16 @@ const messages = defineMessages({ 'Displayed on the right of the Recommended system requirements status row when hardware requirements are ok', }, hasMetHardwareRequirementsStatusLowTooltip: { - id: 'daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusLowTooltip', + id: + 'daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusLowTooltip', defaultMessage: '!!!Your system specifications do not meet Daedalus’ recommended hardware requirements. We suggest using a machine with at least 16 GB of RAM', description: 'Visible on hovering over Recommended system requirement status when status is Low', }, hasMetHardwareRequirementsStatusGoodTooltip: { - id: 'daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusGoodTooltip', + id: + 'daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusGoodTooltip', defaultMessage: '!!!Your system specifications meet Daedalus’ recommended hardware requirements', description: diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx index 234cd68dad..284f7e49a7 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx @@ -22,7 +22,8 @@ const messages = defineMessages({ 'Label "Wallet" for select input on the voting registration "choose wallet" step.', }, selectWalletInputPlaceholder: { - id: 'voting.votingRegistration.chooseWallet.step.selectWalletInputPlaceholder', + id: + 'voting.votingRegistration.chooseWallet.step.selectWalletInputPlaceholder', defaultMessage: '!!!Select a wallet', description: 'Placeholder "Select Wallet" for select input on the voting registration "choose wallet" step.', @@ -35,7 +36,8 @@ const messages = defineMessages({ 'errorMinVotingFunds Error Label on the voting registration "choose wallet" step.', }, errorMinVotingFundsRewardsOnly: { - id: 'voting.votingRegistration.chooseWallet.step.errorMinVotingFundsRewardsOnly', + id: + 'voting.votingRegistration.chooseWallet.step.errorMinVotingFundsRewardsOnly', defaultMessage: '!!!This wallet cannot be registered for voting as it contains rewards balance only.', description: diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx index d6d999febb..4f6a2271ca 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx @@ -48,7 +48,8 @@ const messages = defineMessages({ description: 'Error message shown when repeat pin code is invalid.', }, invalidRepeatPinCode: { - id: 'voting.votingRegistration.enterPinCode.step.errors.invalidRepeatPinCode', + id: + 'voting.votingRegistration.enterPinCode.step.errors.invalidRepeatPinCode', defaultMessage: '!!!PIN doesn’t match', description: 'Error message shown when repeat pin code is invalid.', }, diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx index f607bd00d7..6e96094b99 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx @@ -22,13 +22,15 @@ const messages = defineMessages({ 'Content for the voting registration cancellation confirmation dialog.', }, cancelButtonLabel: { - id: 'voting.votingRegistration.dialog.confirmation.button.cancelButtonLabel', + id: + 'voting.votingRegistration.dialog.confirmation.button.cancelButtonLabel', defaultMessage: '!!!Cancel registration', description: '"Cancel registration" button label for the voting registration cancellation confirmation dialog.', }, confirmButtonLabel: { - id: 'voting.votingRegistration.dialog.confirmation.button.confirmButtonLabel', + id: + 'voting.votingRegistration.dialog.confirmation.button.confirmButtonLabel', defaultMessage: '!!!Continue registration', description: '"Continue registration" button label for the voting registration cancellation confirmation dialog.', diff --git a/source/renderer/app/components/wallet/WalletSendForm.tsx b/source/renderer/app/components/wallet/WalletSendForm.tsx index 5f84da7319..a231353171 100755 --- a/source/renderer/app/components/wallet/WalletSendForm.tsx +++ b/source/renderer/app/components/wallet/WalletSendForm.tsx @@ -593,8 +593,11 @@ class WalletSendForm extends Component { adaAmount: BigNumber, minimumAda: BigNumber ): Promise => { - const { adaAmountInputTrack, selectedAssetUniqueIds, adaInputState } = - this.state; + const { + adaAmountInputTrack, + selectedAssetUniqueIds, + adaInputState, + } = this.state; if ( adaAmountInputTrack.gt(minimumAda) && diff --git a/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.tsx b/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.tsx index 4376b7735d..61335941db 100644 --- a/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.tsx +++ b/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.tsx @@ -21,7 +21,8 @@ const messages = defineMessages({ 'Instructions for backing up wallet recovery phrase on dialog that displays wallet recovery phrase.', }, buttonLabelIHaveWrittenItDown: { - id: 'wallet.backup.recovery.phrase.display.dialog.button.label.iHaveWrittenItDown', + id: + 'wallet.backup.recovery.phrase.display.dialog.button.label.iHaveWrittenItDown', defaultMessage: '!!!Yes, I have written down my wallet recovery phrase.', description: 'Label for button "Yes, I have written down my wallet recovery phrase." on wallet backup dialog', @@ -78,8 +79,7 @@ class WalletRecoveryPhraseDisplayDialog extends Component { } diff --git a/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx b/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx index 33b091bdb0..66213e592f 100644 --- a/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx +++ b/source/renderer/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.tsx @@ -44,18 +44,21 @@ const messages = defineMessages({ description: 'Placeholder hint for the mnemonics autocomplete.', }, recoveryPhraseInputPlaceholder: { - id: 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputPlaceholder', + id: + 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputPlaceholder', defaultMessage: '!!!Enter word #{wordNumber}', description: 'Placeholder for the mnemonics autocomplete.', }, recoveryPhraseNoResults: { - id: 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputNoResults', + id: + 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInputNoResults', defaultMessage: '!!!No results', description: '"No results" message for the recovery phrase input search results.', }, recoveryPhraseInvalidMnemonics: { - id: 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInvalidMnemonics', + id: + 'wallet.backup.recovery.phrase.entry.dialog.recoveryPhraseInvalidMnemonics', defaultMessage: '!!!Invalid recovery phrase', description: 'Error message shown when invalid recovery phrase was entered.', @@ -66,13 +69,15 @@ const messages = defineMessages({ description: 'Label for button "Confirm" on wallet backup dialog', }, termOffline: { - id: 'wallet.backup.recovery.phrase.entry.dialog.terms.and.condition.offline', + id: + 'wallet.backup.recovery.phrase.entry.dialog.terms.and.condition.offline', defaultMessage: '!!!I understand that the simplest way to keep my wallet recovery phrase secure is to never store it digitally or online. If I decide to use an online service, such as a password manager with an encrypted database, it is my responsibility to make sure that I use it correctly.', description: 'Term on wallet creation to store recovery phrase offline', }, termRecovery: { - id: 'wallet.backup.recovery.phrase.entry.dialog.terms.and.condition.recovery', + id: + 'wallet.backup.recovery.phrase.entry.dialog.terms.and.condition.recovery', defaultMessage: '!!!I understand that the only way to recover my wallet if my computer is lost, broken, stolen, or stops working is to use my wallet recovery phrase.', description: diff --git a/source/renderer/app/components/wallet/paper-wallet-certificate/CompletionDialog.tsx b/source/renderer/app/components/wallet/paper-wallet-certificate/CompletionDialog.tsx index 4b703488d2..4b1bead432 100644 --- a/source/renderer/app/components/wallet/paper-wallet-certificate/CompletionDialog.tsx +++ b/source/renderer/app/components/wallet/paper-wallet-certificate/CompletionDialog.tsx @@ -111,8 +111,12 @@ class CompletionDialog extends Component { render() { const { intl } = this.context; - const { onClose, walletCertificateAddress, onOpenExternalLink, network } = - this.props; + const { + onClose, + walletCertificateAddress, + onOpenExternalLink, + network, + } = this.props; const { showCopyNotification } = this.state; const dialogClasses = classnames([styles.component, 'completionDialog']); const actions = [ diff --git a/source/renderer/app/components/wallet/paper-wallet-certificate/InstructionsDialog.tsx b/source/renderer/app/components/wallet/paper-wallet-certificate/InstructionsDialog.tsx index 4ee7b33d71..70efcad940 100644 --- a/source/renderer/app/components/wallet/paper-wallet-certificate/InstructionsDialog.tsx +++ b/source/renderer/app/components/wallet/paper-wallet-certificate/InstructionsDialog.tsx @@ -40,13 +40,15 @@ const messages = defineMessages({ 'subtitle2 for the "Paper wallet create certificate instructions dialog".', }, instructionsListLabel: { - id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.label', + id: + 'paper.wallet.create.certificate.instructions.dialog.instructionsList.label', defaultMessage: '!!!Instructions', description: 'Instructions list label for the "Paper wallet create certificate instructions dialog".', }, instructionsListDefinition1: { - id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition1', + id: + 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition1', defaultMessage: `!!!Your printed certificate will include your paper wallet recovery phrase of {paperWalletRecoveryPhraseWordCount} words. Note that your paper wallet recovery phrase is different to the {walletRecoveryPhraseWordCount}-word recovery phrases used to restore your @@ -54,32 +56,37 @@ const messages = defineMessages({ description: 'Wallet certificate create instructions dialog definition 1.', }, instructionsListDefinition2: { - id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition2', + id: + 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition2', defaultMessage: `!!!For security reasons, the last {paperWalletWrittenWordsCount} words of your paper wallet recovery phrase will not be printed on the paper wallet certificate itself. You will need to write them on your certificate by hand in a moment.`, description: 'Wallet certificate create instructions dialog definition 2.', }, instructionsListDefinition3: { - id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition3', + id: + 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition3', defaultMessage: '!!!Use the address on your certificate to send funds to your paper wallet.', description: 'Wallet certificate create instructions dialog definition 3.', }, instructionsListDefinition4: { - id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition4', + id: + 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition4', defaultMessage: `!!!Your paper wallet will be offline so will not be held in Daedalus. To check the balance of the wallet, input the address on the certificate into`, description: 'Wallet certificate create instructions dialog definition 4.', }, instructionsListDefinition5: { - id: 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition5', + id: + 'paper.wallet.create.certificate.instructions.dialog.instructionsList.definition5', defaultMessage: '!!!Store your certificate containing your paper wallet recovery phrase in a safe place.', description: 'Wallet certificate create instructions dialog definition 5.', }, printingInstructions: { - id: 'paper.wallet.create.certificate.instructions.dialog.printingInstructions', + id: + 'paper.wallet.create.certificate.instructions.dialog.printingInstructions', defaultMessage: `!!!When you click “Save PDF file for printing” you will be prompted to choose a location on your computer where the PDF file will be saved. After that open the saved PDF file and print it.`, @@ -127,8 +134,14 @@ class InstructionsDialog extends Component { render() { const { intl } = this.context; - const { onClose, onPrint, inProgress, onOpenExternalLink, network, error } = - this.props; + const { + onClose, + onPrint, + inProgress, + onOpenExternalLink, + network, + error, + } = this.props; const dialogClasses = classnames([styles.component, 'instructionsDialog']); const printButtonClasses = classnames([ 'printButton', @@ -178,16 +191,13 @@ class InstructionsDialog extends Component {
  • {intl.formatMessage(messages.instructionsListDefinition1, { - paperWalletRecoveryPhraseWordCount: - PAPER_WALLET_RECOVERY_PHRASE_WORD_COUNT, - walletRecoveryPhraseWordCount: - WALLET_RECOVERY_PHRASE_WORD_COUNT, + paperWalletRecoveryPhraseWordCount: PAPER_WALLET_RECOVERY_PHRASE_WORD_COUNT, + walletRecoveryPhraseWordCount: WALLET_RECOVERY_PHRASE_WORD_COUNT, })}
  • {intl.formatMessage(messages.instructionsListDefinition2, { - paperWalletWrittenWordsCount: - PAPER_WALLET_WRITTEN_WORDS_COUNT, + paperWalletWrittenWordsCount: PAPER_WALLET_WRITTEN_WORDS_COUNT, })}
  • diff --git a/source/renderer/app/components/wallet/paper-wallet-certificate/PrintDialog.tsx b/source/renderer/app/components/wallet/paper-wallet-certificate/PrintDialog.tsx index 1cc84cdb0a..2b5eadff39 100644 --- a/source/renderer/app/components/wallet/paper-wallet-certificate/PrintDialog.tsx +++ b/source/renderer/app/components/wallet/paper-wallet-certificate/PrintDialog.tsx @@ -36,14 +36,16 @@ const messages = defineMessages({ description: '"Paper wallet create certificate print dialog" info.', }, certificatePrintedConfirmationLabel: { - id: 'paper.wallet.create.certificate.print.dialog.certificatePrintedConfirmation', + id: + 'paper.wallet.create.certificate.print.dialog.certificatePrintedConfirmation', defaultMessage: '!!!Yes, the paper wallet certificate printed successfully.', description: '"Paper wallet create certificate print dialog" certificate printed confirmation.', }, certificateReadableConfirmationLabel: { - id: 'paper.wallet.create.certificate.print.dialog.certificateReadableConfirmation', + id: + 'paper.wallet.create.certificate.print.dialog.certificateReadableConfirmation', defaultMessage: '!!!Yes, first {paperWalletPrintedWordsCount} words of the paper wallet recovery phrase are readable.', description: @@ -152,8 +154,7 @@ class PrintDialog extends Component { label={intl.formatMessage( messages.certificateReadableConfirmationLabel, { - paperWalletPrintedWordsCount: - PAPER_WALLET_PRINTED_WORDS_COUNT, + paperWalletPrintedWordsCount: PAPER_WALLET_PRINTED_WORDS_COUNT, } )} onChange={this.onConfirmReadable} diff --git a/source/renderer/app/components/wallet/paper-wallet-certificate/SecuringPasswordDialog.tsx b/source/renderer/app/components/wallet/paper-wallet-certificate/SecuringPasswordDialog.tsx index b1d8ff9b6f..5b1cb7bc49 100644 --- a/source/renderer/app/components/wallet/paper-wallet-certificate/SecuringPasswordDialog.tsx +++ b/source/renderer/app/components/wallet/paper-wallet-certificate/SecuringPasswordDialog.tsx @@ -35,7 +35,8 @@ const messages = defineMessages({ description: 'You may write the remaining words here:', }, securingPasswordConfirmation: { - id: 'paper.wallet.create.certificate.securingPassword.dialog.securingPasswordConfirmation', + id: + 'paper.wallet.create.certificate.securingPassword.dialog.securingPasswordConfirmation', defaultMessage: '!!!I have written the remaining {paperWalletWrittenWordsCount} words on the certificate.', description: diff --git a/source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx b/source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx index 7e23d0814c..2787e9129b 100644 --- a/source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx +++ b/source/renderer/app/components/wallet/paper-wallet-certificate/VerificationDialog.tsx @@ -43,19 +43,22 @@ const messages = defineMessages({ '"Paper wallet create certificate verification dialog" subtitle.', }, recoveryPhraseLabel: { - id: 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.label', + id: + 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.label', defaultMessage: '!!!Paper wallet recovery phrase', description: '"Paper wallet create certificate verification dialog" recovery phrase label.', }, recoveryPhraseHint: { - id: 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.hint', + id: + 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.hint', defaultMessage: '!!!Enter recovery phrase', description: '"Paper wallet create certificate verification dialog" recovery phrase hint.', }, recoveryPhraseNoResults: { - id: 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.noResults', + id: + 'paper.wallet.create.certificate.verification.dialog.recoveryPhrase.noResults', defaultMessage: '!!!No results', description: '"Paper wallet create certificate verification dialog" recovery phrase no results label.', @@ -67,14 +70,16 @@ const messages = defineMessages({ '"Paper wallet create certificate verification dialog" button clear label.', }, storingUnderstandanceLabel: { - id: 'paper.wallet.create.certificate.verification.dialog.storingUnderstandanceConfirmationLabel', + id: + 'paper.wallet.create.certificate.verification.dialog.storingUnderstandanceConfirmationLabel', defaultMessage: '!!!I understand that the paper wallet I create will not be stored in Daedalus.', description: '"Paper wallet create certificate verification dialog" storing understandance confirmation.', }, recoveringUnderstandanceLabel: { - id: 'paper.wallet.create.certificate.verification.dialog.recoveringUnderstandanceConfirmationLabel', + id: + 'paper.wallet.create.certificate.verification.dialog.recoveringUnderstandanceConfirmationLabel', defaultMessage: '!!!I understand that my paper wallet can be recovered only by using my paper wallet certificate.', description: @@ -221,8 +226,11 @@ class VerificationDialog extends Component { const { intl } = this.context; const { form, resetForm } = this; const { suggestedMnemonics, onClose } = this.props; - const { storingConfirmed, recoveringConfirmed, isRecoveryPhraseValid } = - this.state; + const { + storingConfirmed, + recoveringConfirmed, + isRecoveryPhraseValid, + } = this.state; const recoveryPhraseField = form.$('recoveryPhrase'); const dialogClasses = classnames([styles.dialog, 'verificationDialog']); const storingUnderstandanceCheckboxClasses = classnames([ diff --git a/source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx b/source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx index 690cad5ad9..a24d008938 100644 --- a/source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx +++ b/source/renderer/app/components/wallet/receive/WalletReceiveDialog.tsx @@ -197,8 +197,9 @@ class WalletReceiveDialog extends Component { }; constructPaths = (address: WalletAddress) => { const hardenedSpendingPath = utils.str_to_path(address.spendingPath); - const derivationSpendingPath = - hardenedPathToDerivationPath(hardenedSpendingPath); + const derivationSpendingPath = hardenedPathToDerivationPath( + hardenedSpendingPath + ); const spendingPath = map( derivationSpendingPath.constructed, (constructeSpendingPathChunk, index) => { diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.messages.ts b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.messages.ts index 319ace9ef8..f224536b3c 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.messages.ts +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.messages.ts @@ -93,13 +93,15 @@ export const getMessages = () => { description: 'Label for "unformated amount"', }, unformattedAmountMessageForSoftwareWallets: { - id: 'wallet.send.confirmationDialog.unformattedAmountMessageForSoftwareWallets', + id: + 'wallet.send.confirmationDialog.unformattedAmountMessageForSoftwareWallets', defaultMessage: '!!!Native assets may specify a number of decimal places, as defined in the Cardano token registry. Daedalus uses this information to format the amount that is being sent in the transaction.

    The native token unformatted amount is the amount without these decimal places. Please ensure that you verify both amounts, as some wallet software may not yet use the Cardano token registry.', description: 'Message for "unformated amount"', }, unformattedAmountMessageForHardwareWallets: { - id: 'wallet.send.confirmationDialog.unformattedAmountMessageForHardwareWallets', + id: + 'wallet.send.confirmationDialog.unformattedAmountMessageForHardwareWallets', defaultMessage: '!!!Native assets may specify a number of decimal places, as defined in the Cardano token registry. Daedalus uses this information to format the amount that is being sent in the transaction.

    The native token unformatted amount is the amount without these decimal places. Please ensure that you verify both amounts, as some wallet software may not yet use the Cardano token registry.

    The native token unformatted amount will be displayed on the hardware wallet device during transaction confirmation.', description: 'Message for "unformated amount"', diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx index 65f1f73fc7..7d5710b5f4 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx @@ -150,8 +150,12 @@ class WalletSendAssetsConfirmationDialog extends Component { this.form.submit({ onSuccess: (form) => { const { selectedAssets, assetsAmounts } = this.state; - const { receiver, amount, amountToNaturalUnits, isHardwareWallet } = - this.props; + const { + receiver, + amount, + amountToNaturalUnits, + isHardwareWallet, + } = this.props; const { passphrase } = form.values(); const hasAssetsRemainingAfterTransaction = this.props.allAvailableTokens?.length > 0; @@ -177,8 +181,13 @@ class WalletSendAssetsConfirmationDialog extends Component { ): React.ReactElement, any> | null => { const passphraseField = this.form.$('passphrase'); const { areTermsAccepted } = this.state; - const { hwDeviceStatus, isFlight, onExternalLinkClick, wallet, isTrezor } = - this.props; + const { + hwDeviceStatus, + isFlight, + onExternalLinkClick, + wallet, + isTrezor, + } = this.props; let returnJSX = null; if (!isFlight || (isFlight && areTermsAccepted)) { diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx index 44d07836be..33285cb7d8 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx @@ -115,8 +115,12 @@ class WalletSendConfirmationDialog extends Component { submit = () => { this.form.submit({ onSuccess: (form) => { - const { receiver, amount, amountToNaturalUnits, isHardwareWallet } = - this.props; + const { + receiver, + amount, + amountToNaturalUnits, + isHardwareWallet, + } = this.props; const { passphrase } = form.values(); const hasAssetsRemainingAfterTransaction = this.props.allAvailableTokens?.length && @@ -141,8 +145,13 @@ class WalletSendConfirmationDialog extends Component { ): React.ReactElement, any> | null | undefined => { const passphraseField = this.form.$('passphrase'); const { areTermsAccepted } = this.state; - const { hwDeviceStatus, isFlight, onExternalLinkClick, wallet, isTrezor } = - this.props; + const { + hwDeviceStatus, + isFlight, + onExternalLinkClick, + wallet, + isTrezor, + } = this.props; if (!isFlight || (isFlight && areTermsAccepted)) { const { name } = wallet; diff --git a/source/renderer/app/components/wallet/settings/ICOPublicKeyBox.tsx b/source/renderer/app/components/wallet/settings/ICOPublicKeyBox.tsx index ec2bec5458..1e9ed96333 100644 --- a/source/renderer/app/components/wallet/settings/ICOPublicKeyBox.tsx +++ b/source/renderer/app/components/wallet/settings/ICOPublicKeyBox.tsx @@ -42,8 +42,13 @@ type Props = { }; const ICOPublicKeyBox = (props: Props) => { - const { publicKey, locale, onCopyICOPublicKey, openDialogAction, intl } = - props; + const { + publicKey, + locale, + onCopyICOPublicKey, + openDialogAction, + intl, + } = props; return ( <> diff --git a/source/renderer/app/components/wallet/settings/PublicKeyField.tsx b/source/renderer/app/components/wallet/settings/PublicKeyField.tsx index 45f26e9258..c3bb21dc35 100644 --- a/source/renderer/app/components/wallet/settings/PublicKeyField.tsx +++ b/source/renderer/app/components/wallet/settings/PublicKeyField.tsx @@ -58,10 +58,9 @@ const PublicKeyField = (props: Props) => { useEffect(() => { setPublicKeyHidden(true); }, []); - const handleCopyPublicKey = useCallback( - () => onCopyPublicKey(publicKey), - [publicKey] - ); + const handleCopyPublicKey = useCallback(() => onCopyPublicKey(publicKey), [ + publicKey, + ]); const fieldStyles = classnames([ styles.field, publicKeyHidden || !publicKey ? styles.valueHidden : styles.valueShown, diff --git a/source/renderer/app/components/wallet/settings/WalletRecoveryPhraseVerificationWidget.tsx b/source/renderer/app/components/wallet/settings/WalletRecoveryPhraseVerificationWidget.tsx index 623a021270..b73d5c6cdf 100644 --- a/source/renderer/app/components/wallet/settings/WalletRecoveryPhraseVerificationWidget.tsx +++ b/source/renderer/app/components/wallet/settings/WalletRecoveryPhraseVerificationWidget.tsx @@ -119,7 +119,8 @@ export const messages = defineMessages({ 'Label for the recoveryPhraseVerificationButton on wallet settings.', }, timeUntilWarningReplacement: { - id: 'wallet.settings.recoveryPhraseVerification.timeUntilWarningReplacement', + id: + 'wallet.settings.recoveryPhraseVerification.timeUntilWarningReplacement', defaultMessage: '!!!ヶ月,か月', description: 'Label for the recoveryPhraseVerificationButton on wallet settings.', @@ -226,8 +227,12 @@ class WalletRecoveryPhraseVerificationWidget extends Component { recoveryPhraseVerificationDate, isLegacy, } = this.props; - const { icon, message, timeAgo, timeUntilWarning } = - this.recoveryPhraseStatus; + const { + icon, + message, + timeAgo, + timeUntilWarning, + } = this.recoveryPhraseStatus; const { recoveryPhraseVerificationStatus } = getStatusFromWalletData({ creationDate, recoveryPhraseVerificationDate, diff --git a/source/renderer/app/components/wallet/settings/WalletSettings.tsx b/source/renderer/app/components/wallet/settings/WalletSettings.tsx index 665c14ef03..069d74dded 100644 --- a/source/renderer/app/components/wallet/settings/WalletSettings.tsx +++ b/source/renderer/app/components/wallet/settings/WalletSettings.tsx @@ -182,8 +182,11 @@ class WalletSettings extends Component { }); }; onUndelegateWalletClick = async () => { - const { walletId, openDialogAction, updateDataForActiveDialogAction } = - this.props; + const { + walletId, + openDialogAction, + updateDataForActiveDialogAction, + } = this.props; this.onBlockForm(); openDialogAction({ dialog: UndelegateWalletConfirmationDialog, diff --git a/source/renderer/app/components/wallet/tokens/wallet-token-picker/WalletTokenPickerCheckbox.tsx b/source/renderer/app/components/wallet/tokens/wallet-token-picker/WalletTokenPickerCheckbox.tsx index a9aa9998af..98749792f2 100644 --- a/source/renderer/app/components/wallet/tokens/wallet-token-picker/WalletTokenPickerCheckbox.tsx +++ b/source/renderer/app/components/wallet/tokens/wallet-token-picker/WalletTokenPickerCheckbox.tsx @@ -17,10 +17,10 @@ const WalletTokenPickerCheckbox = ({ }: Props) => { const checked = isChecked || isPreviouslyChecked; const toolTipDisabled = !isMaxCount || checked; - const onChange = useCallback( - () => toggleCheckbox(uniqueId), - [toggleCheckbox, uniqueId] - ); + const onChange = useCallback(() => toggleCheckbox(uniqueId), [ + toggleCheckbox, + uniqueId, + ]); return (
    { }, [sortDirection, hasSorting, sortBy] ); - const onSortByToken = useCallback( - () => onSortBy('token'), - [sortDirection, sortBy, hasSorting] - ); - const onSortByAmount = useCallback( - () => onSortBy('quantity'), - [sortDirection, sortBy, hasSorting] - ); + const onSortByToken = useCallback(() => onSortBy('token'), [ + sortDirection, + sortBy, + hasSorting, + ]); + const onSortByAmount = useCallback(() => onSortBy('quantity'), [ + sortDirection, + sortBy, + hasSorting, + ]); const hasTokens = assets.length || isLoadingAssets; if (!hasTokens) return ( diff --git a/source/renderer/app/components/wallet/transactions/Transaction.tsx b/source/renderer/app/components/wallet/transactions/Transaction.tsx index fe26205f94..eae102b850 100644 --- a/source/renderer/app/components/wallet/transactions/Transaction.tsx +++ b/source/renderer/app/components/wallet/transactions/Transaction.tsx @@ -402,8 +402,12 @@ export default class Transaction extends Component { } get assetsList(): Array { - const { assetTokens, data, isInternalAddress, hasAssetsEnabled } = - this.props; + const { + assetTokens, + data, + isInternalAddress, + hasAssetsEnabled, + } = this.props; if (!hasAssetsEnabled) { return []; @@ -420,8 +424,9 @@ export default class Transaction extends Component { const type = this.hasAssets ? data.type : null; if (addresses && addresses.length > 0) { - const hasUnresolvedAddresses = - this.includesUnresolvedAddresses(addresses); + const hasUnresolvedAddresses = this.includesUnresolvedAddresses( + addresses + ); return type !== TransactionTypes.EXPEND && hasUnresolvedAddresses ? (
    { if (!filterOptions || !activeWallet) return null; let walletTransactions = null; // const { searchLimit } = filterOptions; - const numberOfFilterDimensionsApplied = - getNumberOfFilterDimensionsApplied(filterOptions); + const numberOfFilterDimensionsApplied = getNumberOfFilterDimensionsApplied( + filterOptions + ); const noTransactionsLabel = intl.formatMessage(messages.noTransactions); const isRestoreActive = activeWallet && activeWallet.isRestoring; const isFilterDisabled = diff --git a/source/renderer/app/components/wallet/transactions/WalletTransactionsList.tsx b/source/renderer/app/components/wallet/transactions/WalletTransactionsList.tsx index f0a17bb0f4..0e892bfb3f 100644 --- a/source/renderer/app/components/wallet/transactions/WalletTransactionsList.tsx +++ b/source/renderer/app/components/wallet/transactions/WalletTransactionsList.tsx @@ -45,10 +45,11 @@ const messages = defineMessages({ export type ScrollContextType = { setIsScrolling: (...args: Array) => any; }; -export const WalletTransactionsListScrollContext = - React.createContext({ - setIsScrolling: () => null, - }); +export const WalletTransactionsListScrollContext = React.createContext< + ScrollContextType +>({ + setIsScrolling: () => null, +}); type Props = { deletePendingTransaction: (...args: Array) => any; formattedWalletAmount: (...args: Array) => any; diff --git a/source/renderer/app/components/wallet/transactions/metadata/MetadataValueView.tsx b/source/renderer/app/components/wallet/transactions/metadata/MetadataValueView.tsx index 2d87be1e69..e9246fc5f1 100644 --- a/source/renderer/app/components/wallet/transactions/metadata/MetadataValueView.tsx +++ b/source/renderer/app/components/wallet/transactions/metadata/MetadataValueView.tsx @@ -31,16 +31,14 @@ function BytesView({ value }: { value: MetadataBytes }) { function ListView({ value }: { value: MetadataList }) { return (
      - {value.list.map( - ( - v, - index // eslint-disable-next-line react/no-array-index-key - ) => ( -
    1. - -
    2. - ) - )} + {value.list.map(( + v, + index // eslint-disable-next-line react/no-array-index-key + ) => ( +
    3. + +
    4. + ))}
    ); } @@ -48,16 +46,14 @@ function ListView({ value }: { value: MetadataList }) { function MapView({ value }: { value: MetadataMap }) { return (
      - {value.map.map( - ( - v, - index // eslint-disable-next-line react/no-array-index-key - ) => ( -
    1. - : -
    2. - ) - )} + {value.map.map(( + v, + index // eslint-disable-next-line react/no-array-index-key + ) => ( +
    3. + : +
    4. + ))}
    ); } diff --git a/source/renderer/app/components/wallet/transactions/render-strategies/SimpleTransactionList.tsx b/source/renderer/app/components/wallet/transactions/render-strategies/SimpleTransactionList.tsx index 20f064db9d..5838a3b57a 100644 --- a/source/renderer/app/components/wallet/transactions/render-strategies/SimpleTransactionList.tsx +++ b/source/renderer/app/components/wallet/transactions/render-strategies/SimpleTransactionList.tsx @@ -40,16 +40,14 @@ class SimpleTransactionList extends Component { className={styles.component} onScroll={(evt) => this.onListScroll(context, evt)} > - {rows.map( - ( - row, - index // eslint-disable-next-line react/no-array-index-key - ) => ( -
    - {renderRow(row)} -
    - ) - )} + {rows.map(( + row, + index // eslint-disable-next-line react/no-array-index-key + ) => ( +
    + {renderRow(row)} +
    + ))}
    )} diff --git a/source/renderer/app/components/wallet/wallet-import/WalletSelectImportDialog.tsx b/source/renderer/app/components/wallet/wallet-import/WalletSelectImportDialog.tsx index 2449b3b106..c00eda2ead 100644 --- a/source/renderer/app/components/wallet/wallet-import/WalletSelectImportDialog.tsx +++ b/source/renderer/app/components/wallet/wallet-import/WalletSelectImportDialog.tsx @@ -187,8 +187,8 @@ class WalletSelectImportDialog extends Component { ); if (checkboxes[index] && topWrapper.length) { - const checkboxTopOffset = - checkboxes[index].getBoundingClientRect().top; + const checkboxTopOffset = checkboxes[index].getBoundingClientRect() + .top; const topWrapperTopOffset = topWrapper[0].getBoundingClientRect().top; const topPart = topWrapperTopOffset + 121; const spaceForTooltip = checkboxTopOffset - topPart; diff --git a/source/renderer/app/components/wallet/wallet-restore/ConfigurationDialog.tsx b/source/renderer/app/components/wallet/wallet-restore/ConfigurationDialog.tsx index 6d39d22eed..f09b4bdd13 100644 --- a/source/renderer/app/components/wallet/wallet-restore/ConfigurationDialog.tsx +++ b/source/renderer/app/components/wallet/wallet-restore/ConfigurationDialog.tsx @@ -62,7 +62,8 @@ const messages = defineMessages({ 'Label for the "Repeat password" input in the wallet restore dialog.', }, passwordFieldsPlaceholder: { - id: 'wallet.restore.dialog.step.configuration.input.passwordFields.placeholder', + id: + 'wallet.restore.dialog.step.configuration.input.passwordFields.placeholder', defaultMessage: '!!!Password', description: 'Placeholder for the "Password" inputs in the wallet restore dialog.', diff --git a/source/renderer/app/components/wallet/wallet-restore/MnemonicsDialog.tsx b/source/renderer/app/components/wallet/wallet-restore/MnemonicsDialog.tsx index 6b25a34bb2..10c768e8e2 100644 --- a/source/renderer/app/components/wallet/wallet-restore/MnemonicsDialog.tsx +++ b/source/renderer/app/components/wallet/wallet-restore/MnemonicsDialog.tsx @@ -26,7 +26,8 @@ const messages = defineMessages({ description: 'Placeholder for the mnemonics autocomplete.', }, autocompleteMultiLengthPhrase: { - id: 'wallet.restore.dialog.step.mnemonics.autocomplete.multiLengthPhrase.placeholder', + id: + 'wallet.restore.dialog.step.mnemonics.autocomplete.multiLengthPhrase.placeholder', defaultMessage: '!!!Enter your 12, 18 or 24-word recovery phrase', description: 'Placeholder for the multi-length mnemonics autocomplete.', }, @@ -42,7 +43,8 @@ const messages = defineMessages({ description: 'Label for the mnemonics Continue button.', }, invalidRecoveryPhrase: { - id: 'wallet.restore.dialog.step.mnemonics.autocomplete.invalidRecoveryPhrase', + id: + 'wallet.restore.dialog.step.mnemonics.autocomplete.invalidRecoveryPhrase', defaultMessage: '!!!Invalid recovery phrase', description: 'Label for invalid recovery phrase', }, diff --git a/source/renderer/app/components/wallet/wallet-restore/WalletTypeDialog.tsx b/source/renderer/app/components/wallet/wallet-restore/WalletTypeDialog.tsx index c60e57d430..c59cb1d97a 100644 --- a/source/renderer/app/components/wallet/wallet-restore/WalletTypeDialog.tsx +++ b/source/renderer/app/components/wallet/wallet-restore/WalletTypeDialog.tsx @@ -51,25 +51,29 @@ const messages = defineMessages({ description: 'Label for the "labelDaedalusWalletKind" checkbox.', }, labelDaedalusWalletKind12WordByron: { - id: 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind12WordByron', + id: + 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind12WordByron', defaultMessage: '!!!12 words (Byron legacy wallet)', description: 'Label for the "labelDaedalusWalletKind12WordByron" checkbox.', }, labelDaedalusWalletKind15WordShelley: { - id: 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind15WordShelley', + id: + 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind15WordShelley', defaultMessage: '!!!15 words (Incentivized Testnet Rewards wallet)', description: 'Label for the "labelDaedalusWalletKind15WordShelley" checkbox.', }, labelDaedalusWalletKind24WordShelley: { - id: 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind24WordShelley', + id: + 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind24WordShelley', defaultMessage: '!!!24 words (Shelley wallet)', description: 'Label for the "labelDaedalusWalletKind24WordShelley" checkbox.', }, labelDaedalusWalletKind27WordPaper: { - id: 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind27WordPaper', + id: + 'wallet.restore.dialog.step.walletKind.label.daedalusWalletKind27WordPaper', defaultMessage: '!!!27 words - paper wallet (Byron legacy wallet)', description: 'Label for the "labelDaedalusWalletKind27WordPaper" checkbox.', }, @@ -79,12 +83,14 @@ const messages = defineMessages({ description: 'Label for the "labelYoroiWalletKind" checkbox.', }, labelYoroiWalletKind15WordByron: { - id: 'wallet.restore.dialog.step.walletKind.label.yoroiWalletKindByronLegacy15Word', + id: + 'wallet.restore.dialog.step.walletKind.label.yoroiWalletKindByronLegacy15Word', defaultMessage: '!!!15 words (Byron legacy wallet)', description: 'Label for the "labelDaedalusWalletKind15WordByron" checkbox.', }, labelYoroiWalletKind15WordShelley: { - id: 'wallet.restore.dialog.step.walletKind.label.yoroiWalletKindShelley15Word', + id: + 'wallet.restore.dialog.step.walletKind.label.yoroiWalletKindShelley15Word', defaultMessage: '!!!15 words (Shelley wallet)', description: 'Label for the "labelDaedalusWalletKind15WordShelley" checkbox.', diff --git a/source/renderer/app/components/widgets/BorderedBox.tsx b/source/renderer/app/components/widgets/BorderedBox.tsx index 5b600865d0..af929902cf 100644 --- a/source/renderer/app/components/widgets/BorderedBox.tsx +++ b/source/renderer/app/components/widgets/BorderedBox.tsx @@ -17,8 +17,13 @@ type Props = { @observer class BorderedBox extends Component { render() { - const { children, className, fullHeight, onMouseEnter, onMouseLeave } = - this.props; + const { + children, + className, + fullHeight, + onMouseEnter, + onMouseLeave, + } = this.props; const componentClasses = classnames([ styles.component, fullHeight ? styles.fullHeight : null, diff --git a/source/renderer/app/components/widgets/forms/PinCode.tsx b/source/renderer/app/components/widgets/forms/PinCode.tsx index d4b430a12e..bd34c32997 100644 --- a/source/renderer/app/components/widgets/forms/PinCode.tsx +++ b/source/renderer/app/components/widgets/forms/PinCode.tsx @@ -67,8 +67,16 @@ export default class PinCode extends Component { } generatePinCodeInput = () => { - const { id, name, type, autoFocus, length, error, value, disabled } = - this.props; + const { + id, + name, + type, + autoFocus, + length, + error, + value, + disabled, + } = this.props; const pinCodeClasses = classNames([ styles.pinCode, error ? styles.error : null, diff --git a/source/renderer/app/config/currencyConfig.ts b/source/renderer/app/config/currencyConfig.ts index efcfc8857a..33503780f3 100644 --- a/source/renderer/app/config/currencyConfig.ts +++ b/source/renderer/app/config/currencyConfig.ts @@ -27,31 +27,29 @@ export const CURRENCY_DEFAULT_SELECTED = currenciesList.usd; export const CURRENCY_REQUEST_RATE_INTERVAL = 60 * 1000; // 1 minute | unit: milliseconds // Generic function for all the Currency requests -export const genericCurrencyRequest = - ( - requestName: RequestName - // @ts-ignore ts-migrate(1064) FIXME: The return type of an async function or method mus... Remove this comment to see the full error message - ): ((...args: Array) => any) => - async (payload?: any): any => { - const request = currencyConfig.requests[requestName]; - let response; +export const genericCurrencyRequest = ( + requestName: RequestName + // @ts-ignore ts-migrate(1064) FIXME: The return type of an async function or method mus... Remove this comment to see the full error message +): ((...args: Array) => any) => async (payload?: any): any => { + const request = currencyConfig.requests[requestName]; + let response; - if (Array.isArray(request)) { - response = []; + if (Array.isArray(request)) { + response = []; - for (const req of request) { - const responseItem = await externalRequest(req); - response.push(responseItem); - } - } else if (typeof request === 'function') { - const req = request(payload); - response = await externalRequest(req); - } else if (request) { - response = await externalRequest(request); + for (const req of request) { + const responseItem = await externalRequest(req); + response.push(responseItem); } + } else if (typeof request === 'function') { + const req = request(payload); + response = await externalRequest(req); + } else if (request) { + response = await externalRequest(request); + } - return response; - }; + return response; +}; export const getLocalizedCurrenciesList = ( rawCurrencyList: Array, currentLocale: Locale diff --git a/source/renderer/app/config/walletRestoreConfig.ts b/source/renderer/app/config/walletRestoreConfig.ts index 87f48eec24..cd958e840c 100644 --- a/source/renderer/app/config/walletRestoreConfig.ts +++ b/source/renderer/app/config/walletRestoreConfig.ts @@ -26,19 +26,21 @@ export const WALLET_KINDS: EnumMap = { YOROI: 'Yoroi', // HARDWARE: 'Hardware', }; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'EnumMap'. -export const WALLET_DAEDALUS_KINDS: EnumMap = - isMainnet - ? { - BYRON_12_WORD: '12WordByron', - SHELLEY_24_WORD: '24WordShelley', - BYRON_27_WORD: '27WordPaper', - } - : { - BYRON_12_WORD: '12WordByron', - SHELLEY_15_WORD: '15WordShelley', - SHELLEY_24_WORD: '24WordShelley', - BYRON_27_WORD: '27WordPaper', - }; +export const WALLET_DAEDALUS_KINDS: EnumMap< + string, + WalletDaedalusKind +> = isMainnet + ? { + BYRON_12_WORD: '12WordByron', + SHELLEY_24_WORD: '24WordShelley', + BYRON_27_WORD: '27WordPaper', + } + : { + BYRON_12_WORD: '12WordByron', + SHELLEY_15_WORD: '15WordShelley', + SHELLEY_24_WORD: '24WordShelley', + BYRON_27_WORD: '27WordPaper', + }; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'EnumMap'. export const WALLET_YOROI_KINDS: EnumMap = { BYRON_15_WORD: '15WordByron', diff --git a/source/renderer/app/containers/TopBarContainer.tsx b/source/renderer/app/containers/TopBarContainer.tsx index bd1a353903..7504832db1 100644 --- a/source/renderer/app/containers/TopBarContainer.tsx +++ b/source/renderer/app/containers/TopBarContainer.tsx @@ -24,8 +24,15 @@ const TopBarContainer = ( stores: null, } ) => { - const { sidebar, app, networkStatus, wallets, newsFeed, appUpdate, staking } = - stores; + const { + sidebar, + app, + networkStatus, + wallets, + newsFeed, + appUpdate, + staking, + } = stores; const { isSynced, syncPercentage, diff --git a/source/renderer/app/containers/appUpdate/AppUpdateContainer.tsx b/source/renderer/app/containers/appUpdate/AppUpdateContainer.tsx index 176acf97c9..2861e4c4e4 100644 --- a/source/renderer/app/containers/appUpdate/AppUpdateContainer.tsx +++ b/source/renderer/app/containers/appUpdate/AppUpdateContainer.tsx @@ -30,8 +30,11 @@ class AppUpdateContainer extends Component { isWaitingToQuitDaedalus, installationProgress, } = appUpdate; - const { installUpdate, closeAppUpdateOverlay, postponeUpdate } = - actions.appUpdate; + const { + installUpdate, + closeAppUpdateOverlay, + postponeUpdate, + } = actions.appUpdate; if (!availableUpdate) return null; return ( { } get isSystemTimeError() { - const { isSystemTimeCorrect, isNodeStopping, isNodeStopped } = - this.networkStatus; + const { + isSystemTimeCorrect, + isNodeStopping, + isNodeStopped, + } = this.networkStatus; return !isSystemTimeCorrect && !isNodeStopping && !isNodeStopped; } diff --git a/source/renderer/app/containers/loading/NoDiskSpaceErrorPage.tsx b/source/renderer/app/containers/loading/NoDiskSpaceErrorPage.tsx index e54b91aa96..626b4923ee 100644 --- a/source/renderer/app/containers/loading/NoDiskSpaceErrorPage.tsx +++ b/source/renderer/app/containers/loading/NoDiskSpaceErrorPage.tsx @@ -14,8 +14,11 @@ class NoDiskSpaceErrorPage extends Component { render() { const { stores } = this.props; - const { diskSpaceRequired, diskSpaceMissing, diskSpaceRecommended } = - stores.networkStatus; + const { + diskSpaceRequired, + diskSpaceMissing, + diskSpaceRecommended, + } = stores.networkStatus; return ( { }; render() { - const { newsFeed, appUpdate, networkStatus, profile, app } = - this.props.stores; + const { + newsFeed, + appUpdate, + networkStatus, + profile, + app, + } = this.props.stores; const { cardanoNodeState, isNodeResponding, diff --git a/source/renderer/app/containers/loading/SystemTimeErrorPage.tsx b/source/renderer/app/containers/loading/SystemTimeErrorPage.tsx index fbede1c78d..320aab74fd 100644 --- a/source/renderer/app/containers/loading/SystemTimeErrorPage.tsx +++ b/source/renderer/app/containers/loading/SystemTimeErrorPage.tsx @@ -15,8 +15,10 @@ class SystemTimeErrorPage extends Component { render() { const { actions, stores } = this.props; - const { localTimeDifference, ignoreSystemTimeChecks } = - stores.networkStatus; + const { + localTimeDifference, + ignoreSystemTimeChecks, + } = stores.networkStatus; const { forceCheckNetworkClock } = actions.networkStatus; const { app, networkStatus, profile } = stores; const { openExternalLink } = app; diff --git a/source/renderer/app/containers/news/NewsFeedContainer.tsx b/source/renderer/app/containers/news/NewsFeedContainer.tsx index f0ae4f9666..50a6339eb2 100644 --- a/source/renderer/app/containers/news/NewsFeedContainer.tsx +++ b/source/renderer/app/containers/news/NewsFeedContainer.tsx @@ -21,8 +21,11 @@ class NewsFeedContainer extends Component { const { app, profile, appUpdate, newsFeed } = stores; const { newsFeedData, isLoadingNews, proceedNewsAction } = newsFeed; const { openAppUpdateOverlay } = actions.appUpdate; - const { downloadProgress, displayAppUpdateNewsItem, isUpdatePostponed } = - appUpdate; + const { + downloadProgress, + displayAppUpdateNewsItem, + isUpdatePostponed, + } = appUpdate; const { toggleNewsFeed } = actions.app; const { openExternalLink, newsFeedIsOpen } = app; const { currentDateFormat } = profile; diff --git a/source/renderer/app/containers/notifications/NotificationsContainer.tsx b/source/renderer/app/containers/notifications/NotificationsContainer.tsx index 75219a0537..e0a1d2c97f 100644 --- a/source/renderer/app/containers/notifications/NotificationsContainer.tsx +++ b/source/renderer/app/containers/notifications/NotificationsContainer.tsx @@ -127,8 +127,8 @@ class NotificationsContainer extends Component { }, { id: 'downloadTransactionsCSVSuccess', - actionToListenAndOpen: - this.props.actions.transactions.requestCSVFileSuccess, + actionToListenAndOpen: this.props.actions.transactions + .requestCSVFileSuccess, actionToListenAndClose: this.props.actions.transactions.requestCSVFile, }, { @@ -145,8 +145,8 @@ class NotificationsContainer extends Component { }, { id: 'downloadAddressPDFSuccess', - actionToListenAndOpen: - this.props.actions.wallets.generateAddressPDFSuccess, + actionToListenAndOpen: this.props.actions.wallets + .generateAddressPDFSuccess, actionToListenAndClose: this.props.actions.wallets.generateAddressPDF, }, { @@ -161,13 +161,13 @@ class NotificationsContainer extends Component { }, { id: 'copyStateDirectoryPath', - actionToListenAndOpen: - this.props.actions.networkStatus.copyStateDirectoryPath, + actionToListenAndOpen: this.props.actions.networkStatus + .copyStateDirectoryPath, }, { id: 'copyAssetParam', - actionToListenAndOpen: - this.props.actions.assets.copyAssetParamNotification, + actionToListenAndOpen: this.props.actions.assets + .copyAssetParamNotification, }, ]; // @ts-ignore ts-migrate(2740) FIXME: Type '{ downloadLogsProgress: { icon: string; hasE... Remove this comment to see the full error message diff --git a/source/renderer/app/containers/profile/DataLayerMigrationPage.tsx b/source/renderer/app/containers/profile/DataLayerMigrationPage.tsx index ab006bad6c..c1ecd45076 100644 --- a/source/renderer/app/containers/profile/DataLayerMigrationPage.tsx +++ b/source/renderer/app/containers/profile/DataLayerMigrationPage.tsx @@ -16,8 +16,9 @@ class DataLayerMigrationPage extends Component { }; render() { - const { setDataLayerMigrationAcceptanceRequest } = - this.props.stores.profile; + const { + setDataLayerMigrationAcceptanceRequest, + } = this.props.stores.profile; return ( { render() { const { stores, actions } = this.props; - const { smashServerUrl, smashServerUrlError, smashServerLoading } = - stores.staking; + const { + smashServerUrl, + smashServerUrlError, + smashServerLoading, + } = stores.staking; const { isSynced, syncPercentage } = stores.networkStatus; const { openExternalLink } = stores.app; const { resetSmashServerError } = actions.staking; diff --git a/source/renderer/app/containers/staking/RedeemItnRewardsContainer.tsx b/source/renderer/app/containers/staking/RedeemItnRewardsContainer.tsx index 95097c1409..5a433a2a54 100644 --- a/source/renderer/app/containers/staking/RedeemItnRewardsContainer.tsx +++ b/source/renderer/app/containers/staking/RedeemItnRewardsContainer.tsx @@ -30,8 +30,11 @@ class RedeemItnRewardsContainer extends Component { render() { const { stores, actions } = this.props; const { allWallets } = stores.wallets; - const { redeemStep, isSubmittingReedem, isCalculatingReedemFees } = - stores.staking; + const { + redeemStep, + isSubmittingReedem, + isCalculatingReedemFees, + } = stores.staking; const { isSynced } = stores.networkStatus; const { onRedeemStart, closeRedeemDialog } = actions.staking; if (!redeemStep) return null; diff --git a/source/renderer/app/containers/staking/StakePoolsListPage.tsx b/source/renderer/app/containers/staking/StakePoolsListPage.tsx index cf627057c1..d60a5e6154 100644 --- a/source/renderer/app/containers/staking/StakePoolsListPage.tsx +++ b/source/renderer/app/containers/staking/StakePoolsListPage.tsx @@ -48,8 +48,14 @@ class StakePoolsListPage extends Component { }; render() { - const { uiDialogs, staking, app, networkStatus, profile, wallets } = - this.props.stores; + const { + uiDialogs, + staking, + app, + networkStatus, + profile, + wallets, + } = this.props.stores; const { currentTheme, currentLocale } = profile; const { isSynced } = networkStatus; const { diff --git a/source/renderer/app/containers/staking/Staking.tsx b/source/renderer/app/containers/staking/Staking.tsx index 2d87a55f10..3b8b538eb3 100644 --- a/source/renderer/app/containers/staking/Staking.tsx +++ b/source/renderer/app/containers/staking/Staking.tsx @@ -82,8 +82,12 @@ class Staking extends Component { stores: { app, staking, networkStatus, uiDialogs }, children, } = this.props; - const { isSynced, syncPercentage, isAlonzoPending, isAlonzoActivated } = - networkStatus; + const { + isSynced, + syncPercentage, + isAlonzoPending, + isAlonzoActivated, + } = networkStatus; const { isStakingDelegationCountdown } = staking; const shouldShowInfoTab = isAlonzoPending || isAlonzoActivated; const isDelegationWizardOpen = uiDialogs.isOpen( diff --git a/source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.tsx b/source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.tsx index 1c7751355b..41e4819678 100644 --- a/source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.tsx +++ b/source/renderer/app/containers/staking/dialogs/DelegationSetupWizardDialogContainer.tsx @@ -165,10 +165,20 @@ class DelegationSetupWizardDialogContainer extends Component { }; render() { - const { activeStep, selectedWalletId, selectedPoolId, stakePoolJoinFee } = - this.state; - const { app, staking, wallets, profile, networkStatus, hardwareWallets } = - this.props.stores; + const { + activeStep, + selectedWalletId, + selectedPoolId, + stakePoolJoinFee, + } = this.state; + const { + app, + staking, + wallets, + profile, + networkStatus, + hardwareWallets, + } = this.props.stores; const { futureEpoch } = networkStatus; const { currentTheme, currentLocale } = profile; const { diff --git a/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx b/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx index 0a1d8c246f..3a41d7f117 100644 --- a/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx +++ b/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx @@ -45,11 +45,16 @@ class Step1ConfigurationContainer extends Component { const { actions, stores, onBack, onClose } = this.props; const { app, staking, wallets } = stores; const { allWallets } = wallets; - const { redeemWallet, isCalculatingReedemFees, redeemRecoveryPhrase } = - staking; + const { + redeemWallet, + isCalculatingReedemFees, + redeemRecoveryPhrase, + } = staking; const { openExternalLink } = app; - const { onConfigurationContinue, onCalculateRedeemWalletFees } = - actions.staking; + const { + onConfigurationContinue, + onCalculateRedeemWalletFees, + } = actions.staking; const selectedWalletId = get(redeemWallet, 'id', null); const selectedWallet: Wallet | null | undefined = allWallets.find( (current: Wallet) => current && current.id === selectedWalletId diff --git a/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step3ResultContainer.tsx b/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step3ResultContainer.tsx index 53d8d29112..6747fd4325 100644 --- a/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step3ResultContainer.tsx +++ b/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step3ResultContainer.tsx @@ -15,8 +15,12 @@ class Step3ResultContainer extends Component { render() { const { onBack, onClose, stores, actions } = this.props; - const { redeemWallet, transactionFees, redeemedRewards, redeemSuccess } = - stores.staking; + const { + redeemWallet, + transactionFees, + redeemedRewards, + redeemSuccess, + } = stores.staking; const { onResultContinue } = actions.staking; if (!redeemWallet) throw new Error('Redeem wallet required'); diff --git a/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx b/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx index 233f9be29d..20f99ba2d9 100644 --- a/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx +++ b/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx @@ -145,10 +145,18 @@ class VotingRegistrationDialogContainer extends Component { }; render() { - const { selectedWalletId, transactionFee, transactionFeeError } = - this.state; - const { wallets, staking, voting, app, hardwareWallets } = - this.props.stores; + const { + selectedWalletId, + transactionFee, + transactionFeeError, + } = this.state; + const { + wallets, + staking, + voting, + app, + hardwareWallets, + } = this.props.stores; const { closeConfirmationDialog, saveAsPDF } = this.props.actions.voting; const { all } = wallets; const { stakePools, getStakePoolById } = staking; @@ -233,8 +241,14 @@ class VotingRegistrationDialogContainer extends Component { } async _handleCalculateTransactionFee() { - const { transactions, addresses, app, wallets, hardwareWallets, voting } = - this.props.stores; + const { + transactions, + addresses, + app, + wallets, + hardwareWallets, + voting, + } = this.props.stores; const { calculateTransactionFee } = transactions; const { getAddressesByWalletId } = addresses; const { getWalletById } = wallets; diff --git a/source/renderer/app/containers/wallet/TransferFundsPage.tsx b/source/renderer/app/containers/wallet/TransferFundsPage.tsx index 44be12f46d..c82fd1ef9f 100644 --- a/source/renderer/app/containers/wallet/TransferFundsPage.tsx +++ b/source/renderer/app/containers/wallet/TransferFundsPage.tsx @@ -18,8 +18,11 @@ class TransferFundsPage extends Component { const { actions, stores } = this.props; const { wallets: walletsActions } = actions; const { wallets: walletsStore } = stores; - const { transferFundsNextStep, transferFundsPrevStep, transferFundsClose } = - walletsActions; + const { + transferFundsNextStep, + transferFundsPrevStep, + transferFundsClose, + } = walletsActions; const { transferFundsStep } = walletsStore; if (!transferFundsStep) return null; let Container; diff --git a/source/renderer/app/containers/wallet/Wallet.tsx b/source/renderer/app/containers/wallet/Wallet.tsx index 830d708f5e..767df04818 100644 --- a/source/renderer/app/containers/wallet/Wallet.tsx +++ b/source/renderer/app/containers/wallet/Wallet.tsx @@ -70,8 +70,11 @@ class Wallet extends Component { ); } - const { hasNotification } = - walletSettings.getWalletsRecoveryPhraseVerificationData(activeWallet.id); + const { + hasNotification, + } = walletSettings.getWalletsRecoveryPhraseVerificationData( + activeWallet.id + ); const { isRestoring, isLegacy, diff --git a/source/renderer/app/containers/wallet/WalletReceivePage.tsx b/source/renderer/app/containers/wallet/WalletReceivePage.tsx index e29a7fdcef..e028f5070c 100755 --- a/source/renderer/app/containers/wallet/WalletReceivePage.tsx +++ b/source/renderer/app/containers/wallet/WalletReceivePage.tsx @@ -173,8 +173,13 @@ class WalletReceivePage extends Component { render() { const { actions, stores } = this.props; - const { uiDialogs, addresses, sidebar, hardwareWallets, walletSettings } = - stores; + const { + uiDialogs, + addresses, + sidebar, + hardwareWallets, + walletSettings, + } = stores; const { activeWallet } = this; const { addressToShare } = this.state; const { toggleSubMenus } = actions.sidebar; @@ -187,8 +192,10 @@ class WalletReceivePage extends Component { checkIsTrezorByWalletId, } = hardwareWallets; const { getLocalWalletDataById } = walletSettings; - const localWalletData: WalletLocalData | null | undefined = - getLocalWalletDataById(activeWallet ? activeWallet.id : ''); + const localWalletData: + | WalletLocalData + | null + | undefined = getLocalWalletDataById(activeWallet ? activeWallet.id : ''); const { showUsedAddresses } = localWalletData || {}; // Guard against potential null values if (!activeWallet) diff --git a/source/renderer/app/containers/wallet/WalletSendPage.tsx b/source/renderer/app/containers/wallet/WalletSendPage.tsx index f445397d52..b129b7ebc2 100755 --- a/source/renderer/app/containers/wallet/WalletSendPage.tsx +++ b/source/renderer/app/containers/wallet/WalletSendPage.tsx @@ -29,28 +29,36 @@ class WalletSendPage extends Component { isHardwareWallet: boolean; selectedAssets?: ApiTokens; }) => { - const { walletId, address, amount, isHardwareWallet, selectedAssets } = - params; + const { + walletId, + address, + amount, + isHardwareWallet, + selectedAssets, + } = params; let fee; let minimumAda; if (isHardwareWallet) { - const coinsSelection = - await this.props.stores.hardwareWallets.selectCoins({ + const coinsSelection = await this.props.stores.hardwareWallets.selectCoins( + { walletId, address, amount, assets: selectedAssets, - }); + } + ); fee = coinsSelection.fee; } else { - ({ fee, minimumAda } = - await this.props.stores.transactions.calculateTransactionFee({ - walletId, - address, - amount, - assets: selectedAssets, - })); + ({ + fee, + minimumAda, + } = await this.props.stores.transactions.calculateTransactionFee({ + walletId, + address, + amount, + assets: selectedAssets, + })); } return { diff --git a/source/renderer/app/containers/wallet/WalletSummaryPage.tsx b/source/renderer/app/containers/wallet/WalletSummaryPage.tsx index 17d42147f0..861b5fad32 100755 --- a/source/renderer/app/containers/wallet/WalletSummaryPage.tsx +++ b/source/renderer/app/containers/wallet/WalletSummaryPage.tsx @@ -79,12 +79,22 @@ class WalletSummaryPage extends Component { render() { const { intl } = this.context; const { stores, actions } = this.props; - const { app, wallets, addresses, transactions, profile, assets, currency } = - stores; + const { + app, + wallets, + addresses, + transactions, + profile, + assets, + currency, + } = stores; const { all, getAsset, favorites } = assets; const { isInternalAddress } = addresses; - const { onOpenAssetSend, onCopyAssetParam, onToggleFavorite } = - actions.assets; + const { + onOpenAssetSend, + onCopyAssetParam, + onToggleFavorite, + } = actions.assets; const { openExternalLink, environment: { network }, diff --git a/source/renderer/app/containers/wallet/WalletTokensPage.tsx b/source/renderer/app/containers/wallet/WalletTokensPage.tsx index 35e94f2345..5cdc9f1cfc 100644 --- a/source/renderer/app/containers/wallet/WalletTokensPage.tsx +++ b/source/renderer/app/containers/wallet/WalletTokensPage.tsx @@ -17,10 +17,17 @@ const WalletTokensPage = inject( observer((props: Props) => { const { actions, stores } = props; const { assets, profile, wallets, app } = stores; - const { all, favorites, insertingAssetUniqueId, removingAssetUniqueId } = - assets; - const { setEditedAsset, onOpenAssetSend, onToggleFavorite } = - actions.assets; + const { + all, + favorites, + insertingAssetUniqueId, + removingAssetUniqueId, + } = assets; + const { + setEditedAsset, + onOpenAssetSend, + onToggleFavorite, + } = actions.assets; const { open } = actions.dialogs; const { active: activeWallet } = wallets; const { currentLocale } = profile; diff --git a/source/renderer/app/containers/wallet/dialogs/WalletCreateDialogContainer.tsx b/source/renderer/app/containers/wallet/dialogs/WalletCreateDialogContainer.tsx index e95a6637ae..6568bc664d 100644 --- a/source/renderer/app/containers/wallet/dialogs/WalletCreateDialogContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/WalletCreateDialogContainer.tsx @@ -45,8 +45,10 @@ class WalletCreateDialogContainer extends Component { } onContinue = () => { - const { createWalletChangeStep, createWalletClose } = - this.props.actions.wallets; + const { + createWalletChangeStep, + createWalletClose, + } = this.props.actions.wallets; if (this.currentStep !== null) { if (this.currentStep < CREATE_WALLET_STEPS.length - 1) { @@ -71,8 +73,10 @@ class WalletCreateDialogContainer extends Component { onAbort = () => this.props.actions.wallets.createWalletAbort.trigger(); render() { - const { createWalletStep, createWalletShowAbortConfirmation } = - this.props.stores.wallets; + const { + createWalletStep, + createWalletShowAbortConfirmation, + } = this.props.stores.wallets; if (createWalletStep === null) { return null; diff --git a/source/renderer/app/containers/wallet/dialogs/WalletRestoreDialogContainer.tsx b/source/renderer/app/containers/wallet/dialogs/WalletRestoreDialogContainer.tsx index 2a8109287e..c26e4aca0a 100644 --- a/source/renderer/app/containers/wallet/dialogs/WalletRestoreDialogContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/WalletRestoreDialogContainer.tsx @@ -29,8 +29,10 @@ class WalletRestoreContainer extends Component { render() { const { stores, actions } = this.props; - const { restoreWalletStep, restoreWalletShowAbortConfirmation } = - stores.wallets; + const { + restoreWalletStep, + restoreWalletShowAbortConfirmation, + } = stores.wallets; const { restoreWalletClose, restoreWalletCancelClose, diff --git a/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/InstructionsDialogContainer.tsx b/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/InstructionsDialogContainer.tsx index ab0d4c7990..14badd20dc 100644 --- a/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/InstructionsDialogContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/InstructionsDialogContainer.tsx @@ -20,8 +20,10 @@ class InstructionsDialogContainer extends Component { onClose: () => {}, }; onPrint = async () => { - const { currentDateFormat, currentTimeFormatShort } = - this.props.stores.profile; + const { + currentDateFormat, + currentTimeFormatShort, + } = this.props.stores.profile; const date = moment(); const formattedDate = date.format(currentDateFormat); const formattedTime = date.format(currentTimeFormatShort); diff --git a/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/VerificationDialogContainer.tsx b/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/VerificationDialogContainer.tsx index 8118117629..2df67f190c 100644 --- a/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/VerificationDialogContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/paper-wallet-certificate/VerificationDialogContainer.tsx @@ -21,8 +21,10 @@ class VerificationDialogContainer extends Component { render() { const { wallets } = this.props.stores; - const { walletCertificateRecoveryPhrase, additionalMnemonicWords } = - wallets; + const { + walletCertificateRecoveryPhrase, + additionalMnemonicWords, + } = wallets; if (!walletCertificateRecoveryPhrase || !additionalMnemonicWords) { throw new Error( diff --git a/source/renderer/app/containers/wallet/dialogs/settings/UndelegateWalletDialogContainer.tsx b/source/renderer/app/containers/wallet/dialogs/settings/UndelegateWalletDialogContainer.tsx index 0e08884ae5..17a496dccc 100644 --- a/source/renderer/app/containers/wallet/dialogs/settings/UndelegateWalletDialogContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/settings/UndelegateWalletDialogContainer.tsx @@ -94,8 +94,13 @@ class UndelegateWalletDialogContainer extends Component { render() { const { actions, stores, onExternalLinkClick } = this.props; - const { wallets, staking, networkStatus, profile, hardwareWallets } = - stores; + const { + wallets, + staking, + networkStatus, + profile, + hardwareWallets, + } = stores; const { futureEpoch } = networkStatus; const { currentLocale } = profile; const { @@ -116,8 +121,10 @@ class UndelegateWalletDialogContainer extends Component { if (!walletToBeUndelegated) return null; const isTrezor = checkIsTrezorByWalletId(walletToBeUndelegated.id); const { name: walletName } = walletToBeUndelegated; - const { lastDelegatedStakePoolId, delegatedStakePoolId } = - walletToBeUndelegated; + const { + lastDelegatedStakePoolId, + delegatedStakePoolId, + } = walletToBeUndelegated; const stakePoolId = lastDelegatedStakePoolId || delegatedStakePoolId || ''; if ( diff --git a/source/renderer/app/containers/wallet/dialogs/wallet-import/WalletSelectImportStepContainer.tsx b/source/renderer/app/containers/wallet/dialogs/wallet-import/WalletSelectImportStepContainer.tsx index dcb73500a9..b870981099 100644 --- a/source/renderer/app/containers/wallet/dialogs/wallet-import/WalletSelectImportStepContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/wallet-import/WalletSelectImportStepContainer.tsx @@ -33,8 +33,11 @@ class WalletSelectImportStepContainer extends Component { render() { const { onClose, onContinue, stores } = this.props; const { walletMigration, app } = stores; - const { exportedWallets, pendingImportWalletsCount, isRestorationRunning } = - walletMigration; + const { + exportedWallets, + pendingImportWalletsCount, + isRestorationRunning, + } = walletMigration; const { openExternalLink } = app; let walletsCount = this.state.existingWalletsCount + pendingImportWalletsCount; diff --git a/source/renderer/app/containers/wallet/dialogs/wallet-restore/StepConfigurationContainer.tsx b/source/renderer/app/containers/wallet/dialogs/wallet-restore/StepConfigurationContainer.tsx index a2f0573bb7..c74e0699ee 100644 --- a/source/renderer/app/containers/wallet/dialogs/wallet-restore/StepConfigurationContainer.tsx +++ b/source/renderer/app/containers/wallet/dialogs/wallet-restore/StepConfigurationContainer.tsx @@ -25,10 +25,15 @@ class ConfigurationDialogContainer extends Component { const { wallets, profile } = stores; const { currentLocale } = profile; const { error } = wallets.restoreRequest; - const { walletName, spendingPassword, repeatPassword, isRestoring } = - wallets; - const { error: certificateError } = - stores.wallets.getWalletRecoveryPhraseFromCertificateRequest; + const { + walletName, + spendingPassword, + repeatPassword, + isRestoring, + } = wallets; + const { + error: certificateError, + } = stores.wallets.getWalletRecoveryPhraseFromCertificateRequest; return ( = new RendererIpcChannel(CARDANO_TLS_CONFIG_CHANNEL); -export const restartCardanoNodeChannel: RendererIpcChannel = - new RendererIpcChannel(CARDANO_RESTART_CHANNEL); +export const restartCardanoNodeChannel: RendererIpcChannel< + void, + void +> = new RendererIpcChannel(CARDANO_RESTART_CHANNEL); export const cardanoStateChangeChannel: RendererIpcChannel< CardanoNodeState, void > = new RendererIpcChannel(CARDANO_STATE_CHANNEL); -export const awaitUpdateChannel: RendererIpcChannel = - new RendererIpcChannel(CARDANO_AWAIT_UPDATE_CHANNEL); +export const awaitUpdateChannel: RendererIpcChannel< + void, + void +> = new RendererIpcChannel(CARDANO_AWAIT_UPDATE_CHANNEL); export const cardanoFaultInjectionChannel: RendererIpcChannel< void, FaultInjectionIpcRequest diff --git a/source/renderer/app/ipc/downloadManagerChannel.ts b/source/renderer/app/ipc/downloadManagerChannel.ts index c68b40aac9..72174c26ca 100644 --- a/source/renderer/app/ipc/downloadManagerChannel.ts +++ b/source/renderer/app/ipc/downloadManagerChannel.ts @@ -26,11 +26,15 @@ import type { import { RendererIpcChannel } from './lib/RendererIpcChannel'; export const requestDownloadChannel: // IpcChannel -RendererIpcChannel = - new RendererIpcChannel(REQUEST_DOWNLOAD); +RendererIpcChannel< + DownloadMainResponse, + DownloadRendererRequest +> = new RendererIpcChannel(REQUEST_DOWNLOAD); export const requestResumeDownloadChannel: // IpcChannel -RendererIpcChannel = - new RendererIpcChannel(RESUME_DOWNLOAD); +RendererIpcChannel< + ResumeDownloadMainResponse, + ResumeDownloadRendererRequest +> = new RendererIpcChannel(RESUME_DOWNLOAD); export const deleteDownloadedFile: // IpcChannel RendererIpcChannel< DeleteDownloadedFileMainResponse, diff --git a/source/renderer/app/ipc/generateCsvChannel.ts b/source/renderer/app/ipc/generateCsvChannel.ts index 485b847837..bccab8ddb7 100644 --- a/source/renderer/app/ipc/generateCsvChannel.ts +++ b/source/renderer/app/ipc/generateCsvChannel.ts @@ -6,5 +6,7 @@ import type { import { RendererIpcChannel } from './lib/RendererIpcChannel'; export const generateCsvChannel: // IpcChannel -RendererIpcChannel = - new RendererIpcChannel(GENERATE_CSV_CHANNEL); +RendererIpcChannel< + GenerateCsvMainResponse, + GenerateCsvRendererRequest +> = new RendererIpcChannel(GENERATE_CSV_CHANNEL); diff --git a/source/renderer/app/ipc/rebuild-application-menu.ts b/source/renderer/app/ipc/rebuild-application-menu.ts index 957c20e501..8194d027e4 100644 --- a/source/renderer/app/ipc/rebuild-application-menu.ts +++ b/source/renderer/app/ipc/rebuild-application-menu.ts @@ -9,5 +9,6 @@ export type RebuildApplicationMenu = RendererIpcChannel< RebuildAppMenuMainResponse, RebuildAppMenuRendererRequest >; -export const rebuildApplicationMenu: RebuildApplicationMenu = - new RendererIpcChannel(REBUILD_APP_MENU_CHANNEL); +export const rebuildApplicationMenu: RebuildApplicationMenu = new RendererIpcChannel( + REBUILD_APP_MENU_CHANNEL +); diff --git a/source/renderer/app/ipc/saveQRCodeImageChannel.ts b/source/renderer/app/ipc/saveQRCodeImageChannel.ts index fbbb210054..ffd0e2eac8 100644 --- a/source/renderer/app/ipc/saveQRCodeImageChannel.ts +++ b/source/renderer/app/ipc/saveQRCodeImageChannel.ts @@ -6,5 +6,7 @@ import type { import { RendererIpcChannel } from './lib/RendererIpcChannel'; export const saveQRCodeImageChannel: // IpcChannel -RendererIpcChannel = - new RendererIpcChannel(GENERATE_QRCODE_CHANNEL); +RendererIpcChannel< + GenerateQRCodeMainResponse, + GenerateQRCodeRendererRequest +> = new RendererIpcChannel(GENERATE_QRCODE_CHANNEL); diff --git a/source/renderer/app/ipc/show-file-dialog-channels.ts b/source/renderer/app/ipc/show-file-dialog-channels.ts index 1c0cb81406..0a6bd437ff 100644 --- a/source/renderer/app/ipc/show-file-dialog-channels.ts +++ b/source/renderer/app/ipc/show-file-dialog-channels.ts @@ -11,8 +11,12 @@ import type { } from '../../../common/ipc/api'; export const showOpenDialogChannel: // IpcChannel -RendererIpcChannel = - new RendererIpcChannel(SHOW_OPEN_DIALOG_CHANNEL); +RendererIpcChannel< + ShowOpenDialogMainResponse, + ShowOpenDialogRendererRequest +> = new RendererIpcChannel(SHOW_OPEN_DIALOG_CHANNEL); export const showSaveDialogChannel: // IpcChannel -RendererIpcChannel = - new RendererIpcChannel(SHOW_SAVE_DIALOG_CHANNEL); +RendererIpcChannel< + ShowSaveDialogMainResponse, + ShowSaveDialogRendererRequest +> = new RendererIpcChannel(SHOW_SAVE_DIALOG_CHANNEL); diff --git a/source/renderer/app/stores/AddressesStore.ts b/source/renderer/app/stores/AddressesStore.ts index fb63b822a0..e0ad276dd5 100644 --- a/source/renderer/app/stores/AddressesStore.ts +++ b/source/renderer/app/stores/AddressesStore.ts @@ -45,12 +45,13 @@ export default class AddressesStore extends Store { const { walletId, passphrase } = params; const accountIndex = await this.getAccountIndexByWalletId(walletId); // @ts-ignore ts-migrate(2739) FIXME: Type 'Address' is missing the following properties... Remove this comment to see the full error message - const address: WalletAddress = - await this.createByronWalletAddressRequest.execute({ + const address: WalletAddress = await this.createByronWalletAddressRequest.execute( + { addressIndex: accountIndex, passphrase, walletId, - }).promise; + } + ).promise; if (address != null) { this._refreshAddresses(); diff --git a/source/renderer/app/stores/AppUpdateStore.ts b/source/renderer/app/stores/AppUpdateStore.ts index a74007f6a0..caca5e2650 100644 --- a/source/renderer/app/stores/AppUpdateStore.ts +++ b/source/renderer/app/stores/AppUpdateStore.ts @@ -178,8 +178,7 @@ export default class AppUpdateStore extends Store { _checkNewAppUpdate = async (update: News) => { const { version, url } = this.getUpdateInfo(update); // @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 - const appUpdateCompleted = - await this.getAppUpdateCompletedRequest.execute(); + const appUpdateCompleted = await this.getAppUpdateCompletedRequest.execute(); /* * The update was already installed and the installer was already deleted. @@ -209,8 +208,7 @@ export default class AppUpdateStore extends Store { if (this.isUpdateDownloading) return false; // Is there an 'Automatic Update Failed' flag? // @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 - const isAutomaticUpdateFailed = - await this.getAppAutomaticUpdateFailedRequest.execute(); + const isAutomaticUpdateFailed = await this.getAppAutomaticUpdateFailedRequest.execute(); if (isAutomaticUpdateFailed) { runInAction(() => { @@ -273,11 +271,12 @@ export default class AppUpdateStore extends Store { id: APP_UPDATE_DOWNLOAD_ID, }); }; - _getUpdateDownloadLocalData = - async (): Promise => - getDownloadLocalDataChannel.request({ - id: APP_UPDATE_DOWNLOAD_ID, - }); + _getUpdateDownloadLocalData = async (): Promise< + DownloadLocalDataMainResponse + > => + getDownloadLocalDataChannel.request({ + id: APP_UPDATE_DOWNLOAD_ID, + }); _checkFileExists = async (): Promise => checkFileExistsChannel.request({ id: APP_UPDATE_DOWNLOAD_ID, diff --git a/source/renderer/app/stores/HardwareWalletsStore.ts b/source/renderer/app/stores/HardwareWalletsStore.ts index b342efd426..eb4f09557b 100644 --- a/source/renderer/app/stores/HardwareWalletsStore.ts +++ b/source/renderer/app/stores/HardwareWalletsStore.ts @@ -169,13 +169,13 @@ export default class HardwareWalletsStore extends Store { this.api.ada.constructAddress ); @observable - hardwareWalletsLocalDataRequest: Request = new Request( - this.api.localStorage.getHardwareWalletsLocalData - ); + hardwareWalletsLocalDataRequest: Request< + HardwareWalletsLocalData + > = new Request(this.api.localStorage.getHardwareWalletsLocalData); @observable - setHardwareWalletLocalDataRequest: Request = new Request( - this.api.localStorage.setHardwareWalletLocalData - ); + setHardwareWalletLocalDataRequest: Request< + HardwareWalletLocalData + > = new Request(this.api.localStorage.setHardwareWalletLocalData); @observable unsetHardwareWalletLocalDataRequest: Request = new Request( this.api.localStorage.unsetHardwareWalletLocalData @@ -185,25 +185,25 @@ export default class HardwareWalletsStore extends Store { this.api.localStorage.getHardwareWalletDevices ); @observable - setHardwareWalletDeviceRequest: Request = new Request( - this.api.localStorage.setHardwareWalletDevice - ); + setHardwareWalletDeviceRequest: Request< + HardwareWalletLocalData + > = new Request(this.api.localStorage.setHardwareWalletDevice); @observable - overrideHardwareWalletDevicesRequest: Request = new Request( - this.api.localStorage.overrideHardwareWalletDevices - ); + overrideHardwareWalletDevicesRequest: Request< + HardwareWalletDevicesType + > = new Request(this.api.localStorage.overrideHardwareWalletDevices); @observable - unsetHardwareWalletDeviceRequest: Request = new Request( - this.api.localStorage.unsetHardwareWalletDevice - ); + unsetHardwareWalletDeviceRequest: Request< + HardwareWalletLocalData + > = new Request(this.api.localStorage.unsetHardwareWalletDevice); @observable unsetHardwareWalletDevicesAllRequest: Request = new Request( this.api.localStorage.unsetHardwareWalletDevicesAll ); @observable - unsetHardwareWalletLocalDataAllRequest: Request = new Request( - this.api.localStorage.unsetHardwareWalletLocalDataAll - ); + unsetHardwareWalletLocalDataAllRequest: Request< + HardwareWalletLocalData + > = new Request(this.api.localStorage.unsetHardwareWalletLocalDataAll); @observable hwDeviceStatus: HwDeviceStatus = HwDeviceStatuses.CONNECTING; @observable @@ -438,11 +438,15 @@ export default class HardwareWalletsStore extends Store { walletId: string; isVotingRegistrationTransaction: boolean; }) => { - const { transactionId, walletId, isVotingRegistrationTransaction } = - request; + const { + transactionId, + walletId, + isVotingRegistrationTransaction, + } = request; - const recentTransactionsResponse = - this.stores.transactions._getTransactionsRecentRequest(walletId).result; + const recentTransactionsResponse = this.stores.transactions._getTransactionsRecentRequest( + walletId + ).result; const recentTransactions = recentTransactionsResponse ? recentTransactionsResponse.transactions @@ -1843,10 +1847,11 @@ export default class HardwareWalletsStore extends Store { const outputsData = []; for (const output of outputs) { - const { address_style: addressStyle } = - await this.stores.addresses._inspectAddress({ - addressId: output.address, - }); + const { + address_style: addressStyle, + } = await this.stores.addresses._inspectAddress({ + addressId: output.address, + }); const shelleyTxOutput = ShelleyTxOutput(output, addressStyle); unsignedTxOutputs.push(shelleyTxOutput); const ledgerOutput = prepareTrezorOutput(output); @@ -2164,10 +2169,11 @@ export default class HardwareWalletsStore extends Store { const outputsData = []; for (const output of outputs) { - const { address_style: addressStyle } = - await this.stores.addresses._inspectAddress({ - addressId: output.address, - }); + const { + address_style: addressStyle, + } = await this.stores.addresses._inspectAddress({ + addressId: output.address, + }); const shelleyTxOutput = ShelleyTxOutput(output, addressStyle); unsignedTxOutputs.push(shelleyTxOutput); const ledgerOutput = prepareLedgerOutput(output, addressStyle); diff --git a/source/renderer/app/stores/NetworkStatusStore.ts b/source/renderer/app/stores/NetworkStatusStore.ts index d592b46304..87d9ea0e13 100644 --- a/source/renderer/app/stores/NetworkStatusStore.ts +++ b/source/renderer/app/stores/NetworkStatusStore.ts @@ -144,9 +144,9 @@ export default class NetworkStatusStore extends Store { this.api.ada.getNetworkClock ); @observable - getNetworkParametersRequest: Request = new Request( - this.api.ada.getNetworkParameters - ); + getNetworkParametersRequest: Request< + GetNetworkParametersResponse + > = new Request(this.api.ada.getNetworkParameters); @observable isNotEnoughDiskSpace = false; @observable @@ -509,10 +509,11 @@ export default class NetworkStatusStore extends Store { }); try { - const networkClock: GetNetworkClockResponse = - await this.getNetworkClockRequest.execute({ + const networkClock: GetNetworkClockResponse = await this.getNetworkClockRequest.execute( + { isForceCheck, - }).promise; + } + ).promise; // System time is correct if local time difference is below allowed threshold runInAction('update localTimeDifference and isNodeTimeCorrect', () => { // Update localTimeDifference only in case NTP check status is not still pending @@ -542,8 +543,8 @@ export default class NetworkStatusStore extends Store { const wasConnected = this.isConnected; try { - const networkStatus: GetNetworkInfoResponse = - await this.getNetworkInfoRequest.execute().promise; + const networkStatus: GetNetworkInfoResponse = await this.getNetworkInfoRequest.execute() + .promise; // In case we no longer have TLS config we ignore all API call responses // as this means we are in the Cardano shutdown (stopping|exiting|updating) sequence @@ -706,8 +707,8 @@ export default class NetworkStatusStore extends Store { if (!this.isNodeResponding) return; try { - const networkParameters: GetNetworkParametersResponse = - await this.getNetworkParametersRequest.execute().promise; + const networkParameters: GetNetworkParametersResponse = await this.getNetworkParametersRequest.execute() + .promise; let { isShelleyActivated, isShelleyPending, diff --git a/source/renderer/app/stores/ProfileStore.ts b/source/renderer/app/stores/ProfileStore.ts index ed0e70383d..6be759acb9 100644 --- a/source/renderer/app/stores/ProfileStore.ts +++ b/source/renderer/app/stores/ProfileStore.ts @@ -488,8 +488,9 @@ export default class ProfileStore extends Store { } }; _compressLogs = action(async ({ logs }) => { - const { fileName = generateFileNameWithTimestamp() } = - this.compressedLogsStatus; + const { + fileName = generateFileNameWithTimestamp(), + } = this.compressedLogsStatus; try { const outputPath = await compressLogsChannel.request({ diff --git a/source/renderer/app/stores/SidebarStore.ts b/source/renderer/app/stores/SidebarStore.ts index f2dd4d150e..702f8288fd 100644 --- a/source/renderer/app/stores/SidebarStore.ts +++ b/source/renderer/app/stores/SidebarStore.ts @@ -47,8 +47,12 @@ export default class SidebarStore extends Store { // https://alexhisen.gitbooks.io/mobx-recipes/content/use-computedstruct-for-computed-objects.html @computed.struct get wallets(): Array { - const { networkStatus, wallets, walletSettings, hardwareWallets } = - this.stores; + const { + networkStatus, + wallets, + walletSettings, + hardwareWallets, + } = this.stores; const { hardwareWalletsConnectionData } = hardwareWallets; const shelleyWallets = sortWallets({ wallets: wallets.all.filter((w) => !w.isLegacy), @@ -67,8 +71,9 @@ export default class SidebarStore extends Store { [wallet.id, 'disconnected'], true ); - const { hasNotification } = - walletSettings.getWalletsRecoveryPhraseVerificationData(wallet.id); + const { + hasNotification, + } = walletSettings.getWalletsRecoveryPhraseVerificationData(wallet.id); return { id: wallet.id, title: wallet.name, @@ -105,8 +110,10 @@ export default class SidebarStore extends Store { // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'typ... Remove this comment to see the full error message environment: { isDev, isMainnet }, } = global; - const { CATEGORIES_BY_NAME: categories, CATEGORIES_LIST: list } = - sidebarConfig; + const { + CATEGORIES_BY_NAME: categories, + CATEGORIES_LIST: list, + } = sidebarConfig; const categoryValidation: Record< string, boolean | ((...args: Array) => any) diff --git a/source/renderer/app/stores/StakingStore.ts b/source/renderer/app/stores/StakingStore.ts index 39d2ecc357..d80b506816 100644 --- a/source/renderer/app/stores/StakingStore.ts +++ b/source/renderer/app/stores/StakingStore.ts @@ -101,8 +101,10 @@ export default class StakingStore extends Store { _delegationFeeCalculationWalletId: string | null | undefined = null; setup() { - const { staking: stakingActions, networkStatus: networkStatusActions } = - this.actions; + const { + staking: stakingActions, + networkStatus: networkStatusActions, + } = this.actions; this.refreshPolling = setInterval( this.getStakePoolsData, STAKE_POOLS_FAST_INTERVAL @@ -157,9 +159,9 @@ export default class StakingStore extends Store { this.api.ada.getStakePools ); @observable - calculateDelegationFeeRequest: Request = new Request( - this.api.ada.calculateDelegationFee - ); + calculateDelegationFeeRequest: Request< + DelegationCalculateFeeResponse + > = new Request(this.api.ada.calculateDelegationFee); // @REDEEM TODO: Proper type it when the API endpoint is implemented. @observable getRedeemItnRewardsFeeRequest: Request = new Request( @@ -267,8 +269,7 @@ export default class StakingStore extends Store { }; @action _getStakingInfoWasOpen = async () => { - const stakingInfoWasOpen = - await this.api.localStorage.getStakingInfoWasOpen(); + const stakingInfoWasOpen = await this.api.localStorage.getStakingInfoWasOpen(); runInAction(() => { this.stakingInfoWasOpen = stakingInfoWasOpen; }); @@ -400,8 +401,9 @@ export default class StakingStore extends Store { }) => { const { transactionId, walletId } = request; - const recentTransactionsResponse = - this.stores.transactions._getTransactionsRecentRequest(walletId).result; + const recentTransactionsResponse = this.stores.transactions._getTransactionsRecentRequest( + walletId + ).result; const recentTransactions = recentTransactionsResponse ? recentTransactionsResponse.transactions @@ -485,10 +487,11 @@ export default class StakingStore extends Store { } try { - const delegationFee: DelegationCalculateFeeResponse = - await this.calculateDelegationFeeRequest.execute({ + const delegationFee: DelegationCalculateFeeResponse = await this.calculateDelegationFeeRequest.execute( + { ...delegationFeeRequest, - }).promise; + } + ).promise; if (this._delegationFeeCalculationWalletId !== walletId) { return null; @@ -574,8 +577,11 @@ export default class StakingStore extends Store { @action getStakePoolsData = async (isSmash?: boolean) => { - const { isConnected, isSynced, isShelleyActivated } = - this.stores.networkStatus; + const { + isConnected, + isSynced, + isShelleyActivated, + } = this.stores.networkStatus; if (!isShelleyActivated || !isConnected || !isSynced) { this._resetIsRanking(); diff --git a/source/renderer/app/stores/TransactionsStore.ts b/source/renderer/app/stores/TransactionsStore.ts index dd6fca7cf3..8f003da4f6 100644 --- a/source/renderer/app/stores/TransactionsStore.ts +++ b/source/renderer/app/stores/TransactionsStore.ts @@ -94,14 +94,15 @@ export default class TransactionsStore extends Store { this.api.ada.deleteTransaction ); @observable - createExternalTransactionRequest: Request = - new Request(this.api.ada.createExternalTransaction); + createExternalTransactionRequest: Request< + CreateExternalTransactionRequest + > = new Request(this.api.ada.createExternalTransaction); @observable _filterOptionsForWallets = {}; @observable - calculateTransactionFeeRequest: Request = new Request( - this.api.ada.calculateTransactionFee - ); + calculateTransactionFeeRequest: Request< + GetTransactionFeeRequest + > = new Request(this.api.ada.calculateTransactionFee); setup() { const { diff --git a/source/renderer/app/stores/UiNotificationsStore.ts b/source/renderer/app/stores/UiNotificationsStore.ts index 6640aba242..4457b76221 100644 --- a/source/renderer/app/stores/UiNotificationsStore.ts +++ b/source/renderer/app/stores/UiNotificationsStore.ts @@ -30,8 +30,11 @@ export default class UiNotificationsStore extends Store { isOpen = (id: NotificationId): boolean => !!this.activeNotifications[id]; @action _registerNotification = (notificationConfig: NotificationConfig) => { - const { id, actionToListenAndOpen, actionToListenAndClose } = - notificationConfig; + const { + id, + actionToListenAndOpen, + actionToListenAndClose, + } = notificationConfig; actionToListenAndOpen.listen((labelValues?: Record) => this._openNotification(notificationConfig, labelValues) ); diff --git a/source/renderer/app/stores/VotingStore.ts b/source/renderer/app/stores/VotingStore.ts index e3f34fe14a..13e13f7bb4 100644 --- a/source/renderer/app/stores/VotingStore.ts +++ b/source/renderer/app/stores/VotingStore.ts @@ -97,9 +97,9 @@ export default class VotingStore extends Store { this.api.ada.getWalletPublicKey ); @observable - createVotingRegistrationTransactionRequest: Request = new Request( - this.api.ada.createVotingRegistrationTransaction - ); + createVotingRegistrationTransactionRequest: Request< + WalletTransaction + > = new Request(this.api.ada.createVotingRegistrationTransaction); @observable signMetadataRequest: Request = new Request( this.api.ada.createWalletSignature @@ -319,8 +319,13 @@ export default class VotingStore extends Store { const votingData = await this.prepareVotingData({ walletId, }); - const { stakeAddressHex, votingKey, stakeKey, role, index } = - votingData; + const { + stakeAddressHex, + votingKey, + stakeKey, + role, + index, + } = votingData; // @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 const signature = await this.signMetadataRequest.execute({ addressHex: stakeAddressHex, @@ -333,8 +338,8 @@ export default class VotingStore extends Store { absoluteSlotNumber, }); // @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 - transaction = - await this.createVotingRegistrationTransactionRequest.execute({ + transaction = await this.createVotingRegistrationTransactionRequest.execute( + { address: address.id, addressHex: stakeAddressHex, amount, @@ -344,7 +349,8 @@ export default class VotingStore extends Store { stakeKey, signature: signature.toString('hex'), absoluteSlotNumber, - }); + } + ); } this._setTransactionId(transaction.id); @@ -395,8 +401,11 @@ export default class VotingStore extends Store { if (!selectedWallet) return; const { name: walletName } = selectedWallet; const { desktopDirectoryPath } = this.stores.profile; - const { currentLocale, currentDateFormat, currentTimeFormat } = - this.stores.profile; + const { + currentLocale, + currentDateFormat, + currentTimeFormat, + } = this.stores.profile; const nextVotingFundNumber = NEXT_VOTING_FUND_NUMBER; const { network, isMainnet } = this.environment; const intl = i18nContext(currentLocale); diff --git a/source/renderer/app/stores/WalletMigrationStore.ts b/source/renderer/app/stores/WalletMigrationStore.ts index 487c40ad7f..a593f1e5e7 100644 --- a/source/renderer/app/stores/WalletMigrationStore.ts +++ b/source/renderer/app/stores/WalletMigrationStore.ts @@ -232,11 +232,13 @@ export default class WalletMigrationStore extends Store { // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('WalletMigrationStore: Starting wallet export...'); this.isExportRunning = true; - const { wallets, errors }: ExportWalletsMainResponse = - await exportWalletsChannel.request({ - exportSourcePath: this.exportSourcePath || this.defaultExportSourcePath, - locale: this.stores.profile.currentLocale, - }); + const { + wallets, + errors, + }: ExportWalletsMainResponse = await exportWalletsChannel.request({ + exportSourcePath: this.exportSourcePath || this.defaultExportSourcePath, + locale: this.stores.profile.currentLocale, + }); runInAction('update exportedWallets and exportErrors', () => { this.exportedWallets = orderBy( wallets.map((wallet) => { @@ -367,8 +369,8 @@ export default class WalletMigrationStore extends Store { }; @action _generateMigrationReport = async () => { - const finalMigrationStatus = - await this.getWalletMigrationStatusRequest.execute().promise; + const finalMigrationStatus = await this.getWalletMigrationStatusRequest.execute() + .promise; const walletMigrationReportData: WalletMigrationReportData = { exportedWalletsData: this.exportedWalletsData, exportedWalletsCount: this.exportedWalletsCount, @@ -409,8 +411,8 @@ export default class WalletMigrationStore extends Store { // Reset migration data this._resetMigration(); - const walletMigrationStatus = - await this.getWalletMigrationStatusRequest.execute().promise; + const walletMigrationStatus = await this.getWalletMigrationStatusRequest.execute() + .promise; if (walletMigrationStatus === WalletMigrationStatuses.UNSTARTED) { // Wait for wallets to load as we need to match existing and exported wallets @@ -501,8 +503,8 @@ export default class WalletMigrationStore extends Store { this.actions.dialogs.closeActiveDialog.trigger(); } - const walletMigrationStatus = - await this.getWalletMigrationStatusRequest.execute().promise; + const walletMigrationStatus = await this.getWalletMigrationStatusRequest.execute() + .promise; if (walletMigrationStatus === WalletMigrationStatuses.RUNNING) { // Update migration status diff --git a/source/renderer/app/stores/WalletSettingsStore.ts b/source/renderer/app/stores/WalletSettingsStore.ts index 23e1b9266c..7a0c407278 100644 --- a/source/renderer/app/stores/WalletSettingsStore.ts +++ b/source/renderer/app/stores/WalletSettingsStore.ts @@ -39,8 +39,10 @@ export default class WalletSettingsStore extends Store { pollingApiInterval: IntervalID | null | undefined = null; setup() { - const { walletSettings: walletSettingsActions, sidebar: sidebarActions } = - this.actions; + const { + walletSettings: walletSettingsActions, + sidebar: sidebarActions, + } = this.actions; walletSettingsActions.startEditingWalletField.listen( this._startEditingWalletField ); @@ -303,8 +305,12 @@ export default class WalletSettingsStore extends Store { throw new Error( 'Active wallet required before checking show used addresses statuses.' ); - const localWalletData: WalletLocalData | null | undefined = - this.getLocalWalletDataById(activeWallet ? activeWallet.id : ''); + const localWalletData: + | WalletLocalData + | null + | undefined = this.getLocalWalletDataById( + activeWallet ? activeWallet.id : '' + ); const { showUsedAddresses } = localWalletData || {}; await this.actions.walletsLocal.setWalletLocalData.trigger({ walletId: activeWallet.id, diff --git a/source/renderer/app/stores/WalletsStore.ts b/source/renderer/app/stores/WalletsStore.ts index 6b3d21126b..cafff947a3 100644 --- a/source/renderer/app/stores/WalletsStore.ts +++ b/source/renderer/app/stores/WalletsStore.ts @@ -114,16 +114,19 @@ export default class WalletsStore extends Store { ); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletCertificateAdditionalMnemonicsRequest: Request> = - new Request(this.api.ada.getWalletCertificateAdditionalMnemonics); + getWalletCertificateAdditionalMnemonicsRequest: Request< + Array + > = new Request(this.api.ada.getWalletCertificateAdditionalMnemonics); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletCertificateRecoveryPhraseRequest: Request> = - new Request(this.api.ada.getWalletCertificateRecoveryPhrase); + getWalletCertificateRecoveryPhraseRequest: Request< + Array + > = new Request(this.api.ada.getWalletCertificateRecoveryPhrase); @observable // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - getWalletRecoveryPhraseFromCertificateRequest: Request> = - new Request(this.api.ada.getWalletRecoveryPhraseFromCertificate); + getWalletRecoveryPhraseFromCertificateRequest: Request< + Array + > = new Request(this.api.ada.getWalletRecoveryPhraseFromCertificate); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreDaedalusRequest: Request = new Request( @@ -156,8 +159,9 @@ export default class WalletsStore extends Store { ); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message - transferFundsCalculateFeeRequest: Request = - new Request(this.api.ada.transferFundsCalculateFee); + transferFundsCalculateFeeRequest: Request< + TransferFundsCalculateFeeRequest + > = new Request(this.api.ada.transferFundsCalculateFee); @observable // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message transferFundsRequest: Request = new Request( @@ -431,8 +435,11 @@ export default class WalletsStore extends Store { try { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const recoveryPhrase: Array | null | undefined = - await this.getWalletRecoveryPhraseRequest.execute().promise; + const recoveryPhrase: + | Array + | null + | undefined = await this.getWalletRecoveryPhraseRequest.execute() + .promise; if (recoveryPhrase != null) { // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message @@ -661,8 +668,9 @@ export default class WalletsStore extends Store { // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _finishWalletBackup = async () => { // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - this._newWalletDetails.mnemonic = - this.stores.walletBackup.recoveryPhrase.join(' '); + this._newWalletDetails.mnemonic = this.stores.walletBackup.recoveryPhrase.join( + ' ' + ); const wallet = await this.createWalletRequest.execute( this._newWalletDetails ).promise; @@ -776,11 +784,12 @@ export default class WalletsStore extends Store { const { passphrase, scrambledInput } = getScrambledInput(mnemonics); // Unscramble 18-word wallet certificate mnemonic to 12-word mnemonic // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const unscrambledRecoveryPhrase: Array = - await this.getWalletRecoveryPhraseFromCertificateRequest.execute({ + const unscrambledRecoveryPhrase: Array = await this.getWalletRecoveryPhraseFromCertificateRequest.execute( + { passphrase, scrambledInput, - }).promise; + } + ).promise; this.getWalletRecoveryPhraseFromCertificateRequest.reset(); // @ts-ignore return unscrambledRecoveryPhrase; @@ -1307,14 +1316,17 @@ export default class WalletsStore extends Store { (walletId) => ({ walletId, // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - recentRequest: - this.stores.transactions._getTransactionsRecentRequest(walletId), + recentRequest: this.stores.transactions._getTransactionsRecentRequest( + walletId + ), // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - allRequest: - this.stores.transactions._getTransactionsAllRequest(walletId), + allRequest: this.stores.transactions._getTransactionsAllRequest( + walletId + ), // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - withdrawalsRequest: - this.stores.transactions._getWithdrawalsRequest(walletId), + withdrawalsRequest: this.stores.transactions._getWithdrawalsRequest( + walletId + ), }) ); @@ -1483,13 +1495,12 @@ export default class WalletsStore extends Store { // Generate wallet recovery phrase // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const recoveryPhrase: Array = - yield this.getWalletRecoveryPhraseRequest.execute().promise; + const recoveryPhrase: Array = yield this.getWalletRecoveryPhraseRequest.execute() + .promise; // Generate 9-words (additional) mnemonic // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const additionalMnemonicWords: Array = - yield this.getWalletCertificateAdditionalMnemonicsRequest.execute() - .promise; + const additionalMnemonicWords: Array = yield this.getWalletCertificateAdditionalMnemonicsRequest.execute() + .promise; this.additionalMnemonicWords = additionalMnemonicWords.join(' '); // Generate spending password from 9-word mnemonic and save to store // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. @@ -1497,13 +1508,15 @@ export default class WalletsStore extends Store { this.walletCertificatePassword = spendingPassword; // Generate paper wallet scrambled mnemonic // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. - const walletCertificateRecoveryPhrase: Array = - yield this.getWalletCertificateRecoveryPhraseRequest.execute({ + const walletCertificateRecoveryPhrase: Array = yield this.getWalletCertificateRecoveryPhraseRequest.execute( + { passphrase: spendingPassword, input: recoveryPhrase.join(' '), - }).promise; - this.walletCertificateRecoveryPhrase = - walletCertificateRecoveryPhrase.join(' '); + } + ).promise; + this.walletCertificateRecoveryPhrase = walletCertificateRecoveryPhrase.join( + ' ' + ); // Create temporary wallet const walletData = { name: 'Paper Wallet', diff --git a/source/renderer/app/stores/index.ts b/source/renderer/app/stores/index.ts index 558067c87d..f19c566371 100644 --- a/source/renderer/app/stores/index.ts +++ b/source/renderer/app/stores/index.ts @@ -82,43 +82,47 @@ function executeOnEveryStore(fn: (store: Store) => void) { }); } // Set up and return the stores for this app -> also used to reset all stores to defaults -export default action((api, actions, router): StoresMap => { - function createStoreInstanceOf(StoreSubClass: Class): T { - return new StoreSubClass(api, actions); - } +export default action( + (api, actions, router): StoresMap => { + function createStoreInstanceOf( + StoreSubClass: Class + ): T { + return new StoreSubClass(api, actions); + } - // Teardown existing stores - if (stores) executeOnEveryStore((store) => store.teardown()); - // Create fresh instances of all stores - // @ts-ignore ts-migrate(2322) FIXME: Type '{ addresses: Store; app: Store; assets: Stor... Remove this comment to see the full error message - stores = observable({ - addresses: createStoreInstanceOf(AddressesStore), - app: createStoreInstanceOf(AppStore), - assets: createStoreInstanceOf(AssetsStore), - currency: createStoreInstanceOf(CurrencyStore), - appUpdate: createStoreInstanceOf(AppUpdateStore), - hardwareWallets: createStoreInstanceOf(HardwareWalletsStore), - networkStatus: createStoreInstanceOf(NetworkStatusStore), - newsFeed: createStoreInstanceOf(NewsFeedStore), - profile: createStoreInstanceOf(ProfileStore), - router, - sidebar: createStoreInstanceOf(SidebarStore), - staking: createStoreInstanceOf(StakingStore), - transactions: createStoreInstanceOf(TransactionsStore), - uiDialogs: createStoreInstanceOf(UiDialogsStore), - uiNotifications: createStoreInstanceOf(UiNotificationsStore), - voting: createStoreInstanceOf(VotingStore), - wallets: createStoreInstanceOf(WalletsStore), - walletsLocal: createStoreInstanceOf(WalletsLocalStore), - walletBackup: createStoreInstanceOf(WalletBackupStore), - walletMigration: createStoreInstanceOf(WalletMigrationStore), - walletSettings: createStoreInstanceOf(WalletSettingsStore), - window: createStoreInstanceOf(WindowStore), - }); - // Configure and initialize all stores - executeOnEveryStore((store) => { - if (stores) store.configure(stores); - }); - executeOnEveryStore((store) => store.initialize()); - return stores; -}); + // Teardown existing stores + if (stores) executeOnEveryStore((store) => store.teardown()); + // Create fresh instances of all stores + // @ts-ignore ts-migrate(2322) FIXME: Type '{ addresses: Store; app: Store; assets: Stor... Remove this comment to see the full error message + stores = observable({ + addresses: createStoreInstanceOf(AddressesStore), + app: createStoreInstanceOf(AppStore), + assets: createStoreInstanceOf(AssetsStore), + currency: createStoreInstanceOf(CurrencyStore), + appUpdate: createStoreInstanceOf(AppUpdateStore), + hardwareWallets: createStoreInstanceOf(HardwareWalletsStore), + networkStatus: createStoreInstanceOf(NetworkStatusStore), + newsFeed: createStoreInstanceOf(NewsFeedStore), + profile: createStoreInstanceOf(ProfileStore), + router, + sidebar: createStoreInstanceOf(SidebarStore), + staking: createStoreInstanceOf(StakingStore), + transactions: createStoreInstanceOf(TransactionsStore), + uiDialogs: createStoreInstanceOf(UiDialogsStore), + uiNotifications: createStoreInstanceOf(UiNotificationsStore), + voting: createStoreInstanceOf(VotingStore), + wallets: createStoreInstanceOf(WalletsStore), + walletsLocal: createStoreInstanceOf(WalletsLocalStore), + walletBackup: createStoreInstanceOf(WalletBackupStore), + walletMigration: createStoreInstanceOf(WalletMigrationStore), + walletSettings: createStoreInstanceOf(WalletSettingsStore), + window: createStoreInstanceOf(WindowStore), + }); + // Configure and initialize all stores + executeOnEveryStore((store) => { + if (stores) store.configure(stores); + }); + executeOnEveryStore((store) => store.initialize()); + return stores; + } +); diff --git a/source/renderer/app/types/sidebarTypes.ts b/source/renderer/app/types/sidebarTypes.ts index b0c8355976..169c82054c 100644 --- a/source/renderer/app/types/sidebarTypes.ts +++ b/source/renderer/app/types/sidebarTypes.ts @@ -21,11 +21,13 @@ export const WalletSortBy: EnumMap = { None: 'NONE', }; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'EnumMap'. -export const WalletSortOrder: EnumMap = - Object.freeze({ - Desc: 'desc', - Asc: 'asc', - }); +export const WalletSortOrder: EnumMap< + string, + WalletSortOrderOptions +> = Object.freeze({ + Desc: 'desc', + Asc: 'asc', +}); export type WalletSortConfig = { sortBy: WalletSortByOptions; sortOrder: WalletSortOrderOptions; diff --git a/source/renderer/app/utils/assets.ts b/source/renderer/app/utils/assets.ts index 392b4819f3..e6c208ea70 100644 --- a/source/renderer/app/utils/assets.ts +++ b/source/renderer/app/utils/assets.ts @@ -153,63 +153,64 @@ export const getNonZeroAssetTokens = ( * @param sortBy - sorting parameter * @param sortDirection - should it sort in ascending or descending direction */ -export const sortAssets = - (sortBy: SortBy, sortDirection: SortDirection) => - (asset1: AssetToken, asset2: AssetToken) => { - const { - quantity: unformattedQuantity1, - fingerprint: fingerprint1, - metadata: metadata1, - decimals: decimals1, - } = asset1; - const quantity1 = formattedTokenDecimals(unformattedQuantity1, decimals1); - const { name: name1 } = metadata1 || {}; - const { - quantity: unformattedQuantity2, - fingerprint: fingerprint2, - metadata: metadata2, - decimals: decimals2, - } = asset2; - const quantity2 = formattedTokenDecimals(unformattedQuantity2, decimals2); - const { name: name2 } = metadata2 || {}; - - if (sortBy === 'token') { - if (name1 && !name2) return -1; - if (!name1 && name2) return 1; - - if (name1 && name2) { - if (sortDirection === 'asc') { - return name1.localeCompare(name2); - } +export const sortAssets = (sortBy: SortBy, sortDirection: SortDirection) => ( + asset1: AssetToken, + asset2: AssetToken +) => { + const { + quantity: unformattedQuantity1, + fingerprint: fingerprint1, + metadata: metadata1, + decimals: decimals1, + } = asset1; + const quantity1 = formattedTokenDecimals(unformattedQuantity1, decimals1); + const { name: name1 } = metadata1 || {}; + const { + quantity: unformattedQuantity2, + fingerprint: fingerprint2, + metadata: metadata2, + decimals: decimals2, + } = asset2; + const quantity2 = formattedTokenDecimals(unformattedQuantity2, decimals2); + const { name: name2 } = metadata2 || {}; - return name2.localeCompare(name1); - } + if (sortBy === 'token') { + if (name1 && !name2) return -1; + if (!name1 && name2) return 1; + if (name1 && name2) { if (sortDirection === 'asc') { - return fingerprint1.localeCompare(fingerprint2); + return name1.localeCompare(name2); } - return fingerprint2.localeCompare(fingerprint1); + return name2.localeCompare(name1); } - if (sortBy === 'fingerprint') { - if (sortDirection === 'asc') { - return fingerprint1.localeCompare(fingerprint2); - } + if (sortDirection === 'asc') { + return fingerprint1.localeCompare(fingerprint2); + } - return fingerprint2.localeCompare(fingerprint1); + return fingerprint2.localeCompare(fingerprint1); + } + + if (sortBy === 'fingerprint') { + if (sortDirection === 'asc') { + return fingerprint1.localeCompare(fingerprint2); } - if (sortBy === 'quantity') { - if (sortDirection === 'asc') { - return quantity1.isLessThan(quantity2) ? -1 : 1; - } + return fingerprint2.localeCompare(fingerprint1); + } - return quantity1.isLessThan(quantity2) ? 1 : -1; + if (sortBy === 'quantity') { + if (sortDirection === 'asc') { + return quantity1.isLessThan(quantity2) ? -1 : 1; } - return 0; - }; + return quantity1.isLessThan(quantity2) ? 1 : -1; + } + + return 0; +}; /** * Check if after the transactions your wallet has some assets left @@ -266,8 +267,13 @@ export const searchAssets = ( } return filter(assets, (asset) => { - const { policyId, assetName, assetNameASCII, fingerprint, metadata } = - asset; + const { + policyId, + assetName, + assetNameASCII, + fingerprint, + metadata, + } = asset; const { name, ticker, description } = metadata || {}; const checkList = [ policyId, diff --git a/source/renderer/app/utils/hardwareWalletUtils.ts b/source/renderer/app/utils/hardwareWalletUtils.ts index 85307f8953..6741e47c69 100644 --- a/source/renderer/app/utils/hardwareWalletUtils.ts +++ b/source/renderer/app/utils/hardwareWalletUtils.ts @@ -37,7 +37,15 @@ export const KEY_PREFIXES = { }; // Helpers const receiverAddressTypes: Set = new Set([ - 0, 1, 2, 3, 4, 5, 6, 7, 8, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, ]); export const isReceiverAddressType = (addressType: AddressType) => receiverAddressTypes.has(addressType); diff --git a/source/renderer/app/utils/logging.ts b/source/renderer/app/utils/logging.ts index 7b194b762f..0587a45412 100644 --- a/source/renderer/app/utils/logging.ts +++ b/source/renderer/app/utils/logging.ts @@ -23,19 +23,20 @@ const environmentData = { version, }; -const logToLevel = - (level: LoggingLevel) => - (message: string, data: Record | null | undefined) => { - const args = [ - formatContext({ ...messageContext, level }), - { - message, - data, - environmentData, - }, - ]; - electronLog[level](...args); - }; +const logToLevel = (level: LoggingLevel) => ( + message: string, + data: Record | null | undefined +) => { + const args = [ + formatContext({ ...messageContext, level }), + { + message, + data, + environmentData, + }, + ]; + electronLog[level](...args); +}; export const logger: Logger = { debug: logToLevel('debug'), diff --git a/storybook/stories/_support/utils.ts b/storybook/stories/_support/utils.ts index 365cadc494..8281be8564 100644 --- a/storybook/stories/_support/utils.ts +++ b/storybook/stories/_support/utils.ts @@ -240,13 +240,11 @@ export const generateAddress = (used = false): WalletAddress => used, spendingPath: "1852'/1815'/0'/0/19", }); -export const promise = - (returnValue: any): (() => Promise) => - () => - new Promise((resolve) => { - setTimeout(() => { - resolve(returnValue); - }, 2000); - }); +export const promise = (returnValue: any): (() => Promise) => () => + new Promise((resolve) => { + setTimeout(() => { + resolve(returnValue); + }, 2000); + }); export const isShelleyTestnetTheme = (currentTheme: string) => currentTheme === 'shelley-testnet'; diff --git a/storybook/stories/news/_utils/fakeDataUpdate.ts b/storybook/stories/news/_utils/fakeDataUpdate.ts index c8c4092d5c..bca564264e 100644 --- a/storybook/stories/news/_utils/fakeDataUpdate.ts +++ b/storybook/stories/news/_utils/fakeDataUpdate.ts @@ -15,17 +15,20 @@ const commonUpdateData = { darwin: { version: availableAppVersion, hash: '97d336d45b022b0390446497dbe8b43bb6174436df12d43c4fc2b953ce22b703', - url: 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.pkg', + url: + 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.pkg', }, win32: { version: availableAppVersion, hash: '97d336d45b022b0390446497dbe8b43bb6174436df12d43c4fc2b953ce22b703', - url: 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.exe', + url: + 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.exe', }, linux: { version: availableAppVersion, hash: '97d336d45b022b0390446497dbe8b43bb6174436df12d43c4fc2b953ce22b703', - url: 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.bin', + url: + 'https://update-cardano-mainnet.iohk.io/daedalus-2.0.0-mainnet-13980.bin', }, }, type: 'software-update', diff --git a/storybook/stories/wallets/import/WalletImportFile.stories.tsx b/storybook/stories/wallets/import/WalletImportFile.stories.tsx index 38c04af3fe..e1d8881f11 100644 --- a/storybook/stories/wallets/import/WalletImportFile.stories.tsx +++ b/storybook/stories/wallets/import/WalletImportFile.stories.tsx @@ -57,9 +57,9 @@ storiesOf('Wallets|Import File', module) ...Array(number('Wallets with name', 5)), // @ts-ignore ts-migrate(2345) FIXME: Argument of type 'string' is not assignable to par... Remove this comment to see the full error message ].map((x, index: number) => getWallet(index, true, statusSelect)); - const unnamedWallets = [...Array(number('Wallets with no name', 5))].map( - (x, index: number) => getWallet(index, false) - ); + const unnamedWallets = [ + ...Array(number('Wallets with no name', 5)), + ].map((x, index: number) => getWallet(index, false)); return ( Date: Thu, 10 Feb 2022 10:21:36 +0000 Subject: [PATCH 32/42] [DDW-827] amended error handling to only block send button if specific error thrown --- .../renderer/app/actions/wallets-actions.ts | 3 - .../renderer/app/api/utils/apiHelpers.spec.ts | 22 --- source/renderer/app/api/utils/apiHelpers.ts | 4 - .../WalletSendAssetsConfirmationDialog.tsx | 17 +- .../WalletSendConfirmationDialog.tsx | 9 +- source/renderer/app/i18n/LocalizableError.ts | 3 + source/renderer/app/stores/WalletsStore.ts | 147 ++---------------- 7 files changed, 19 insertions(+), 186 deletions(-) diff --git a/source/renderer/app/actions/wallets-actions.ts b/source/renderer/app/actions/wallets-actions.ts index 2fd15f18ce..ed4149038b 100644 --- a/source/renderer/app/actions/wallets-actions.ts +++ b/source/renderer/app/actions/wallets-actions.ts @@ -38,7 +38,6 @@ export default class WalletsActions { kind: string; }> = new Action(); restoreWalletSetMnemonics: Action<{ - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. mnemonics: Array; }> = new Action(); restoreWalletSetConfig: Action<{ @@ -59,9 +58,7 @@ export default class WalletsActions { receiver: string; amount: string; passphrase: string; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assets?: Array; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assetsAmounts?: Array; hasAssetsRemainingAfterTransaction?: boolean; }> = new Action(); diff --git a/source/renderer/app/api/utils/apiHelpers.spec.ts b/source/renderer/app/api/utils/apiHelpers.spec.ts index e10fa6e1d3..b572b46b0b 100644 --- a/source/renderer/app/api/utils/apiHelpers.spec.ts +++ b/source/renderer/app/api/utils/apiHelpers.spec.ts @@ -1,74 +1,55 @@ import { throwErrorIfNotEnoughAdaToSupportTokens } from './apiHelpers'; import ApiError from '../../domains/ApiError'; -// @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { - // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw if error.code is not "cannot_cover_fee"', () => { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error(); // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'other_error'; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true) ).not.toThrow(); }); - // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw error if error code is "cannot_cover_fee" but hasAssetsRemainingAfterTransaction is undefined', () => { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error( 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' ); // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'cannot_cover_fee'; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error)).not.toThrow(); }); - // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw error if error code is "cannot_cover_fee" but message does not match reegex', () => { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error('other message'); // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'cannot_cover_fee'; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true) ).not.toThrow(); }); - // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw error if error code is not "cannot_cover_fee" and message matches regex', () => { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error( 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' ); // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'other_code'; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true) ).not.toThrow(); }); - // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should not throw if there are no tokens remaining in wallet after transaction', () => { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error(); // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'cannot_cover_fee'; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, false) ).not.toThrow(); }); - // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee" and round to 2 minimum ada', () => { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error( 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.' ); // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'cannot_cover_fee'; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrow( expect.objectContaining({ additionalValues: { adaToRemain: 2 }, @@ -85,15 +66,12 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { ); }); - // @ts-ignore ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee" and round to 2 nearest whole value provided by error', () => { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. const error = new Error( 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 2.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.' ); // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. error.code = 'cannot_cover_fee'; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'expect'. expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrow( expect.objectContaining({ additionalValues: { adaToRemain: 3 }, diff --git a/source/renderer/app/api/utils/apiHelpers.ts b/source/renderer/app/api/utils/apiHelpers.ts index 6e2048214d..79940d8ce2 100644 --- a/source/renderer/app/api/utils/apiHelpers.ts +++ b/source/renderer/app/api/utils/apiHelpers.ts @@ -1,7 +1,6 @@ import { ApiMethodNotYetImplementedError } from '../common/errors'; import ApiError from '../../domains/ApiError'; -// @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message export const notYetImplemented = async () => new Promise((resolve, reject) => { reject(new ApiMethodNotYetImplementedError()); @@ -21,14 +20,12 @@ export const testSync = (apiMethod: (...args: Array) => any) => { return result; }; // helper code for deferring API call execution -// @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message export const wait = (ms: number): Promise => new Promise((resolve) => setTimeout(resolve, ms)); export const throwErrorIfNotEnoughAdaToSupportTokens = ( error: any, hasAssetsRemainingAfterTransaction?: boolean ) => { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'RegExp'. const adaToProceedRegex = new RegExp( /.*I need approximately([\s\d.,]+)ada to proceed.*/ ); @@ -38,7 +35,6 @@ export const throwErrorIfNotEnoughAdaToSupportTokens = ( hasAssetsRemainingAfterTransaction && adaToProceedRegex.test(error.message) ) { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Math'. const roundedAda = Math.ceil( Number(error.message.replace(adaToProceedRegex, '$1')) ); diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx index 7d5710b5f4..0b8a048def 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx @@ -14,9 +14,7 @@ import ReactToolboxMobxForm from '../../../utils/ReactToolboxMobxForm'; import Dialog from '../../widgets/Dialog'; import DialogCloseButton from '../../widgets/DialogCloseButton'; import LocalizableError from '../../../i18n/LocalizableError'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './WalletSendAssetsConfirmation... Remove this comment to see the full error message import styles from './WalletSendAssetsConfirmationDialog.scss'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module '../../../assets/images/questio... Remove this comment to see the full error message import questionMarkIcon from '../../../assets/images/question-mark.inline.svg'; import { FORM_VALIDATION_DEBOUNCE_WAIT } from '../../../config/timingConfig'; import { submitOnEnter } from '../../../utils/form'; @@ -39,36 +37,26 @@ type Props = { receiver: string; wallet: Wallet; totalAmount: BigNumber; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. selectedAssets: Array; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. allAvailableTokens: Array; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assetsAmounts: Array; transactionFee: string | null | undefined; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onSubmit: (...args: Array) => any; amountToNaturalUnits: (amountWithFractions: string) => string; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onCancel: (...args: Array) => any; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onExternalLinkClick: (...args: Array) => any; isSubmitting: boolean; isFlight: boolean; error: LocalizableError | null | undefined; hwDeviceStatus: HwDeviceStatus; isHardwareWallet: boolean; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onInitiateTransaction: (...args: Array) => any; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onCopyAssetParam: (...args: Array) => any; isTrezor: boolean; formattedTotalAmount: string; }; type State = { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. selectedAssets: Array; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assetsAmounts: Array; areTermsAccepted: boolean; }; @@ -281,7 +269,8 @@ class WalletSendAssetsConfirmationDialog extends Component { primary: true, className: 'confirmButton', disabled: - !!error || + error?.id === + 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens' || (!isHardwareWallet && !passphraseField.isValid) || (isHardwareWallet && hwDeviceStatus !== @@ -290,7 +279,6 @@ class WalletSendAssetsConfirmationDialog extends Component { }, ]; const assetsSeparatorBasicHeight = 27; - // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type '{}'. const assetsSeparatorCalculatedHeight = selectedAssets.length ? assetsSeparatorBasicHeight * selectedAssets.length * 2 - 18 : assetsSeparatorBasicHeight; @@ -363,7 +351,6 @@ class WalletSendAssetsConfirmationDialog extends Component {
    - {/* @ts-ignore ts-migrate(2339) FIXME: Property 'map' does not exist on type '{}'. */} {selectedAssets.map((asset, assetIndex) => { const assetAmount = this.getFormattedAssetAmount( asset, diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx index 33285cb7d8..76acc2b459 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx @@ -11,7 +11,6 @@ import ReactToolboxMobxForm from '../../../utils/ReactToolboxMobxForm'; import Dialog from '../../widgets/Dialog'; import DialogCloseButton from '../../widgets/DialogCloseButton'; import LocalizableError from '../../../i18n/LocalizableError'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './WalletSendConfirmationDialog... Remove this comment to see the full error message import styles from './WalletSendConfirmationDialog.scss'; import { FORM_VALIDATION_DEBOUNCE_WAIT } from '../../../config/timingConfig'; import { submitOnEnter } from '../../../utils/form'; @@ -30,22 +29,17 @@ type Props = { receiver: string; wallet: Wallet; totalAmount: BigNumber; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. allAvailableTokens?: Array; transactionFee: string | null | undefined; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onSubmit: (...args: Array) => any; amountToNaturalUnits: (amountWithFractions: string) => string; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onCancel: (...args: Array) => any; isSubmitting: boolean; isFlight: boolean; error: LocalizableError | null | undefined; hwDeviceStatus: HwDeviceStatus; isHardwareWallet: boolean; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onInitiateTransaction: (...args: Array) => any; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. onExternalLinkClick: (...args: Array) => any; isTrezor: boolean; formattedTotalAmount: string; @@ -228,7 +222,8 @@ class WalletSendConfirmationDialog extends Component { primary: true, className: 'confirmButton', disabled: - !!error || + error?.id === + 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens' || (!isHardwareWallet && !passphraseField.isValid) || (isHardwareWallet && hwDeviceStatus !== diff --git a/source/renderer/app/i18n/LocalizableError.ts b/source/renderer/app/i18n/LocalizableError.ts index 9b809da060..04c227f156 100644 --- a/source/renderer/app/i18n/LocalizableError.ts +++ b/source/renderer/app/i18n/LocalizableError.ts @@ -2,6 +2,9 @@ import ExtendableError from 'es6-error'; import type { ReactIntlMessageShape } from './types'; export default class LocalizableError extends ExtendableError { + id: string; + defaultMessage: string; + values: Record; constructor({ id, defaultMessage, values = {} }: ReactIntlMessageShape) { if (!id) throw new Error('id:string is required.'); if (!defaultMessage) throw new Error('defaultMessage:string is required.'); diff --git a/source/renderer/app/stores/WalletsStore.ts b/source/renderer/app/stores/WalletsStore.ts index cafff947a3..3fe87d2583 100644 --- a/source/renderer/app/stores/WalletsStore.ts +++ b/source/renderer/app/stores/WalletsStore.ts @@ -45,7 +45,6 @@ import type { } from '../types/walletRestoreTypes'; import type { CsvFileContent } from '../../../common/types/csv-request.types'; import type { WalletExportTypeChoices } from '../types/walletExportTypes'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module '../actions/wallets-actions' or... Remove this comment to see the full error message import type { WalletImportFromFileParams } from '../actions/wallets-actions'; import type LocalizableError from '../i18n/LocalizableError'; import type { @@ -72,103 +71,82 @@ export default class WalletsStore extends Store { isAddressFromSameWallet = false; // REQUESTS @observable - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. walletsRequest: Request> = new Request(this.api.ada.getWallets); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message accountPublicKeyRequest: Request = new Request( this.api.ada.getAccountPublicKey ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message icoPublicKeyRequest: Request = new Request( this.api.ada.getICOPublicKey ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message importFromFileRequest: Request = new Request( this.api.ada.importWalletFromFile ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message createWalletRequest: Request = new Request(this.api.ada.createWallet); @observable - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. getWalletAddressesRequest: Request> = new Request( this.api.ada.getAddresses ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message deleteWalletRequest: Request = new Request( this.api.ada.deleteWallet ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message sendMoneyRequest: Request = new Request( this.api.ada.createTransaction ); @observable - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. getWalletRecoveryPhraseRequest: Request> = new Request( this.api.ada.getWalletRecoveryPhrase ); @observable - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. getWalletCertificateAdditionalMnemonicsRequest: Request< Array > = new Request(this.api.ada.getWalletCertificateAdditionalMnemonics); @observable - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. getWalletCertificateRecoveryPhraseRequest: Request< Array > = new Request(this.api.ada.getWalletCertificateRecoveryPhrase); @observable - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. getWalletRecoveryPhraseFromCertificateRequest: Request< Array > = new Request(this.api.ada.getWalletRecoveryPhraseFromCertificate); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreDaedalusRequest: Request = new Request( this.api.ada.restoreWallet ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreLegacyRequest: Request = new Request( this.api.ada.restoreLegacyWallet ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreByronRandomWalletRequest: Request = new Request( this.api.ada.restoreByronRandomWallet ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreByronIcarusWalletRequest: Request = new Request( this.api.ada.restoreByronIcarusWallet ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreByronTrezorWalletRequest: Request = new Request( this.api.ada.restoreByronTrezorWallet ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message restoreByronLedgerWalletRequest: Request = new Request( this.api.ada.restoreByronLedgerWallet ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message transferFundsCalculateFeeRequest: Request< TransferFundsCalculateFeeRequest > = new Request(this.api.ada.transferFundsCalculateFee); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message transferFundsRequest: Request = new Request( this.api.ada.transferFunds ); @observable - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message createHardwareWalletRequest: Request = new Request( this.api.ada.createHardwareWallet ); @@ -208,7 +186,6 @@ export default class WalletsStore extends Store { walletKindHardware: WalletHardwareKind | null | undefined = null; // STEP: RECOVERY PHRASE @observable - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. mnemonics: Array = []; // STEP: CONFIGURATION @observable @@ -367,7 +344,6 @@ export default class WalletsStore extends Store { } @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _getAccountPublicKey = async ({ spendingPassword: passphrase, }: { @@ -396,7 +372,6 @@ export default class WalletsStore extends Store { } }; @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _getICOPublicKey = async ({ spendingPassword: passphrase, }: { @@ -428,13 +403,10 @@ export default class WalletsStore extends Store { throw error; } }; - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _create = async (params: { name: string; spendingPassword: string }) => { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Object'. Object.assign(this._newWalletDetails, params); try { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. const recoveryPhrase: | Array | null @@ -442,7 +414,6 @@ export default class WalletsStore extends Store { .promise; if (recoveryPhrase != null) { - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.walletBackup.initiateWalletBackup.trigger({ recoveryPhrase, }); @@ -485,7 +456,6 @@ export default class WalletsStore extends Store { this.restoreWalletShowAbortConfirmation = false; }; @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _restoreWalletEnd = async () => { this._resumePolling(); @@ -523,7 +493,6 @@ export default class WalletsStore extends Store { this._resumePolling(); const { mnemonics, walletName, spendingPassword } = this; - // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type 'string'. const shouldDisplayAbortAlert = (mnemonics.length || walletName.length || spendingPassword.length) && this.restoreWalletStep !== null && @@ -581,7 +550,6 @@ export default class WalletsStore extends Store { _restoreWalletSetMnemonics = ({ mnemonics, }: { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. mnemonics: Array; }) => { this.mnemonics = mnemonics; @@ -603,7 +571,6 @@ export default class WalletsStore extends Store { } }; @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _createHardwareWallet = async (params: { walletName: string; extendedPublicKey: HardwareWalletExtendedPublicKeyResponse; @@ -629,7 +596,6 @@ export default class WalletsStore extends Store { walletName, accountPublicKey, }); - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message await this.stores.hardwareWallets._setHardwareWalletLocalData({ walletId: wallet.id, data: { @@ -638,7 +604,6 @@ export default class WalletsStore extends Store { disconnected: false, }, }); - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message await this.stores.hardwareWallets._setHardwareWalletDevice({ deviceId, data: { @@ -665,9 +630,7 @@ export default class WalletsStore extends Store { this._resumePolling(); } }; - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _finishWalletBackup = async () => { - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this._newWalletDetails.mnemonic = this.stores.walletBackup.recoveryPhrase.join( ' ' ); @@ -683,7 +646,6 @@ export default class WalletsStore extends Store { this.refreshWalletsData(); } }; - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _deleteWallet = async (params: { walletId: string; isLegacy: boolean }) => { // Pause polling in order to avoid fetching data for wallet we are about to delete runInAction('AdaWalletsStore::isDeleting set', () => { @@ -713,7 +675,6 @@ export default class WalletsStore extends Store { this.isDeleting = false; if (this.hasAnyWallets) { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Math'. const nextIndexInList = Math.max(indexOfWalletToDelete - 1, 0); const nextWalletInList = this.all[nextIndexInList]; this.goToWalletRoute(nextWalletInList.id); @@ -732,7 +693,6 @@ export default class WalletsStore extends Store { this.actions.walletsLocal.unsetWalletLocalData.trigger({ walletId: params.walletId, }); - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message await this.stores.hardwareWallets._unsetHardwareWalletLocalData({ walletId: params.walletId, }); @@ -742,16 +702,9 @@ export default class WalletsStore extends Store { this.deleteWalletRequest.reset(); this.refreshWalletsData(); }; - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _undelegateWallet = async (params: QuitStakePoolRequest) => { - const { - quitStakePoolRequest, - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - } = this.stores.staking; - const { - quitStakePool, - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message - } = this.actions.staking; + const { quitStakePoolRequest } = this.stores.staking; + const { quitStakePool } = this.actions.staking; const walletToUndelegate = this.getWalletById(params.walletId); if (!walletToUndelegate) { @@ -775,7 +728,6 @@ export default class WalletsStore extends Store { } ); }; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. _getUnscrambledMnemonics = async ( mnemonics: Array // @ts-ignore ts-migrate(1064) FIXME: The return type of an async function or method mus... Remove this comment to see the full error message @@ -783,7 +735,6 @@ export default class WalletsStore extends Store { // Split recovery phrase to 18 (scrambled mnemonics) + 9 (mnemonics seed) mnemonics const { passphrase, scrambledInput } = getScrambledInput(mnemonics); // Unscramble 18-word wallet certificate mnemonic to 12-word mnemonic - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. const unscrambledRecoveryPhrase: Array = await this.getWalletRecoveryPhraseFromCertificateRequest.execute( { passphrase, @@ -795,7 +746,6 @@ export default class WalletsStore extends Store { return unscrambledRecoveryPhrase; }; @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _restore = async () => { this.isRestoring = true; // Pause polling in order to avoid fetching data for wallet we are about to restore @@ -823,7 +773,6 @@ export default class WalletsStore extends Store { try { const restoredWallet = await request.execute(data).promise; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. if (!restoredWallet) throw new Error('Restored wallet was not received correctly'); runInAction('set restoredWallet', () => { @@ -836,7 +785,6 @@ export default class WalletsStore extends Store { }); } }; - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _sendMoney = async ({ receiver, amount, @@ -848,9 +796,7 @@ export default class WalletsStore extends Store { receiver: string; amount: string; passphrase: string; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assets?: Array; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. assetsAmounts?: Array; hasAssetsRemainingAfterTransaction?: boolean; }) => { @@ -869,12 +815,10 @@ export default class WalletsStore extends Store { ) : null; const wallet = this.active; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. 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 await this.sendMoneyRequest.execute({ address: receiver, - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'parseInt'. amount: parseInt(amount, 10), passphrase, walletId: wallet.id, @@ -889,7 +833,6 @@ export default class WalletsStore extends Store { this.goToWalletRoute(wallet.id); }; @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _transferFundsNextStep = async () => { const { transferFundsStep, @@ -924,7 +867,6 @@ export default class WalletsStore extends Store { this.transferFundsStep = prevStep; }; @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _transferFunds = async ({ spendingPassword, }: { @@ -984,7 +926,6 @@ export default class WalletsStore extends Store { this.transferFundsCalculateFeeRequest.reset(); }; @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _transferFundsCalculateFee = async ({ sourceWalletId, }: { @@ -1035,13 +976,11 @@ export default class WalletsStore extends Store { } @computed - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. get all(): Array { return [...this.allWallets, ...this.allLegacyWallets]; } @computed - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. get allWallets(): Array { return this.walletsRequest.result ? this.walletsRequest.result.filter(({ isLegacy }: Wallet) => !isLegacy) @@ -1049,7 +988,6 @@ export default class WalletsStore extends Store { } @computed - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. get allLegacyWallets(): Array { return this.walletsRequest.result ? this.walletsRequest.result.filter(({ isLegacy }: Wallet) => isLegacy) @@ -1074,10 +1012,7 @@ export default class WalletsStore extends Store { @computed get isWalletRoute(): boolean { - const { - currentRoute, - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - } = this.stores.app; + const { currentRoute } = this.stores.app; return matchRoute(`${ROUTES.WALLETS.ROOT}(/*rest)`, currentRoute); } @@ -1136,16 +1071,12 @@ export default class WalletsStore extends Store { // =================== PRIVATE API ==================== // @computed get _canRedirectToWallet(): boolean { - const { - currentRoute, - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - } = this.stores.app; + const { currentRoute } = this.stores.app; const isRootRoute = matchRoute(ROUTES.WALLETS.ROOT, currentRoute); const isAddWalletRoute = matchRoute(ROUTES.WALLETS.ADD, currentRoute); return isRootRoute || isAddWalletRoute; } - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _patchWalletRequestWithNewWallet = async (wallet: Wallet) => { // Only add the new wallet if it does not exist yet in the result! // @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 @@ -1171,17 +1102,11 @@ export default class WalletsStore extends Store { }); }; _pollRefresh = async () => { - const { - isConnected, - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - } = this.stores.networkStatus; + const { isConnected } = this.stores.networkStatus; return isConnected && this.refreshWalletsData(); }; _updateActiveWalletOnRouteChanges = () => { - const { - currentRoute, - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message - } = this.stores.app; + const { currentRoute } = this.stores.app; const hasAnyWalletLoaded = this.hasAnyLoaded; const isWalletAddPage = matchRoute(ROUTES.WALLETS.ADD, currentRoute); runInAction('WalletsStore::_updateActiveWalletOnRouteChanges', () => { @@ -1225,10 +1150,7 @@ export default class WalletsStore extends Store { }); }; isValidAddress = async (address: string) => { - const { - network, - // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message - } = this.environment; + const { network } = this.environment; const expectedNetworkTag = get(NetworkMagics, [network]); const validAddressStyles: AddressStyle[] = ['Byron', 'Icarus', 'Shelley']; this.isAddressFromSameWallet = false; @@ -1251,7 +1173,6 @@ export default class WalletsStore extends Store { } runInAction('check if address is from the same wallet', () => { - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message const walletAddresses = this.stores.addresses.all .slice() .map((addr) => addr.id); @@ -1259,7 +1180,6 @@ export default class WalletsStore extends Store { (addr) => addr === address ).length; }); - // @ts-ignore ts-migrate(2339) FIXME: Property 'includes' does not exist on type '{}'. return ( validAddressStyles.includes(response.introspection.address_style) && ((Array.isArray(expectedNetworkTag) && @@ -1271,16 +1191,13 @@ export default class WalletsStore extends Store { logger.error(error); } }; - // @ts-ignore ts-migrate(2339) FIXME: Property 'api' does not exist on type 'WalletsStor... Remove this comment to see the full error message isValidCertificateMnemonic = (mnemonic: string) => this.api.ada.isValidCertificateMnemonic(mnemonic); @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message refreshWalletsData = async () => { // Prevent wallets data refresh if polling is blocked if (this._pollingBlocked) return; - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message if (this.stores.networkStatus.isConnected) { const result = await this.walletsRequest.execute().promise; if (!result) return; @@ -1303,11 +1220,9 @@ export default class WalletsStore extends Store { // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.addresses.addressesRequests = walletIds.map((walletId) => ({ walletId, - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message allRequest: this.stores.addresses._getAddressesAllRequest(walletId), })); - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.addresses._refreshAddresses(); }); runInAction('refresh transaction data', () => { @@ -1315,22 +1230,18 @@ export default class WalletsStore extends Store { this.stores.transactions.transactionsRequests = walletIds.map( (walletId) => ({ walletId, - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message recentRequest: this.stores.transactions._getTransactionsRecentRequest( walletId ), - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message allRequest: this.stores.transactions._getTransactionsAllRequest( walletId ), - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message withdrawalsRequest: this.stores.transactions._getWithdrawalsRequest( walletId ), }) ); - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.transactions._refreshTransactionData(); }); // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message @@ -1340,14 +1251,11 @@ export default class WalletsStore extends Store { @action resetWalletsData = () => { this.walletsRequest.reset(); - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.addresses.addressesRequests = []; - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.transactions.transactionsRequests = []; this.isAddressFromSameWallet = false; }; @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _importWalletFromFile = async (params: WalletImportFromFileParams) => { const { filePath, walletName, spendingPassword } = params; const importedWallet = await this.importFromFileRequest.execute({ @@ -1355,7 +1263,6 @@ export default class WalletsStore extends Store { walletName, spendingPassword, }).promise; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. if (!importedWallet) throw new Error('Imported wallet was not received correctly'); await this._patchWalletRequestWithNewWallet(importedWallet); @@ -1376,7 +1283,6 @@ export default class WalletsStore extends Store { newActiveWallet && newActiveWallet.isNotResponding ) { - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.router.goToRoute.trigger({ route: ROUTES.WALLETS.PAGE, params: { @@ -1392,7 +1298,6 @@ export default class WalletsStore extends Store { if (hasActiveWalletBeenChanged) { // Active wallet has been replaced or removed this.active = newActiveWallet || null; - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.addresses.lastGeneratedAddress = null; if (this.active) { @@ -1402,7 +1307,6 @@ export default class WalletsStore extends Store { if (this.active && this.active.isHardwareWallet) { const { hardwareWalletsConnectionData, - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.hardwareWallets; const hardwareWalletConnectionData = get( hardwareWalletsConnectionData, @@ -1412,7 +1316,6 @@ export default class WalletsStore extends Store { if (hardwareWalletConnectionData) { const { extendedPublicKey } = hardwareWalletConnectionData; const extendedPublicKeyHex = `${extendedPublicKey.publicKeyHex}${extendedPublicKey.chainCodeHex}`; - // @ts-ignore ts-migrate(2580) FIXME: Cannot find name 'Buffer'. Do you need to install ... Remove this comment to see the full error message const xpub = Buffer.from(extendedPublicKeyHex, 'hex'); const activePublicKey = bech32EncodePublicKey(xpub); this.activePublicKey = activePublicKey || null; @@ -1434,13 +1337,11 @@ export default class WalletsStore extends Store { this.activeValue = null; this.activePublicKey = null; this.icoPublicKey = null; - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message this.stores.addresses.lastGeneratedAddress = null; }; @action _onRouteChange = (options: { route: string; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. params: Record | null | undefined; }) => { // Reset the send request anytime we visit the send page (e.g: to remove any previous errors) @@ -1460,7 +1361,6 @@ export default class WalletsStore extends Store { } }; @action - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _pausePolling = async () => { // @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 if (this.walletsRequest.isExecuting) await this.walletsRequest; @@ -1484,7 +1384,6 @@ export default class WalletsStore extends Store { _generateCertificate = flow(function* generateCertificate(params: { filePath: string; timestamp: string; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Generator'. }): Generator { try { // Pause polling in order not to show Paper wallet in the UI @@ -1494,11 +1393,11 @@ export default class WalletsStore extends Store { this._updateCertificateCreationState(true); // Generate wallet recovery phrase - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. + const recoveryPhrase: Array = yield this.getWalletRecoveryPhraseRequest.execute() .promise; // Generate 9-words (additional) mnemonic - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. + const additionalMnemonicWords: Array = yield this.getWalletCertificateAdditionalMnemonicsRequest.execute() .promise; this.additionalMnemonicWords = additionalMnemonicWords.join(' '); @@ -1507,7 +1406,7 @@ export default class WalletsStore extends Store { const spendingPassword = mnemonicToSeedHex(this.additionalMnemonicWords); this.walletCertificatePassword = spendingPassword; // Generate paper wallet scrambled mnemonic - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. + const walletCertificateRecoveryPhrase: Array = yield this.getWalletCertificateRecoveryPhraseRequest.execute( { passphrase: spendingPassword, @@ -1552,26 +1451,19 @@ export default class WalletsStore extends Store { } finally { this._resumePolling(); } - // @ts-ignore ts-migrate(2339) FIXME: Property 'bind' does not exist on type '(params: {... Remove this comment to see the full error message }).bind(this); - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _downloadCertificate = async ( address: string, recoveryPhrase: Array, filePath: string, timestamp: string ) => { - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message const locale = this.stores.profile.currentLocale; const intl = i18nContext(locale); - const { - isMainnet, - // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message - } = this.environment; + const { isMainnet } = this.environment; const { // @ts-ignore ts-migrate(2339) FIXME: Property 'buildLabel' does not exist on type 'type... Remove this comment to see the full error message buildLabel, - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. } = global; try { @@ -1598,7 +1490,6 @@ export default class WalletsStore extends Store { }); } }; - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _generateAddressPDF = async ({ note, address, @@ -1612,13 +1503,8 @@ export default class WalletsStore extends Store { currentLocale, currentDateFormat, currentTimeFormat, - // @ts-ignore ts-migrate(2339) FIXME: Property 'stores' does not exist on type 'WalletsS... Remove this comment to see the full error message } = this.stores.profile; - const { - network, - isMainnet, - // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'Wal... Remove this comment to see the full error message - } = this.environment; + const { network, isMainnet } = this.environment; const intl = i18nContext(currentLocale); try { @@ -1639,11 +1525,9 @@ export default class WalletsStore extends Store { walletAddress, }); } catch (error) { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error(error); } }; - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _saveQRCodeImage = async ({ address, filePath, @@ -1662,11 +1546,9 @@ export default class WalletsStore extends Store { walletAddress, }); } catch (error) { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error(error); } }; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. _updateCertificateCreationState = action( (state: boolean, error?: Record | null | undefined) => { this.generatingCertificateInProgress = state; @@ -1674,7 +1556,6 @@ export default class WalletsStore extends Store { this._updateGeneratingCertificateError(error); } ); - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. _updateGeneratingCertificateError = action( (error?: Record | null | undefined) => { if (error && error.syscall && error.syscall === 'open') { @@ -1712,9 +1593,7 @@ export default class WalletsStore extends Store { } finally { this._resumePolling(); } - // @ts-ignore ts-migrate(2339) FIXME: Property 'bind' does not exist on type '(args_0: {... Remove this comment to see the full error message }).bind(this); - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message _downloadRewardsCsv = async ( fileContent: CsvFileContent, filePath: string @@ -1733,7 +1612,6 @@ export default class WalletsStore extends Store { }); } }; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. _updateRewardsCsvCreationState = action( (state: boolean, error?: Record | null | undefined) => { this.generatingRewardsCsvInProgress = state; @@ -1741,7 +1619,6 @@ export default class WalletsStore extends Store { this._updateGeneratingRewardsCsvError(error); } ); - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. _updateGeneratingRewardsCsvError = action( (error?: Record | null | undefined) => { if (error && error.syscall && error.syscall === 'open') { From 8203be5a7160b5969b7b4ae9905698e519192686 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Thu, 10 Feb 2022 11:36:08 +0000 Subject: [PATCH 33/42] [DDW-827] updated typing for localizable error --- .../renderer/app/components/status/DaedalusDiagnostics.tsx | 1 + .../wallet/send-form/WalletSendAssetsConfirmationDialog.tsx | 1 - .../wallet/send-form/WalletSendConfirmationDialog.tsx | 1 - source/renderer/app/i18n/LocalizableError.ts | 5 +---- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/source/renderer/app/components/status/DaedalusDiagnostics.tsx b/source/renderer/app/components/status/DaedalusDiagnostics.tsx index 4cda4ae705..5c9a11abf3 100644 --- a/source/renderer/app/components/status/DaedalusDiagnostics.tsx +++ b/source/renderer/app/components/status/DaedalusDiagnostics.tsx @@ -556,6 +556,7 @@ class DaedalusDiagnostics extends Component { const { isNodeRestarting } = this.state; const isNTPServiceReachable = localTimeDifference != null; const connectionError = get(nodeConnectionError, 'values', '{}'); + // @ts-ignore const { message, code } = connectionError; const unknownDiskSpaceSupportUrl = intl.formatMessage( messages.unknownDiskSpaceSupportUrl diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx index 0b8a048def..c2c9286f98 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx @@ -285,7 +285,6 @@ class WalletSendAssetsConfirmationDialog extends Component { let errorElement = null; if (error) { - // @ts-ignore ts-migrate(2339) FIXME: Property 'values' does not exist on type 'Localiza... Remove this comment to see the full error message const errorHasLink = !!error.values.linkLabel; errorElement = errorHasLink ? ( { let errorElement = null; if (error) { - // @ts-ignore ts-migrate(2339) FIXME: Property 'values' does not exist on type 'Localiza... Remove this comment to see the full error message const errorHasLink = !!error.values.linkLabel; errorElement = errorHasLink ? ( ; + values?: Record; constructor({ id, defaultMessage, values = {} }: ReactIntlMessageShape) { if (!id) throw new Error('id:string is required.'); if (!defaultMessage) throw new Error('defaultMessage:string is required.'); super(`${id}: ${JSON.stringify(values)}`); - // @ts-ignore ts-migrate(2339) FIXME: Property 'id' does not exist on type 'LocalizableE... Remove this comment to see the full error message this.id = id; - // @ts-ignore ts-migrate(2339) FIXME: Property 'defaultMessage' does not exist on type '... Remove this comment to see the full error message this.defaultMessage = defaultMessage; - // @ts-ignore ts-migrate(2339) FIXME: Property 'values' does not exist on type 'Localiza... Remove this comment to see the full error message this.values = values; } } From c0ca3ee219b8407be27e4b49d5d336d44cc468b2 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Thu, 10 Feb 2022 11:54:02 +0000 Subject: [PATCH 34/42] [DDW-827] reduced ts-ignores in test files --- source/renderer/app/api/api.ts | 1 - .../renderer/app/api/utils/apiHelpers.spec.ts | 62 ++++++++++--------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 2fd73b8de7..6f3531cf0c 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -225,7 +225,6 @@ import type { AssetLocalData } from './utils/localStorage'; import Asset from '../domains/Asset'; import { getAssets } from './assets/requests/getAssets'; import { getAccountPublicKey } from './wallets/requests/getAccountPublicKey'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './utils/apiHelpers' or its cor... Remove this comment to see the full error message import { throwErrorIfNotEnoughAdaToSupportTokens } from './utils/apiHelpers'; export default class AdaApi { diff --git a/source/renderer/app/api/utils/apiHelpers.spec.ts b/source/renderer/app/api/utils/apiHelpers.spec.ts index b572b46b0b..66bd1405e2 100644 --- a/source/renderer/app/api/utils/apiHelpers.spec.ts +++ b/source/renderer/app/api/utils/apiHelpers.spec.ts @@ -3,53 +3,56 @@ import ApiError from '../../domains/ApiError'; describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { it('should not throw if error.code is not "cannot_cover_fee"', () => { - const error = new Error(); - // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. - error.code = 'other_error'; + const error = { code: 'other_error' }; + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true) ).not.toThrow(); }); it('should not throw error if error code is "cannot_cover_fee" but hasAssetsRemainingAfterTransaction is undefined', () => { - const error = new Error( - 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' - ); - // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. - error.code = 'cannot_cover_fee'; + const error = { + message: + 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed', + code: 'cannot_cover_fee', + }; + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error)).not.toThrow(); }); it('should not throw error if error code is "cannot_cover_fee" but message does not match reegex', () => { - const error = new Error('other message'); - // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. - error.code = 'cannot_cover_fee'; + const error = { + message: 'other message', + code: 'cannot_cover_fee', + }; + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true) ).not.toThrow(); }); it('should not throw error if error code is not "cannot_cover_fee" and message matches regex', () => { - const error = new Error( - 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed' - ); - // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. - error.code = 'other_code'; + const error = { + message: + 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed', + code: 'other_code', + }; + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true) ).not.toThrow(); }); it('should not throw if there are no tokens remaining in wallet after transaction', () => { - const error = new Error(); - // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. - error.code = 'cannot_cover_fee'; + const error = { code: 'cannot_cover_fee' }; + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, false) ).not.toThrow(); }); it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee" and round to 2 minimum ada', () => { - const error = new Error( - 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.' - ); - // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. - error.code = 'cannot_cover_fee'; + const error = { + message: + 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.', + code: 'cannot_cover_fee', + }; + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrow( expect.objectContaining({ additionalValues: { adaToRemain: 2 }, @@ -67,11 +70,12 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { }); it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee" and round to 2 nearest whole value provided by error', () => { - const error = new Error( - 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 2.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.' - ); - // @ts-ignore ts-migrate(2339) FIXME: Property 'code' does not exist on type 'Error'. - error.code = 'cannot_cover_fee'; + const error = { + message: + 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 2.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.', + code: 'cannot_cover_fee', + }; + expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrow( expect.objectContaining({ additionalValues: { adaToRemain: 3 }, From 6d6efd07f5415d0b1814262806319952276521ba Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Thu, 10 Feb 2022 11:59:41 +0000 Subject: [PATCH 35/42] [DDW-827] Removed more ts-ignores --- source/renderer/app/stores/WalletsStore.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/source/renderer/app/stores/WalletsStore.ts b/source/renderer/app/stores/WalletsStore.ts index 3fe87d2583..afbc50f13d 100644 --- a/source/renderer/app/stores/WalletsStore.ts +++ b/source/renderer/app/stores/WalletsStore.ts @@ -264,7 +264,6 @@ export default class WalletsStore extends Store { setup() { setInterval(this._pollRefresh, this.WALLET_REFRESH_INTERVAL); - // @ts-ignore ts-migrate(2339) FIXME: Property 'registerReactions' does not exist on typ... Remove this comment to see the full error message this.registerReactions([this._updateActiveWalletOnRouteChanges]); const { router, @@ -272,7 +271,6 @@ export default class WalletsStore extends Store { wallets: walletsActions, app, networkStatus, - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message } = this.actions; // Create Wallet Actions --- walletsActions.createWallet.listen(this._create); @@ -681,7 +679,6 @@ export default class WalletsStore extends Store { } else { this.active = null; this.activeValue = null; - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.router.goToRoute.trigger({ route: ROUTES.WALLETS.ADD, }); @@ -689,7 +686,6 @@ export default class WalletsStore extends Store { }); // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.walletsLocal.unsetWalletLocalData.trigger({ walletId: params.walletId, }); @@ -742,7 +738,6 @@ export default class WalletsStore extends Store { } ).promise; this.getWalletRecoveryPhraseFromCertificateRequest.reset(); - // @ts-ignore return unscrambledRecoveryPhrase; }; @action @@ -1062,7 +1057,6 @@ export default class WalletsStore extends Store { // ACTIONS goToWalletRoute(walletId: string) { const route = this.getWalletRoute(walletId); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.router.goToRoute.trigger({ route, }); @@ -1156,7 +1150,6 @@ export default class WalletsStore extends Store { this.isAddressFromSameWallet = false; if (!expectedNetworkTag) { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Unexpected environment'); } @@ -1520,7 +1513,6 @@ export default class WalletsStore extends Store { intl, }); const walletAddress = ellipsis(address, 15, 15); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.wallets.generateAddressPDFSuccess.trigger({ walletAddress, }); @@ -1541,7 +1533,6 @@ export default class WalletsStore extends Store { filePath, }); const walletAddress = ellipsis(address, 15, 15); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.wallets.saveQRCodeImageSuccess.trigger({ walletAddress, }); From 8a2956af52a8fb2f273a74d7810e7f37099d2380 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Fri, 11 Feb 2022 09:28:49 +0000 Subject: [PATCH 36/42] [DDW-827] prevented submission using keyboard if error exists --- .../wallet/send-form/WalletSendConfirmationDialog.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx index 81a963f1f2..ccb7ac0fa5 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx @@ -133,6 +133,8 @@ class WalletSendConfirmationDialog extends Component { }; handleSubmitOnEnter = (event: KeyboardEvent) => (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && + this.props.error?.id !== + 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens' && submitOnEnter(this.submit, event); renderConfirmationElement = ( isHardwareWallet: boolean From 7edda20315957fd41762e22f069a8376e2df7209 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Fri, 11 Feb 2022 09:30:50 +0000 Subject: [PATCH 37/42] [DDW-827] prevented submission using keyboard if form error exists --- .../wallet/send-form/WalletSendAssetsConfirmationDialog.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx index c2c9286f98..f833b8bbfc 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx @@ -163,6 +163,8 @@ class WalletSendAssetsConfirmationDialog extends Component { }; handleSubmitOnEnter = (event: KeyboardEvent) => (this.props.isHardwareWallet || this.form.$('passphrase').isValid) && + this.props.error?.id !== + 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens' && submitOnEnter(this.submit, event); renderConfirmationElement = ( isHardwareWallet: boolean From 3719798d2b1214e19f29a1e2573e329094343602 Mon Sep 17 00:00:00 2001 From: Michael Chappell Date: Fri, 11 Feb 2022 12:23:01 +0000 Subject: [PATCH 38/42] [DDW-827] updated api thrown error --- source/renderer/app/api/api.ts | 25 +++-- .../renderer/app/api/utils/apiHelpers.spec.ts | 91 ++++++++++--------- source/renderer/app/api/utils/apiHelpers.ts | 14 +-- .../WalletSendAssetsConfirmationDialog.tsx | 3 +- .../WalletSendConfirmationDialog.tsx | 3 +- 5 files changed, 77 insertions(+), 59 deletions(-) diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 6f3531cf0c..c60faee6cd 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -225,7 +225,7 @@ import type { AssetLocalData } from './utils/localStorage'; import Asset from '../domains/Asset'; import { getAssets } from './assets/requests/getAssets'; import { getAccountPublicKey } from './wallets/requests/getAccountPublicKey'; -import { throwErrorIfNotEnoughAdaToSupportTokens } from './utils/apiHelpers'; +import { doesWalletRequireAdaToRemainToSupportTokens } from './utils/apiHelpers'; export default class AdaApi { config: RequestConfig; @@ -911,11 +911,8 @@ export default class AdaApi { logger.error('AdaApi::createTransaction error', { error, }); - throwErrorIfNotEnoughAdaToSupportTokens( - error, - hasAssetsRemainingAfterTransaction - ); - throw new ApiError(error) + + const apiError = new ApiError(error) .set('wrongEncryptionPassphrase') .where('code', 'bad_request') .inc('message', 'passphrase is too short') @@ -923,8 +920,20 @@ export default class AdaApi { linkLabel: 'tooBigTransactionErrorLinkLabel', linkURL: 'tooBigTransactionErrorLinkURL', }) - .where('code', 'transaction_is_too_big') - .result(); + .where('code', 'transaction_is_too_big'); + + const { + requiresAdaToRemainToSupportNativeTokens, + adaToRemain, + } = doesWalletRequireAdaToRemainToSupportTokens( + error, + hasAssetsRemainingAfterTransaction + ); + if (requiresAdaToRemainToSupportNativeTokens) { + apiError.set('cannotLeaveWalletEmpty', true, { adaToRemain }); + } + + throw apiError.result(); } }; // For testing purpose ONLY diff --git a/source/renderer/app/api/utils/apiHelpers.spec.ts b/source/renderer/app/api/utils/apiHelpers.spec.ts index 66bd1405e2..c1fec2885c 100644 --- a/source/renderer/app/api/utils/apiHelpers.spec.ts +++ b/source/renderer/app/api/utils/apiHelpers.spec.ts @@ -1,13 +1,16 @@ -import { throwErrorIfNotEnoughAdaToSupportTokens } from './apiHelpers'; -import ApiError from '../../domains/ApiError'; +import { doesWalletRequireAdaToRemainToSupportTokens } from './apiHelpers'; describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { it('should not throw if error.code is not "cannot_cover_fee"', () => { const error = { code: 'other_error' }; - expect(() => - throwErrorIfNotEnoughAdaToSupportTokens(error, true) - ).not.toThrow(); + const expectedResult = { + requiresAdaToRemainToSupportNativeTokens: false, + }; + + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( + expectedResult + ); }); it('should not throw error if error code is "cannot_cover_fee" but hasAssetsRemainingAfterTransaction is undefined', () => { const error = { @@ -16,7 +19,13 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { code: 'cannot_cover_fee', }; - expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error)).not.toThrow(); + const expectedResult = { + requiresAdaToRemainToSupportNativeTokens: false, + }; + + expect(doesWalletRequireAdaToRemainToSupportTokens(error)).toEqual( + expectedResult + ); }); it('should not throw error if error code is "cannot_cover_fee" but message does not match reegex', () => { const error = { @@ -24,9 +33,13 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { code: 'cannot_cover_fee', }; - expect(() => - throwErrorIfNotEnoughAdaToSupportTokens(error, true) - ).not.toThrow(); + const expectedResult = { + requiresAdaToRemainToSupportNativeTokens: false, + }; + + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( + expectedResult + ); }); it('should not throw error if error code is not "cannot_cover_fee" and message matches regex', () => { const error = { @@ -35,16 +48,24 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { code: 'other_code', }; - expect(() => - throwErrorIfNotEnoughAdaToSupportTokens(error, true) - ).not.toThrow(); + const expectedResult = { + requiresAdaToRemainToSupportNativeTokens: false, + }; + + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( + expectedResult + ); }); it('should not throw if there are no tokens remaining in wallet after transaction', () => { const error = { code: 'cannot_cover_fee' }; - expect(() => - throwErrorIfNotEnoughAdaToSupportTokens(error, false) - ).not.toThrow(); + const expectedResult = { + requiresAdaToRemainToSupportNativeTokens: false, + }; + + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( + expectedResult + ); }); it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee" and round to 2 minimum ada', () => { const error = { @@ -53,19 +74,13 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { code: 'cannot_cover_fee', }; - expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrow( - expect.objectContaining({ - additionalValues: { adaToRemain: 2 }, - clause: true, - code: undefined, - defaultMessage: - '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', - forceSet: true, - id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', - isFinalError: false, - tempError: 'cannotLeaveWalletEmpty', - values: { adaToRemain: 2 }, - }) + const expectedResult = { + requiresAdaToRemainToSupportNativeTokens: true, + adaToRemain: 2, + }; + + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( + expectedResult ); }); @@ -76,19 +91,13 @@ describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { code: 'cannot_cover_fee', }; - expect(() => throwErrorIfNotEnoughAdaToSupportTokens(error, true)).toThrow( - expect.objectContaining({ - additionalValues: { adaToRemain: 3 }, - clause: true, - code: undefined, - defaultMessage: - '!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.', - forceSet: true, - id: 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens', - isFinalError: false, - tempError: 'cannotLeaveWalletEmpty', - values: { adaToRemain: 3 }, - }) + const expectedResult = { + requiresAdaToRemainToSupportNativeTokens: true, + adaToRemain: 3, + }; + + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( + expectedResult ); }); }); diff --git a/source/renderer/app/api/utils/apiHelpers.ts b/source/renderer/app/api/utils/apiHelpers.ts index 79940d8ce2..21ec09e31c 100644 --- a/source/renderer/app/api/utils/apiHelpers.ts +++ b/source/renderer/app/api/utils/apiHelpers.ts @@ -22,10 +22,13 @@ export const testSync = (apiMethod: (...args: Array) => any) => { // helper code for deferring API call execution export const wait = (ms: number): Promise => new Promise((resolve) => setTimeout(resolve, ms)); -export const throwErrorIfNotEnoughAdaToSupportTokens = ( +export const doesWalletRequireAdaToRemainToSupportTokens = ( error: any, hasAssetsRemainingAfterTransaction?: boolean -) => { +): { + requiresAdaToRemainToSupportNativeTokens: boolean; + adaToRemain?: number; +} => { const adaToProceedRegex = new RegExp( /.*I need approximately([\s\d.,]+)ada to proceed.*/ ); @@ -39,10 +42,7 @@ export const throwErrorIfNotEnoughAdaToSupportTokens = ( Number(error.message.replace(adaToProceedRegex, '$1')) ); const adaToRemain = roundedAda > 2 ? roundedAda : 2; - throw new ApiError() - .set('cannotLeaveWalletEmpty', true, { - adaToRemain, - }) - .result(); + return { requiresAdaToRemainToSupportNativeTokens: true, adaToRemain }; } + return { requiresAdaToRemainToSupportNativeTokens: false }; }; diff --git a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx index f833b8bbfc..221d6cfb24 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendAssetsConfirmationDialog.tsx @@ -146,7 +146,8 @@ class WalletSendAssetsConfirmationDialog extends Component { } = this.props; const { passphrase } = form.values(); const hasAssetsRemainingAfterTransaction = - this.props.allAvailableTokens?.length > 0; + this.props.selectedAssets.length < + this.props.allAvailableTokens?.length; const transactionData = { receiver, amount: amountToNaturalUnits(amount), diff --git a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx index ccb7ac0fa5..bacf2974f4 100644 --- a/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx +++ b/source/renderer/app/components/wallet/send-form/WalletSendConfirmationDialog.tsx @@ -117,8 +117,7 @@ class WalletSendConfirmationDialog extends Component { } = this.props; const { passphrase } = form.values(); const hasAssetsRemainingAfterTransaction = - this.props.allAvailableTokens?.length && - this.props.allAvailableTokens.length > 0; + this.props.allAvailableTokens?.length > 0; const transactionData = { receiver, amount: amountToNaturalUnits(amount), From c05d7f2088e39eb693e262acf5dc2292bd0d131b Mon Sep 17 00:00:00 2001 From: Renan Ferreira Date: Mon, 14 Feb 2022 17:52:58 -0300 Subject: [PATCH 39/42] [DDW-827] Code review changes --- source/main/ipc/downloadManagerChannel.ts | 3 +- source/renderer/app/actions/lib/Action.ts | 2 +- .../renderer/app/api/utils/apiHelpers.spec.ts | 75 ++++++------------- source/renderer/app/api/utils/apiHelpers.ts | 4 +- .../components/status/DaedalusDiagnostics.tsx | 4 +- source/renderer/app/domains/ApiError.ts | 6 +- source/renderer/app/i18n/LocalizableError.ts | 4 +- source/renderer/app/stores/WalletsStore.ts | 10 --- 8 files changed, 37 insertions(+), 71 deletions(-) diff --git a/source/main/ipc/downloadManagerChannel.ts b/source/main/ipc/downloadManagerChannel.ts index 07ef3ab99d..fd9e8afbad 100644 --- a/source/main/ipc/downloadManagerChannel.ts +++ b/source/main/ipc/downloadManagerChannel.ts @@ -212,8 +212,7 @@ const getDownloadLocalData = async ({ const getDownloadsLocalData = async (): Promise< DownloadsLocalDataMainResponse > => { - // @ts-ignore ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'Download... Remove this comment to see the full error message - return localStorage.getAll(); + return localStorage.getAll() as Promise; }; const clearDownloadLocalData = async ({ diff --git a/source/renderer/app/actions/lib/Action.ts b/source/renderer/app/actions/lib/Action.ts index 34e1fbef6f..79b7aac220 100644 --- a/source/renderer/app/actions/lib/Action.ts +++ b/source/renderer/app/actions/lib/Action.ts @@ -30,7 +30,7 @@ export default class Action { this.listeners.push(listener); } - trigger(params: Params) { + trigger(params?: Params) { this.listeners.forEach((listener) => listener(params)); } diff --git a/source/renderer/app/api/utils/apiHelpers.spec.ts b/source/renderer/app/api/utils/apiHelpers.spec.ts index c1fec2885c..bfc6088ab3 100644 --- a/source/renderer/app/api/utils/apiHelpers.spec.ts +++ b/source/renderer/app/api/utils/apiHelpers.spec.ts @@ -1,103 +1,76 @@ +import { ErrorType } from '../../domains/ApiError'; import { doesWalletRequireAdaToRemainToSupportTokens } from './apiHelpers'; -describe('throwErrorIfNotEnoughAdaToSupportTokens', () => { +describe('throw error if not enough Ada to support tokens', () => { it('should not throw if error.code is not "cannot_cover_fee"', () => { - const error = { code: 'other_error' }; + const error: ErrorType = { code: 'bad_request' }; - const expectedResult = { + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual({ requiresAdaToRemainToSupportNativeTokens: false, - }; - - expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( - expectedResult - ); + }); }); it('should not throw error if error code is "cannot_cover_fee" but hasAssetsRemainingAfterTransaction is undefined', () => { - const error = { + const error: ErrorType = { message: 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed', code: 'cannot_cover_fee', }; - const expectedResult = { + expect(doesWalletRequireAdaToRemainToSupportTokens(error)).toEqual({ requiresAdaToRemainToSupportNativeTokens: false, - }; - - expect(doesWalletRequireAdaToRemainToSupportTokens(error)).toEqual( - expectedResult - ); + }); }); it('should not throw error if error code is "cannot_cover_fee" but message does not match reegex', () => { - const error = { + const error: ErrorType = { message: 'other message', code: 'cannot_cover_fee', }; - const expectedResult = { + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual({ requiresAdaToRemainToSupportNativeTokens: false, - }; - - expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( - expectedResult - ); + }); }); it('should not throw error if error code is not "cannot_cover_fee" and message matches regex', () => { - const error = { + const error: ErrorType = { message: 'I cannot proceed with transaction, I need approximately 1.6 ada to proceed', - code: 'other_code', + code: 'bad_request', }; - const expectedResult = { + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual({ requiresAdaToRemainToSupportNativeTokens: false, - }; - - expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( - expectedResult - ); + }); }); it('should not throw if there are no tokens remaining in wallet after transaction', () => { - const error = { code: 'cannot_cover_fee' }; + const error: ErrorType = { code: 'cannot_cover_fee' }; - const expectedResult = { + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual({ requiresAdaToRemainToSupportNativeTokens: false, - }; - - expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( - expectedResult - ); + }); }); it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee" and round to 2 minimum ada', () => { - const error = { + const error: ErrorType = { message: 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 0.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.', code: 'cannot_cover_fee', }; - const expectedResult = { + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual({ requiresAdaToRemainToSupportNativeTokens: true, adaToRemain: 2, - }; - - expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( - expectedResult - ); + }); }); it('should throw if there are tokens remaining in wallet after transaction and error is "cannot_cover_fee" and round to 2 nearest whole value provided by error', () => { - const error = { + const error: ErrorType = { message: 'I am unable to finalize the transaction, as there is not enough ada available to pay for the fee and also pay for the minimum ada quantities of all change outputs. I need approximately 2.629344 ada to proceed. Try increasing your wallet balance or sending a smaller amount.', code: 'cannot_cover_fee', }; - const expectedResult = { + expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual({ requiresAdaToRemainToSupportNativeTokens: true, adaToRemain: 3, - }; - - expect(doesWalletRequireAdaToRemainToSupportTokens(error, true)).toEqual( - expectedResult - ); + }); }); }); diff --git a/source/renderer/app/api/utils/apiHelpers.ts b/source/renderer/app/api/utils/apiHelpers.ts index 21ec09e31c..85f51f2927 100644 --- a/source/renderer/app/api/utils/apiHelpers.ts +++ b/source/renderer/app/api/utils/apiHelpers.ts @@ -1,5 +1,5 @@ import { ApiMethodNotYetImplementedError } from '../common/errors'; -import ApiError from '../../domains/ApiError'; +import { ErrorType } from '../../domains/ApiError'; export const notYetImplemented = async () => new Promise((resolve, reject) => { @@ -23,7 +23,7 @@ export const testSync = (apiMethod: (...args: Array) => any) => { export const wait = (ms: number): Promise => new Promise((resolve) => setTimeout(resolve, ms)); export const doesWalletRequireAdaToRemainToSupportTokens = ( - error: any, + error: ErrorType, hasAssetsRemainingAfterTransaction?: boolean ): { requiresAdaToRemainToSupportNativeTokens: boolean; diff --git a/source/renderer/app/components/status/DaedalusDiagnostics.tsx b/source/renderer/app/components/status/DaedalusDiagnostics.tsx index 5c9a11abf3..0fb4646a4c 100644 --- a/source/renderer/app/components/status/DaedalusDiagnostics.tsx +++ b/source/renderer/app/components/status/DaedalusDiagnostics.tsx @@ -28,6 +28,7 @@ import type { CardanoNodeState } from '../../../../common/types/cardano-node.typ import type { SystemInfo } from '../../types/systemInfoTypes'; import type { CoreSystemInfo } from '../../types/coreSystemInfoTypes'; import type { TipInfo } from '../../api/network/types'; +import { ErrorType } from '../../domains/ApiError'; const messages = defineMessages({ systemInfo: { @@ -556,8 +557,7 @@ class DaedalusDiagnostics extends Component { const { isNodeRestarting } = this.state; const isNTPServiceReachable = localTimeDifference != null; const connectionError = get(nodeConnectionError, 'values', '{}'); - // @ts-ignore - const { message, code } = connectionError; + const { message, code } = connectionError as ErrorType; const unknownDiskSpaceSupportUrl = intl.formatMessage( messages.unknownDiskSpaceSupportUrl ); diff --git a/source/renderer/app/domains/ApiError.ts b/source/renderer/app/domains/ApiError.ts index 1f393d7204..13ee1deadc 100644 --- a/source/renderer/app/domains/ApiError.ts +++ b/source/renderer/app/domains/ApiError.ts @@ -46,12 +46,14 @@ type KnownErrorType = | 'wallet_not_responding' | 'address_already_exists' | 'utxo_too_small' - | 'invalid_smash_server'; + | 'invalid_smash_server' + | 'cannot_cover_fee'; + type LoggingType = { msg?: string; logError?: Record; }; -type ErrorType = { +export type ErrorType = { code?: KnownErrorType; message?: string; }; diff --git a/source/renderer/app/i18n/LocalizableError.ts b/source/renderer/app/i18n/LocalizableError.ts index f051bf0b6b..e63f61e772 100644 --- a/source/renderer/app/i18n/LocalizableError.ts +++ b/source/renderer/app/i18n/LocalizableError.ts @@ -1,8 +1,10 @@ import ExtendableError from 'es6-error'; import type { ReactIntlMessageShape } from './types'; +type KnownErrorType = 'api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens'; + export default class LocalizableError extends ExtendableError { - id: string; + id: KnownErrorType | string; defaultMessage: string; values?: Record; constructor({ id, defaultMessage, values = {} }: ReactIntlMessageShape) { diff --git a/source/renderer/app/stores/WalletsStore.ts b/source/renderer/app/stores/WalletsStore.ts index afbc50f13d..7827d2ffcc 100644 --- a/source/renderer/app/stores/WalletsStore.ts +++ b/source/renderer/app/stores/WalletsStore.ts @@ -503,7 +503,6 @@ export default class WalletsStore extends Store { this._restoreWalletResetData(); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); } }; @@ -619,7 +618,6 @@ export default class WalletsStore extends Store { await this._patchWalletRequestWithNewWallet(wallet); this.goToWalletRoute(wallet.id); this.refreshWalletsData(); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); } } catch (error) { @@ -638,7 +636,6 @@ export default class WalletsStore extends Store { if (wallet) { await this._patchWalletRequestWithNewWallet(wallet); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this.goToWalletRoute(wallet.id); this.refreshWalletsData(); @@ -684,7 +681,6 @@ export default class WalletsStore extends Store { }); } }); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this.actions.walletsLocal.unsetWalletLocalData.trigger({ walletId: params.walletId, @@ -822,7 +818,6 @@ export default class WalletsStore extends Store { hasAssetsRemainingAfterTransaction, }); this.refreshWalletsData(); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this.sendMoneyRequest.reset(); this.goToWalletRoute(wallet.id); @@ -1200,7 +1195,6 @@ export default class WalletsStore extends Store { syncState.status !== WalletSyncStateStatuses.NOT_RESPONDING ) .map((wallet: Wallet) => wallet.id); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message await this.actions.walletsLocal.refreshWalletsLocalData.trigger(); runInAction('refresh active wallet', () => { if (this.active) { @@ -1237,7 +1231,6 @@ export default class WalletsStore extends Store { this.stores.transactions._refreshTransactionData(); }); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.wallets.refreshWalletsDataSuccess.trigger(); } }; @@ -1259,7 +1252,6 @@ export default class WalletsStore extends Store { if (!importedWallet) throw new Error('Imported wallet was not received correctly'); await this._patchWalletRequestWithNewWallet(importedWallet); - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this.importFromFileRequest.reset(); this.goToWalletRoute(importedWallet.id); @@ -1649,14 +1641,12 @@ export default class WalletsStore extends Store { }; @action _closeCertificateGeneration = () => { - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this._resetCertificateData(); }; @action _closeRewardsCsvGeneration = () => { - // @ts-ignore ts-migrate(2339) FIXME: Property 'actions' does not exist on type 'Wallets... Remove this comment to see the full error message this.actions.dialogs.closeActiveDialog.trigger(); this._resetRewardsCsvData(); From 125791b04ca5e246d5cdab5705d261b311b62147 Mon Sep 17 00:00:00 2001 From: Daniel Main Date: Wed, 16 Feb 2022 10:45:55 +0100 Subject: [PATCH 40/42] [DDW-827] Updated CHANGELOG.md and run `yarn manage:translations` --- CHANGELOG.md | 2 +- .../app/i18n/locales/defaultMessages.json | 280 +++++++++--------- 2 files changed, 141 insertions(+), 141 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32005f70da..f93dd93269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Improved stake pool searchbar ([PR 2847](https://github.com/input-output-hk/daedalus/pull/2847)) - Implemented catalyst dynamic content ([PR 2856](https://github.com/input-output-hk/daedalus/pull/2856)) +- Implemented error message when trying to leave wallet without enough ada to support tokens ([PR 2783](https://github.com/input-output-hk/daedalus/pull/2783)) ### Fixes @@ -15,7 +16,6 @@ ### Features -- Implemented error message when trying to leave wallet without enough ada to support tokens ([PR 2783](https://github.com/input-output-hk/daedalus/pull/2783)) - Added table view for delegated stake pools list ([PR 2837](https://github.com/input-output-hk/daedalus/pull/2837)) - Removed Discreet mode notification ([PR 2852](https://github.com/input-output-hk/daedalus/pull/2852)) - Unified CPU info in diagnostics dialog ([PR 2818](https://github.com/input-output-hk/daedalus/pull/2818)) diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index 667b6c5e15..ef0fc5f542 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -7410,13 +7410,13 @@ "description": "System info", "end": { "column": 3, - "line": 37 + "line": 38 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.system.info", "start": { "column": 14, - "line": 33 + "line": 34 } }, { @@ -7424,13 +7424,13 @@ "description": "Platform", "end": { "column": 3, - "line": 42 + "line": 43 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.platform", "start": { "column": 12, - "line": 38 + "line": 39 } }, { @@ -7438,13 +7438,13 @@ "description": "Platform version", "end": { "column": 3, - "line": 47 + "line": 48 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.platform.version", "start": { "column": 19, - "line": 43 + "line": 44 } }, { @@ -7452,13 +7452,13 @@ "description": "CPU", "end": { "column": 3, - "line": 52 + "line": 53 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cpu", "start": { "column": 7, - "line": 48 + "line": 49 } }, { @@ -7466,13 +7466,13 @@ "description": "RAM", "end": { "column": 3, - "line": 57 + "line": 58 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.ram", "start": { "column": 7, - "line": 53 + "line": 54 } }, { @@ -7480,13 +7480,13 @@ "description": "Available disk space", "end": { "column": 3, - "line": 62 + "line": 63 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.availableDiskSpace", "start": { "column": 22, - "line": 58 + "line": 59 } }, { @@ -7494,13 +7494,13 @@ "description": "Unknown amount of disk space", "end": { "column": 3, - "line": 67 + "line": 68 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.unknownDiskSpace", "start": { "column": 20, - "line": 63 + "line": 64 } }, { @@ -7508,13 +7508,13 @@ "description": "\"Support\" link URL while disk space is unknown", "end": { "column": 3, - "line": 72 + "line": 73 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.unknownDiskSpaceSupportUrl", "start": { "column": 30, - "line": 68 + "line": 69 } }, { @@ -7522,13 +7522,13 @@ "description": "Displayed on the left of the Recommended system requirements status row", "end": { "column": 3, - "line": 78 + "line": 79 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatus", "start": { "column": 35, - "line": 73 + "line": 74 } }, { @@ -7536,13 +7536,13 @@ "description": "Displayed on the right of the Recommended system requirements status row when hardware requirements are insufficient", "end": { "column": 3, - "line": 84 + "line": 85 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusLowValue", "start": { "column": 44, - "line": 79 + "line": 80 } }, { @@ -7550,13 +7550,13 @@ "description": "Displayed on the right of the Recommended system requirements status row when hardware requirements are ok", "end": { "column": 3, - "line": 90 + "line": 91 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusGoodValue", "start": { "column": 45, - "line": 85 + "line": 86 } }, { @@ -7564,13 +7564,13 @@ "description": "Visible on hovering over Recommended system requirement status when status is Low", "end": { "column": 3, - "line": 98 + "line": 99 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusLowTooltip", "start": { "column": 46, - "line": 91 + "line": 92 } }, { @@ -7578,13 +7578,13 @@ "description": "Visible on hovering over Recommended system requirement status when status is Good", "end": { "column": 3, - "line": 106 + "line": 107 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusGoodTooltip", "start": { "column": 47, - "line": 99 + "line": 100 } }, { @@ -7592,13 +7592,13 @@ "description": "Indicates whether RTS Flags Mode is enabled or not", "end": { "column": 3, - "line": 111 + "line": 112 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.isRTSFlagsModeEnabled", "start": { "column": 25, - "line": 107 + "line": 108 } }, { @@ -7606,13 +7606,13 @@ "description": "CORE INFO", "end": { "column": 3, - "line": 116 + "line": 117 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.coreInfo", "start": { "column": 12, - "line": 112 + "line": 113 } }, { @@ -7620,13 +7620,13 @@ "description": "Daedalus version", "end": { "column": 3, - "line": 121 + "line": 122 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.daedalusVersion", "start": { "column": 19, - "line": 117 + "line": 118 } }, { @@ -7634,13 +7634,13 @@ "description": "Daedalus build number", "end": { "column": 3, - "line": 126 + "line": 127 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.daedalusBuildNumber", "start": { "column": 23, - "line": 122 + "line": 123 } }, { @@ -7648,13 +7648,13 @@ "description": "Daedalus main process ID", "end": { "column": 3, - "line": 131 + "line": 132 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.daedalusMainProcessID", "start": { "column": 25, - "line": 127 + "line": 128 } }, { @@ -7662,13 +7662,13 @@ "description": "Daedalus renderer process ID", "end": { "column": 3, - "line": 136 + "line": 137 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.daedalusProcessID", "start": { "column": 21, - "line": 132 + "line": 133 } }, { @@ -7676,13 +7676,13 @@ "description": "Daedalus 'Blank Screen Fix' active", "end": { "column": 3, - "line": 141 + "line": 142 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.blankScreenFix", "start": { "column": 18, - "line": 137 + "line": 138 } }, { @@ -7690,13 +7690,13 @@ "description": "Cardano node version", "end": { "column": 3, - "line": 146 + "line": 147 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeVersion", "start": { "column": 22, - "line": 142 + "line": 143 } }, { @@ -7704,13 +7704,13 @@ "description": "Cardano node process ID", "end": { "column": 3, - "line": 151 + "line": 152 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodePID", "start": { "column": 18, - "line": 147 + "line": 148 } }, { @@ -7718,13 +7718,13 @@ "description": "Cardano node port", "end": { "column": 3, - "line": 156 + "line": 157 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeApiPort", "start": { "column": 22, - "line": 152 + "line": 153 } }, { @@ -7732,13 +7732,13 @@ "description": "Cardano wallet process ID", "end": { "column": 3, - "line": 161 + "line": 162 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoWalletPID", "start": { "column": 20, - "line": 157 + "line": 158 } }, { @@ -7746,13 +7746,13 @@ "description": "Cardano wallet version", "end": { "column": 3, - "line": 166 + "line": 167 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoWalletVersion", "start": { "column": 24, - "line": 162 + "line": 163 } }, { @@ -7760,13 +7760,13 @@ "description": "Cardano wallet port", "end": { "column": 3, - "line": 171 + "line": 172 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoWalletApiPort", "start": { "column": 24, - "line": 167 + "line": 168 } }, { @@ -7774,13 +7774,13 @@ "description": "Cardano network", "end": { "column": 3, - "line": 176 + "line": 177 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNetwork", "start": { "column": 18, - "line": 172 + "line": 173 } }, { @@ -7788,13 +7788,13 @@ "description": "Daedalus state directory", "end": { "column": 3, - "line": 181 + "line": 182 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.stateDirectory", "start": { "column": 22, - "line": 177 + "line": 178 } }, { @@ -7802,13 +7802,13 @@ "description": "Open", "end": { "column": 3, - "line": 186 + "line": 187 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.stateDirectoryPathOpenBtn", "start": { "column": 29, - "line": 182 + "line": 183 } }, { @@ -7816,13 +7816,13 @@ "description": "CONNECTION ERROR", "end": { "column": 3, - "line": 191 + "line": 192 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.connectionError", "start": { "column": 19, - "line": 187 + "line": 188 } }, { @@ -7830,13 +7830,13 @@ "description": "DAEDALUS STATUS", "end": { "column": 3, - "line": 196 + "line": 197 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.daedalusStatus", "start": { "column": 18, - "line": 192 + "line": 193 } }, { @@ -7844,13 +7844,13 @@ "description": "Connected", "end": { "column": 3, - "line": 201 + "line": 202 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.connected", "start": { "column": 13, - "line": 197 + "line": 198 } }, { @@ -7858,13 +7858,13 @@ "description": "Synced", "end": { "column": 3, - "line": 206 + "line": 207 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.synced", "start": { "column": 10, - "line": 202 + "line": 203 } }, { @@ -7872,13 +7872,13 @@ "description": "Sync percentage", "end": { "column": 3, - "line": 211 + "line": 212 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.syncPercentage", "start": { "column": 18, - "line": 207 + "line": 208 } }, { @@ -7886,13 +7886,13 @@ "description": "Local time difference", "end": { "column": 3, - "line": 216 + "line": 217 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.localTimeDifference", "start": { "column": 23, - "line": 212 + "line": 213 } }, { @@ -7900,13 +7900,13 @@ "description": "System time correct", "end": { "column": 3, - "line": 221 + "line": 222 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.systemTimeCorrect", "start": { "column": 21, - "line": 217 + "line": 218 } }, { @@ -7914,13 +7914,13 @@ "description": "System time ignored", "end": { "column": 3, - "line": 226 + "line": 227 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.systemTimeIgnored", "start": { "column": 21, - "line": 222 + "line": 223 } }, { @@ -7928,13 +7928,13 @@ "description": "Checking system time", "end": { "column": 3, - "line": 231 + "line": 232 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.checkingNodeTime", "start": { "column": 20, - "line": 227 + "line": 228 } }, { @@ -7942,13 +7942,13 @@ "description": "CARDANO NODE STATUS", "end": { "column": 3, - "line": 236 + "line": 237 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeStatus", "start": { "column": 21, - "line": 232 + "line": 233 } }, { @@ -7956,13 +7956,13 @@ "description": "Restarting Cardano node...", "end": { "column": 3, - "line": 241 + "line": 242 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeStatusRestarting", "start": { "column": 31, - "line": 237 + "line": 238 } }, { @@ -7970,13 +7970,13 @@ "description": "Restart Cardano node", "end": { "column": 3, - "line": 246 + "line": 247 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeStatusRestart", "start": { "column": 28, - "line": 242 + "line": 243 } }, { @@ -7984,13 +7984,13 @@ "description": "Cardano node state", "end": { "column": 3, - "line": 251 + "line": 252 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeState", "start": { "column": 20, - "line": 247 + "line": 248 } }, { @@ -7998,13 +7998,13 @@ "description": "Updated", "end": { "column": 3, - "line": 256 + "line": 257 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeHasBeenUpdated", "start": { "column": 22, - "line": 252 + "line": 253 } }, { @@ -8012,13 +8012,13 @@ "description": "Crashed", "end": { "column": 3, - "line": 261 + "line": 262 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeHasCrashed", "start": { "column": 18, - "line": 257 + "line": 258 } }, { @@ -8026,13 +8026,13 @@ "description": "Errored", "end": { "column": 3, - "line": 266 + "line": 267 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeHasErrored", "start": { "column": 18, - "line": 262 + "line": 263 } }, { @@ -8040,13 +8040,13 @@ "description": "Stopped", "end": { "column": 3, - "line": 271 + "line": 272 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeHasStopped", "start": { "column": 18, - "line": 267 + "line": 268 } }, { @@ -8054,13 +8054,13 @@ "description": "Exiting", "end": { "column": 3, - "line": 276 + "line": 277 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsExiting", "start": { "column": 17, - "line": 272 + "line": 273 } }, { @@ -8068,13 +8068,13 @@ "description": "Running", "end": { "column": 3, - "line": 281 + "line": 282 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsRunning", "start": { "column": 17, - "line": 277 + "line": 278 } }, { @@ -8082,13 +8082,13 @@ "description": "Starting", "end": { "column": 3, - "line": 286 + "line": 287 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsStarting", "start": { "column": 18, - "line": 282 + "line": 283 } }, { @@ -8096,13 +8096,13 @@ "description": "Stopping", "end": { "column": 3, - "line": 291 + "line": 292 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsStopping", "start": { "column": 18, - "line": 287 + "line": 288 } }, { @@ -8110,13 +8110,13 @@ "description": "Unrecoverable", "end": { "column": 3, - "line": 296 + "line": 297 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsUnrecoverable", "start": { "column": 23, - "line": 292 + "line": 293 } }, { @@ -8124,13 +8124,13 @@ "description": "Updating", "end": { "column": 3, - "line": 301 + "line": 302 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsUpdating", "start": { "column": 18, - "line": 297 + "line": 298 } }, { @@ -8138,13 +8138,13 @@ "description": "Cardano node responding", "end": { "column": 3, - "line": 306 + "line": 307 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeResponding", "start": { "column": 25, - "line": 302 + "line": 303 } }, { @@ -8152,13 +8152,13 @@ "description": "Cardano node subscribed", "end": { "column": 3, - "line": 311 + "line": 312 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeSubscribed", "start": { "column": 25, - "line": 307 + "line": 308 } }, { @@ -8166,13 +8166,13 @@ "description": "Cardano node time correct", "end": { "column": 3, - "line": 316 + "line": 317 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeTimeCorrect", "start": { "column": 26, - "line": 312 + "line": 313 } }, { @@ -8180,13 +8180,13 @@ "description": "Cardano node syncing", "end": { "column": 3, - "line": 321 + "line": 322 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeSyncing", "start": { "column": 22, - "line": 317 + "line": 318 } }, { @@ -8194,13 +8194,13 @@ "description": "Cardano node in sync", "end": { "column": 3, - "line": 326 + "line": 327 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeInSync", "start": { "column": 21, - "line": 322 + "line": 323 } }, { @@ -8208,13 +8208,13 @@ "description": "Checking...", "end": { "column": 3, - "line": 331 + "line": 332 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.localTimeDifferenceChecking", "start": { "column": 31, - "line": 327 + "line": 328 } }, { @@ -8222,13 +8222,13 @@ "description": "Check time", "end": { "column": 3, - "line": 336 + "line": 337 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.localTimeDifferenceCheckTime", "start": { "column": 32, - "line": 332 + "line": 333 } }, { @@ -8236,13 +8236,13 @@ "description": "Yes", "end": { "column": 3, - "line": 341 + "line": 342 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.statusOn", "start": { "column": 12, - "line": 337 + "line": 338 } }, { @@ -8250,13 +8250,13 @@ "description": "No", "end": { "column": 3, - "line": 346 + "line": 347 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.statusOff", "start": { "column": 13, - "line": 342 + "line": 343 } }, { @@ -8264,13 +8264,13 @@ "description": "On", "end": { "column": 3, - "line": 351 + "line": 352 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.statusOnForUserSettings", "start": { "column": 27, - "line": 347 + "line": 348 } }, { @@ -8278,13 +8278,13 @@ "description": "Off", "end": { "column": 3, - "line": 356 + "line": 357 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.statusOffForUserSettings", "start": { "column": 28, - "line": 352 + "line": 353 } }, { @@ -8292,13 +8292,13 @@ "description": "NTP service unreachable", "end": { "column": 3, - "line": 361 + "line": 362 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.serviceUnreachable", "start": { "column": 22, - "line": 357 + "line": 358 } }, { @@ -8306,13 +8306,13 @@ "description": "message", "end": { "column": 3, - "line": 366 + "line": 367 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.message", "start": { "column": 11, - "line": 362 + "line": 363 } }, { @@ -8320,13 +8320,13 @@ "description": "code", "end": { "column": 3, - "line": 371 + "line": 372 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.code", "start": { "column": 8, - "line": 367 + "line": 368 } }, { @@ -8334,13 +8334,13 @@ "description": "Last network block", "end": { "column": 3, - "line": 376 + "line": 377 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.lastNetworkBlock", "start": { "column": 20, - "line": 372 + "line": 373 } }, { @@ -8348,13 +8348,13 @@ "description": "Last synchronized block", "end": { "column": 3, - "line": 381 + "line": 382 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.lastSynchronizedBlock", "start": { "column": 25, - "line": 377 + "line": 378 } }, { @@ -8362,13 +8362,13 @@ "description": "epoch", "end": { "column": 3, - "line": 386 + "line": 387 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.epoch", "start": { "column": 9, - "line": 382 + "line": 383 } }, { @@ -8376,13 +8376,13 @@ "description": "slot", "end": { "column": 3, - "line": 391 + "line": 392 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.slot", "start": { "column": 8, - "line": 387 + "line": 388 } } ], From b2965b3c83647799e8a895e003bab9a7b272091f Mon Sep 17 00:00:00 2001 From: Renan Ferreira Date: Thu, 17 Feb 2022 17:06:51 -0300 Subject: [PATCH 41/42] [DDW-827] Remove ts-ignore --- source/common/types/logging.types.ts | 8 +- source/renderer/app/api/api.ts | 161 +++------------------------ 2 files changed, 18 insertions(+), 151 deletions(-) diff --git a/source/common/types/logging.types.ts b/source/common/types/logging.types.ts index 9aa2f77368..e8d93af11e 100644 --- a/source/common/types/logging.types.ts +++ b/source/common/types/logging.types.ts @@ -19,10 +19,10 @@ import type { AdaApiStakePool } from '../../renderer/app/api/staking/types'; export type LoggingLevel = 'debug' | 'info' | 'error' | 'warn'; export type Logger = { - debug: (arg0: string, arg1: Record | null | undefined) => void; - info: (arg0: string, arg1: Record | null | undefined) => void; - error: (arg0: string, arg1: Record | null | undefined) => void; - warn: (arg0: string, arg1: Record | null | undefined) => void; + debug: (arg0: string, arg1?: Record | null | undefined) => void; + info: (arg0: string, arg1?: Record | null | undefined) => void; + error: (arg0: string, arg1?: Record | null | undefined) => void; + warn: (arg0: string, arg1?: Record | null | undefined) => void; }; export type FormatMessageContextParams = { appName: string; diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 15bf0bdaf4..2fda2709b6 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -128,8 +128,7 @@ import type { GetNetworkParametersApiResponse, } from './network/types'; // Transactions Types -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './transactions/types' or its c... Remove this comment to see the full error message -import type { +import { Transaction, TransactionFee, TransactionWithdrawals, @@ -151,7 +150,7 @@ import type { ICOPublicKeyParams, } from './transactions/types'; // Wallets Types -import type { +import { AdaWallet, AdaWallets, CreateHardwareWalletRequest, @@ -216,7 +215,7 @@ import { getSHA256HexForString } from './utils/hashing'; import { getNewsHash } from './news/requests/getNewsHash'; import { deleteTransaction } from './transactions/requests/deleteTransaction'; import { WALLET_BYRON_KINDS } from '../config/walletRestoreConfig'; -import ApiError from '../domains/ApiError'; +import ApiError, { ErrorType } from '../domains/ApiError'; import { formattedAmountToLovelace } from '../utils/formatters'; import type { GetAssetsRequest, @@ -245,18 +244,17 @@ export default class AdaApi { this.config = config; } - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWallets = async (): Promise> => { - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWallets called'); const { getHardwareWalletLocalData, getHardwareWalletsLocalData, - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. } = global.daedalus.api.localStorage; try { - const wallets: AdaWallets = await getWallets(this.config); + const wallets: Array = await getWallets( + this.config + ); const legacyWallets: LegacyAdaWallets = await getLegacyWallets( this.config ); @@ -277,13 +275,11 @@ export default class AdaApi { }, isLegacy: true, }; - // @ts-ignore ts-migrate(2698) FIXME: Spread types may only be created from object types... Remove this comment to see the full error message wallets.push({ ...legacyAdaWallet, ...extraLegacyWalletProps }); }); // @TODO - Remove this once we get hardware wallet flag from WBE - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return await Promise.all( - wallets.map(async (wallet) => { + wallets.map(async (wallet: AdaWallet) => { const { id } = wallet; const walletData = await getHardwareWalletLocalData(id); return _createWalletFromServerData({ @@ -300,7 +296,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWallet = async (request: GetWalletRequest): Promise => { logger.debug('AdaApi::getWallet called', { parameters: filterLogData(request), @@ -345,7 +340,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletPublicKey = async ( request: GetWalletPublicKeyRequest ): Promise => { @@ -371,7 +365,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getAccountPublicKey = async ( request: GetAccountPublicKeyRequest ): Promise => { @@ -402,7 +395,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getAddresses = async ( request: GetAddressesRequest ): Promise> => { @@ -422,14 +414,12 @@ export default class AdaApi { ); } else { response = await getAddresses(this.config, walletId, queryParams); - // @ts-ignore ts-migrate(2339) FIXME: Property 'reverse' does not exist on type '{}'. response.reverse(); } logger.debug('AdaApi::getAddresses success', { addresses: response, }); - // @ts-ignore ts-migrate(2339) FIXME: Property 'map' does not exist on type '{}'. return response.map(_createAddressFromServerData); } catch (error) { logger.error('AdaApi::getAddresses error', { @@ -438,7 +428,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getTransaction = async ( request: GetTransactionRequest ): Promise => { @@ -464,7 +453,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getTransactions = async ( request: GetTransactionsRequest ): Promise => { @@ -472,18 +460,17 @@ export default class AdaApi { parameters: request, }); const { walletId, order, fromDate, toDate, isLegacy } = request; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Object'. const params = Object.assign( {}, { order: order || 'descending', + start: undefined, + end: undefined, } ); if (fromDate) - // @ts-ignore ts-migrate(2339) FIXME: Property 'start' does not exist on type '{ order: ... Remove this comment to see the full error message params.start = `${moment.utc(fromDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; if (toDate) - // @ts-ignore ts-migrate(2339) FIXME: Property 'end' does not exist on type '{ order: "a... Remove this comment to see the full error message params.end = `${moment.utc(toDate).format('YYYY-MM-DDTHH:mm:ss')}Z`; try { @@ -505,7 +492,6 @@ export default class AdaApi { const transactions = response.map((tx) => _createTransactionFromServerData(tx) ); - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return Promise.resolve({ transactions, total: response.length, @@ -664,7 +650,6 @@ export default class AdaApi { // throw new GenericApiError(error); // } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getAssets = async (request: GetAssetsRequest): Promise => { logger.debug('AdaApi::getAssets called', { parameters: request, @@ -678,7 +663,6 @@ export default class AdaApi { logger.debug('AdaApi::getAssets success', { assets: response, }); - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. const assetsLocaldata = await global.daedalus.api.localStorage.getAssetsLocalData(); logger.debug('AdaApi::getAssetsLocalData success', { assetsLocaldata, @@ -690,7 +674,6 @@ export default class AdaApi { this.storedAssetMetadata ) ); - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return new Promise((resolve) => resolve({ assets, @@ -704,7 +687,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWithdrawals = async ( request: GetWithdrawalsRequest ): Promise => { @@ -741,7 +723,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createWallet = async (request: CreateWalletRequest): Promise => { logger.debug('AdaApi::createWallet called', { parameters: filterLogData(request), @@ -769,7 +750,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createLegacyWallet = async ( request: CreateWalletRequest ): Promise => { @@ -827,7 +807,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message deleteWallet = async (request: DeleteWalletRequest): Promise => { logger.debug('AdaApi::deleteWallet called', { parameters: filterLogData(request), @@ -858,9 +837,10 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createTransaction = async ( - request: CreateTransactionRequest + request: CreateTransactionRequest & { + hasAssetsRemainingAfterTransaction: boolean; + } ): Promise => { logger.debug('AdaApi::createTransaction called', { parameters: filterLogData(request), @@ -873,7 +853,6 @@ export default class AdaApi { isLegacy, assets, withdrawal = TransactionWithdrawal, - // @ts-ignore ts-migrate(2339) FIXME: Property 'hasAssetsRemainingAfterTransaction' does... Remove this comment to see the full error message hasAssetsRemainingAfterTransaction, } = request; @@ -940,9 +919,7 @@ export default class AdaApi { } }; // For testing purpose ONLY - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createExpiredTransaction = async (request: any): Promise => { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'global'. if (global.environment.isDev) { logger.debug('AdaApi::createTransaction called', { parameters: filterLogData(request), @@ -1012,7 +989,6 @@ export default class AdaApi { return null; }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message calculateTransactionFee = async ( request: GetTransactionFeeRequest ): Promise => { @@ -1136,7 +1112,6 @@ export default class AdaApi { payments?: CoinSelectionsPaymentRequestType; delegation?: CoinSelectionsDelegationRequestType; metadata?: VotingMetadataType; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message }): Promise => { logger.debug('AdaApi::selectCoins called', { parameters: filterLogData(request), @@ -1177,7 +1152,6 @@ export default class AdaApi { metadata: metadata || null, }; } else { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Missing parameters!'); } @@ -1194,28 +1168,19 @@ export default class AdaApi { let totalInputs = new BigNumber(0); let totalOutputs = new BigNumber(0); map(response.inputs, (input) => { - // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message const inputAmount = new BigNumber(input.amount.quantity.toString()); // @ts-ignore ts-migrate(2339) FIXME: Property 'assets' does not exist on type 'unknown'... Remove this comment to see the full error message const inputAssets = map(input.assets, (asset) => ({ - // @ts-ignore ts-migrate(2339) FIXME: Property 'policy_id' does not exist on type 'unkno... Remove this comment to see the full error message policyId: asset.policy_id, - // @ts-ignore ts-migrate(2339) FIXME: Property 'asset_name' does not exist on type 'unkn... Remove this comment to see the full error message assetName: asset.asset_name, - // @ts-ignore ts-migrate(2339) FIXME: Property 'quantity' does not exist on type 'unknow... Remove this comment to see the full error message quantity: asset.quantity, })); totalInputs = totalInputs.plus(inputAmount); const inputData = { - // @ts-ignore ts-migrate(2339) FIXME: Property 'address' does not exist on type 'unknown... Remove this comment to see the full error message address: input.address, - // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message amount: input.amount, - // @ts-ignore ts-migrate(2339) FIXME: Property 'id' does not exist on type 'unknown'. id: input.id, - // @ts-ignore ts-migrate(2339) FIXME: Property 'index' does not exist on type 'unknown'. index: input.index, - // @ts-ignore ts-migrate(2339) FIXME: Property 'derivation_path' does not exist on type ... Remove this comment to see the full error message derivationPath: input.derivation_path, assets: inputAssets, }; @@ -1223,24 +1188,17 @@ export default class AdaApi { inputsData.push(inputData); }); map(outputs, (output) => { - // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message const outputAmount = new BigNumber(output.amount.quantity.toString()); // @ts-ignore ts-migrate(2339) FIXME: Property 'assets' does not exist on type 'unknown'... Remove this comment to see the full error message const outputAssets = map(output.assets, (asset) => ({ - // @ts-ignore ts-migrate(2339) FIXME: Property 'policy_id' does not exist on type 'unkno... Remove this comment to see the full error message policyId: asset.policy_id, - // @ts-ignore ts-migrate(2339) FIXME: Property 'asset_name' does not exist on type 'unkn... Remove this comment to see the full error message assetName: asset.asset_name, - // @ts-ignore ts-migrate(2339) FIXME: Property 'quantity' does not exist on type 'unknow... Remove this comment to see the full error message quantity: asset.quantity, })); totalOutputs = totalOutputs.plus(outputAmount); const outputData = { - // @ts-ignore ts-migrate(2339) FIXME: Property 'address' does not exist on type 'unknown... Remove this comment to see the full error message address: output.address, - // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message amount: output.amount, - // @ts-ignore ts-migrate(2339) FIXME: Property 'derivation_path' does not exist on type ... Remove this comment to see the full error message derivationPath: output.derivation_path || null, assets: outputAssets, }; @@ -1251,11 +1209,8 @@ export default class AdaApi { if (response.certificates) { map(response.certificates, (certificate) => { const certificateData = { - // @ts-ignore ts-migrate(2339) FIXME: Property 'certificate_type' does not exist on type... Remove this comment to see the full error message certificateType: certificate.certificate_type, - // @ts-ignore ts-migrate(2339) FIXME: Property 'reward_account_path' does not exist on t... Remove this comment to see the full error message rewardAccountPath: certificate.reward_account_path, - // @ts-ignore ts-migrate(2339) FIXME: Property 'pool' does not exist on type 'unknown'. pool: certificate.pool || null, }; // @ts-ignore ts-migrate(2339) FIXME: Property 'push' does not exist on type '{}'. @@ -1264,18 +1219,13 @@ export default class AdaApi { } const withdrawalsData = map(response.withdrawals, (withdrawal) => ({ - // @ts-ignore ts-migrate(2339) FIXME: Property 'stake_address' does not exist on type 'u... Remove this comment to see the full error message stakeAddress: withdrawal.stake_address, - // @ts-ignore ts-migrate(2339) FIXME: Property 'derivation_path' does not exist on type ... Remove this comment to see the full error message derivationPath: withdrawal.derivation_path, - // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message amount: withdrawal.amount, })); - // @ts-ignore ts-migrate(2339) FIXME: Property 'quantity' does not exist on type 'unknow... Remove this comment to see the full error message const depositsArray = map(response.deposits, (deposit) => deposit.quantity.toString() ); - // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type '{}'. const deposits = depositsArray.length ? BigNumber.sum.apply(null, depositsArray) : new BigNumber(0); @@ -1284,11 +1234,9 @@ export default class AdaApi { delegation && delegation.delegationAction === DELEGATION_ACTIONS.QUIT ? new BigNumber(DELEGATION_DEPOSIT).multipliedBy(LOVELACES_PER_ADA) : new BigNumber(0); - // @ts-ignore ts-migrate(2339) FIXME: Property 'amount' does not exist on type 'unknown'... Remove this comment to see the full error message const withdrawalsArray = map(response.withdrawals, (withdrawal) => withdrawal.amount.quantity.toString() ); - // @ts-ignore ts-migrate(2339) FIXME: Property 'length' does not exist on type '{}'. const withdrawals = withdrawalsArray.length ? BigNumber.sum.apply(null, withdrawalsArray) : new BigNumber(0); @@ -1350,7 +1298,6 @@ export default class AdaApi { .set(notEnoughMoneyError, true) .where('code', 'not_enough_money') .set('utxoTooSmall', true, { - // @ts-ignore ts-migrate(2339) FIXME: Property 'exec' does not exist on type '{}'. minimumAda: get( /(Expected min coin value: +)([0-9]+.[0-9]+)/.exec(error.message), 2, @@ -1364,7 +1311,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createExternalTransaction = async ( request: CreateExternalTransactionRequest ): Promise => { @@ -1384,7 +1330,6 @@ export default class AdaApi { }; inspectAddress = async (request: { addressId: string; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message }): Promise => { logger.debug('AdaApi::inspectAddress called', { parameters: filterLogData(request), @@ -1406,7 +1351,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getPublicKey = async (request: any): Promise => { logger.debug('AdaApi::getPublicKey called', { parameters: filterLogData(request), @@ -1430,7 +1374,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getICOPublicKey = async (request: ICOPublicKeyParams): Promise => { logger.debug('AdaApi::getICOPublicKey called', { parameters: filterLogData(request), @@ -1454,7 +1397,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message constructAddress = async (request: any): Promise => { const { data } = request; @@ -1473,7 +1415,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createAddress = async ( request: CreateByronWalletAddressRequest ): Promise => { @@ -1504,7 +1445,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message deleteTransaction = async ( request: DeleteTransactionRequest ): Promise => { @@ -1537,21 +1477,16 @@ export default class AdaApi { // is no longer pending - in which case there is nothing we can do. } }; - // @ts-ignore ts-migrate(2339) FIXME: Property 'split' does not exist on type 'string'. isValidCertificateMnemonic = (mnemonic: string): boolean => mnemonic.split(' ').length === ADA_CERTIFICATE_MNEMONIC_LENGTH; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletRecoveryPhrase(): Promise> { - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletRecoveryPhrase called'); try { - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message const response: Promise> = new Promise((resolve) => resolve(generateAccountMnemonics(WALLET_RECOVERY_PHRASE_WORD_COUNT)) ); - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletRecoveryPhrase success'); return response; } catch (error) { @@ -1562,17 +1497,13 @@ export default class AdaApi { } } - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletCertificateAdditionalMnemonics(): Promise> { - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletCertificateAdditionalMnemonics called'); try { - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message const response: Promise> = new Promise((resolve) => resolve(generateAdditionalMnemonics()) ); - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletCertificateAdditionalMnemonics success'); return response; } catch (error) { @@ -1583,16 +1514,13 @@ export default class AdaApi { } } - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletCertificateRecoveryPhrase( request: GetWalletCertificateRecoveryPhraseRequest ): Promise> { - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletCertificateRecoveryPhrase called'); const { passphrase, input: scrambledInput } = request; try { - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message const response: Promise> = new Promise((resolve) => resolve( scrambleMnemonics({ @@ -1601,7 +1529,6 @@ export default class AdaApi { }) ) ); - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletCertificateRecoveryPhrase success'); return response; } catch (error) { @@ -1612,11 +1539,9 @@ export default class AdaApi { } } - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletRecoveryPhraseFromCertificate( request: GetWalletRecoveryPhraseFromCertificateRequest ): Promise> { - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate called'); const { passphrase, scrambledInput } = request; @@ -1625,9 +1550,7 @@ export default class AdaApi { passphrase, scrambledInput, }); - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getWalletRecoveryPhraseFromCertificate success'); - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return Promise.resolve(response); } catch (error) { logger.error('AdaApi::getWalletRecoveryPhraseFromCertificate error', { @@ -1636,12 +1559,10 @@ export default class AdaApi { const errorRejection = new ApiError(error) .set('invalidMnemonic', true) .result(); - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message return Promise.reject(errorRejection); } } - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreWallet = async (request: RestoreWalletRequest): Promise => { logger.debug('AdaApi::restoreWallet called', { parameters: filterLogData(request), @@ -1677,7 +1598,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createHardwareWallet = async ( request: CreateHardwareWalletRequest ): Promise => { @@ -1709,7 +1629,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getCurrencyList = async (): Promise => { try { const apiResponse = await getCurrencyList(); @@ -1727,7 +1646,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getCurrencyRate = async ( currency: GetCurrencyRateRequest ): Promise => { @@ -1747,7 +1665,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreLegacyWallet = async ( request: RestoreLegacyWalletRequest ): Promise => { @@ -1801,7 +1718,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreByronRandomWallet = async ( request: RestoreLegacyWalletRequest ): Promise => { @@ -1865,7 +1781,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreByronIcarusWallet = async ( request: RestoreLegacyWalletRequest ): Promise => { @@ -1920,7 +1835,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreByronTrezorWallet = async ( request: RestoreLegacyWalletRequest ): Promise => { @@ -1975,7 +1889,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreByronLedgerWallet = async ( request: RestoreLegacyWalletRequest ): Promise => { @@ -2030,7 +1943,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message restoreExportedByronWallet = async ( request: RestoreExportedByronWalletRequest ): Promise => { @@ -2068,7 +1980,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message importWalletFromKey = async ( request: ImportWalletFromKeyRequest ): Promise => { @@ -2096,7 +2007,6 @@ export default class AdaApi { .result('walletFileImportError'); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message importWalletFromFile = async ( request: ImportWalletFromFileRequest ): Promise => { @@ -2127,7 +2037,6 @@ export default class AdaApi { .result('walletFileImportError'); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message updateWallet = async (request: UpdateWalletRequest): Promise => { logger.debug('AdaApi::updateWallet called', { parameters: filterLogData(request), @@ -2171,7 +2080,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message updateSpendingPassword = async ( request: UpdateSpendingPasswordRequest ): Promise => { @@ -2206,7 +2114,6 @@ export default class AdaApi { }); } - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::updateSpendingPassword success'); return true; } catch (error) { @@ -2220,7 +2127,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message quitStakePool = async ( request: QuitStakePoolRequest ): Promise => { @@ -2249,9 +2155,7 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getSmashSettings = async (): Promise => { - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getSmashSettings called'); try { @@ -2269,7 +2173,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message checkSmashServerIsValid = async (url: string): Promise => { logger.debug('AdaApi::checkSmashServerIsValid called', { parameters: { @@ -2300,7 +2203,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message updateSmashSettings = async ( poolMetadataSource: PoolMetadataSource ): Promise => { @@ -2316,10 +2218,9 @@ export default class AdaApi { ); if (!isSmashServerValid) { - const error = { + const error: ErrorType = { code: 'invalid_smash_server', }; - // @ts-ignore ts-migrate(2345) FIXME: Argument of type '{ code: string; }' is not assign... Remove this comment to see the full error message throw new ApiError(error); } @@ -2347,7 +2248,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getRedeemItnRewardsFee = async ( request: GetRedeemItnRewardsFeeRequest ): Promise => { @@ -2393,7 +2293,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message requestRedeemItnRewards = async ( request: RequestRedeemItnRewardsRequest ): Promise => { @@ -2437,7 +2336,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message exportWalletToFile = async ( request: ExportWalletToFileRequest ): Promise<[]> => { @@ -2447,8 +2345,7 @@ export default class AdaApi { }); try { - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message - const response: Promise<[]> = await exportWalletAsJSON(this.config, { + const response: [] = await exportWalletAsJSON(this.config, { walletId, filePath, }); @@ -2463,7 +2360,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getWalletUtxos = async ( request: GetWalletUtxosRequest ): Promise => { @@ -2496,7 +2392,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message transferFundsCalculateFee = async ( request: TransferFundsCalculateFeeRequest ): Promise => { @@ -2525,7 +2420,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message transferFunds = async ( request: TransferFundsRequest ): Promise => { @@ -2565,7 +2459,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getStakePools = async (stake = 0): Promise> => { logger.debug('AdaApi::getStakePools called', { parameters: { @@ -2599,14 +2492,11 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message testReset = async (): Promise => { - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::testReset called'); try { const wallets = await this.getWallets(); - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message await Promise.all( wallets.map((wallet) => this.deleteWallet({ @@ -2616,7 +2506,6 @@ export default class AdaApi { }) ) ); - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::testReset success'); } catch (error) { logger.error('AdaApi::testReset error', { @@ -2625,9 +2514,7 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getNetworkInfo = async (): Promise => { - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getNetworkInfo called'); try { @@ -2762,9 +2649,7 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message getNews = async (): Promise => { - // @ts-ignore ts-migrate(2554) FIXME: Expected 2 arguments, but got 1. logger.debug('AdaApi::getNews called'); // Fetch news json let rawNews: string; @@ -2772,13 +2657,11 @@ export default class AdaApi { try { rawNews = await getNews(); - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'JSON'. news = JSON.parse(rawNews); } catch (error) { logger.error('AdaApi::getNews error', { error, }); - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Unable to fetch news'); } @@ -2793,12 +2676,10 @@ export default class AdaApi { logger.error('AdaApi::getNews (hash) error', { error, }); - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Unable to fetch news hash'); } if (newsHash !== expectedNewsHash) { - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Error'. throw new Error('Newsfeed could not be verified'); } @@ -2808,7 +2689,6 @@ export default class AdaApi { }); return news; }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message calculateDelegationFee = async ( request: GetDelegationFeeRequest ): Promise => { @@ -2831,7 +2711,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message joinStakePool = async ( request: JoinStakePoolRequest ): Promise => { @@ -2861,7 +2740,6 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createWalletSignature = async ( request: CreateWalletSignatureRequest ): Promise => { @@ -2938,7 +2816,6 @@ export default class AdaApi { throw new ApiError(error); } }; - // @ts-ignore ts-migrate(2583) FIXME: Cannot find name 'Promise'. Do you need to change ... Remove this comment to see the full error message createVotingRegistrationTransaction = async ( request: CreateVotingRegistrationRequest ): Promise => { @@ -3044,31 +2921,23 @@ export default class AdaApi { .result(); } }; - // @ts-ignore ts-migrate(2697) FIXME: An async function or method must return a 'Promise... Remove this comment to see the full error message setCardanoNodeFault = async (fault: FaultInjectionIpcRequest) => { await cardanoFaultInjectionChannel.send(fault); }; // No implementation here but can be overwritten - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setLocalTimeDifference: (...args: Array) => any; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setSyncProgress: (...args: Array) => any; setFaultyNodeSettingsApi: boolean; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. resetTestOverrides: (...args: Array) => any; // Newsfeed testing utility setTestingNewsFeed: (testingNewsFeedData: GetNewsResponse) => void; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setTestingStakePools: (testingStakePoolsData: Array) => void; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setTestingWallets: (testingWalletsData: Array) => void; - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Record'. setTestingWallet: ( testingWalletData: Record, walletIndex?: number ) => void; // Stake pools testing utility - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Array'. setFakeStakePoolsJsonForTesting: ( fakeStakePoolsJson: Array ) => void; @@ -3198,7 +3067,6 @@ const _createWalletFromServerData = action( availableAmount: walletAvailableAmount, reward: walletRewardAmount, assets: walletAssets, - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Date'. passwordUpdateDate: passphraseLastUpdatedAt && new Date(passphraseLastUpdatedAt), hasPassword: isHardwareWallet || passphraseLastUpdatedAt !== null, @@ -3459,7 +3327,6 @@ const _createStakePoolFromServerData = action( ), profitMargin: profitMarginPercentage, ranking: index + 1, - // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'Date'. retiring: retiringAt ? new Date(retiringAt) : null, saturation: saturation * 100, }); From fee9423defc7a0a0f63b2777915ee8b32f8f3e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Mas=C5=82owski?= Date: Wed, 23 Feb 2022 11:00:46 +0100 Subject: [PATCH 42/42] [DDW-827] Update defaultMessages.json file --- .../app/i18n/locales/defaultMessages.json | 294 +++++++++--------- 1 file changed, 154 insertions(+), 140 deletions(-) diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index c4a8b61ad5..55f11cc6c4 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -285,6 +285,20 @@ "column": 22, "line": 109 } + }, + { + "defaultMessage": "!!!Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.", + "description": "\"Balance after transaction would not leave enough ada in the wallet to support tokens remaining in wallet", + "end": { + "column": 3, + "line": 120 + }, + "file": "source/renderer/app/api/errors.ts", + "id": "api.errors.NotEnoughFundsForTransactionFeesErrorWithTokens", + "start": { + "column": 26, + "line": 114 + } } ], "path": "source/renderer/app/api/errors.json" @@ -7457,13 +7471,13 @@ "description": "System info", "end": { "column": 3, - "line": 33 + "line": 34 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.system.info", "start": { "column": 14, - "line": 29 + "line": 30 } }, { @@ -7471,13 +7485,13 @@ "description": "Platform", "end": { "column": 3, - "line": 38 + "line": 39 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.platform", "start": { "column": 12, - "line": 34 + "line": 35 } }, { @@ -7485,13 +7499,13 @@ "description": "Platform version", "end": { "column": 3, - "line": 43 + "line": 44 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.platform.version", "start": { "column": 19, - "line": 39 + "line": 40 } }, { @@ -7499,13 +7513,13 @@ "description": "CPU", "end": { "column": 3, - "line": 48 + "line": 49 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cpu", "start": { "column": 7, - "line": 44 + "line": 45 } }, { @@ -7513,13 +7527,13 @@ "description": "RAM", "end": { "column": 3, - "line": 53 + "line": 54 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.ram", "start": { "column": 7, - "line": 49 + "line": 50 } }, { @@ -7527,13 +7541,13 @@ "description": "Available disk space", "end": { "column": 3, - "line": 58 + "line": 59 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.availableDiskSpace", "start": { "column": 22, - "line": 54 + "line": 55 } }, { @@ -7541,13 +7555,13 @@ "description": "Unknown amount of disk space", "end": { "column": 3, - "line": 63 + "line": 64 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.unknownDiskSpace", "start": { "column": 20, - "line": 59 + "line": 60 } }, { @@ -7555,13 +7569,13 @@ "description": "\"Support\" link URL while disk space is unknown", "end": { "column": 3, - "line": 68 + "line": 69 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.unknownDiskSpaceSupportUrl", "start": { "column": 30, - "line": 64 + "line": 65 } }, { @@ -7569,13 +7583,13 @@ "description": "Displayed on the left of the Recommended system requirements status row", "end": { "column": 3, - "line": 74 + "line": 75 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatus", "start": { "column": 35, - "line": 69 + "line": 70 } }, { @@ -7583,13 +7597,13 @@ "description": "Displayed on the right of the Recommended system requirements status row when hardware requirements are insufficient", "end": { "column": 3, - "line": 80 + "line": 81 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusLowValue", "start": { "column": 44, - "line": 75 + "line": 76 } }, { @@ -7597,13 +7611,13 @@ "description": "Displayed on the right of the Recommended system requirements status row when hardware requirements are ok", "end": { "column": 3, - "line": 86 + "line": 87 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusGoodValue", "start": { "column": 45, - "line": 81 + "line": 82 } }, { @@ -7611,13 +7625,13 @@ "description": "Visible on hovering over Recommended system requirement status when status is Low", "end": { "column": 3, - "line": 94 + "line": 95 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusLowTooltip", "start": { "column": 46, - "line": 87 + "line": 88 } }, { @@ -7625,13 +7639,13 @@ "description": "Visible on hovering over Recommended system requirement status when status is Good", "end": { "column": 3, - "line": 102 + "line": 103 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.hasMetHardwareRequirementsStatusGoodTooltip", "start": { "column": 47, - "line": 95 + "line": 96 } }, { @@ -7639,13 +7653,13 @@ "description": "Indicates whether RTS Flags Mode is enabled or not", "end": { "column": 3, - "line": 107 + "line": 108 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.isRTSFlagsModeEnabled", "start": { "column": 25, - "line": 103 + "line": 104 } }, { @@ -7653,13 +7667,13 @@ "description": "CORE INFO", "end": { "column": 3, - "line": 112 + "line": 113 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.coreInfo", "start": { "column": 12, - "line": 108 + "line": 109 } }, { @@ -7667,13 +7681,13 @@ "description": "Daedalus version", "end": { "column": 3, - "line": 117 + "line": 118 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.daedalusVersion", "start": { "column": 19, - "line": 113 + "line": 114 } }, { @@ -7681,13 +7695,13 @@ "description": "Daedalus build number", "end": { "column": 3, - "line": 122 + "line": 123 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.daedalusBuildNumber", "start": { "column": 23, - "line": 118 + "line": 119 } }, { @@ -7695,13 +7709,13 @@ "description": "Daedalus main process ID", "end": { "column": 3, - "line": 127 + "line": 128 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.daedalusMainProcessID", "start": { "column": 25, - "line": 123 + "line": 124 } }, { @@ -7709,13 +7723,13 @@ "description": "Daedalus renderer process ID", "end": { "column": 3, - "line": 132 + "line": 133 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.daedalusProcessID", "start": { "column": 21, - "line": 128 + "line": 129 } }, { @@ -7723,13 +7737,13 @@ "description": "Daedalus 'Blank Screen Fix' active", "end": { "column": 3, - "line": 137 + "line": 138 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.blankScreenFix", "start": { "column": 18, - "line": 133 + "line": 134 } }, { @@ -7737,13 +7751,13 @@ "description": "Cardano node version", "end": { "column": 3, - "line": 142 + "line": 143 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeVersion", "start": { "column": 22, - "line": 138 + "line": 139 } }, { @@ -7751,13 +7765,13 @@ "description": "Cardano node process ID", "end": { "column": 3, - "line": 147 + "line": 148 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodePID", "start": { "column": 18, - "line": 143 + "line": 144 } }, { @@ -7765,13 +7779,13 @@ "description": "Cardano node port", "end": { "column": 3, - "line": 152 + "line": 153 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeApiPort", "start": { "column": 22, - "line": 148 + "line": 149 } }, { @@ -7779,13 +7793,13 @@ "description": "Cardano wallet process ID", "end": { "column": 3, - "line": 157 + "line": 158 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoWalletPID", "start": { "column": 20, - "line": 153 + "line": 154 } }, { @@ -7793,13 +7807,13 @@ "description": "Cardano wallet version", "end": { "column": 3, - "line": 162 + "line": 163 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoWalletVersion", "start": { "column": 24, - "line": 158 + "line": 159 } }, { @@ -7807,13 +7821,13 @@ "description": "Cardano wallet port", "end": { "column": 3, - "line": 167 + "line": 168 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoWalletApiPort", "start": { "column": 24, - "line": 163 + "line": 164 } }, { @@ -7821,13 +7835,13 @@ "description": "Cardano network", "end": { "column": 3, - "line": 172 + "line": 173 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNetwork", "start": { "column": 18, - "line": 168 + "line": 169 } }, { @@ -7835,13 +7849,13 @@ "description": "Daedalus state directory", "end": { "column": 3, - "line": 177 + "line": 178 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.stateDirectory", "start": { "column": 22, - "line": 173 + "line": 174 } }, { @@ -7849,13 +7863,13 @@ "description": "Open", "end": { "column": 3, - "line": 182 + "line": 183 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.stateDirectoryPathOpenBtn", "start": { "column": 29, - "line": 178 + "line": 179 } }, { @@ -7863,13 +7877,13 @@ "description": "CONNECTION ERROR", "end": { "column": 3, - "line": 187 + "line": 188 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.connectionError", "start": { "column": 19, - "line": 183 + "line": 184 } }, { @@ -7877,13 +7891,13 @@ "description": "DAEDALUS STATUS", "end": { "column": 3, - "line": 192 + "line": 193 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.daedalusStatus", "start": { "column": 18, - "line": 188 + "line": 189 } }, { @@ -7891,13 +7905,13 @@ "description": "Connected", "end": { "column": 3, - "line": 197 + "line": 198 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.connected", "start": { "column": 13, - "line": 193 + "line": 194 } }, { @@ -7905,13 +7919,13 @@ "description": "Synced", "end": { "column": 3, - "line": 202 + "line": 203 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.synced", "start": { "column": 10, - "line": 198 + "line": 199 } }, { @@ -7919,13 +7933,13 @@ "description": "Sync percentage", "end": { "column": 3, - "line": 207 + "line": 208 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.syncPercentage", "start": { "column": 18, - "line": 203 + "line": 204 } }, { @@ -7933,13 +7947,13 @@ "description": "Local time difference", "end": { "column": 3, - "line": 212 + "line": 213 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.localTimeDifference", "start": { "column": 23, - "line": 208 + "line": 209 } }, { @@ -7947,13 +7961,13 @@ "description": "System time correct", "end": { "column": 3, - "line": 217 + "line": 218 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.systemTimeCorrect", "start": { "column": 21, - "line": 213 + "line": 214 } }, { @@ -7961,13 +7975,13 @@ "description": "System time ignored", "end": { "column": 3, - "line": 222 + "line": 223 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.systemTimeIgnored", "start": { "column": 21, - "line": 218 + "line": 219 } }, { @@ -7975,13 +7989,13 @@ "description": "Checking system time", "end": { "column": 3, - "line": 227 + "line": 228 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.checkingNodeTime", "start": { "column": 20, - "line": 223 + "line": 224 } }, { @@ -7989,13 +8003,13 @@ "description": "CARDANO NODE STATUS", "end": { "column": 3, - "line": 232 + "line": 233 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeStatus", "start": { "column": 21, - "line": 228 + "line": 229 } }, { @@ -8003,13 +8017,13 @@ "description": "Restarting Cardano node...", "end": { "column": 3, - "line": 237 + "line": 238 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeStatusRestarting", "start": { "column": 31, - "line": 233 + "line": 234 } }, { @@ -8017,13 +8031,13 @@ "description": "Restart Cardano node", "end": { "column": 3, - "line": 242 + "line": 243 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeStatusRestart", "start": { "column": 28, - "line": 238 + "line": 239 } }, { @@ -8031,13 +8045,13 @@ "description": "Cardano node state", "end": { "column": 3, - "line": 247 + "line": 248 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeState", "start": { "column": 20, - "line": 243 + "line": 244 } }, { @@ -8045,13 +8059,13 @@ "description": "Updated", "end": { "column": 3, - "line": 252 + "line": 253 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeHasBeenUpdated", "start": { "column": 22, - "line": 248 + "line": 249 } }, { @@ -8059,13 +8073,13 @@ "description": "Crashed", "end": { "column": 3, - "line": 257 + "line": 258 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeHasCrashed", "start": { "column": 18, - "line": 253 + "line": 254 } }, { @@ -8073,13 +8087,13 @@ "description": "Errored", "end": { "column": 3, - "line": 262 + "line": 263 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeHasErrored", "start": { "column": 18, - "line": 258 + "line": 259 } }, { @@ -8087,13 +8101,13 @@ "description": "Stopped", "end": { "column": 3, - "line": 267 + "line": 268 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeHasStopped", "start": { "column": 18, - "line": 263 + "line": 264 } }, { @@ -8101,13 +8115,13 @@ "description": "Exiting", "end": { "column": 3, - "line": 272 + "line": 273 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsExiting", "start": { "column": 17, - "line": 268 + "line": 269 } }, { @@ -8115,13 +8129,13 @@ "description": "Running", "end": { "column": 3, - "line": 277 + "line": 278 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsRunning", "start": { "column": 17, - "line": 273 + "line": 274 } }, { @@ -8129,13 +8143,13 @@ "description": "Starting", "end": { "column": 3, - "line": 282 + "line": 283 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsStarting", "start": { "column": 18, - "line": 278 + "line": 279 } }, { @@ -8143,13 +8157,13 @@ "description": "Stopping", "end": { "column": 3, - "line": 287 + "line": 288 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsStopping", "start": { "column": 18, - "line": 283 + "line": 284 } }, { @@ -8157,13 +8171,13 @@ "description": "Unrecoverable", "end": { "column": 3, - "line": 292 + "line": 293 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsUnrecoverable", "start": { "column": 23, - "line": 288 + "line": 289 } }, { @@ -8171,13 +8185,13 @@ "description": "Updating", "end": { "column": 3, - "line": 297 + "line": 298 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.nodeIsUpdating", "start": { "column": 18, - "line": 293 + "line": 294 } }, { @@ -8185,13 +8199,13 @@ "description": "Cardano node responding", "end": { "column": 3, - "line": 302 + "line": 303 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeResponding", "start": { "column": 25, - "line": 298 + "line": 299 } }, { @@ -8199,13 +8213,13 @@ "description": "Cardano node subscribed", "end": { "column": 3, - "line": 307 + "line": 308 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeSubscribed", "start": { "column": 25, - "line": 303 + "line": 304 } }, { @@ -8213,13 +8227,13 @@ "description": "Cardano node time correct", "end": { "column": 3, - "line": 312 + "line": 313 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeTimeCorrect", "start": { "column": 26, - "line": 308 + "line": 309 } }, { @@ -8227,13 +8241,13 @@ "description": "Cardano node syncing", "end": { "column": 3, - "line": 317 + "line": 318 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeSyncing", "start": { "column": 22, - "line": 313 + "line": 314 } }, { @@ -8241,13 +8255,13 @@ "description": "Cardano node in sync", "end": { "column": 3, - "line": 322 + "line": 323 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.cardanoNodeInSync", "start": { "column": 21, - "line": 318 + "line": 319 } }, { @@ -8255,13 +8269,13 @@ "description": "Checking...", "end": { "column": 3, - "line": 327 + "line": 328 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.localTimeDifferenceChecking", "start": { "column": 31, - "line": 323 + "line": 324 } }, { @@ -8269,13 +8283,13 @@ "description": "Check time", "end": { "column": 3, - "line": 332 + "line": 333 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.localTimeDifferenceCheckTime", "start": { "column": 32, - "line": 328 + "line": 329 } }, { @@ -8283,13 +8297,13 @@ "description": "Yes", "end": { "column": 3, - "line": 337 + "line": 338 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.statusOn", "start": { "column": 12, - "line": 333 + "line": 334 } }, { @@ -8297,13 +8311,13 @@ "description": "No", "end": { "column": 3, - "line": 342 + "line": 343 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.statusOff", "start": { "column": 13, - "line": 338 + "line": 339 } }, { @@ -8311,13 +8325,13 @@ "description": "On", "end": { "column": 3, - "line": 347 + "line": 348 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.statusOnForUserSettings", "start": { "column": 27, - "line": 343 + "line": 344 } }, { @@ -8325,13 +8339,13 @@ "description": "Off", "end": { "column": 3, - "line": 352 + "line": 353 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.statusOffForUserSettings", "start": { "column": 28, - "line": 348 + "line": 349 } }, { @@ -8339,13 +8353,13 @@ "description": "NTP service unreachable", "end": { "column": 3, - "line": 357 + "line": 358 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.serviceUnreachable", "start": { "column": 22, - "line": 353 + "line": 354 } }, { @@ -8353,13 +8367,13 @@ "description": "message", "end": { "column": 3, - "line": 362 + "line": 363 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.message", "start": { "column": 11, - "line": 358 + "line": 359 } }, { @@ -8367,13 +8381,13 @@ "description": "code", "end": { "column": 3, - "line": 367 + "line": 368 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.code", "start": { "column": 8, - "line": 363 + "line": 364 } }, { @@ -8381,13 +8395,13 @@ "description": "Last network block", "end": { "column": 3, - "line": 372 + "line": 373 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.lastNetworkBlock", "start": { "column": 20, - "line": 368 + "line": 369 } }, { @@ -8395,13 +8409,13 @@ "description": "Last synchronized block", "end": { "column": 3, - "line": 377 + "line": 378 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.lastSynchronizedBlock", "start": { "column": 25, - "line": 373 + "line": 374 } }, { @@ -8409,13 +8423,13 @@ "description": "epoch", "end": { "column": 3, - "line": 382 + "line": 383 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.epoch", "start": { "column": 9, - "line": 378 + "line": 379 } }, { @@ -8423,13 +8437,13 @@ "description": "slot", "end": { "column": 3, - "line": 387 + "line": 388 }, "file": "source/renderer/app/components/status/DaedalusDiagnostics.tsx", "id": "daedalus.diagnostics.dialog.slot", "start": { "column": 8, - "line": 383 + "line": 384 } } ],