diff --git a/package-lock.json b/package-lock.json index 8d31e175c..5fff04f7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "kukai", - "version": "1.8.0", + "version": "1.8.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3802,62 +3802,6 @@ } } }, - "@ledgerhq/hw-transport-webauthn": { - "version": "5.19.0", - "resolved": "https://registry.npmjs.org/@ledgerhq/hw-transport-webauthn/-/hw-transport-webauthn-5.19.0.tgz", - "integrity": "sha512-PCF88Si/4OH7NhhEDNGtwZFtknKioFhYQS8b2VHdb+7rx8q0CY3sLJXvTd1PzhoQm6C53G4YZX0gT0/EYBnTBg==", - "requires": { - "@ledgerhq/devices": "^5.19.0", - "@ledgerhq/errors": "^5.19.0", - "@ledgerhq/hw-transport": "^5.19.0", - "@ledgerhq/logs": "^5.19.0" - }, - "dependencies": { - "@ledgerhq/devices": { - "version": "5.19.0", - "resolved": "https://registry.npmjs.org/@ledgerhq/devices/-/devices-5.19.0.tgz", - "integrity": "sha512-b8isGErLpGOYnAIswav54j7EWmynTQOvnXriny3eqgzpLt8HOJ9g+C6+67RDzFidwz+5RZW+Qn+ZWAQ3Xo5e/g==", - "requires": { - "@ledgerhq/errors": "^5.19.0", - "@ledgerhq/logs": "^5.19.0", - "rxjs": "^6.6.0" - } - }, - "@ledgerhq/errors": { - "version": "5.19.0", - "resolved": "https://registry.npmjs.org/@ledgerhq/errors/-/errors-5.19.0.tgz", - "integrity": "sha512-UrRS1xZ/UidIrGyM+h/T/h57DpiFgfqMtlu5VBic1LbekNUojBPx0cMb099p07uyEwKggfawzbdLmxv4j9Ct+g==" - }, - "@ledgerhq/hw-transport": { - "version": "5.19.0", - "resolved": "https://registry.npmjs.org/@ledgerhq/hw-transport/-/hw-transport-5.19.0.tgz", - "integrity": "sha512-MpIut+ZX88PPKmiqX+Df1lch930/Io0SqvjNPtXbYSg1SVZjxW8t85OuAwzukkaXr3tfUTb6IFlSHKC+QYCSBA==", - "requires": { - "@ledgerhq/devices": "^5.19.0", - "@ledgerhq/errors": "^5.19.0", - "events": "^3.1.0" - } - }, - "@ledgerhq/logs": { - "version": "5.19.0", - "resolved": "https://registry.npmjs.org/@ledgerhq/logs/-/logs-5.19.0.tgz", - "integrity": "sha512-gShImyBi0UQUc3Oo3nNwhGDovo1SNRKZYkhA2OKgeUe7PPiKBGuRqfD+cCvvgxcaoTbWlRYeOWbtShnRLRT8HA==" - }, - "events": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz", - "integrity": "sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg==" - }, - "rxjs": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.0.tgz", - "integrity": "sha512-3HMA8z/Oz61DUHe+SdOiQyzIf4tOx5oQHmMir7IZEu6TMqCLHT4LRcmNaUS0NwOz8VLvmmBduMsoaUvMaIiqzg==", - "requires": { - "tslib": "^1.9.0" - } - } - } - }, "@ledgerhq/logs": { "version": "4.68.2", "resolved": "https://registry.npmjs.org/@ledgerhq/logs/-/logs-4.68.2.tgz", diff --git a/package.json b/package.json index 7d3c220ea..895c2a6db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kukai", - "version": "1.8.0", + "version": "1.8.2", "license": "MIT", "scripts": { "ng": "ng", @@ -9,7 +9,7 @@ "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", - "stage-ghpages-mainnet": "ng lint --fix && ng build --prod && angular-cli-ghpages --repo \"git@github.com:kukai-wallet/kukai-wallet.github.io.git\" --branch staging", + "stage-ghpages-mainnet": "ng lint --fix && ng build --prod && angular-cli-ghpages --repo \"git@github.com:kukai-wallet/wallet.git\" --branch staging", "stage-ghpages-testnet": "ng lint --fix && ng build --prod && angular-cli-ghpages --repo \"git@github.com:kukai-wallet/testnet.git\" --branch staging", "deploy-preview-version": "ng lint --fix && ng build --prod && angular-cli-ghpages --repo \"git@github.com:kukai-wallet/preview.git\" --branch master", "deploy-beta-version": "ng lint --fix && ng build --prod && angular-cli-ghpages --repo \"git@github.com:kukai-wallet/beta.git\" --branch master" @@ -27,7 +27,6 @@ "@angular/platform-browser-dynamic": "^9.1.1", "@angular/router": "^9.1.1", "@ledgerhq/hw-transport-u2f": "^5.19.0", - "@ledgerhq/hw-transport-webauthn": "^5.19.0", "@ng-bootstrap/ng-bootstrap": "^5.1.0", "@ngx-translate/core": "11.0.1", "@ngx-translate/http-loader": "4.0.0", diff --git a/releasenotes.md b/releasenotes.md index dbd6eda4b..76a1c9504 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,4 +1,7 @@ # Release notes +## 1.8.2 +* Various bug fixes and improvements in the send modal +* Remove webauthn due to incompatability with Safari ## 1.8.1 * Add support for manager.tz undelegation * Add error pages and fix routing diff --git a/src/app/components/send/send.component.html b/src/app/components/send/send.component.html index 56b315c03..448809aee 100644 --- a/src/app/components/send/send.component.html +++ b/src/app/components/send/send.component.html @@ -25,7 +25,7 @@

Send tez

Fee: Fee & storage cost: - {{ getTotalCost() }}

+ {{ getTotalCost(true) }}

@@ -59,13 +59,13 @@

Send tez

- +
- +
diff --git a/src/app/components/send/send.component.ts b/src/app/components/send/send.component.ts index ca3587875..a27b41f3f 100644 --- a/src/app/components/send/send.component.ts +++ b/src/app/components/send/send.component.ts @@ -170,7 +170,7 @@ export class SendComponent implements OnInit { this.messageService.startSpinner('Signing transaction...'); let keys; try { - keys = await this.walletService.getKeys(pwd, this.activeAccount.address); + keys = await this.walletService.getKeys(pwd, this.activeAccount.pkh); } catch { this.messageService.stopSpinner(); } @@ -220,19 +220,21 @@ export class SendComponent implements OnInit { updateMaxAmount() { if (this.sendMax) { const max = this.maxToSend(this.activeAccount); + let maxAmount = '0'; if (max.length && max.slice(0, 1) !== '-') { - this.amount = max; - } else { - this.amount = '0'; + maxAmount = max; + } + if (this.amount !== maxAmount) { + this.amount = maxAmount; } } } maxToSend(account: Account): string { if (account && (account instanceof ImplicitAccount)) { let accountBalance = Big(account.balanceXTZ).div(1000000); - accountBalance = accountBalance.minus(this.fee ? Number(this.fee) : this.defaultTransactionParams.fee); + accountBalance = accountBalance.minus(this.fee && Number(this.fee) ? Number(this.fee) : this.defaultTransactionParams.fee); if (!this.isMultipleDestinations) { - accountBalance = accountBalance.minus(this.storage ? Number(this.storage) / 1000 : this.defaultTransactionParams.burn); + accountBalance = accountBalance.minus(this.storage && Number(this.storage) ? Number(this.storage) / 1000 : this.defaultTransactionParams.burn); } else { accountBalance = accountBalance.minus(this.defaultTransactionParams.burn); } @@ -454,6 +456,7 @@ export class SendComponent implements OnInit { if (res) { console.log(res); this.defaultTransactionParams = res; + this.updateMaxAmount(); } this.latestSimError = ''; this.formInvalid = ''; @@ -471,6 +474,7 @@ export class SendComponent implements OnInit { this.latestSimError = prevSimError; if (this.isMultipleDestinations ? !this.toMultipleDestinationsString : !this.toPkh) { this.defaultTransactionParams = zeroTxParams; + this.updateMaxAmount(); this.prevEquiClass = ''; } } @@ -522,7 +526,7 @@ export class SendComponent implements OnInit { if (!this.inputValidationService.address(toPkh) || toPkh === this.activeAccount.address) { return this.translate.instant('SENDCOMPONENT.INVALIDRECEIVERADDRESS'); } else if (!this.inputValidationService.amount(amount) || - (finalCheck && (amount === '0' || amount === ''))) { + (finalCheck && (((amount === '0') || amount === '') && (toPkh.slice(0, 3) !== 'KT1')))) { return this.translate.instant('SENDCOMPONENT.INVALIDAMOUNT'); } else if (!this.inputValidationService.gas(this.gas)) { return this.translate.instant('SENDCOMPONENT.INVALIDGASLIMIT'); @@ -583,22 +587,22 @@ export class SendComponent implements OnInit { } return totalSent.toString(); } - getTotalCost(): string { + getTotalCost(display: boolean = false): string { const totalFee = Big(this.getTotalFee()).plus(Big(this.getTotalBurn())).toString(); - setTimeout(() => { - this.updateMaxAmount(); - }, 100); + if (display && totalFee === '0') { + return '-'; + } return totalFee; } getTotalFee(): number { - if (this.fee !== '') { + if (this.fee !== '' && Number(this.fee)) { return Number(this.fee); } return Number(this.defaultTransactionParams.fee); } getTotalBurn(): number { - if (this.storage) { - return (Number(this.storage) * this.transactions.length) / 1000; + if (this.storage !== '' && Number(this.storage)) { + return Number(Big(this.storage).mul(this.transactions.length).div('1000').toString()); } return Number(this.defaultTransactionParams.burn); } diff --git a/src/app/services/estimate/estimate.service.spec.ts b/src/app/services/estimate/estimate.service.spec.ts index 0d31fd6dc..30fdb1b00 100644 --- a/src/app/services/estimate/estimate.service.spec.ts +++ b/src/app/services/estimate/estimate.service.spec.ts @@ -52,7 +52,7 @@ describe('EstimateService', () => { gasLimit: 10287, storageLimit: 257 }], - fee: 0.003988, + fee: 0.003991, burn: 0.257, gas: 11980, storage: 86, diff --git a/src/app/services/estimate/estimate.service.ts b/src/app/services/estimate/estimate.service.ts index 052f4d97d..c3b40790f 100644 --- a/src/app/services/estimate/estimate.service.ts +++ b/src/app/services/estimate/estimate.service.ts @@ -48,7 +48,7 @@ export class EstimateService { storageLimit: 60000 }; for (const tx of transactions) { - if (!invoke) { + if (tx.to.slice(0, 3) !== 'KT1') { tx.amount = 0.000001; } tx.gasLimit = simulation.gasLimit; diff --git a/src/app/services/import/import.service.spec.ts b/src/app/services/import/import.service.spec.ts index 3c8093f29..5dd9a4b72 100644 --- a/src/app/services/import/import.service.spec.ts +++ b/src/app/services/import/import.service.spec.ts @@ -209,7 +209,7 @@ describe('[ ImportService ]', () => { describe('> Legacy v3', async () => { beforeEach(() => { spyOn(conseil, 'getContractAddresses').and.callFake(async function(address: string) { - if (address.slice(0,2) === 'tz') { + if (address.slice(0, 2) === 'tz') { return ['KT1KwPDCVmkrXQ2ZKWhVAiiFzYxiXCEyhE7U']; } else { return []; diff --git a/src/app/services/ledger/ledger.service.ts b/src/app/services/ledger/ledger.service.ts index 87e615211..f8e7e7e2a 100644 --- a/src/app/services/ledger/ledger.service.ts +++ b/src/app/services/ledger/ledger.service.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import 'babel-polyfill'; import TransportU2F from '@ledgerhq/hw-transport-u2f'; -import TransportWebAuthn from '@ledgerhq/hw-transport-webauthn'; import Tezos from '@obsidiansystems/hw-app-xtz'; import { OperationService } from '../operation/operation.service'; import { MessageService } from '../message/message.service'; @@ -14,9 +13,7 @@ export class LedgerService { constructor( private operationService: OperationService, private messageService: MessageService - ) { - this.setTransport(); - } + ) {} async setTransport() { if (!this.transport) { console.log('Trying to use U2F for transport...'); @@ -27,15 +24,6 @@ export class LedgerService { console.log('Couldn\'t use U2F for transport!'); } } - if (!this.transport) { - console.log('Trying to use WebAuthn for transport...'); - try { - this.transport = await TransportWebAuthn.create(); - console.log('Transport is now set to use WebAuthn!'); - } catch (e) { - console.log('Couldn\'t use WebAuthn for transport!'); - } - } } async transportCheck() { if (!this.transport) {