From 80edf519b346924bcaa28f2fd94f964689dc2c25 Mon Sep 17 00:00:00 2001 From: Igor Lins e Silva Date: Fri, 2 Aug 2019 11:08:15 -0300 Subject: [PATCH] v0.9.2 --- index.js | 221 +++++--- package-lock.json | 189 +++---- package.json | 10 +- src/app/app.component.ts | 12 +- src/app/chains.ts | 11 + src/app/dashboard/about/about.component.css | 4 +- src/app/dashboard/about/about.component.ts | 2 +- .../acc_resources/resources.component.html | 14 +- src/app/dashboard/dashboard.component.html | 2 +- src/app/dashboard/dashboard.component.ts | 61 ++- src/app/dashboard/send/send.component.html | 7 +- src/app/dashboard/send/send.component.ts | 515 +++++++++--------- .../dashboard/settings/config.component.css | 13 +- .../dashboard/settings/config.component.html | 19 +- src/app/dashboard/vote/vote.component.html | 16 +- src/app/dashboard/vote/vote.component.ts | 86 +-- src/app/dashboard/wallet/wallet.component.ts | 10 +- src/app/landing/landing.component.css | 8 + src/app/landing/landing.component.html | 21 +- src/app/landing/landing.component.ts | 6 +- src/app/services/eosjs2.service.ts | 453 +++++++-------- src/app/services/network.service.ts | 23 + src/app/services/theme.service.ts | 2 +- src/app/services/voting.service.ts | 10 +- 24 files changed, 942 insertions(+), 773 deletions(-) diff --git a/index.js b/index.js index a22e2bf1..b13e1a18 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,12 @@ -const {app, BrowserWindow, Menu, protocol, ipcMain, Notification, Tray, shell} = require('electron'); +const _electron = require('electron'); +const {app, BrowserWindow, Menu, protocol, ipcMain, Notification, Tray, shell} = _electron; const path = require('path'); const url = require('url'); const keytar = require('keytar'); const fs = require('fs'); const moment = require('moment'); const schedule = require('node-schedule'); +const AutoLaunch = require('auto-launch'); const portfinder = require('portfinder'); const {version, productName, name} = require('./package.json'); const {Api, JsonRpc, RpcError} = require('eosjs'); @@ -22,6 +24,8 @@ let win, devtools, serve, isAutoLaunch; let appIcon = null; let deepLink = null; let job = null; +let isEnableAutoClaim = false; + app.getVersion = () => version; const PROTOCOL_PREFIX = 'simpleos'; @@ -39,18 +43,20 @@ const lockAutoLaunchFile = basePath + '/' + productName + '-lockALFile'; const lockLaunchFile = basePath + '/' + productName + '-lockLFile'; const logFile = basePath + '/' + productName + '-autoclaim.log'; -console.log(lockFile); - function clearLock() { fs.writeFileSync(lockFile, ''); } function unlinkLALock() { - fs.unlinkSync(lockAutoLaunchFile); + if (fs.existsSync(lockAutoLaunchFile)) { + fs.unlinkSync(lockAutoLaunchFile); + } } function unlinkLLock() { - fs.unlinkSync(lockLaunchFile); + if (fs.existsSync(lockLaunchFile)) { + fs.unlinkSync(lockLaunchFile); + } } function appendLock() { @@ -74,10 +80,46 @@ try { console.error(e); } -const devMode = process.mainModule.filename.indexOf('app.asar') === -1; +function autoClaimCheck() { + const cPath = basePath + '/autoclaim.json'; + if (fs.existsSync(basePath + '/autoclaim.json')) { + console.log('file exist'); + const autoclaimConf = JSON.parse(fs.readFileSync(cPath).toString()); + isEnableAutoClaim = autoclaimConf['enabled']; + if (!isEnableAutoClaim) { + unlinkLALock(); + } + } else { + unlinkLALock(); + } +} +const devMode = process.mainModule.filename.indexOf('app.asar') === -1; +writeLog(`Developer Mode: ${devMode}`); console.log('Developer Mode:', devMode); +const simpleosAutoLauncher = new AutoLaunch({ + name: 'simpleos' +}); + +writeLog(`simpleos Auto Launcher: ${JSON.stringify(simpleosAutoLauncher)}`); + +simpleosAutoLauncher.opts.appPath += ' --autostart'; + +simpleosAutoLauncher.isEnabled().then(function (status) { + console.log('STATUS:', status); + if (status) { + console.log('Auto launch already enabled!'); + return; + } + if (!devMode) { + console.log('Enabling auto-launch!'); + simpleosAutoLauncher.enable(); + } +}).catch(function (err) { + console.log(err); +}); + app.setLoginItemSettings({ openAtLogin: !devMode, args: ["--autostart"] @@ -90,6 +132,7 @@ const loginOpts = app.getLoginItemSettings({ isAutoLaunch = loginOpts.wasOpenedAtLogin || args.some(val => val === '--autostart'); const contextMenu = require('electron-context-menu'); + contextMenu(); function setupExpress() { @@ -251,6 +294,7 @@ function unfocus() { break; } case "darwin": { + writeLog(`unfocus `); Menu.sendActionToFirstResponder('hide:'); break; } @@ -286,7 +330,7 @@ async function createWindow() { webPreferences: { nodeIntegration: true, webSecurity: !serve, - devTools: false + devTools: true }, darkTheme: true, width: 1440, @@ -298,7 +342,7 @@ async function createWindow() { icon: _icon }); - win.removeMenu(); + // win.removeMenu(); if (serve) { require('electron-reload')(__dirname, { @@ -465,17 +509,25 @@ async function claimGBM(account_name, private_key, permission, rpc) { function addTrayIcon() { appIcon = new Tray(path.join(__dirname, 'static/tray-icon.png')); const trayMenu = Menu.buildFromTemplate([ + { + label: 'SimplEOS Wallet', click: () => { + const spawn = require('child_process').spawn; + spawn(process.execPath, [], { + detached: true, + stdio: 'ignore' + }).unref(); + } + }, { label: 'Quit SimplEOS Agent', click: () => { appIcon.destroy(); - fs.writeFileSync(lockFile, ''); + unlinkLALock(); app.quit(); } } ]); appIcon.setToolTip('simplEOS Agent'); appIcon.setContextMenu(trayMenu); - appIcon.setHighlightMode('always'); } function storeConfig(autoClaimConfig) { @@ -550,55 +602,79 @@ function runAutoClaim() { let autoclaimConf = JSON.parse(data.toString()); (async () => { if (autoclaimConf['enabled']) { - const apis = autoclaimConf['WAX-GBM']['apis']; - setRpcApi(apis[0]); - for (const job of autoclaimConf['WAX-GBM']['jobs']) { - const a = await safeRun((api) => getClaimTime(job.account, api), null, apis); - if (a) { - a.add(1, 'day'); - const b = moment().utc(); - if (b.diff(a, 'seconds') > 0) { - writeLog(`${job.account} is ready to claim!`); - try { - const pvtkey = await keytar.getPassword('simpleos', job['public_key']); - const perm = job['permission']; - const claimResult = await safeRun((api) => claimGBM(job.account, pvtkey, perm, api), null, apis); - if (claimResult) { - job['last_claim'] = Date.now(); - schedule.scheduleJob(a.toDate(), () => { + if (autoclaimConf['WAX-GBM']) { + const apis = autoclaimConf['WAX-GBM']['apis']; + setRpcApi(apis[0]); + for (const job of autoclaimConf['WAX-GBM']['jobs']) { + const a = await safeRun((api) => getClaimTime(job.account, api), null, apis); + if (a) { + a.add(1, 'day'); + const b = moment().utc(); + const scheduleName = 'autoClaim-' + job['account']; + if (b.diff(a, 'seconds') > 0) { + writeLog(`${job.account} is ready to claim!`); + try { + const pvtkey = await keytar.getPassword('simpleos', job['public_key']); + const perm = job['permission']; + const claimResult = await safeRun((api) => claimGBM(job.account, pvtkey, perm, api), null, apis); + + if (claimResult) { + job['last_claim'] = Date.now(); + schedule.scheduleJob(scheduleName, a.toDate(), () => { + runAutoClaim(); + }); + } + } catch (e) { + const logFile = basePath + '/autoclaim-error_' + (Date.now()) + '.txt'; + fs.writeFileSync(logFile, e); + writeLog(`Autoclaim error, check log file: ${logFile}`); + // shell.openItem(logFile); + schedule.scheduleJob(scheduleName, b.add(10, 'minutes').toDate(), () => { runAutoClaim(); }); } - } catch (e) { - const logFile = basePath + '/autoclaim-error_' + (Date.now()) + '.txt'; - fs.writeFileSync(logFile, e); - writeLog(`Autoclaim error, check log file: ${logFile}`); - // shell.openItem(logFile); - schedule.scheduleJob(b.add(10, 'minutes').toDate(), () => { - runAutoClaim(); - }); + } else { + writeLog(`${job.account} claims again at ${a.format()}`); } - } else { - writeLog(`${job.account} claims again at ${a.format()}`); } } + storeConfig(autoclaimConf); } - storeConfig(autoclaimConf); } })().catch(console.log); }); } - } +function rescheduleAutoClaim() { + writeLog("Checking claim conditions reschedule..."); + const cPath = basePath + '/autoclaim.json'; + if (fs.existsSync(basePath + '/autoclaim.json')) { + const data = fs.readFileSync(cPath); + let autoclaimConf = JSON.parse(data.toString()); + if (autoclaimConf['enabled']) { + if (autoclaimConf['WAX-GBM']) { + for (const job of autoclaimConf['WAX-GBM']['jobs']) { + const a = moment.utc(job['next_claim_time']); + const b = moment().utc(); + const scheduleName = 'autoClaim-' + job['account']; + writeLog(`Diff next date from now (sec): ${b.diff(a, 'seconds')}`); + if (b.diff(a, 'seconds') > 0) { + runAutoClaim(); + } + } + } + } + } +} function launchApp() { - const gotTheLock = app.requestSingleInstanceLock(); process.defaultApp = true; - console.log(gotTheLock); + // writeLog(`On Launching File LAUNCH: ${(fs.existsSync(lockLaunchFile))} `); + writeLog(`On Launching File LAUNCH: ${(fs.existsSync(lockLaunchFile))} | The LOCK: ${gotTheLock}`); if (fs.existsSync(lockLaunchFile)) { if (gotTheLock) { @@ -609,8 +685,8 @@ function launchApp() { return; } } - appendLock(); + appendLock(); portfinder.getPortPromise().then((port) => { http.listen(port, "127.0.0.1", () => { @@ -632,10 +708,11 @@ function launchApp() { app.on('ready', () => { console.log('ready'); - createWindow(); + createWindow().catch(console.log); }); app.on('window-all-closed', () => { + writeLog(`Quitting Application...`); clearLock(); unlinkLLock(); app.quit(); @@ -649,61 +726,65 @@ function launchApp() { app.on('will-finish-launching', () => { app.on('open-url', (e, url) => { - e.preventDefault(); + //e.preventDefault(); console.log(url); }) }); } // Main startup logic - if (isAutoLaunch) { - // check if another agent is running - app.requestSingleInstanceLock(); app.on('second-instance', (event, argv, workingDirectory) => { if (argv[1] === '--autostart') { + writeLog(`Force quit agent in second instance...`); + const spawn = require('child_process').spawn; app.quit(); } }); + app.on("quit", () => { + writeLog(`Quitting Agent...`); unlinkLALock(); }); app.on('ready', () => { - clearLock(); + unlinkLALock(); appendLock(); + autoClaimCheck(); console.log('READY!'); - const cPath = basePath + '/autoclaim.json'; - if (fs.existsSync(basePath + '/autoclaim.json')) { - console.log('Loading configuration file...'); - fs.readFile(cPath, (err, data) => { - if (err) throw err; - let autoclaimConf = JSON.parse(data.toString()); - if (autoclaimConf['enabled']) { - addTrayIcon(); - runAutoClaim(); - if (process.platform === 'darwin') { - app.dock.hide(); - } - } else { - app.quit(); - } - }); + if (isEnableAutoClaim) { + addTrayIcon(); + runAutoClaim(); + if (process.platform === 'darwin') { + app.dock.hide(); + } + } else { + writeLog(`Quitting disabled auto claim...`); + app.quit(); } + _electron.powerMonitor.on('suspend', () => { + rescheduleAutoClaim(); + }); + _electron.powerMonitor.on('resume', () => { + rescheduleAutoClaim(); + }); + _electron.powerMonitor.on('lock-screen', () => { + rescheduleAutoClaim(); + }); }); - } else { + setupExpress(); launchApp(); + autoClaimCheck(); - if (!fs.existsSync(lockAutoLaunchFile)) { - // add agent - if (!devMode) { - const spawn = require('child_process').spawn; + const spawn = require('child_process').spawn; + if (isEnableAutoClaim) { + if (!(fs.existsSync(lockAutoLaunchFile))) { spawn(process.execPath, ['--autostart'], { - stdio: 'ignore', - detached: true + detached: true, + stdio: 'ignore' }).unref(); } } diff --git a/package-lock.json b/package-lock.json index 6f190822..2efb46dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "simpleos", - "version": "0.9.1", + "version": "0.9.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -779,6 +779,16 @@ "resolved": "https://registry.npmjs.org/@clr/ui/-/ui-2.0.2.tgz", "integrity": "sha512-GJcw7A8lWLGj07sXKmNrfulr40jU7ohFRpcyPvuRZyDjXJ/DsIx/qAf1H5stFYUcaJNddJVZ2+KnZP8BPMhi/A==" }, + "@develar/schema-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@develar/schema-utils/-/schema-utils-2.1.0.tgz", + "integrity": "sha512-qjCqB4ctMig9Gz5bd6lkdFr3bO6arOdQqptdBSpF1ZpCnjofieCciEzkoS9ujY9cMGyllYSCSmBJ3x9OKHXzoA==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0" + } + }, "@fortawesome/angular-fontawesome": { "version": "0.4.0", "resolved": "https://npm.fontawesome.com/@fortawesome/angular-fontawesome/-/angular-fontawesome-0.4.0.tgz", @@ -1472,26 +1482,27 @@ } }, "app-builder-bin": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-3.3.1.tgz", - "integrity": "sha512-Py6FjU/asxW8PAFz5mGShCv3FVX/JfcejoyXTTks7xnJZazx+X/9c7jNM+InzZ5UfC6QX4iUeKl3fTLhQCyR7w==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-3.4.3.tgz", + "integrity": "sha512-qMhayIwi3juerQEVJMQ76trObEbfQT0nhUdxZz9a26/3NLT3pE6awmQ8S1cEnrGugaaM5gYqR8OElcDezfmEsg==", "dev": true }, "app-builder-lib": { - "version": "21.1.0", - "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-21.1.0.tgz", - "integrity": "sha512-kpk29LNWfvGLP001jzq2pfiC/VasmpguqHD7D2i1RxDHuIYhsznOSD9WGjayHEjQU5WEKdjNhuF0tnx8ndJBSA==", + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-21.2.0.tgz", + "integrity": "sha512-aOX/nv77/Bti6NymJDg7p9T067xD8m1ipIEJR7B4Mm1GsJWpMm9PZdXtCRiMNRjHtQS5KIljT0g17781y6qn5A==", "dev": true, "requires": { - "7zip-bin": "~5.0.1", + "7zip-bin": "~5.0.3", + "@develar/schema-utils": "~2.1.0", "async-exit-hook": "^2.0.1", "bluebird-lst": "^1.0.9", - "builder-util": "21.1.0", + "builder-util": "21.2.0", "builder-util-runtime": "8.3.0", "chromium-pickle-js": "^0.2.0", "debug": "^4.1.1", "ejs": "^2.6.2", - "electron-publish": "21.1.0", + "electron-publish": "21.2.0", "fs-extra": "^8.1.0", "hosted-git-info": "^2.7.1", "is-ci": "^2.0.0", @@ -1500,9 +1511,9 @@ "lazy-val": "^1.0.4", "minimatch": "^3.0.4", "normalize-package-data": "^2.5.0", - "read-config-file": "4.0.1", - "sanitize-filename": "^1.6.1", - "semver": "^6.2.0", + "read-config-file": "5.0.0", + "sanitize-filename": "^1.6.2", + "semver": "^6.3.0", "temp-file": "^3.3.4" }, "dependencies": { @@ -1539,9 +1550,9 @@ "dev": true }, "semver": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.2.0.tgz", - "integrity": "sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true } } @@ -2491,14 +2502,14 @@ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" }, "builder-util": { - "version": "21.1.0", - "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-21.1.0.tgz", - "integrity": "sha512-urE2ip9GaLo/L+5LSQznIk3+tPAJAa9rNGA9p8U4NVxJ4UrIfrd4orCqW/8m4hhHpfX2OtNZjW/t4Af6x0CuYg==", + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-21.2.0.tgz", + "integrity": "sha512-Nd6CUb6YgDY8EXAXEIegx+1kzKqyFQ5ZM5BoYkeunAlwz/zDJoH1UCyULjoS5wQe5czNClFQy07zz2bzYD0Z4A==", "dev": true, "requires": { - "7zip-bin": "~5.0.1", + "7zip-bin": "~5.0.3", "@types/debug": "^4.1.4", - "app-builder-bin": "3.3.1", + "app-builder-bin": "3.4.3", "bluebird-lst": "^1.0.9", "builder-util-runtime": "8.3.0", "chalk": "^2.4.2", @@ -2506,7 +2517,7 @@ "fs-extra": "^8.1.0", "is-ci": "^2.0.0", "js-yaml": "^3.13.1", - "source-map-support": "^0.5.12", + "source-map-support": "^0.5.13", "stat-mode": "^0.3.0", "temp-file": "^3.3.4" }, @@ -2570,9 +2581,9 @@ "dev": true }, "source-map-support": { - "version": "0.5.12", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", - "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -3888,19 +3899,18 @@ } }, "dmg-builder": { - "version": "21.1.0", - "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-21.1.0.tgz", - "integrity": "sha512-2Gfrd2WlsawQeB6dItpsqMU3ffFK6ywTCFJwSI/61SLiHJB4xtdaKer4s+cdnf/99KrL7NRd5CgsaWzuxe0aGQ==", + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-21.2.0.tgz", + "integrity": "sha512-9cJEclnGy7EyKFCoHDYDf54pub/t92CQapyiUxU0w9Bj2vUvfoDagP1PMiX4XD5rPp96141h9A+QN0OB4VgvQg==", "dev": true, "requires": { - "app-builder-lib": "~21.1.0", + "app-builder-lib": "~21.2.0", "bluebird-lst": "^1.0.9", - "builder-util": "~21.1.0", + "builder-util": "~21.2.0", "fs-extra": "^8.1.0", "iconv-lite": "^0.5.0", "js-yaml": "^3.13.1", - "parse-color": "^1.0.0", - "sanitize-filename": "^1.6.1" + "sanitize-filename": "^1.6.2" }, "dependencies": { "fs-extra": { @@ -4041,9 +4051,9 @@ "dev": true }, "electron": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/electron/-/electron-5.0.7.tgz", - "integrity": "sha512-OMMz8DhatxLuBFbnW7KYcAUjflGYFn0IQEtKR0iZhMAm89FgNOd9SVbxXWAGNxvRR6C0gORXwhTh6BCqqqcR6Q==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/electron/-/electron-5.0.8.tgz", + "integrity": "sha512-wkUVE2GaYCsqQTsISSHWkIkcdpwLwZ1jhzAXSFFoSzsTgugmzhX60rJjIccotUmZ0iPzw+u4ahfcaJ0eslrPNQ==", "dev": true, "requires": { "@types/node": "^10.12.18", @@ -4052,30 +4062,30 @@ }, "dependencies": { "@types/node": { - "version": "10.14.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.13.tgz", - "integrity": "sha512-yN/FNNW1UYsRR1wwAoyOwqvDuLDtVXnaJTZ898XIw/Q5cCaeVAlVwvsmXLX5PuiScBYwZsZU4JYSHB3TvfdwvQ==", + "version": "10.14.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.14.tgz", + "integrity": "sha512-xXD08vZsvpv4xptQXj1+ky22f7ZoKu5ZNI/4l+/BXG3X+XaeZsmaFbbTKuhSE3NjjvRuZFxFf9sQBMXIcZNFMQ==", "dev": true } } }, "electron-builder": { - "version": "21.1.0", - "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-21.1.0.tgz", - "integrity": "sha512-Mc/tsfmaTZA71lhEajMLiaxkalwMGrP9QD7K26SbNWzeWOFUgRTa6TqyQKvk0V/6Vu4LvNfuz00mCx/PhMqhSw==", + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-21.2.0.tgz", + "integrity": "sha512-x8EXrqFbAb2L3N22YlGar3dGh8vwptbB3ovo3OF6K7NTpcsmM2zEoJv7GhFyX73rNzSG2HaWpXwGAtOp2JWiEw==", "dev": true, "requires": { - "app-builder-lib": "21.1.0", + "app-builder-lib": "21.2.0", "bluebird-lst": "^1.0.9", - "builder-util": "21.1.0", + "builder-util": "21.2.0", "builder-util-runtime": "8.3.0", "chalk": "^2.4.2", - "dmg-builder": "21.1.0", + "dmg-builder": "21.2.0", "fs-extra": "^8.1.0", "is-ci": "^2.0.0", "lazy-val": "^1.0.4", - "read-config-file": "4.0.1", - "sanitize-filename": "^1.6.1", + "read-config-file": "5.0.0", + "sanitize-filename": "^1.6.2", "update-notifier": "^3.0.1", "yargs": "^13.3.0" }, @@ -4294,13 +4304,13 @@ "integrity": "sha512-Z1qA/1oHNowGtSBIcWk0pcLEqYT/j+13xUw/MYOrBUOL4X7VN0i0KCTf5SqyvMPmW5pSPKbo28wkxMxzZ20YnQ==" }, "electron-publish": { - "version": "21.1.0", - "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-21.1.0.tgz", - "integrity": "sha512-Zsk21nqrjGT8eqiN37e+T0Sep8s8tjSUhuxW6AU8OVHYoVY9U0icT8riOLaq1XCRB97+Ctp8XnM08LuKBMMCJQ==", + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-21.2.0.tgz", + "integrity": "sha512-mWavuoWJe87iaeKd0I24dNWIaR+0yRzshjNVqGyK019H766fsPWl3caQJnVKFaEyrZRP397v4JZVG0e7s16AxA==", "dev": true, "requires": { "bluebird-lst": "^1.0.9", - "builder-util": "~21.1.0", + "builder-util": "~21.2.0", "builder-util-runtime": "8.3.0", "chalk": "^2.4.2", "fs-extra": "^8.1.0", @@ -7407,9 +7417,9 @@ "dev": true }, "lodash-es": { - "version": "4.17.14", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.14.tgz", - "integrity": "sha512-7zchRrGa8UZXjD/4ivUWP1867jDkhzTG2c/uj739utSd7O/pFFdxspCemIFKEEjErbcqRzn8nKnGsi7mvTgRPA==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.15.tgz", + "integrity": "sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ==", "dev": true }, "lodash.clonedeep": { @@ -8702,21 +8712,21 @@ "dev": true }, "package-json": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.4.0.tgz", - "integrity": "sha512-bd1T8OBG7hcvMd9c/udgv6u5v9wISP3Oyl9Cm7Weop8EFwrtcQDnS2sb6zhwqus2WslSr5wSTIPiTTpxxmPm7Q==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", "dev": true, "requires": { "got": "^9.6.0", - "registry-auth-token": "^3.4.0", + "registry-auth-token": "^4.0.0", "registry-url": "^5.0.0", - "semver": "^6.1.1" + "semver": "^6.2.0" }, "dependencies": { "semver": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.2.0.tgz", - "integrity": "sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true } } @@ -8792,23 +8802,6 @@ "safe-buffer": "^5.1.1" } }, - "parse-color": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-color/-/parse-color-1.0.0.tgz", - "integrity": "sha1-e3SLlag/A/FqlPU15S1/PZRlhhk=", - "dev": true, - "requires": { - "color-convert": "~0.5.0" - }, - "dependencies": { - "color-convert": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-0.5.3.tgz", - "integrity": "sha1-vbbGnOZg+t/+CwAHzER+G59ygr0=", - "dev": true - } - } - }, "parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", @@ -9624,13 +9617,11 @@ } }, "read-config-file": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/read-config-file/-/read-config-file-4.0.1.tgz", - "integrity": "sha512-5caED3uo2IAZMPcbh/9hx/O29s2430RLxtnFDdzxpH/epEpawOrQnGBHueotIXUrGPPIgdNQN+S/CIp2WmiSfw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/read-config-file/-/read-config-file-5.0.0.tgz", + "integrity": "sha512-jIKUu+C84bfnKxyJ5j30CxCqgXWYjZLXuVE/NYlMEpeni+dhESgAeZOZd0JZbg1xTkMmnCdxksDoarkOyfEsOg==", "dev": true, "requires": { - "ajv": "^6.10.1", - "ajv-keywords": "^3.4.1", "dotenv": "^8.0.0", "dotenv-expand": "^5.1.0", "fs-extra": "^8.1.0", @@ -9639,24 +9630,6 @@ "lazy-val": "^1.0.4" }, "dependencies": { - "ajv": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", - "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ajv-keywords": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz", - "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==", - "dev": true - }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -9865,12 +9838,12 @@ } }, "registry-auth-token": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.4.0.tgz", - "integrity": "sha512-4LM6Fw8eBQdwMYcES4yTnn2TqIasbXuwDx3um+QRs7S55aMKCBKBxvPXl2RiUjHwuJLTyYfxSpmfSAjQpcuP+A==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.0.0.tgz", + "integrity": "sha512-lpQkHxd9UL6tb3k/aHAVfnVtn+Bcs9ob5InuFLLEDqSqeq+AljB8GZW9xY0x7F+xYwEcjKe07nyoxzEYz6yvkw==", "dev": true, "requires": { - "rc": "^1.1.6", + "rc": "^1.2.8", "safe-buffer": "^5.0.1" } }, @@ -10116,9 +10089,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sanitize-filename": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.1.tgz", - "integrity": "sha1-YS2hyWRz+gLczaktzVtKsWSmdyo=", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.2.tgz", + "integrity": "sha512-cmTzND7RMxUB+f7gI+4+KAVHWEg0lfXvQJdko+FXDP5bNbGIdx4KMP5pX6lv5jfT9jSf6OBbjyxjFtZQwYA/ig==", "dev": true, "requires": { "truncate-utf8-bytes": "^1.0.0" diff --git a/package.json b/package.json index 06d8e1f3..1a9f2b7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simpleos", - "version": "0.9.1", + "version": "0.9.2", "productName": "simpleos", "appId": "io.eosrio.simpleos", "compilerVersion": "EOS MAINNET", @@ -138,13 +138,13 @@ "codelyzer": "~4.5.0", "core-js": "^2.5.4", "echarts": "^4.2.1", - "electron": "^5.0.7", - "electron-builder": "^21.1.0", + "electron": "^5.0.8", + "electron-builder": "^21.1.5", "electron-reload": "^1.4.0", "fuse.js": "^3.4.5", "hammerjs": "^2.0.8", "jquery": "^3.4.0", - "lodash-es": "^4.17.14", + "lodash-es": "^4.17.15", "lodash.get": "^4.4.2", "lodash.set": "^4.3.2", "moment": "^2.24.0", @@ -226,4 +226,4 @@ "tar": "^4.4.10", "tslib": "^1.10.0" } -} +} \ No newline at end of file diff --git a/src/app/app.component.ts b/src/app/app.component.ts index fbc245dc..34c7d63b 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,5 +1,5 @@ -import {AfterViewInit, ChangeDetectorRef, Component, NgZone, OnInit, ViewChild} from '@angular/core'; -import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {AfterViewInit , ChangeDetectorRef , Component , NgZone , OnInit} from '@angular/core'; +import {FormBuilder , FormGroup , Validators} from '@angular/forms'; import {Router} from '@angular/router'; import {environment} from '../environments/environment'; @@ -9,7 +9,7 @@ import {EOSJSService} from './services/eosjs.service'; import {CryptoService} from './services/crypto.service'; import {ConnectService} from './services/connect.service'; import {BackupService} from './services/backup.service'; -import {BehaviorSubject, Subscription} from 'rxjs'; +import {BehaviorSubject , Subscription} from 'rxjs'; import {Eosjs2Service} from './services/eosjs2.service'; import {TransactionFactoryService} from './services/transaction-factory.service'; import {ElectronService} from 'ngx-electron'; @@ -94,8 +94,6 @@ export class AppComponent implements OnInit, AfterViewInit { this.titleService.setTitle('SimplEOS Wallet v' + this.version); } - this.isMac = this._electronService.isMacOS; - this.confirmForm = this.fb.group({ pass: ['', Validators.required] }); @@ -267,6 +265,9 @@ export class AppComponent implements OnInit, AfterViewInit { }); } + this.isMac = this._electronService.isMacOS; + console.log('Is MacOS?',this._electronService.isMacOS); + } onModalClose(ev) { @@ -437,6 +438,7 @@ export class AppComponent implements OnInit, AfterViewInit { this.aService.reloadActions(account); this.aService.refreshFromChain(); this.cdr.detectChanges(); + } } catch (e) { this.wrongpass = e; diff --git a/src/app/chains.ts b/src/app/chains.ts index 523f147e..1a1e1b15 100644 --- a/src/app/chains.ts +++ b/src/app/chains.ts @@ -5,6 +5,7 @@ export const defaultChainsJSON = [ icon: 'eos.png', precision: 4, name: 'EOS MAINNET', + network: 'MAINNET', firstApi: 'https://hapi.eosrio.io', historyApi: 'https://eos.hyperion.eosrio.io/v2', forumTally: 'https://s3.amazonaws.com/api.eosvotes.io/eosvotes/tallies/latest.json', @@ -118,6 +119,7 @@ export const defaultChainsJSON = [ icon: 'wax.png', precision: 8, name: 'WAX MAINNET', + network: 'MAINNET', firstApi: 'https://wax.eosrio.io', historyApi: 'https://wax.hyperion.eosrio.io/v2', forumTally: '', @@ -163,6 +165,7 @@ export const defaultChainsJSON = [ icon: 'bos.png', precision: 4, name: 'BOS MAINNET', + network: 'MAINNET', firstApi: 'https://api.bos.eosrio.io', historyApi: 'https://bos.hyperion.eosrio.io/v2', forumTally: 'https://s3.amazonaws.com/bos.referendum/referendum/tallies/latest.json', @@ -216,6 +219,7 @@ export const defaultChainsJSON = [ precision: 4, icon: 'meetone.png', name: 'MEET.ONE MAINNET', + network: 'MAINNET', firstApi: 'https://fullnode.meet.one', historyApi: 'https://meetone.hyperion.eosrio.io/v2', forumTally: '', @@ -265,6 +269,7 @@ export const defaultChainsJSON = [ icon: 'telos.png', precision: 4, name: 'TELOS MAINNET', + network: 'MAINNET', firstApi: 'https://api.tlos.goodblock.io', historyApi: '', eosrioBP: '', @@ -308,6 +313,7 @@ export const defaultChainsJSON = [ icon: 'worbli.png', precision: 4, name: 'WORBLI MAINNET', + network: 'MAINNET', firstApi: 'https://api.worbli.eosrio.io', historyApi: '', forumTally: '', @@ -357,6 +363,7 @@ export const defaultChainsJSON = [ icon: 'jungle.png', precision: 4, name: 'EOS JUNGLE TESTNET', + network: 'TESTNET', firstApi: 'https://jungle2.cryptolions.io:443', historyApi: 'https://jungle.hyperion.eosrio.io/v2', forumTally: '', @@ -400,6 +407,7 @@ export const defaultChainsJSON = [ icon: 'bos.png', precision: 4, name: 'BOS TESTNET', + network: 'TESTNET', firstApi: 'https://boscore.eosrio.io', historyApi: '', forumTally: '', @@ -443,6 +451,7 @@ export const defaultChainsJSON = [ icon: 'kylin.png', precision: 4, name: 'EOS KYLIN TESTNET', + network: 'TESTNET', firstApi: 'https://api-kylin.eoslaomao.com', historyApi: '', forumTally: '', @@ -491,6 +500,7 @@ export const defaultChainsJSON = [ icon: 'liberland.png', precision: 8, name: 'LIBERLAND TESTNET', + network: 'TESTNET', firstApi: 'https://liberland.eossweden.org', historyApi: 'https://liberland.eosio.se/v2', forumTally: '', @@ -528,6 +538,7 @@ export const defaultChainsJSON = [ icon: 'meetone.png', precision: 4, name: 'MEET.ONE TESTNET', + network: 'TESTNET', firstApi: 'https://sidechain-test-history.meet.one', historyApi: 'https://meetone.hyperion.eosrio.io/v2', forumTally: '', diff --git a/src/app/dashboard/about/about.component.css b/src/app/dashboard/about/about.component.css index 9b4d4b44..cc966365 100644 --- a/src/app/dashboard/about/about.component.css +++ b/src/app/dashboard/about/about.component.css @@ -20,14 +20,14 @@ } .social-icon fa-icon:hover { - color: white; + color: var(--text-white-color); cursor: pointer; } .steemit { width: 29px; margin-bottom: 11px; - opacity: 0.6; + opacity: 0.7; } .steemit:hover { diff --git a/src/app/dashboard/about/about.component.ts b/src/app/dashboard/about/about.component.ts index 5ef83510..d22b8ded 100644 --- a/src/app/dashboard/about/about.component.ts +++ b/src/app/dashboard/about/about.component.ts @@ -17,7 +17,7 @@ export class AboutComponent implements OnInit { } extOpen(value) { - window['shell'].openExternal(value); + window['shell'].openExternal(value).catch(console.log); } } diff --git a/src/app/dashboard/acc_resources/resources.component.html b/src/app/dashboard/acc_resources/resources.component.html index d25acbb8..28775f48 100644 --- a/src/app/dashboard/acc_resources/resources.component.html +++ b/src/app/dashboard/acc_resources/resources.component.html @@ -16,7 +16,7 @@ [merge]="ram_chartMerge" class="demo-chart"> -
+
@@ -49,12 +49,11 @@ = - - - {{aService.activeChain['symbol']}} + {{errormsg2}} @@ -99,8 +98,7 @@ placeholder="Price in {{aService.activeChain['symbol']}}" formControlName="sellEos" (keyup)="(errormsgeos='');convertToBytesSELL()" (blur)="checkSellBytes()"/> - - {{aService.activeChain['symbol']}} + {{errormsgeos}} @@ -121,7 +119,7 @@ class="tooltip-content">Used on the rare case when unstaking gets stuck. If your unstaking is taking more than 72 hours to complete, request the refund to free your funds.
- +
@@ -129,7 +127,7 @@
-
+
diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 19ed3f5a..d11234c8 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -330,7 +330,7 @@
Define your password for this account. This will be used to transactions con key shall be {{ final_owner }} and the active public key shall be {{ final_active }}. -
+ diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index e194d16f..0b8e942f 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -5,14 +5,13 @@ import { ViewChild, OnDestroy, AfterViewInit, - ChangeDetectorRef, - ElementRef + ChangeDetectorRef } from '@angular/core'; import {EOSJSService} from '../services/eosjs.service'; import {AccountsService} from '../services/accounts.service'; import {LandingComponent} from '../landing/landing.component'; import {ClrWizard} from '@clr/angular'; -import {FormBuilder, FormGroup, FormControl, Validators} from '@angular/forms'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {BodyOutputType, Toast, ToasterConfig, ToasterService} from 'angular2-toaster'; import * as moment from 'moment'; @@ -121,6 +120,12 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { private subscriptions: Subscription[] = []; private pvtImportReady: boolean; + + + static extOpen(value) { + window['shell'].openExternal(value).catch(console.log); + } + constructor( public eos: EOSJSService, public eosjs: Eosjs2Service, @@ -185,7 +190,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { this.subscriptions.push(this.pvtform.get('private_key').valueChanges.subscribe((value) => { if (value) { if (value.length === 51) { - this.verifyPrivateKey(value, false); + this.verifyPrivateKey(value.trim(), false); } else { this.pvtImportReady = false; } @@ -197,9 +202,6 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { window['shell']['openExternal'](this.aService.activeChain['explorers'][0]['tx_url'] + value); } - extOpen(value) { - window['shell'].openExternal(value); - } ngOnDestroy(): void { this.subscriptions.forEach(s => { @@ -227,7 +229,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { } else { if (input !== '') { this.busyActivekey = true; - this.eos.checkPvtKey(input).then((results) => { + this.eos.checkPvtKey(input.trim()).then((results) => { this.publicEOS = results.publicKey; this.importedPublicKey = results.publicKey; this.importedAccounts = []; @@ -242,7 +244,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { const refundTime = new Date(tempDate).getTime() + (72 * 60 * 60 * 1000); const now = new Date().getTime(); if (now > refundTime) { - this.eos.claimRefunds(item.account_name, input, item['permission']).then((tx) => { + this.eos.claimRefunds(item.account_name, input.trim(), item['permission']).then((tx) => { console.log(tx); }); } else { @@ -357,13 +359,14 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { } doRemoveAcc() { - const [key] = this.aService.getStoredKey(this.aService.accounts[this.accRemovalIndex]); - const savedData = localStorage.getItem('eos_keys.' + this.aService.activeChain.id); - if (savedData) { - const keystore = JSON.parse(savedData); - delete keystore[key]; - localStorage.setItem('eos_keys.' + this.aService.activeChain.id, JSON.stringify(keystore)); - } + // const [key] = this.aService.getStoredKey(this.aService.accounts[this.accRemovalIndex]); + // const savedData = localStorage.getItem('eos_keys.' + this.aService.activeChain.id); + // console.log(key); + // if (savedData) { + // const keystore = JSON.parse(savedData); + // delete keystore[key]; + // // localStorage.setItem('eos_keys.' + this.aService.activeChain.id, JSON.stringify(keystore)); + // } this.aService.accounts.splice(this.accRemovalIndex, 1); this.deleteAccModal = false; this.aService.select(0); @@ -415,14 +418,14 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { if (pform.pass1 === pform.pass2) { this.crypto.initKeys(this.final_active, pform.pass1).then(() => { this.crypto.encryptAndStore(this.activepk, this.final_active).then(() => { - this.aService.appendNewAccount(results.foundAccounts[0]); + this.aService.appendNewAccount(results.foundAccounts[0]).catch(console.log); this.wrongwalletpass = ''; this.busy = false; this.success = true; this.confirmationID = txdata['transaction_id']; this.showToast('success', 'Account created', 'Check your history for confirmation.'); this.submitTXForm.reset(); - this.aService.refreshFromChain(); + this.aService.refreshFromChain().catch(console.log); }).catch((err) => { console.log(err); }); @@ -442,7 +445,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { this.eos.getAccountInfo(this.final_name).then((acc_data) => { this.eos.getTokens(acc_data['account_name']).then((tokens) => { acc_data['tokens'] = tokens; - this.aService.appendNewAccount(acc_data); + this.aService.appendNewAccount(acc_data).catch(console.log); this.wrongwalletpass = ''; this.busy = false; this.success = true; @@ -456,16 +459,18 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { }, 5000); } }).catch((err2) => { - const errorJSON = JSON.parse(err2); - if (errorJSON.error.code === 3081001) { - this.wrongwalletpass = 'Not enough stake to perform this action.'; - } else if (errorJSON.error.code === 3050000) { - this.wrongwalletpass = 'Account name not available.'; - } else { - this.wrongwalletpass = errorJSON.error['what']; - } + console.log(err2); this.busy = false; this.success = false; + // const errorJSON = JSON.parse(err2); + // if (errorJSON.error.code === 3081001) { + // this.wrongwalletpass = 'Not enough stake to perform this action.'; + // } else if (errorJSON.error.code === 3050000) { + // this.wrongwalletpass = 'Account name not available.'; + // } else { + // this.wrongwalletpass = errorJSON.error['what']; + // } + }); } else { this.wrongwalletpass = 'Something went wrong!'; @@ -490,7 +495,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { ngAfterViewInit() { this.subscriptions.push( - this.aService.selected.asObservable().subscribe((sel) => { + this.aService.selected.asObservable().subscribe(() => { // this.aService.select(this.aService.selectedIdx.toString ()); this.selectedTab = this.aService.selectedIdx; }) diff --git a/src/app/dashboard/send/send.component.html b/src/app/dashboard/send/send.component.html index 14e81cc0..5fab926d 100644 --- a/src/app/dashboard/send/send.component.html +++ b/src/app/dashboard/send/send.component.html @@ -1,4 +1,4 @@ - +
@@ -14,7 +14,7 @@
+ *ngIf="sendForm.value.token !== aService.activeChain['symbol'] && 'selectedToken'['price'] !== null"> ${{token_balance * selectedToken['price'] | number : precision}}
@@ -32,7 +32,7 @@
+ [matAutocomplete]="auto1" > @@ -182,6 +182,7 @@
{{ sendForm.value.alias }}<
diff --git a/src/app/dashboard/vote/vote.component.html b/src/app/dashboard/vote/vote.component.html index ae1b7e24..2713238e 100644 --- a/src/app/dashboard/vote/vote.component.html +++ b/src/app/dashboard/vote/vote.component.html @@ -10,7 +10,7 @@
{{(totalBalance > 10000) ? ((totalBalance / 1000) | - number: '1.2-4') + "K" : ((totalBalance) | number: '1.2-4') }} {{aService.activeChain['symbol']}} + number: '1.2-4') + "K" : ((totalBalance) | number: precision) }} {{aService.activeChain['symbol']}}
@@ -22,7 +22,7 @@
{{(stakedBalance > 10000) ? ((stakedBalance / 1000) | - number: '1.2-4') + "K" : ((stakedBalance) | number: '1.2-4') }} {{aService.activeChain['symbol']}} + number: '1.2-4') + "K" : ((stakedBalance) | number: precision) }} {{aService.activeChain['symbol']}}
STAKED + REX: {{(totalStaked) | number : @@ -211,6 +211,15 @@ + + Add linkauth + + + + + Authorize your custom permission to execute these actions:
eosio::claimgbmvote,
eosio::claimgenesis,
eosio::voteproducer. +
+
Auto-claim setup verified. All good. @@ -234,6 +243,7 @@ Enable autoclaim +
@@ -591,7 +601,7 @@

Background:

@@ -263,7 +270,7 @@
Insert your existing private key below (ACTIVE key recom + placeholder="{{network.activeChain['name']}} Private key" pattern="[0-9a-zA-Z ]" > { - let pvk = this.pvtform.value.private_key; + let pvk = this.pvtform.value.private_key.trim(); this.crypto.encryptAndStore(pvk, pubk).then(() => { @@ -568,7 +568,7 @@ export class LandingComponent implements OnInit, OnDestroy { } else { if (input !== '') { this.busyActivekey = true; - this.eos.checkPvtKey(input).then((results) => { + this.eos.checkPvtKey(input.trim()).then((results) => { this.publicEOS = results.publicKey; this.importedAccounts = []; this.importedAccounts = [...results.foundAccounts]; @@ -582,7 +582,7 @@ export class LandingComponent implements OnInit, OnDestroy { const refundTime = new Date(tempDate).getTime() + (72 * 60 * 60 * 1000); const now = new Date().getTime(); if (now > refundTime) { - this.eos.claimRefunds(item.account_name, input, item['permission']).then((tx) => { + this.eos.claimRefunds(item.account_name, input.trim(), item['permission']).then((tx) => { console.log(tx); }); } else { diff --git a/src/app/services/eosjs2.service.ts b/src/app/services/eosjs2.service.ts index ef02db2c..13e9a107 100644 --- a/src/app/services/eosjs2.service.ts +++ b/src/app/services/eosjs2.service.ts @@ -1,9 +1,9 @@ import {Injectable} from '@angular/core'; -import {Api, JsonRpc} from 'eosjs'; -import {SignatureProvider, SignatureProviderArgs} from 'eosjs/dist/eosjs-api-interfaces'; +import {Api , JsonRpc} from 'eosjs'; +import {SignatureProvider , SignatureProviderArgs} from 'eosjs/dist/eosjs-api-interfaces'; import {PushTransactionArgs} from 'eosjs/dist/eosjs-rpc-interfaces'; -const {JsSignatureProvider} = require('eosjs/dist/eosjs-jssig'); +const {JsSignatureProvider} = require ( 'eosjs/dist/eosjs-jssig' ); export class SimpleosSigProvider implements SignatureProvider { localRPC: JsonRpc; @@ -14,46 +14,46 @@ export class SimpleosSigProvider implements SignatureProvider { async processTrx(binaryData) { const args = { - rpc: this.localRPC, - authorityProvider: undefined, - abiProvider: undefined, - signatureProvider: this, - chainId: undefined, - textEncoder: undefined, + rpc: this.localRPC , + authorityProvider: undefined , + abiProvider: undefined , + signatureProvider: this , + chainId: undefined , + textEncoder: undefined , textDecoder: undefined }; - const api = new Api(args); - return await api.deserializeTransactionWithActions(binaryData); + const api = new Api ( args ); + return await api.deserializeTransactionWithActions ( binaryData ); } getAvailableKeys(): Promise { - console.log('get available keys'); - return new Promise((resolve, reject) => { - resolve(['']); - }); + console.log ( 'get available keys' ); + return new Promise ( (resolve , reject) => { + resolve ( [ '' ] ); + } ); } sign(args: SignatureProviderArgs): Promise { - console.log('Incoming signature request'); - console.log(args); - return new Promise((resolve, reject) => { - resolve({ - signatures: [''], - serializedTransaction: new Uint8Array() - }); - }); + console.log ( 'Incoming signature request' ); + console.log ( args ); + return new Promise ( (resolve , reject) => { + resolve ( { + signatures: [ '' ] , + serializedTransaction: new Uint8Array () + } ); + } ); } } -@Injectable({ +@Injectable ( { providedIn: 'root' -}) +} ) export class Eosjs2Service { constructor() { this.rpc = null; - this.textDecoder = new TextDecoder(); - this.textEncoder = new TextEncoder(); + this.textDecoder = new TextDecoder (); + this.textEncoder = new TextEncoder (); } rpc: JsonRpc; @@ -67,287 +67,313 @@ export class Eosjs2Service { private api: Api; private defaultMainnetEndpoint = 'https://api.eosrio.io'; - static makeDelegateBW(auth, from: string, receiver: string, stake_net_quantity: string, stake_cpu_quantity: string, transfer: boolean, symbol: string) { + static makeDelegateBW(auth , from: string , receiver: string , stake_net_quantity: string , stake_cpu_quantity: string , transfer: boolean , symbol: string) { return { - account: 'eosio', - name: 'delegatebw', - authorization: [auth], + account: 'eosio' , + name: 'delegatebw' , + authorization: [ auth ] , data: { - 'from': from, - 'receiver': receiver, - 'stake_net_quantity': stake_net_quantity + ' ' + symbol, - 'stake_cpu_quantity': stake_cpu_quantity + ' ' + symbol, + 'from': from , + 'receiver': receiver , + 'stake_net_quantity': stake_net_quantity + ' ' + symbol , + 'stake_cpu_quantity': stake_cpu_quantity + ' ' + symbol , 'transfer': transfer } }; } - static makeUndelegateBW(auth: any, from: string, receiver: string, unstake_net_quantity: string, unstake_cpu_quantity: string, symbol: string) { + static makeUndelegateBW(auth: any , from: string , receiver: string , unstake_net_quantity: string , unstake_cpu_quantity: string , symbol: string) { return { - account: 'eosio', - name: 'undelegatebw', - authorization: [auth], + account: 'eosio' , + name: 'undelegatebw' , + authorization: [ auth ] , data: { - 'from': from, - 'receiver': receiver, - 'unstake_net_quantity': unstake_net_quantity + ' ' + symbol, + 'from': from , + 'receiver': receiver , + 'unstake_net_quantity': unstake_net_quantity + ' ' + symbol , 'unstake_cpu_quantity': unstake_cpu_quantity + ' ' + symbol } }; } - initRPC(endpoint, chainID) { + initRPC(endpoint , chainID) { this.activeEndpoint = endpoint; this.chainId = chainID; - this.rpc = new JsonRpc(this.activeEndpoint); - this.localSigProvider = new SimpleosSigProvider(this.rpc); + this.rpc = new JsonRpc ( this.activeEndpoint ); + this.localSigProvider = new SimpleosSigProvider ( this.rpc ); } initAPI(key) { - this.JsSigProvider = new JsSignatureProvider([key]); - this.api = new Api({ - rpc: this.rpc, - signatureProvider: this.JsSigProvider, - textDecoder: new TextDecoder(), - textEncoder: new TextEncoder() - }); - setTimeout(() => { + this.JsSigProvider = new JsSignatureProvider ( [ key ] ); + this.api = new Api ( { + rpc: this.rpc , + signatureProvider: this.JsSigProvider , + textDecoder: new TextDecoder () , + textEncoder: new TextEncoder () + } ); + setTimeout ( () => { this.JsSigProvider = null; this.api = null; - }, 5000); + } , 5000 ); } signTrx(trx) { - return this.api.transact(trx, { - blocksBehind: 3, - expireSeconds: 30, - broadcast: false, + return this.api.transact ( trx , { + blocksBehind: 3 , + expireSeconds: 30 , + broadcast: false , sign: true - }); + } ); } transact(trx) { if (this.api) { - return this.api.transact(trx, { - blocksBehind: 3, - expireSeconds: 30, - }); + return this.api.transact ( trx , { + blocksBehind: 3 , + expireSeconds: 30 , + } ); } else { - return new Promise(resolve => { - resolve('wrong_pass'); - }); + return new Promise ( resolve => { + resolve ( 'wrong_pass' ); + } ); } } - async getTableRows(_code: string, _scope: string, _table: string) { - return this.rpc.get_table_rows({ - code: _code, - scope: _scope, + async getTableRows(_code: string , _scope: string , _table: string) { + return this.rpc.get_table_rows ( { + code: _code , + scope: _scope , table: _table - }); + } ); } - async getMainnetTableRows(_code: string, _scope: string, _table: string) { - const tempRpc = new JsonRpc(this.defaultMainnetEndpoint); - return tempRpc.get_table_rows({ - code: _code, - scope: _scope, + async getMainnetTableRows(_code: string , _scope: string , _table: string) { + const tempRpc = new JsonRpc ( this.defaultMainnetEndpoint ); + return tempRpc.get_table_rows ( { + code: _code , + scope: _scope , table: _table - }); + } ); } async getRexPool(): Promise { - const rexpool = await this.rpc.get_table_rows({ - json: true, - code: 'eosio', - scope: 'eosio', + const rexpool = await this.rpc.get_table_rows ( { + json: true , + code: 'eosio' , + scope: 'eosio' , table: 'rexpool' - }); - return rexpool.rows[0]; + } ); + return rexpool.rows[ 0 ]; } async getRexData(_account: string): Promise { - const rexbal_rows = await this.rpc.get_table_rows({ - json: true, - code: 'eosio', - scope: 'eosio', - table: 'rexbal', - lower_bound: _account, + const rexbal_rows = await this.rpc.get_table_rows ( { + json: true , + code: 'eosio' , + scope: 'eosio' , + table: 'rexbal' , + lower_bound: _account , limit: 1 - }); - const rexbal_data = rexbal_rows.rows.find(row => row.owner === _account); - const rexfund_rows = await this.rpc.get_table_rows({ - json: true, - code: 'eosio', - scope: 'eosio', - table: 'rexfund', - lower_bound: _account, + } ); + const rexbal_data = rexbal_rows.rows.find ( row => row.owner === _account ); + const rexfund_rows = await this.rpc.get_table_rows ( { + json: true , + code: 'eosio' , + scope: 'eosio' , + table: 'rexfund' , + lower_bound: _account , limit: 1 - }); - const rexfund_data = rexfund_rows.rows.find(row => row.owner === _account); + } ); + const rexfund_data = rexfund_rows.rows.find ( row => row.owner === _account ); return { - rexbal: rexbal_data, + rexbal: rexbal_data , rexfund: rexfund_data }; } - async recursiveFetchTableRows(array: any[], _code: string, _scope: string, _table: string, _pkey: string, LB: string, _batch: number) { - const data = await this.rpc.get_table_rows({ - json: true, - code: _code, - scope: _scope, - table: _table, - limit: _batch, + async recursiveFetchTableRows(array: any[] , _code: string , _scope: string , _table: string , _pkey: string , LB: string , _batch: number) { + const data = await this.rpc.get_table_rows ( { + json: true , + code: _code , + scope: _scope , + table: _table , + limit: _batch , lower_bound: LB - }); + } ); let batch_size = _batch; if (LB !== '') { - data.rows.shift(); + data.rows.shift (); batch_size--; } - array.push(...data.rows); - const last_elem = data.rows[data.rows.length - 1]; - const last_pk = last_elem[_pkey]; + array.push ( ...data.rows ); + const last_elem = data.rows[ data.rows.length - 1 ]; + const last_pk = last_elem[ _pkey ]; if (data.rows.length === batch_size) { - await this.recursiveFetchTableRows(array, _code, _scope, _table, _pkey, last_pk, _batch); + await this.recursiveFetchTableRows ( array , _code , _scope , _table , _pkey , last_pk , _batch ); } } async getProxies(contract): Promise { - console.log('Getting proxy data via chain API'); + console.log ( 'Getting proxy data via chain API' ); const result = { rows: [] }; if (contract !== '') { - await this.recursiveFetchTableRows(result.rows, contract, contract, 'proxies', 'owner', '', 100); + await this.recursiveFetchTableRows ( result.rows , contract , contract , 'proxies' , 'owner' , '' , 100 ); } return result; } async getLoans(account: string): Promise { const loans = { - cpu: [], + cpu: [] , net: [] }; - const data = await Promise.all([this.rpc.get_table_rows({ - json: true, - code: 'eosio', - table: 'cpuloan', - scope: 'eosio', - index_position: 3, - key_type: 'i64', - lower_bound: account, + const data = await Promise.all ( [ this.rpc.get_table_rows ( { + json: true , + code: 'eosio' , + table: 'cpuloan' , + scope: 'eosio' , + index_position: 3 , + key_type: 'i64' , + lower_bound: account , limit: 25 - }), this.rpc.get_table_rows({ - json: true, - code: 'eosio', - table: 'netloan', - scope: 'eosio', - index_position: 3, - key_type: 'i64', - lower_bound: account, + } ) , this.rpc.get_table_rows ( { + json: true , + code: 'eosio' , + table: 'netloan' , + scope: 'eosio' , + index_position: 3 , + key_type: 'i64' , + lower_bound: account , limit: 25 - })]); + } ) ] ); // Extract owner's CPU loans - for (const row of data[0].rows) { + for (const row of data[ 0 ].rows) { if (row.from === account) { - loans.cpu.push(row); + loans.cpu.push ( row ); } } // Extract owner's NET loans - for (const row of data[1].rows) { + for (const row of data[ 1 ].rows) { if (row.from === account) { - loans.net.push(row); + loans.net.push ( row ); } } return loans; } async checkSimpleosUpdate() { - const tempRpc = new JsonRpc(this.defaultMainnetEndpoint); - return tempRpc.get_table_rows({ - json: true, - code: 'simpleosvers', - scope: 'simpleosvers', + const tempRpc = new JsonRpc ( this.defaultMainnetEndpoint ); + return tempRpc.get_table_rows ( { + json: true , + code: 'simpleosvers' , + scope: 'simpleosvers' , table: 'info' - }); + } ); } - async createAccount(creator: string, name: string, owner: string, - active: string, delegateAmount: number, - rambytes: number, transfer: boolean, - giftAmount: number, giftMemo: string, symbol: string, precision: number, permission): Promise { + async createAccount(creator: string , name: string , owner: string , + active: string , delegateAmount: number , + rambytes: number , transfer: boolean , + giftAmount: number , giftMemo: string , symbol: string , precision: number , permission): Promise { const _actions = []; const auth = { - actor: creator, + actor: creator , permission: permission }; - _actions.push({ - account: 'eosio', - name: 'newaccount', - authorization: [auth], - data: {creator: creator, name: name, owner: owner, active: active} - }); - _actions.push({ - account: 'eosio', - name: 'buyrambytes', - authorization: [auth], - data: {payer: creator, receiver: name, bytes: rambytes} - }); - _actions.push({ - account: 'eosio', - name: 'delegatebw', - authorization: [auth], + const _onwer = { + 'threshold': 1 , + 'keys': [ { + 'key': owner , + 'weight': 1 + } ] , + 'accounts': [] , + 'waits': [] + }; + const _avtive = { + 'threshold': 1 , + 'keys': [ { + 'key': active , + 'weight': 1 + } ] , + 'accounts': [] , + 'waits': [] + }; + + _actions.push ( { + account: 'eosio' , + name: 'newaccount' , + authorization: [ auth ] , + data: {creator: creator , name: name , owner: _onwer , active: _avtive} + } ); + _actions.push ( { + account: 'eosio' , + name: 'buyrambytes' , + authorization: [ auth ] , + data: {payer: creator , receiver: name , bytes: rambytes} + } ); + _actions.push ( { + account: 'eosio' , + name: 'delegatebw' , + authorization: [ auth ] , data: { - from: creator, receiver: name, - stake_net_quantity: (delegateAmount * 0.3).toFixed(precision) + ' ' + symbol, - stake_cpu_quantity: (delegateAmount * 0.7).toFixed(precision) + ' ' + symbol, - transfer: transfer ? 1 : 0 + from: creator , receiver: name , + stake_net_quantity: (delegateAmount * 0.3).toFixed ( precision ) + ' ' + symbol , + stake_cpu_quantity: (delegateAmount * 0.7).toFixed ( precision ) + ' ' + symbol , + transfer: transfer } - }); + } ); if (giftAmount > 0) { - _actions.push({ - from: creator, - to: name, - quantity: giftAmount.toFixed(precision) + ' ' + symbol, + _actions.push ( { + from: creator , + to: name , + quantity: giftAmount.toFixed ( precision ) + ' ' + symbol , memo: giftMemo - }); + } ); } - return this.api.transact({ + + console.log ( _actions ); + return this.api.transact ( { actions: _actions - }, { - blocksBehind: 3, - expireSeconds: 30, - }); + } , { + blocksBehind: 3 , + expireSeconds: 30 , + } ); } - async changebw(account, permission, amount, symbol, ratio, fr) { - let cpu_v, net_v; - const accountInfo = await this.rpc.get_account(account); - const refund = accountInfo['refund_request']; - const liquid_bal = accountInfo['core_liquid_balance']; + async changebw(account , permission , amount , symbol , ratio , fr) { + let cpu_v , net_v; + const accountInfo = await this.rpc.get_account ( account ); + const refund = accountInfo[ 'refund_request' ]; + const liquid_bal = accountInfo[ 'core_liquid_balance' ]; let wei_cpu: any; let wei_net: any; let ref_cpu = 0; let ref_net = 0; let liquid = 0; - if ((typeof accountInfo['cpu_weight']) === 'string') { - wei_cpu = Math.round(parseFloat(accountInfo['cpu_weight'].split(' ')[0]) / 10000); - wei_net = Math.round(parseFloat(accountInfo['net_weight'].split(' ')[0]) / 10000); + const _div = Math.pow ( 10 , fr ); + const _zero = Number ( 0 ).toFixed ( fr ); + + if ((typeof accountInfo[ 'cpu_weight' ]) === 'string') { + wei_cpu = Math.round ( parseFloat ( accountInfo[ 'cpu_weight' ].split ( ' ' )[ 0 ] ) / _div ); + wei_net = Math.round ( parseFloat ( accountInfo[ 'net_weight' ].split ( ' ' )[ 0 ] ) / _div ); } else { - wei_cpu = accountInfo['cpu_weight']; - wei_net = accountInfo['net_weight']; + wei_cpu = accountInfo[ 'cpu_weight' ]; + wei_net = accountInfo[ 'net_weight' ]; } if (liquid_bal) { - liquid = Math.round(parseFloat(liquid_bal.split(' ')[0]) * 10000); + liquid = Math.round ( parseFloat ( liquid_bal.split ( ' ' )[ 0 ] ) * _div ); } if (refund) { - ref_cpu = Math.round(parseFloat(refund['cpu_amount'].split(' ')[0]) * 10000); - ref_net = Math.round(parseFloat(refund['net_amount'].split(' ')[0]) * 10000); + ref_cpu = Math.round ( parseFloat ( refund[ 'cpu_amount' ].split ( ' ' )[ 0 ] ) * _div ); + ref_net = Math.round ( parseFloat ( refund[ 'net_amount' ].split ( ' ' )[ 0 ] ) * _div ); } + console.log(wei_cpu,wei_net,liquid,ref_cpu,ref_net); + const current_stake = wei_cpu + wei_net; const new_total = current_stake + amount; @@ -370,46 +396,43 @@ export class Eosjs2Service { const _actions = []; const auth = { - actor: account, + actor: account , permission: permission }; - const _div = Math.pow(10, fr); - const _zero = Number(0).toFixed(fr); - if (cpu_diff < 0 && net_diff >= 0) { net_v = _zero; - cpu_v = ((Math.abs(cpu_diff)) / _div).toFixed(fr); - _actions.push(Eosjs2Service.makeUndelegateBW(auth, account, account, net_v, cpu_v, symbol)); + cpu_v = ((Math.abs ( cpu_diff )) / _div).toFixed ( fr ); + _actions.push ( Eosjs2Service.makeUndelegateBW ( auth , account , account , net_v , cpu_v , symbol ) ); if (net_diff > 0) { cpu_v = _zero; - net_v = (net_diff / _div).toFixed(fr); - _actions.push(Eosjs2Service.makeDelegateBW(auth, account, account, net_v, cpu_v, false, symbol)); + net_v = (net_diff / _div).toFixed ( fr ); + _actions.push ( Eosjs2Service.makeDelegateBW ( auth , account , account , net_v , cpu_v , false , symbol ) ); } } else if (net_diff < 0 && cpu_diff >= 0) { - net_v = ((Math.abs(net_diff)) / _div).toFixed(fr); + net_v = ((Math.abs ( net_diff )) / _div).toFixed ( fr ); cpu_v = _zero; - _actions.push(Eosjs2Service.makeUndelegateBW(auth, account, account, net_v, cpu_v, symbol)); + _actions.push ( Eosjs2Service.makeUndelegateBW ( auth , account , account , net_v , cpu_v , symbol ) ); if (cpu_diff > 0) { net_v = _zero; - cpu_v = (cpu_diff / _div).toFixed(fr); - _actions.push(Eosjs2Service.makeDelegateBW(auth, account, account, net_v, cpu_v, false, symbol)); + cpu_v = (cpu_diff / _div).toFixed ( fr ); + _actions.push ( Eosjs2Service.makeDelegateBW ( auth , account , account , net_v , cpu_v , false , symbol ) ); } } else if (net_diff < 0 && cpu_diff < 0) { - cpu_v = ((Math.abs(cpu_diff)) / _div).toFixed(fr); - net_v = ((Math.abs(net_diff)) / _div).toFixed(fr); - _actions.push(Eosjs2Service.makeUndelegateBW(auth, account, account, net_v, cpu_v, symbol)); + cpu_v = ((Math.abs ( cpu_diff )) / _div).toFixed ( fr ); + net_v = ((Math.abs ( net_diff )) / _div).toFixed ( fr ); + _actions.push ( Eosjs2Service.makeUndelegateBW ( auth , account , account , net_v , cpu_v , symbol ) ); } else { - cpu_v = (cpu_diff / _div).toFixed(fr); - net_v = (net_diff / _div).toFixed(fr); - _actions.push(Eosjs2Service.makeDelegateBW(auth, account, account, net_v, cpu_v, false, symbol)); + cpu_v = (cpu_diff / _div).toFixed ( fr ); + net_v = (net_diff / _div).toFixed ( fr ); + _actions.push ( Eosjs2Service.makeDelegateBW ( auth , account , account , net_v , cpu_v , false , symbol ) ); } - return this.api.transact({ + return this.api.transact ( { actions: _actions - }, { - blocksBehind: 3, - expireSeconds: 30, - }); + } , { + blocksBehind: 3 , + expireSeconds: 30 , + } ); } } diff --git a/src/app/services/network.service.ts b/src/app/services/network.service.ts index c91e90d9..e5f3387c 100644 --- a/src/app/services/network.service.ts +++ b/src/app/services/network.service.ts @@ -55,6 +55,21 @@ export class NetworkService { public activeChain = null; defaultChains: any[]; + selectGroup: any[]; + + static groupBy(list, keyGetter) { + const map = new Map(); + list.forEach((item) => { + const key = keyGetter(item); + const collection = map.get(key); + if (!collection) { + map.set(key, [item]); + } else { + collection.push(item); + } + }); + return map; + } constructor( private eosjs: EOSJSService, @@ -70,8 +85,16 @@ export class NetworkService { this.validEndpoints = []; this.status = ''; this.connectionTimeout = null; + + const groupChain = NetworkService.groupBy(this.defaultChains, chain => chain.network); + const mainnet = groupChain.get('MAINNET'); + const testenet = groupChain.get('TESTNET'); + this.selectGroup = [{'name':'MAINNETS','chains': mainnet},{'name':'TESTNETS','chains': testenet}]; + } + + connect(automatic: boolean) { // console.log('analyzing endpoints...'); this.autoMode = automatic; diff --git a/src/app/services/theme.service.ts b/src/app/services/theme.service.ts index 2170a56b..2b5fe702 100644 --- a/src/app/services/theme.service.ts +++ b/src/app/services/theme.service.ts @@ -1,4 +1,4 @@ -import {ApplicationRef, Injectable} from '@angular/core'; +import {Injectable} from '@angular/core'; export const DefaultTheme = { '--main-background': '#272727', diff --git a/src/app/services/voting.service.ts b/src/app/services/voting.service.ts index 01bad6ca..8d6a9532 100644 --- a/src/app/services/voting.service.ts +++ b/src/app/services/voting.service.ts @@ -360,7 +360,7 @@ export class VotingService { } async listProxies() { - console.log('list proxies!'); + // console.log('list proxies!'); this.setWeightParams(); let registry = null; if (this.proxies.length > 0) { @@ -368,7 +368,7 @@ export class VotingService { } if (!this.loadingProxs && this.initListProx === false && this.aService.selected.getValue().name) { this.loadingProxs = true; - console.log('listProxies 1', this.loadingProxs, this.initListProx); + // console.log('listProxies 1', this.loadingProxs, this.initListProx); this.proxies = []; this.uniqueProxies.clear(); const myAccount = this.aService.selected.getValue(); @@ -466,7 +466,7 @@ export class VotingService { this.initListProx = true; this.listReady.next(true); this.loadingProxs = false; - console.log('listProxies 2', this.loadingProxs, this.initListProx); + // console.log('listProxies 2', this.loadingProxs, this.initListProx); // Pass 2 - Enhance metadata this.activeCounter = 50; @@ -512,8 +512,8 @@ export class VotingService { requestQueue.push({proxy: prox['account'], index: idx}); } }); - console.log('After'); - console.log(this.proxies); + // console.log('After'); + // console.log(this.proxies); if (requestQueue.length > 0) { this.processReqQueueProxy(requestQueue, registry).then(() => { console.log('success');