diff --git a/.eslintrc.yml b/.eslintrc.yml index 81323c52..52c14af7 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,7 +1,7 @@ # root: true # enable ES6 parserOptions: - ecmaVersion: 6 + ecmaVersion: 2017 sourceType: "module" ecmaFeatures: jsx: true # enable React's JSX diff --git a/client/head.html b/client/head.html index 0859b28e..80a03095 100644 --- a/client/head.html +++ b/client/head.html @@ -2,6 +2,4 @@ QRL Wallet - - diff --git a/imports/startup/both/index.js b/imports/startup/both/index.js index e3aed6de..7c5df5e8 100644 --- a/imports/startup/both/index.js +++ b/imports/startup/both/index.js @@ -13,7 +13,7 @@ import './nodes.js' SHOR_PER_QUANTA = 1000000000 // qrl-wallet Version -WALLET_VERSION = '1.1.1' +WALLET_VERSION = '1.2.0' // 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 eecb03cf..88d203a0 100644 --- a/imports/startup/client/functions.js +++ b/imports/startup/client/functions.js @@ -10,10 +10,43 @@ import aes256 from 'aes256' import qrlAddressValdidator from '@theqrl/validate-qrl-address' import helpers from '@theqrl/explorer-helpers' +import 'babel-polyfill' +import Qrl from '@theqrl/hw-app-qrl' +import TransportWebUSB from "@ledgerhq/hw-transport-webusb"; + + bech32 = require('bech32') // eslint-disable-line +export function ledgerReturnedError(e) { + let r = false; + try { + if (e instanceof DOMException) { + // DOMException will be thrown if WebUSB device is unplugged during Ledger UI event + r = true; + } + } catch (e) { + r = false; + } + try { + if (e.name === 'TransportStatusError' || e instanceof TransportStatusError || e.name === 'TransportOpenUserCancelled') { + r = true; + } + } catch (e) { + r = false; + } + return r; +} + +export async function createTransport() { + var transport = null; + transport = await TransportWebUSB.create(); + console.log('USING WEBUSB'); + var qrl = await new Qrl(transport); + return qrl +} + // Client side function to detmine if running within Electron -isElectrified = () => { +export function isElectrified () { const userAgent = navigator.userAgent.toLowerCase() if (userAgent.indexOf(' electron/') > -1) { return true @@ -341,7 +374,7 @@ getBalance = (getAddress, callBack) => { network: selectedNetwork(), } - wrapMeteorCall('getAddress', request, (err, res) => { + wrapMeteorCall('getAddress', request, async (err, res) => { if (err) { console.log('err: ', err) Session.set('transferFromBalance', 0) @@ -400,8 +433,9 @@ getBalance = (getAddress, callBack) => { callBack() }) } else { + const QrlLedger = await createTransport() QrlLedger.get_state().then(data => { - console.log('> Got Ledger Nano State from U2F') + console.log('> Got Ledger Nano State from WebUSB') Session.set('otsKeyEstimate', data.xmss_index) // Get remaining OTS Keys const validationResult = qrlAddressValdidator.hexString(getAddress) diff --git a/imports/startup/client/index.js b/imports/startup/client/index.js index 8f308d66..f328d870 100644 --- a/imports/startup/client/index.js +++ b/imports/startup/client/index.js @@ -6,7 +6,8 @@ /* 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, */ -import { QRLLIB } from 'qrllib/build/web-libjsqrl.js' // eslint-disable-line +// import { QRLLIB } from 'qrllib/build/web-libjsqrl.js' // eslint-disable-line +import { QRLLIBmodule } from 'qrllib/build/offline-libjsqrl' // eslint-disable-line import './routes.js' import './functions.js' @@ -28,6 +29,6 @@ if ((!openWalletPref) || (openWalletPref === 'undefined')) { // Developer note console.log('qrl-wallet - ', WALLET_VERSION) -console.log('We\'re hiring! jobs@theqrl.org') +console.log('Work with us! jobs@theqrl.org') console.log('Found a security bug? security@theqrl.org') console.log('Found a problem? https://github.com/theQRL/qrl-wallet/issues') diff --git a/imports/startup/server/index.js b/imports/startup/server/index.js index 0da06292..54779eb8 100644 --- a/imports/startup/server/index.js +++ b/imports/startup/server/index.js @@ -23,6 +23,7 @@ BrowserPolicy.content.disallowInlineScripts() BrowserPolicy.content.allowStyleOrigin('fonts.googleapis.com') BrowserPolicy.content.allowFontOrigin('fonts.gstatic.com') BrowserPolicy.content.allowFontDataUrl() +BrowserPolicy.content.allowDataUrlForAll() // An array of grpc connections and associated proto file paths const qrlClient = [] diff --git a/imports/ui/layouts/body/body.html b/imports/ui/layouts/body/body.html index 80f3bca6..10b176dd 100644 --- a/imports/ui/layouts/body/body.html +++ b/imports/ui/layouts/body/body.html @@ -1,137 +1,160 @@ \ No newline at end of file + diff --git a/imports/ui/layouts/body/body.js b/imports/ui/layouts/body/body.js index 5369b96a..8bdf7da3 100644 --- a/imports/ui/layouts/body/body.js +++ b/imports/ui/layouts/body/body.js @@ -8,6 +8,7 @@ import './body.html' import './customNode.html' import '../../stylesheets/overrides.css' +import { isElectrified } from '../../../startup/client/functions' BlazeLayout.setRoot('body') @@ -200,12 +201,18 @@ Template.appBody.onRendered(() => { }) Template.appBody.events({ + 'click .main-content-warning .right .item': () => { + $('.main-content-wrapper').css('padding-top', '0') + $('.main-content-warning').hide('slow') + }, 'click #hamburger': (event) => { event.preventDefault() $('.sidebar').sidebar('show') }, 'change #network': () => { updateNetwork(selectedNetwork()) + // reload to update balances/Txs if on different network + window.Reload._reload() }, 'change #addressFormatCheckbox': () => { const checked = $('#addressFormatCheckbox').prop('checked') diff --git a/imports/ui/pages/open/open.html b/imports/ui/pages/open/open.html index 9bd283ad..62f17820 100644 --- a/imports/ui/pages/open/open.html +++ b/imports/ui/pages/open/open.html @@ -20,7 +20,7 @@