diff --git a/.electrify/package-lock.json b/.electrify/package-lock.json index 3ea41b04..811bff57 100644 --- a/.electrify/package-lock.json +++ b/.electrify/package-lock.json @@ -1,6 +1,6 @@ { "name": "QRLWallet", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/.electrify/package.json b/.electrify/package.json index 2348e95b..82c4086a 100644 --- a/.electrify/package.json +++ b/.electrify/package.json @@ -2,7 +2,7 @@ "name": "QRLWallet", "productName": "QRLWallet", "projectName": "qrl-wallet", - "version": "1.1.0", + "version": "1.1.1", "main": "index.js", "dependencies": { "electrify-qrl": "0.2.3", diff --git a/imports/startup/both/index.js b/imports/startup/both/index.js index 06e4c5d9..e3aed6de 100644 --- a/imports/startup/both/index.js +++ b/imports/startup/both/index.js @@ -5,7 +5,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './nodes.js' @@ -13,10 +13,7 @@ import './nodes.js' SHOR_PER_QUANTA = 1000000000 // qrl-wallet Version -WALLET_VERSION = '1.1.0' - -// Ledger Timeout -LEDGER_TIMEOUT = 29000 +WALLET_VERSION = '1.1.1' // qrl.proto sha256 sum for each release of QRL Node QRLPROTO_SHA256 = [ diff --git a/imports/startup/client/functions.js b/imports/startup/client/functions.js index 2d2d54e6..f185ac76 100644 --- a/imports/startup/client/functions.js +++ b/imports/startup/client/functions.js @@ -4,7 +4,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import aes256 from 'aes256' import qrlAddressValdidator from '@theqrl/validate-qrl-address' diff --git a/imports/startup/client/index.js b/imports/startup/client/index.js index b525704c..8f308d66 100644 --- a/imports/startup/client/index.js +++ b/imports/startup/client/index.js @@ -4,7 +4,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import { QRLLIB } from 'qrllib/build/web-libjsqrl.js' // eslint-disable-line import './routes.js' diff --git a/imports/startup/server/index.js b/imports/startup/server/index.js index d836766e..8dc62da8 100644 --- a/imports/startup/server/index.js +++ b/imports/startup/server/index.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import { Meteor } from 'meteor/meteor' import { check } from 'meteor/check' diff --git a/imports/ui/pages/close/close.js b/imports/ui/pages/close/close.js index 38f87834..393a44eb 100644 --- a/imports/ui/pages/close/close.js +++ b/imports/ui/pages/close/close.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './close.html' diff --git a/imports/ui/pages/create/address.js b/imports/ui/pages/create/address.js index 10e96e33..f8ea0757 100644 --- a/imports/ui/pages/create/address.js +++ b/imports/ui/pages/create/address.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import aes256 from 'aes256' import './address.html' diff --git a/imports/ui/pages/create/create.js b/imports/ui/pages/create/create.js index a5327773..0b0bff73 100644 --- a/imports/ui/pages/create/create.js +++ b/imports/ui/pages/create/create.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './create.html' diff --git a/imports/ui/pages/open/open.js b/imports/ui/pages/open/open.js index c586e094..39a04e09 100644 --- a/imports/ui/pages/open/open.js +++ b/imports/ui/pages/open/open.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import aes256 from 'aes256' import async from 'async' @@ -100,18 +100,11 @@ function getLedgerLibraryVersion(callback) { } } -// Wrap ledger calls in async.timeout -const getLedgerStateWrapper = async.timeout(getLedgerState, LEDGER_TIMEOUT) -const getLedgerPubkeyWrapper = async.timeout(getLedgerPubkey, LEDGER_TIMEOUT) -const getLedgerVersionWrapper = async.timeout(getLedgerVersion, LEDGER_TIMEOUT) -const getLedgerLibraryVersionWrapper = async.timeout(getLedgerLibraryVersion, LEDGER_TIMEOUT) - - function refreshLedger() { // Clear Ledger State clearLedgerDetails() - getLedgerStateWrapper(function (err, data) { + getLedgerState(function (err, data) { if (err) { // We timed out requesting data from ledger $('#readingLedger').hide() @@ -133,7 +126,7 @@ function refreshLedger() { async.during( // Truth function - check if current generation height < 256 function (callback) { - getLedgerStateWrapper(function (stateErr, stateData) { //eslint-disable-line + getLedgerState(function (stateErr, stateData) { //eslint-disable-line if (stateErr) { // Device unplugged? $('#ledgerKeysGeneratingError').hide() @@ -165,7 +158,7 @@ function refreshLedger() { async.waterfall([ // Get the public key from the ledger so we can determine Q address function (cb) { - getLedgerPubkeyWrapper(function (pubErr, pubData) { // eslint-disable-line + getLedgerPubkey(function (pubErr, pubData) { // eslint-disable-line if (pubErr) { // We timed out requesting data from ledger $('#readingLedger').hide() @@ -177,13 +170,13 @@ function refreshLedger() { }, // Get the Ledger Device app version function (cb) { - getLedgerVersionWrapper(function (data) { + getLedgerVersion(function (data) { cb() }) }, // Get the local QrlLedger JS library version function (cb) { - getLedgerLibraryVersionWrapper(function(data) { + getLedgerLibraryVersion(function(data) { cb() }) }, @@ -212,7 +205,7 @@ function refreshLedger() { }) // waitForQRLLIB } // device state check } // if(err) else - }) // getLedgerStateWrapper + }) // getLedgerState } function updateWalletType() { diff --git a/imports/ui/pages/tokens/tokenCreate.js b/imports/ui/pages/tokens/tokenCreate.js index 960a2fef..76d8478d 100644 --- a/imports/ui/pages/tokens/tokenCreate.js +++ b/imports/ui/pages/tokens/tokenCreate.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './tokenCreate.html' import { BigNumber } from 'bignumber.js' diff --git a/imports/ui/pages/tokens/tokenCreateConfirm.js b/imports/ui/pages/tokens/tokenCreateConfirm.js index 3fa9b09e..04136f89 100644 --- a/imports/ui/pages/tokens/tokenCreateConfirm.js +++ b/imports/ui/pages/tokens/tokenCreateConfirm.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './tokenCreateConfirm.html' import helpers from '@theqrl/explorer-helpers' diff --git a/imports/ui/pages/tokens/tokenCreateResult.js b/imports/ui/pages/tokens/tokenCreateResult.js index 4e3f4452..98d4a8ae 100644 --- a/imports/ui/pages/tokens/tokenCreateResult.js +++ b/imports/ui/pages/tokens/tokenCreateResult.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import JSONFormatter from 'json-formatter-js' import './tokenCreateResult.html' diff --git a/imports/ui/pages/tools/keybase/keybaseConfirm.html b/imports/ui/pages/tools/keybase/keybaseConfirm.html index 49b1f8c2..724c2099 100644 --- a/imports/ui/pages/tools/keybase/keybaseConfirm.html +++ b/imports/ui/pages/tools/keybase/keybaseConfirm.html @@ -54,6 +54,10 @@

Timed out waiting for response from Ledger Nano. To save an OTS Key, you should reject the transaction on your Ledger and try again.

+ + diff --git a/imports/ui/pages/tools/keybase/keybaseConfirm.js b/imports/ui/pages/tools/keybase/keybaseConfirm.js index 5468891a..e1780d16 100644 --- a/imports/ui/pages/tools/keybase/keybaseConfirm.js +++ b/imports/ui/pages/tools/keybase/keybaseConfirm.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import async from 'async' import './keybaseConfirm.html' @@ -41,10 +41,6 @@ function getLedgerRetrieveSignature(request, callback) { } } -// Wrap ledger calls in async.timeout -const getLedgerCreateMessageTxWrapper = async.timeout(getLedgerCreateMessageTx, LEDGER_TIMEOUT) -const getLedgerRetrieveSignatureWrapper = async.timeout(getLedgerRetrieveSignature, LEDGER_TIMEOUT) - function confirmKeybaseCreation() { const tx = Session.get('messageCreationConfirmationResponse') @@ -119,6 +115,7 @@ function confirmKeybaseCreation() { $('#awaitingLedgerConfirmation').show() $('#signOnLedgerRejected').hide() $('#signOnLedgerTimeout').hide() + $('#signOnLedgerError').hide() $('#ledgerHasConfirmed').hide() $('#relayLedgerTxnButton').hide() $('#noRemainingSignatures').hide() @@ -162,8 +159,8 @@ function confirmKeybaseCreation() { const fee = toBigendianUint64BytesUnsigned(tx.extended_transaction_unsigned.tx.fee, true) // eslint-disable-next-line max-len - getLedgerCreateMessageTxWrapper(sourceAddr, fee, Buffer.from(tx.extended_transaction_unsigned.tx.message.message_hash), function (err, txn) { - getLedgerRetrieveSignatureWrapper(txn, function (err, sigResponse) { + getLedgerCreateMessageTx(sourceAddr, fee, Buffer.from(tx.extended_transaction_unsigned.tx.message.message_hash), function (err, txn) { + getLedgerRetrieveSignature(txn, function (err, sigResponse) { // Hide the awaiting ledger confirmation spinner $('#awaitingLedgerConfirmation').hide() @@ -177,6 +174,9 @@ function confirmKeybaseCreation() { // Check if the the request timed out waiting for response on ledger } else if (sigResponse.return_code === 14) { $('#signOnLedgerTimeout').show() + // Check for unknown errors + } else if ((sigResponse.return_code === 1) && (sigResponse.error_message == "Unknown error code")) { + $('#signOnLedgerError').show() } else { // Show confirmation message $('#ledgerHasConfirmed').show() diff --git a/imports/ui/pages/tools/keybase/keybaseCreate.js b/imports/ui/pages/tools/keybase/keybaseCreate.js index 2dd5c6fe..d1d36c61 100644 --- a/imports/ui/pages/tools/keybase/keybaseCreate.js +++ b/imports/ui/pages/tools/keybase/keybaseCreate.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './keybaseCreate.html' diff --git a/imports/ui/pages/tools/keybase/keybaseResult.js b/imports/ui/pages/tools/keybase/keybaseResult.js index 7d6775f5..14540432 100644 --- a/imports/ui/pages/tools/keybase/keybaseResult.js +++ b/imports/ui/pages/tools/keybase/keybaseResult.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import JSONFormatter from 'json-formatter-js' import './keybaseResult.html' diff --git a/imports/ui/pages/tools/message/messageConfirm.html b/imports/ui/pages/tools/message/messageConfirm.html index d1bf0af5..f96e2ebd 100644 --- a/imports/ui/pages/tools/message/messageConfirm.html +++ b/imports/ui/pages/tools/message/messageConfirm.html @@ -54,6 +54,10 @@

Timed out waiting for response from Ledger Nano. To save an OTS Key, you should reject the transaction on your Ledger and try again.

+ + diff --git a/imports/ui/pages/tools/message/messageConfirm.js b/imports/ui/pages/tools/message/messageConfirm.js index ec79f3e0..24537a30 100644 --- a/imports/ui/pages/tools/message/messageConfirm.js +++ b/imports/ui/pages/tools/message/messageConfirm.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import async from 'async' import './messageConfirm.html' @@ -41,10 +41,6 @@ function getLedgerRetrieveSignature(request, callback) { } } -// Wrap ledger calls in async.timeout -const getLedgerCreateMessageTxWrapper = async.timeout(getLedgerCreateMessageTx, LEDGER_TIMEOUT) -const getLedgerRetrieveSignatureWrapper = async.timeout(getLedgerRetrieveSignature, LEDGER_TIMEOUT) - function confirmMessageCreation() { const tx = Session.get('messageCreationConfirmationResponse') @@ -111,6 +107,7 @@ function confirmMessageCreation() { $('#awaitingLedgerConfirmation').show() $('#signOnLedgerRejected').hide() $('#signOnLedgerTimeout').hide() + $('#signOnLedgerError').hide() $('#ledgerHasConfirmed').hide() $('#relayLedgerTxnButton').hide() $('#noRemainingSignatures').hide() @@ -154,8 +151,8 @@ function confirmMessageCreation() { const fee = toBigendianUint64BytesUnsigned(tx.extended_transaction_unsigned.tx.fee, true) // eslint-disable-next-line max-len - getLedgerCreateMessageTxWrapper(sourceAddr, fee, Buffer.from(tx.extended_transaction_unsigned.tx.message.message_hash), function (err, txn) { - getLedgerRetrieveSignatureWrapper(txn, function (err, sigResponse) { + getLedgerCreateMessageTx(sourceAddr, fee, Buffer.from(tx.extended_transaction_unsigned.tx.message.message_hash), function (err, txn) { + getLedgerRetrieveSignature(txn, function (err, sigResponse) { // Hide the awaiting ledger confirmation spinner $('#awaitingLedgerConfirmation').hide() @@ -170,6 +167,9 @@ function confirmMessageCreation() { // Check if the the request timed out waiting for response on ledger } else if (sigResponse.return_code === 14) { $('#signOnLedgerTimeout').show() + // Check for unknown errors + } else if ((sigResponse.return_code === 1) && (sigResponse.error_message == "Unknown error code")) { + $('#signOnLedgerError').show() } else { // Show confirmation message $('#ledgerHasConfirmed').show() diff --git a/imports/ui/pages/tools/message/messageCreate.js b/imports/ui/pages/tools/message/messageCreate.js index acb90108..5ed96610 100644 --- a/imports/ui/pages/tools/message/messageCreate.js +++ b/imports/ui/pages/tools/message/messageCreate.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './messageCreate.html' diff --git a/imports/ui/pages/tools/message/messageResult.js b/imports/ui/pages/tools/message/messageResult.js index 255e988a..43e1eb49 100644 --- a/imports/ui/pages/tools/message/messageResult.js +++ b/imports/ui/pages/tools/message/messageResult.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import JSONFormatter from 'json-formatter-js' import './messageResult.html' diff --git a/imports/ui/pages/tools/notarise/confirm.html b/imports/ui/pages/tools/notarise/confirm.html index 00a8fe9a..cbaf30e6 100644 --- a/imports/ui/pages/tools/notarise/confirm.html +++ b/imports/ui/pages/tools/notarise/confirm.html @@ -54,6 +54,10 @@

Timed out waiting for response from Ledger Nano. To save an OTS Key, you should reject the transaction on your Ledger and try again.

+ + diff --git a/imports/ui/pages/tools/notarise/confirm.js b/imports/ui/pages/tools/notarise/confirm.js index 661564d9..de40c940 100644 --- a/imports/ui/pages/tools/notarise/confirm.js +++ b/imports/ui/pages/tools/notarise/confirm.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import async from 'async' import './confirm.html' @@ -41,10 +41,6 @@ function getLedgerRetrieveSignature(request, callback) { } } -// Wrap ledger calls in async.timeout -const getLedgerCreateMessageTxWrapper = async.timeout(getLedgerCreateMessageTx, LEDGER_TIMEOUT) -const getLedgerRetrieveSignatureWrapper = async.timeout(getLedgerRetrieveSignature, LEDGER_TIMEOUT) - function confirmMessageCreation() { const tx = Session.get('notariseCreationConfirmationResponse') @@ -111,6 +107,7 @@ function confirmMessageCreation() { $('#awaitingLedgerConfirmation').show() $('#signOnLedgerRejected').hide() $('#signOnLedgerTimeout').hide() + $('#signOnLedgerError').hide() $('#ledgerHasConfirmed').hide() $('#relayLedgerTxnButton').hide() $('#noRemainingSignatures').hide() @@ -154,8 +151,8 @@ function confirmMessageCreation() { const fee = toBigendianUint64BytesUnsigned(tx.extended_transaction_unsigned.tx.fee, true) // eslint-disable-next-line max-len - getLedgerCreateMessageTxWrapper(sourceAddr, fee, Buffer.from(tx.extended_transaction_unsigned.tx.message.message_hash), function (err, txn) { - getLedgerRetrieveSignatureWrapper(txn, function (err, sigResponse) { + getLedgerCreateMessageTx(sourceAddr, fee, Buffer.from(tx.extended_transaction_unsigned.tx.message.message_hash), function (err, txn) { + getLedgerRetrieveSignature(txn, function (err, sigResponse) { // Hide the awaiting ledger confirmation spinner $('#awaitingLedgerConfirmation').hide() @@ -169,6 +166,9 @@ function confirmMessageCreation() { // Check if the the request timed out waiting for response on ledger } else if (sigResponse.return_code === 14) { $('#signOnLedgerTimeout').show() + // Check for unknown errors + } else if ((sigResponse.return_code === 1) && (sigResponse.error_message == "Unknown error code")) { + $('#signOnLedgerError').show() } else { // Show confirmation message $('#ledgerHasConfirmed').show() diff --git a/imports/ui/pages/tools/notarise/result.js b/imports/ui/pages/tools/notarise/result.js index 1e1dcd2a..20e24f45 100644 --- a/imports/ui/pages/tools/notarise/result.js +++ b/imports/ui/pages/tools/notarise/result.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import JSONFormatter from 'json-formatter-js' import './result.html' diff --git a/imports/ui/pages/tools/notarise/start.js b/imports/ui/pages/tools/notarise/start.js index 9aa6d0cd..948c2a87 100644 --- a/imports/ui/pages/tools/notarise/start.js +++ b/imports/ui/pages/tools/notarise/start.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './start.html' import CryptoJS from 'crypto-js' diff --git a/imports/ui/pages/tools/tools.js b/imports/ui/pages/tools/tools.js index f92f02dd..bb49e806 100644 --- a/imports/ui/pages/tools/tools.js +++ b/imports/ui/pages/tools/tools.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './tools.html' diff --git a/imports/ui/pages/tools/xmssindex/update.js b/imports/ui/pages/tools/xmssindex/update.js index 5d42bfe9..dc8b886d 100644 --- a/imports/ui/pages/tools/xmssindex/update.js +++ b/imports/ui/pages/tools/xmssindex/update.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import async from 'async' import './update.html' @@ -22,9 +22,6 @@ function updateLedgerIdx(otsKey, callback) { } } -// Wrap ledger calls in async.timeout -const updateLedgerIdxWrapper = async.timeout(updateLedgerIdx, LEDGER_TIMEOUT) - function updateLedgerOtsKeyIndex() { // Get OTS Index const otsKey = parseInt(document.getElementById('otsKey').value, 10) @@ -39,7 +36,7 @@ function updateLedgerOtsKeyIndex() { // Attempt to set IDX console.log('Setting Ledger Nano XMSS Index to: ', otsKey) // QrlLedger.setIdx(otsKey).then(idxResponse => { - updateLedgerIdxWrapper(otsKey, function (err, idxResponse) { + updateLedgerIdx(otsKey, function (err, idxResponse) { $('#updatingLedger').hide() console.log('Ledger Response') console.log(idxResponse) diff --git a/imports/ui/pages/transfer/reload.js b/imports/ui/pages/transfer/reload.js index aa328705..0c80c948 100644 --- a/imports/ui/pages/transfer/reload.js +++ b/imports/ui/pages/transfer/reload.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './reload.html' diff --git a/imports/ui/pages/transfer/transfer.html b/imports/ui/pages/transfer/transfer.html index 9cbb2c88..9b50b8fc 100644 --- a/imports/ui/pages/transfer/transfer.html +++ b/imports/ui/pages/transfer/transfer.html @@ -300,6 +300,10 @@

Timed out waiting for response from Ledger Nano. To save an OTS Key, you should reject the transaction on your Ledger and try again.

+ + diff --git a/imports/ui/pages/transfer/transfer.js b/imports/ui/pages/transfer/transfer.js index b3739cfa..b66e3287 100644 --- a/imports/ui/pages/transfer/transfer.js +++ b/imports/ui/pages/transfer/transfer.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import JSONFormatter from 'json-formatter-js' import { BigNumber } from 'bignumber.js' @@ -31,8 +31,6 @@ function verifyLedgerNanoAddress(callback) { function getLedgerCreateTx(sourceAddr, fee, destAddr, destAmount, callback) { console.log('-- Getting QRL Ledger Nano App createTx --') - console.log('1: sourceAddr: ',sourceAddr,' - fee: ', fee,' - destAddr: ',destAddr, ' - destAmount: ', destAmount) - if (isElectrified()) { Meteor.call('ledgerCreateTx', sourceAddr, fee, destAddr, destAmount, (err, data) => { console.log('> Got Ledger Nano createTx from USB') @@ -64,12 +62,6 @@ function getLedgerRetrieveSignature(request, callback) { } } -// Wrap ledger calls in async.timeout -const verifyLedgerNanoAddressWrapper = async.timeout(verifyLedgerNanoAddress, LEDGER_TIMEOUT) -const getLedgerCreateTxWrapper = async.timeout(getLedgerCreateTx, LEDGER_TIMEOUT) -const getLedgerRetrieveSignatureWrapper = async.timeout(getLedgerRetrieveSignature, LEDGER_TIMEOUT) - - function generateTransaction() { // Get to/amount details const sendFrom = anyAddressToRawAddress(Session.get('transferFromAddress')) @@ -284,6 +276,7 @@ function confirmTransaction() { $('#awaitingLedgerConfirmation').show() $('#signOnLedgerRejected').hide() $('#signOnLedgerTimeout').hide() + $('#signOnLedgerError').hide() $('#ledgerHasConfirmed').hide() $('#relayLedgerTxnButton').hide() $('#noRemainingSignatures').hide() @@ -330,10 +323,8 @@ function confirmTransaction() { const sourceAddr = hexToBytes(QRLLIB.getAddress(getXMSSDetails().pk)) const fee = toBigendianUint64BytesUnsigned(tx.extended_transaction_unsigned.tx.fee, true) - getLedgerCreateTxWrapper(sourceAddr, fee, destAddr, destAmount, function(err, txn) { - getLedgerRetrieveSignatureWrapper(txn, function(err, sigResponse) { - //QrlLedger.createTx(sourceAddr, fee, destAddr, destAmount).then(txn => { - // QrlLedger.retrieveSignature(txn).then(sigResponse => { + getLedgerCreateTx(sourceAddr, fee, destAddr, destAmount, function(err, txn) { + getLedgerRetrieveSignature(txn, function(err, sigResponse) { // Hide the awaiting ledger confirmation spinner $('#awaitingLedgerConfirmation').hide() @@ -348,6 +339,9 @@ function confirmTransaction() { // Check if the the request timed out waiting for response on ledger } else if (sigResponse.return_code === 14) { $('#signOnLedgerTimeout').show() + // Check for unknown errors + } else if ((sigResponse.return_code === 1) && (sigResponse.error_message == "Unknown error code")) { + $('#signOnLedgerError').show() } else { // Show confirmation message $('#ledgerHasConfirmed').show() @@ -975,7 +969,7 @@ Template.appTransfer.events({ }, 'click #verifyLedgerNanoAddress': () => { $('#verifyLedgerNanoAddressModal').modal('show') - verifyLedgerNanoAddressWrapper(function () {}) + verifyLedgerNanoAddress(function () {}) }, }) diff --git a/imports/ui/pages/verify/tx.js b/imports/ui/pages/verify/tx.js index 86cec6c7..ffdabe86 100644 --- a/imports/ui/pages/verify/tx.js +++ b/imports/ui/pages/verify/tx.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import JSONFormatter from 'json-formatter-js' import './tx.html' diff --git a/imports/ui/pages/verify/verify.js b/imports/ui/pages/verify/verify.js index c8a02fcd..e9868096 100644 --- a/imports/ui/pages/verify/verify.js +++ b/imports/ui/pages/verify/verify.js @@ -3,7 +3,7 @@ /* global pkRawToB32Address, hexOrB32, rawToHexOrB32, anyAddressToRawAddress, stringToBytes, binaryToBytes, bytesToString, bytesToHex, hexToBytes, toBigendianUint64BytesUnsigned, numberToString, decimalToBinary */ /* global getMnemonicOfFirstAddress, getXMSSDetails, isWalletFileDeprecated, waitForQRLLIB, addressForAPI, binaryToQrlAddress, toUint8Vector, concatenateTypedArrays, getQrlProtoShasum */ /* global resetWalletStatus, passwordPolicyValid, countDecimals, supportedBrowser, wrapMeteorCall, getBalance, otsIndexUsed, ledgerHasNoTokenSupport, resetLocalStorageState, nodeReturnedValidResponse */ -/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, LEDGER_TIMEOUT, */ +/* global POLL_TXN_RATE, POLL_MAX_CHECKS, DEFAULT_NETWORKS, findNetworkData, SHOR_PER_QUANTA, WALLET_VERSION, QRLPROTO_SHA256, */ import './verify.html' diff --git a/package-lock.json b/package-lock.json index d32b1291..2e608ce9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "qrl-wallet", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1366,9 +1366,9 @@ "dev": true }, "bindings": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.4.0.tgz", - "integrity": "sha512-7znEVX22Djn+nYjxCWKDne0RRloa9XfYa84yk3s+HkE3LpDYZmhArYr9O9huBoHY3/oXispx5LorIX7Sl2CgSQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", "requires": { "file-uri-to-path": "1.0.0" } @@ -5611,7 +5611,9 @@ } }, "glob": { - "version": "github:lucetius/node-glob#51c7ca6e69bfbd17db5f1ea710e3f2a7a457d9ce", + "version": "7.1.1", + "resolved": "github:lucetius/node-glob#51c7ca6e69bfbd17db5f1ea710e3f2a7a457d9ce", + "integrity": "sha1-QXY4qG6VMSTDeE6kT3kOTafaaY0=", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -5668,7 +5670,7 @@ "debug": "2.6.8", "diff": "3.2.0", "escape-string-regexp": "1.0.5", - "glob": "github:lucetius/node-glob#51c7ca6e69bfbd17db5f1ea710e3f2a7a457d9ce", + "glob": "7.1.1", "growl": "1.9.2", "he": "1.1.1", "json3": "3.3.2", @@ -7301,13 +7303,13 @@ } }, "ledger-qrl-js": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/ledger-qrl-js/-/ledger-qrl-js-0.4.2.tgz", - "integrity": "sha512-4v04c4vWliBCocYIRRfSsPOAgosDrCFa3yBa9S9Jui+tMzBczMzVdxO7VYiQoaW5mtRPnJXk1l1c/m0QVV3CEA==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/ledger-qrl-js/-/ledger-qrl-js-0.4.3.tgz", + "integrity": "sha512-uOw13az3f+KFqDV5ujIiVRdBL2Rdts6oiHcSlt3YQATsKbK9Bt6QnbB2C40hAcBOCxsT7CYRJL/2FRVynbTikQ==", "requires": { "chai": "4.2.0", "mocha": "5.2.0", - "node-hid": "0.7.6", + "node-hid": "0.7.7", "q": "1.5.1", "requirejs": "2.3.6" }, @@ -8772,9 +8774,9 @@ } }, "node-abi": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.7.0.tgz", - "integrity": "sha512-egTtvNoZLMjwxkL/5iiJKYKZgn2im0zP+G+PncMxICYGiD3aZtXUvEsDmu0pF8gpASvLZyD8v53qi1/ELaRZpg==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.7.1.tgz", + "integrity": "sha512-OV8Bq1OrPh6z+Y4dqwo05HqrRL9YNF7QVMRfq1/pguwKLG+q9UB/Lk0x5qXjO23JjJg+/jqCHSTaG1P3tfKfuw==", "requires": { "semver": "5.6.0" }, @@ -8821,11 +8823,11 @@ } }, "node-hid": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/node-hid/-/node-hid-0.7.6.tgz", - "integrity": "sha512-cjbjL1CmOpImKQrqkvQKZUWuzvofwECZQ50zoih5vtPRowIZ4TFJDTN3tJYfVhbQYM9PGqDFXLcTILjx9EPvzw==", + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/node-hid/-/node-hid-0.7.7.tgz", + "integrity": "sha512-s6x8dU9/9+yKyeNw5xvU9FvQ1QGazVrDIG08/bixxCVQw98jfeFyz51C0T9/0KzKAYMOXMtElYvPIKmtY7eizw==", "requires": { - "bindings": "1.4.0", + "bindings": "1.5.0", "nan": "2.12.1", "prebuild-install": "5.2.4" }, @@ -9649,7 +9651,7 @@ "minimist": "1.2.0", "mkdirp": "0.5.1", "napi-build-utils": "1.0.1", - "node-abi": "2.7.0", + "node-abi": "2.7.1", "noop-logger": "0.1.1", "npmlog": "4.1.2", "os-homedir": "1.0.2", diff --git a/package.json b/package.json index 3aed7532..d39ecb08 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qrl-wallet", - "version": "1.1.0", + "version": "1.1.1", "description": "QRL Wallet", "author": "Scott Donald, JP Lomas and The QRL Team", "license": "MIT", @@ -18,7 +18,7 @@ "fibers": "^3.0.0", "grpc": "^1.14.0", "json-formatter-js": "^2.2.0", - "ledger-qrl-js": "0.4.2", + "ledger-qrl-js": "0.4.3", "mathjs": "4.0.1", "meteor-babel-helpers": "0.0.3", "meteor-node-stubs": "^0.2.11",