Skip to content

Commit 42977de

Browse files
[DDW-970] Remove unnecessary calls of the resetWalletPairing function
1 parent 7a1fe76 commit 42977de

File tree

3 files changed

+53
-74
lines changed

3 files changed

+53
-74
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1304,4 +1304,4 @@
13041304
"wallet.transferFunds.dialog2.total.label": "合計",
13051305
"widgets.itemsDropdown.syncingLabel": "同期",
13061306
"widgets.itemsDropdown.syncingLabelProgress": "同期中 {syncingProgress}%"
1307-
}
1307+
}

source/renderer/app/stores/HardwareWalletsStore.ts

Lines changed: 51 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,38 +1377,33 @@ export default class HardwareWalletsStore extends Store {
13771377
// @ts-ignore ts-migrate(2339) FIXME: Property 'path' does not exist on type '{}'.
13781378
devicePath = activeDevice.path || path || newConnectionData.path || null;
13791379

1380-
try {
1381-
const extendedPublicKey = await this._requestExtendedPublicKey(
1382-
devicePath,
1383-
walletId,
1384-
address
1385-
);
1386-
const associatedWallet = await this._findAssociatedWalletByExtendedPublicKey(
1387-
{ extendedPublicKey }
1388-
);
1380+
const extendedPublicKey = await this._requestExtendedPublicKey(
1381+
devicePath,
1382+
walletId,
1383+
address
1384+
);
1385+
const associatedWallet = await this._findAssociatedWalletByExtendedPublicKey(
1386+
{ extendedPublicKey }
1387+
);
13891388

1390-
if (associatedWallet) {
1391-
await this._storeWalletDataInLocalStorageAndHandleTransactionOrAddressVerificationOrRouting(
1392-
{
1393-
address,
1394-
associatedWallet,
1395-
expectedWalletId: walletId,
1396-
extendedPublicKey,
1397-
path: devicePath,
1398-
}
1399-
);
1400-
} else {
1401-
logger.debug(
1402-
'[HW-DEBUG] HWStore - Software wallet not recognized - Setting error states'
1403-
);
1404-
this._discardConnectedDeviceAndReInitiateAddressVerification({
1389+
if (associatedWallet) {
1390+
await this._storeWalletDataInLocalStorageAndHandleTransactionOrAddressVerificationOrRouting(
1391+
{
14051392
address,
1406-
walletId,
1407-
});
1408-
}
1409-
} catch (e) {
1410-
await this.resetWalletPairing();
1411-
throw e;
1393+
associatedWallet,
1394+
expectedWalletId: walletId,
1395+
extendedPublicKey,
1396+
path: devicePath,
1397+
}
1398+
);
1399+
} else {
1400+
logger.debug(
1401+
'[HW-DEBUG] HWStore - Software wallet not recognized - Setting error states'
1402+
);
1403+
this._discardConnectedDeviceAndReInitiateAddressVerification({
1404+
address,
1405+
walletId,
1406+
});
14121407
}
14131408
} else {
14141409
logger.debug('[HW-DEBUG] Verify Address with Ledger: ', {
@@ -2771,40 +2766,35 @@ export default class HardwareWalletsStore extends Store {
27712766
}
27722767
);
27732768

2774-
try {
2775-
const extendedPublicKey = await this._requestExtendedPublicKey(
2776-
transportDevice.path,
2777-
walletId
2769+
const extendedPublicKey = await this._requestExtendedPublicKey(
2770+
transportDevice.path,
2771+
walletId
2772+
);
2773+
const associatedWallet = await this._findAssociatedWalletByExtendedPublicKey(
2774+
{ extendedPublicKey }
2775+
);
2776+
2777+
if (associatedWallet) {
2778+
await this._storeWalletDataInLocalStorageAndHandleTransactionOrAddressVerificationOrRouting(
2779+
{
2780+
associatedWallet,
2781+
expectedWalletId: walletId,
2782+
extendedPublicKey,
2783+
path: transportDevice.path,
2784+
}
27782785
);
2779-
const associatedWallet = await this._findAssociatedWalletByExtendedPublicKey(
2780-
{ extendedPublicKey }
2786+
} else {
2787+
const deviceId =
2788+
extendedPublicKey.deviceId || this.transportDevice.deviceId;
2789+
logger.debug(
2790+
'[HW-DEBUG] HWStore - I don not have recognized wallet - reject TX: ',
2791+
{
2792+
deviceId,
2793+
}
27812794
);
27822795

2783-
if (associatedWallet) {
2784-
await this._storeWalletDataInLocalStorageAndHandleTransactionOrAddressVerificationOrRouting(
2785-
{
2786-
associatedWallet,
2787-
expectedWalletId: walletId,
2788-
extendedPublicKey,
2789-
path: transportDevice.path,
2790-
}
2791-
);
2792-
} else {
2793-
const deviceId =
2794-
extendedPublicKey.deviceId || this.transportDevice.deviceId;
2795-
logger.debug(
2796-
'[HW-DEBUG] HWStore - I don not have recognized wallet - reject TX: ',
2797-
{
2798-
deviceId,
2799-
}
2800-
);
2801-
2802-
// Software Wallet not recognized and TX initiated. Show error
2803-
this._discardConnectedDeviceAndReInitiateTransaction({ walletId });
2804-
}
2805-
} catch (e) {
2806-
await this.resetWalletPairing();
2807-
throw e;
2796+
// Software Wallet not recognized and TX initiated. Show error
2797+
this._discardConnectedDeviceAndReInitiateTransaction({ walletId });
28082798
}
28092799
}
28102800
} else {

yarn.lock

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3155,10 +3155,6 @@
31553155
version "1.0.0"
31563156
resolved "https://registry.yarnpkg.com/@types/is-function/-/is-function-1.0.0.tgz#1b0b819b1636c7baf0d6785d030d12edf70c3e83"
31573157

3158-
"@types/istanbul-lib-coverage@*":
3159-
version "2.0.4"
3160-
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44"
3161-
31623158
"@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
31633159
version "2.0.3"
31643160
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762"
@@ -13558,14 +13554,7 @@ promise@^7.1.1:
1355813554
dependencies:
1355913555
asap "~2.0.3"
1356013556

13561-
13562-
version "2.4.2"
13563-
resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069"
13564-
dependencies:
13565-
kleur "^3.0.3"
13566-
sisteransi "^1.0.5"
13567-
13568-
prompts@^2.0.1:
13557+
[email protected], prompts@^2.0.1:
1356913558
version "2.4.2"
1357013559
resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069"
1357113560
dependencies:

0 commit comments

Comments
 (0)