Info box and dependency update

This commit is contained in:
Aleksander Rem 2022-01-23 19:24:47 +01:00
commit 53e7bf8b90
5 changed files with 21652 additions and 312 deletions

View file

@ -64,7 +64,7 @@ export class LedgerService {
// Open a connection to the usb device and initialize up the Nano Ledger library
async loadTransport(bluetooth: boolean) {
return new Promise((resolve, reject) => {
const transport: typeof Transport = bluetooth ? TransportNodeBle : TransportNodeHid;
const transport = bluetooth ? TransportNodeBle : TransportNodeHid;
let found = false;
const sub = transport.listen({
@ -72,7 +72,7 @@ export class LedgerService {
found = true;
if (sub) sub.unsubscribe();
this.ledger.transport = await transport.open(e.descriptor, 3000);
this.ledger.transport = await transport.open(e.descriptor);
this.ledger.transport.setExchangeTimeout(this.waitTimeout); // 5 minutes
this.ledger.nano = new Nano(this.ledger.transport);
resolve(this.ledger.transport);
@ -84,16 +84,6 @@ export class LedgerService {
}
}
})
// transport.create(undefined, undefined).then(trans => {
// // LedgerLogs.listen((log) => console.log(`Ledger: ${log.type}: ${log.message}`))
// this.ledger.transport = trans;
// this.ledger.transport.setExchangeTimeout(this.waitTimeout); // 5 minutes
// this.ledger.nano = new Nano(this.ledger.transport);
// resolve(this.ledger.transport);
// }).catch(reject);
});
}
@ -236,10 +226,9 @@ export class LedgerService {
} catch (err) {
if (err.statusCode === STATUS_CODES.SECURITY_STATUS_NOT_SATISFIED) {
this.setLedgerStatus(LedgerStatus.LOCKED, `Ledger device locked`);
return;
// Stop polling when ledger is locked...? or keep going?
} else {
this.setLedgerStatus(LedgerStatus.NOT_CONNECTED, `Ledger Disconnected: ${err.message || err }`);
}
this.setLedgerStatus(LedgerStatus.NOT_CONNECTED, `Ledger Disconnected: ${err.message || err }`);
this.pollingLedger = false;
}
}

21917
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -40,8 +40,8 @@
"@angular/router": "^10.0.7",
"@angular/service-worker": "^10.2.5",
"@ledgerhq/hw-transport": "^5.51.1",
"@ledgerhq/hw-transport-node-ble": "^5.51.1",
"@ledgerhq/hw-transport-node-hid": "^5.51.1",
"@ledgerhq/hw-transport-node-ble": "^6.20.0",
"@ledgerhq/hw-transport-node-hid": "^6.20.0",
"@ledgerhq/hw-transport-u2f": "^5.34.0",
"@ledgerhq/hw-transport-web-ble": "^5.51.1",
"@ledgerhq/hw-transport-webhid": "^5.51.1",

View file

@ -1,7 +1,7 @@
<h2 class="uk-heading-divider">Configure Wallet</h2>
<div *ngIf="isConfigured() && !walletService.isLedgerWallet() && (activePanel === panels.landing || activePanel === panels.import || activePanel === panels.mnemonicTypeSelection)" class="uk-margin-small-bottom">
<div class="uk-alert uk-alert-danger nlt-inline-alert">
<div *ngIf="isConfigured() && (activePanel === panels.landing || activePanel === panels.import || activePanel === panels.mnemonicTypeSelection)" class="uk-margin-small-bottom">
<div *ngIf="!walletService.isLedgerWallet()" class="uk-alert uk-alert-danger nlt-inline-alert">
<div class="icon-column">
<div uk-icon="icon: warning; ratio: 2;"></div>
</div>
@ -11,6 +11,15 @@
Without it, <b>any funds you have will become completely unrecoverable!</b>
</p>
</div>
<div *ngIf="walletService.isLedgerWallet()" class="uk-alert uk-alert-info nlt-inline-alert">
<div class="icon-column">
<div uk-icon="icon: info; ratio: 2;"></div>
</div>
<p>
<b>You are about to configure a new wallet, which will disconnect your Ledger device from Nault</b><br>
If you need to use the Ledger wallet later, simply import your device again.
</p>
</div>
</div>
<div class="uk-card uk-card-default wallet-setup-card" *ngIf="activePanel === panels.landing">
@ -366,7 +375,7 @@
</div>
</div>
</div>
<div *ngIf="ledgerService.isDesktop && !ledgerService.supportsBluetooth">
<div *ngIf="ledgerService.isDesktop && !ledgerService.supportsBluetooth && ledger.status === ledgerStatus.NOT_CONNECTED">
<div class="uk-alert uk-alert-danger nlt-inline-alert">
<div class="icon-column">
<div uk-icon="icon: warning; ratio: 2;"></div>

View file

@ -189,14 +189,11 @@ export class ConfigureWalletComponent implements OnInit {
if (!this.isConfigured()) return true;
const UIkit = window['UIkit'];
let msg;
try {
if (this.walletService.isLedgerWallet()) {
msg = '<p class="uk-alert uk-alert-danger"><br><span class="uk-flex"><span uk-icon="icon: warning; ratio: 3;" class="uk-align-center"></span></span><span style="font-size: 18px;">You are about to configure a new wallet, which will <b>disconnect your Ledger device from Nault</b>.</span><br><br>If you need to use the Ledger wallet, simply import your device again.<br><br><b style="font-size: 18px;">Make sure you have saved the recovery phrase you got when initially setting up your Ledger device</b>.<br><br><span style="font-size: 18px;"><b>YOU WILL NOT BE ABLE TO RECOVER THE FUNDS</b><br>if you lose both the recovery phrase and access to your Ledger device.</span></p><br>';
} else {
msg = '<p class="uk-alert uk-alert-danger"><br><span class="uk-flex"><span uk-icon="icon: warning; ratio: 3;" class="uk-align-center"></span></span><span style="font-size: 18px;">You are about to configure a new wallet, which will <b>replace your currently configured wallet</b>.</span><br><br><b style="font-size: 18px;">' + this.translocoService.translate('reset-wallet.before-continuing-make-sure-you-have-saved-the-nano-seed') + '</b><br><br><b style="font-size: 18px;">' + this.translocoService.translate('reset-wallet.you-will-not-be-able-to-recover-the-funds-without-a-backup') + '</b></p><br>';
if (!this.walletService.isLedgerWallet()) {
const msg = '<p class="uk-alert uk-alert-danger"><br><span class="uk-flex"><span uk-icon="icon: warning; ratio: 3;" class="uk-align-center"></span></span><span style="font-size: 18px;">You are about to configure a new wallet, which will <b>replace your currently configured wallet</b>.</span><br><br><b style="font-size: 18px;">' + this.translocoService.translate('reset-wallet.before-continuing-make-sure-you-have-saved-the-nano-seed') + '</b><br><br><b style="font-size: 18px;">' + this.translocoService.translate('reset-wallet.you-will-not-be-able-to-recover-the-funds-without-a-backup') + '</b></p><br>';
await UIkit.modal.confirm(msg);
}
await UIkit.modal.confirm(msg);
return true;
} catch (err) {
if (!this.walletService.isLedgerWallet()) {