Merge remote-tracking branch 'upstream/chat-reference' into qchat-updates-integration
This commit is contained in:
commit
5c8e7265b1
@ -26,8 +26,9 @@ Easiest way to install the lastest required packages on Linux is via nvm.
|
||||
``` source ~/.profile ``` (For Debian based distro) <br/>
|
||||
``` source ~/.bashrc ``` (For Fedora / CentOS) <br/>
|
||||
``` nvm ls-remote ``` (Fetch list of available versions) <br/>
|
||||
``` nvm install v16.14.2 ``` (LTS: Gallium supported by Electron) <br/>
|
||||
``` npm -g install yarn ``` <br/>
|
||||
``` nvm install v16.16.0 ``` (LTS: Gallium supported by Electron) <br/>
|
||||
``` npm --location=global install yarn ``` <br/>
|
||||
``` npm --location=global install npm@8.19.2 ``` <br/>
|
||||
|
||||
On BSD do a ``` pkg_add node followed by npm install -g yarn ```
|
||||
|
||||
|
@ -99,7 +99,7 @@ linux:
|
||||
StartupWMClass: qortal-ui
|
||||
executableArgs:
|
||||
- --no-sandbox
|
||||
- '--js-flags="--max-old-space-size=6144"'
|
||||
- '--js-flags="--max-old-space-size=3584"'
|
||||
target:
|
||||
- "deb"
|
||||
- "AppImage"
|
||||
|
48
electron.js
48
electron.js
@ -4,7 +4,7 @@ const server = require('./server.js');
|
||||
const log = require('electron-log');
|
||||
const path = require('path');
|
||||
|
||||
// THOUGHTS: Make this APP more modularize and platform agnostic...
|
||||
app.commandLine.appendSwitch('js-flags', '--max-old-space-size=512')
|
||||
|
||||
process.env['APP_PATH'] = app.getAppPath();
|
||||
|
||||
@ -56,36 +56,60 @@ function createWindow() {
|
||||
minWidth: 700,
|
||||
minHeight: 640,
|
||||
icon: iconPath(),
|
||||
title: "Qortal",
|
||||
title: "Qortal UI",
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
partition: 'persist:webviewsession',
|
||||
enableRemoteModule: false,
|
||||
nativeWindowOpen: false,
|
||||
nativeWindowOpen: false,
|
||||
sandbox: true
|
||||
},
|
||||
show: false
|
||||
})
|
||||
myWindow.maximize();
|
||||
myWindow.show();
|
||||
myWindow.maximize()
|
||||
myWindow.show()
|
||||
myWindow.loadURL('http://localhost:12388/app/wallet')
|
||||
myWindow.on('closed', function () {
|
||||
myWindow = null
|
||||
})
|
||||
myWindow.on('minimize',function(event) {
|
||||
event.preventDefault()
|
||||
myWindow.hide()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const createTray = () => {
|
||||
let myTray = new Tray(path.join(__dirname, 'img', 'icons', 'png', '32x32.png'))
|
||||
const contextMenu = Menu.buildFromTemplate([{
|
||||
label: "Quit", click() {
|
||||
myTray.destroy();
|
||||
app.quit();
|
||||
let myTray = new Tray(__dirname + '/img/icons/png/tray/tray.png')
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
label: `Qortal UI v${app.getVersion()}`,
|
||||
enabled: false,
|
||||
},
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
}])
|
||||
{
|
||||
label: 'Show Qortal UI',
|
||||
click: function () {
|
||||
myWindow.maximize()
|
||||
myWindow.show()
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Quit',
|
||||
click() {
|
||||
myTray.destroy()
|
||||
app.quit()
|
||||
},
|
||||
},
|
||||
])
|
||||
myTray.setTitle("QORTAL UI")
|
||||
myTray.setToolTip("QORTAL UI")
|
||||
myTray.setToolTip(`Qortal UI v${app.getVersion()}`)
|
||||
myTray.setContextMenu(contextMenu)
|
||||
myTray.on("double-click", () => myWindow.maximize() , myWindow.show())
|
||||
}
|
||||
|
||||
const isLock = app.requestSingleInstanceLock();
|
||||
|
BIN
img/icons/png/tray/tray.png
Normal file
BIN
img/icons/png/tray/tray.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 847 B |
BIN
img/icons/png/tray/tray@1.5x.png
Normal file
BIN
img/icons/png/tray/tray@1.5x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
img/icons/png/tray/tray@2x.png
Normal file
BIN
img/icons/png/tray/tray@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
img/icons/png/tray/tray@3x.png
Normal file
BIN
img/icons/png/tray/tray@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
img/icons/png/tray/tray@4x.png
Normal file
BIN
img/icons/png/tray/tray@4x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
94
package.json
94
package.json
@ -1,48 +1,48 @@
|
||||
{
|
||||
"name": "qortal-ui",
|
||||
"version": "2.0.0",
|
||||
"description": "Qortal Project - decentralize the world - Data storage, communications, web hosting, decentralized trading, complete infrastructure for the future blockchain-based Internet",
|
||||
"keywords": [
|
||||
"QORT",
|
||||
"QORTAL",
|
||||
"DECENTRALIZED"
|
||||
],
|
||||
"main": "electron.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Qortal/qortal-ui.git"
|
||||
},
|
||||
"homepage": "https://qortal.org",
|
||||
"author": "QORTAL <admin@qortal.org>",
|
||||
"license": "GPL-3.0",
|
||||
"scripts": {
|
||||
"install_link:all": "(cd qortal-ui-core && yarn install && yarn link) && (cd qortal-ui-plugins && yarn install && yarn link) && (cd qortal-ui-crypto && yarn install && yarn link) && (yarn link qortal-ui-core && yarn link qortal-ui-plugins && yarn link qortal-ui-crypto)",
|
||||
"dev": "node server.js",
|
||||
"prebuild": "node -p \"'export const UI_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > qortal-ui-core/src/redux/app/version.js",
|
||||
"build-dev": "node build.js",
|
||||
"build": "NODE_ENV=production node build.js",
|
||||
"server": "NODE_ENV=production node server.js",
|
||||
"watch": "node watch.js",
|
||||
"watch-inline": "node watch-inline.js",
|
||||
"start-electron": "NODE_ENV=production electron .",
|
||||
"build-electron": "electron-builder build --publish never",
|
||||
"deploy-electron": "electron-builder build --win --publish never",
|
||||
"release": "NODE_ENV=production electron-builder build --publish never",
|
||||
"update-package-json": "node update-package-json.js",
|
||||
"publish": "electron-builder -p always"
|
||||
},
|
||||
"dependencies": {
|
||||
"electron-updater": "5.2.1",
|
||||
"electron-log": "4.4.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "17.4.11",
|
||||
"electron-builder": "23.3.3",
|
||||
"electron-notarize": "1.2.1",
|
||||
"electron-packager": "16.0.0",
|
||||
"shelljs": "0.8.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17.0"
|
||||
}
|
||||
}
|
||||
"name": "qortal-ui",
|
||||
"version": "2.1.1",
|
||||
"description": "Qortal Project - decentralize the world - Data storage, communications, web hosting, decentralized trading, complete infrastructure for the future blockchain-based Internet",
|
||||
"keywords": [
|
||||
"QORT",
|
||||
"QORTAL",
|
||||
"DECENTRALIZED"
|
||||
],
|
||||
"main": "electron.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Qortal/qortal-ui.git"
|
||||
},
|
||||
"homepage": "https://qortal.org",
|
||||
"author": "QORTAL <admin@qortal.org>",
|
||||
"license": "GPL-3.0",
|
||||
"scripts": {
|
||||
"install_link:all": "(cd qortal-ui-core && yarn install && yarn link) && (cd qortal-ui-plugins && yarn install && yarn link) && (cd qortal-ui-crypto && yarn install && yarn link) && (yarn link qortal-ui-core && yarn link qortal-ui-plugins && yarn link qortal-ui-crypto)",
|
||||
"dev": "node server.js",
|
||||
"prebuild": "node -p \"'export const UI_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > qortal-ui-core/src/redux/app/version.js",
|
||||
"build-dev": "node build.js",
|
||||
"build": "NODE_ENV=production node build.js",
|
||||
"server": "NODE_ENV=production node server.js",
|
||||
"watch": "node watch.js",
|
||||
"watch-inline": "node watch-inline.js",
|
||||
"start-electron": "NODE_ENV=production electron .",
|
||||
"build-electron": "electron-builder build --publish never",
|
||||
"deploy-electron": "electron-builder build --win --publish never",
|
||||
"release": "NODE_ENV=production electron-builder build --publish never",
|
||||
"update-package-json": "node update-package-json.js",
|
||||
"publish": "electron-builder -p always"
|
||||
},
|
||||
"dependencies": {
|
||||
"electron-log": "4.4.8",
|
||||
"electron-updater": "5.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "21.1.1",
|
||||
"electron-builder": "23.3.3",
|
||||
"electron-notarize": "1.2.1",
|
||||
"electron-packager": "16.0.0",
|
||||
"shelljs": "0.8.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.15.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
const styles = {
|
||||
breakpoints: {
|
||||
tablet: '',
|
||||
desktop: '',
|
||||
laptop: '',
|
||||
tablet: '',
|
||||
mobile: ''
|
||||
},
|
||||
theme: {
|
||||
@ -36,5 +37,4 @@ const styles = {
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = styles
|
||||
|
@ -3,7 +3,7 @@ const path = require('path')
|
||||
const user = {
|
||||
node: 0,
|
||||
nodeSettings: {
|
||||
pingInterval: 10 * 1000, // (10 secs)
|
||||
pingInterval: 30 * 1000,
|
||||
},
|
||||
server: {
|
||||
writeHosts: {
|
||||
@ -27,7 +27,7 @@ const user = {
|
||||
},
|
||||
},
|
||||
constants: {
|
||||
pollingInterval: 10000, // How long between checking for new unconfirmed transactions and new blocks (in milliseconds).
|
||||
pollingInterval: 30 * 1000, // How long between checking for new unconfirmed transactions and new blocks (in milliseconds).
|
||||
workerURL: '/build/worker.js',
|
||||
},
|
||||
|
||||
@ -43,5 +43,4 @@ const user = {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = user
|
||||
|
@ -1,85 +1,85 @@
|
||||
{
|
||||
"name": "qortal-ui-core",
|
||||
"version": "2.2.2",
|
||||
"description": "QORTAL-UI Core",
|
||||
"keywords": [
|
||||
"QORT",
|
||||
"QORTAL",
|
||||
"DECENTRALIZED"
|
||||
],
|
||||
"homepage": "https://qortal.org",
|
||||
"main": "ui-core.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Qortal/qortal-ui.git",
|
||||
"directory": "qortal-ui-core"
|
||||
},
|
||||
"author": "QORTAL <admin@qortal.org>",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@hapi/hapi": "20.2.2",
|
||||
"@hapi/inert": "7.0.0",
|
||||
"sass": "1.54.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.19.1",
|
||||
"@material/mwc-button": "0.27.0",
|
||||
"@material/mwc-checkbox": "0.27.0",
|
||||
"@material/mwc-dialog": "0.27.0",
|
||||
"@material/mwc-drawer": "0.27.0",
|
||||
"@material/mwc-fab": "0.27.0",
|
||||
"@material/mwc-formfield": "0.27.0",
|
||||
"@material/mwc-icon": "0.27.0",
|
||||
"@material/mwc-icon-button": "0.27.0",
|
||||
"@material/mwc-list": "0.27.0",
|
||||
"@material/mwc-select": "0.27.0",
|
||||
"@material/mwc-snackbar": "0.27.0",
|
||||
"@material/mwc-textfield": "0.27.0",
|
||||
"@polymer/app-layout": "3.1.0",
|
||||
"@polymer/iron-collapse": "3.0.1",
|
||||
"@polymer/iron-flex-layout": "3.0.1",
|
||||
"@polymer/iron-icons": "3.0.1",
|
||||
"@polymer/iron-pages": "3.0.1",
|
||||
"@polymer/paper-button": "3.0.1",
|
||||
"@polymer/paper-checkbox": "3.1.0",
|
||||
"@polymer/paper-dialog": "3.0.1",
|
||||
"@polymer/paper-dropdown-menu": "3.2.0",
|
||||
"@polymer/paper-icon-button": "3.0.2",
|
||||
"@polymer/paper-input": "3.2.1",
|
||||
"@polymer/paper-item": "3.0.1",
|
||||
"@polymer/paper-listbox": "3.0.1",
|
||||
"@polymer/paper-progress": "3.0.1",
|
||||
"@polymer/paper-ripple": "3.0.2",
|
||||
"@polymer/paper-spinner": "3.0.2",
|
||||
"@polymer/paper-toast": "3.0.1",
|
||||
"@polymer/paper-tooltip": "3.0.1",
|
||||
"@rollup/plugin-alias": "3.1.9",
|
||||
"@rollup/plugin-babel": "5.3.1",
|
||||
"@rollup/plugin-commonjs": "22.0.2",
|
||||
"@rollup/plugin-node-resolve": "14.1.0",
|
||||
"@rollup/plugin-replace": "4.0.0",
|
||||
"@vaadin/grid": "23.2.1",
|
||||
"@vaadin/icons": "23.2.1",
|
||||
"@vaadin/password-field": "23.2.1",
|
||||
"asmcrypto.js": "2.3.2",
|
||||
"bcryptjs": "2.4.3",
|
||||
"epml": "0.3.3",
|
||||
"file-saver": "2.0.5",
|
||||
"lit": "2.3.1",
|
||||
"lit-translate": "2.0.1",
|
||||
"postcss": "8.4.16",
|
||||
"pwa-helpers": "0.9.1",
|
||||
"random-sentence-generator": "0.0.8",
|
||||
"redux": "4.2.0",
|
||||
"redux-thunk": "2.4.1",
|
||||
"rollup": "2.79.0",
|
||||
"rollup-plugin-node-globals": "1.4.0",
|
||||
"rollup-plugin-postcss": "4.0.2",
|
||||
"rollup-plugin-progress": "1.1.2",
|
||||
"rollup-plugin-scss": "3.0.0",
|
||||
"rollup-plugin-terser": "7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17.0"
|
||||
}
|
||||
}
|
||||
"name": "qortal-ui-core",
|
||||
"version": "2.2.3",
|
||||
"description": "QORTAL-UI Core",
|
||||
"keywords": [
|
||||
"QORT",
|
||||
"QORTAL",
|
||||
"DECENTRALIZED"
|
||||
],
|
||||
"homepage": "https://qortal.org",
|
||||
"main": "ui-core.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Qortal/qortal-ui.git",
|
||||
"directory": "qortal-ui-core"
|
||||
},
|
||||
"author": "QORTAL <admin@qortal.org>",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@hapi/hapi": "20.2.2",
|
||||
"@hapi/inert": "7.0.0",
|
||||
"sass": "1.55.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.19.3",
|
||||
"@material/mwc-button": "0.27.0",
|
||||
"@material/mwc-checkbox": "0.27.0",
|
||||
"@material/mwc-dialog": "0.27.0",
|
||||
"@material/mwc-drawer": "0.27.0",
|
||||
"@material/mwc-fab": "0.27.0",
|
||||
"@material/mwc-formfield": "0.27.0",
|
||||
"@material/mwc-icon": "0.27.0",
|
||||
"@material/mwc-icon-button": "0.27.0",
|
||||
"@material/mwc-list": "0.27.0",
|
||||
"@material/mwc-select": "0.27.0",
|
||||
"@material/mwc-snackbar": "0.27.0",
|
||||
"@material/mwc-textfield": "0.27.0",
|
||||
"@polymer/app-layout": "3.1.0",
|
||||
"@polymer/iron-collapse": "3.0.1",
|
||||
"@polymer/iron-flex-layout": "3.0.1",
|
||||
"@polymer/iron-icons": "3.0.1",
|
||||
"@polymer/iron-pages": "3.0.1",
|
||||
"@polymer/paper-button": "3.0.1",
|
||||
"@polymer/paper-checkbox": "3.1.0",
|
||||
"@polymer/paper-dialog": "3.0.1",
|
||||
"@polymer/paper-dropdown-menu": "3.2.0",
|
||||
"@polymer/paper-icon-button": "3.0.2",
|
||||
"@polymer/paper-input": "3.2.1",
|
||||
"@polymer/paper-item": "3.0.1",
|
||||
"@polymer/paper-listbox": "3.0.1",
|
||||
"@polymer/paper-progress": "3.0.1",
|
||||
"@polymer/paper-ripple": "3.0.2",
|
||||
"@polymer/paper-spinner": "3.0.2",
|
||||
"@polymer/paper-toast": "3.0.1",
|
||||
"@polymer/paper-tooltip": "3.0.1",
|
||||
"@rollup/plugin-alias": "4.0.0",
|
||||
"@rollup/plugin-babel": "6.0.0",
|
||||
"@rollup/plugin-commonjs": "23.0.0",
|
||||
"@rollup/plugin-node-resolve": "15.0.0",
|
||||
"@rollup/plugin-replace": "5.0.0",
|
||||
"@vaadin/grid": "23.2.5",
|
||||
"@vaadin/icons": "23.2.5",
|
||||
"@vaadin/password-field": "23.2.5",
|
||||
"asmcrypto.js": "2.3.2",
|
||||
"bcryptjs": "2.4.3",
|
||||
"epml": "0.3.3",
|
||||
"file-saver": "2.0.5",
|
||||
"lit": "2.4.0",
|
||||
"lit-translate": "2.0.1",
|
||||
"postcss": "8.4.18",
|
||||
"pwa-helpers": "0.9.1",
|
||||
"random-sentence-generator": "0.0.8",
|
||||
"redux": "4.2.0",
|
||||
"redux-thunk": "2.4.1",
|
||||
"rollup": "2.79.1",
|
||||
"rollup-plugin-node-globals": "1.4.0",
|
||||
"rollup-plugin-postcss": "4.0.2",
|
||||
"rollup-plugin-progress": "1.1.2",
|
||||
"rollup-plugin-scss": "3.0.0",
|
||||
"rollup-plugin-terser": "7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.15.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { LitElement, html, css } from 'lit'
|
||||
import { connect } from 'pwa-helpers'
|
||||
import { store } from '../store.js'
|
||||
import { doAddNode, doSetNode } from '../redux/app/app-actions.js'
|
||||
import { doAddNode, doSetNode, doLoadNodeConfig } from '../redux/app/app-actions.js'
|
||||
import { get, translate, translateUnsafeHTML } from 'lit-translate'
|
||||
import FileSaver from 'file-saver'
|
||||
import snackbar from './snackbar.js'
|
||||
import { translate, translateUnsafeHTML } from 'lit-translate'
|
||||
import '../components/language-selector.js'
|
||||
|
||||
import '../custom-elements/frag-file-input.js'
|
||||
import '@material/mwc-dialog'
|
||||
import '@material/mwc-button'
|
||||
import '@material/mwc-select'
|
||||
@ -32,6 +33,9 @@ class SettingsPage extends connect(store)(LitElement) {
|
||||
--mdc-dialog-content-ink-color: var(--black);
|
||||
--mdc-theme-surface: var(--white);
|
||||
--mdc-theme-text-primary-on-background: var(--black);
|
||||
--mdc-dialog-min-width: 300px;
|
||||
--mdc-dialog-max-width: 650px;
|
||||
--mdc-dialog-max-height: 700px;
|
||||
}
|
||||
|
||||
#main {
|
||||
@ -45,16 +49,40 @@ class SettingsPage extends connect(store)(LitElement) {
|
||||
--mdc-icon-size: 36px;
|
||||
}
|
||||
|
||||
span.name {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
font-weight: 600;
|
||||
color: #03a9f4;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.red {
|
||||
--mdc-theme-primary: red;
|
||||
}
|
||||
|
||||
.buttonred {
|
||||
color: #f44336;
|
||||
}
|
||||
|
||||
.buttongreen {
|
||||
color: #03c851;
|
||||
}
|
||||
|
||||
.floatleft {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.floatright {
|
||||
float: right;
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
this.nodeConfig = {}
|
||||
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light';
|
||||
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -65,16 +93,25 @@ class SettingsPage extends connect(store)(LitElement) {
|
||||
<hr>
|
||||
</div>
|
||||
<br>
|
||||
<div style="min-height: 250px; min-width: 300px; box-sizing: border-box; position: relative;">
|
||||
<div style="min-height: 250px; min-width: 500px; box-sizing: border-box; position: relative;">
|
||||
<mwc-select icon="link" id="nodeSelect" label="${translate("settings.nodeurl")}" index="0" @selected="${(e) => this.nodeSelected(e)}" style="min-width: 130px; max-width:100%; width:100%;">
|
||||
${this.nodeConfig.knownNodes.map((n, index) => html`
|
||||
<mwc-list-item value="${index}">${n.protocol + '://' + n.domain + ':' + n.port}</mwc-list-item>
|
||||
<mwc-list-item value="${index}">
|
||||
<span class="name">${n.name}</span>
|
||||
<span>${n.protocol + '://' + n.domain + ':' + n.port}</span>
|
||||
</mwc-list-item>
|
||||
`)}
|
||||
</mwc-select>
|
||||
<p style="margin-top: 30px;">${translate("settings.nodehint")}</p>
|
||||
<p style="margin-top: 30px; text-align: center;">${translate("settings.nodehint")}</p>
|
||||
<center>
|
||||
<mwc-button outlined @click="${() => this.shadowRoot.querySelector('#addNodeDialog').show()}"><mwc-icon>add</mwc-icon>${translate("settings.addcustomnode")}</mwc-button>
|
||||
<mwc-button outlined @click="${() => this.shadowRoot.querySelector('#addNodeDialog').show()}"><mwc-icon class="buttongreen">add</mwc-icon>${translate("settings.addcustomnode")}</mwc-button>
|
||||
</center>
|
||||
<center>
|
||||
<mwc-button outlined @click="${() => this.removeList()}"><mwc-icon class="buttonred">remove</mwc-icon>${translate("settings.deletecustomnode")}</mwc-button>
|
||||
</center>
|
||||
<br>
|
||||
<div class="floatleft">${this.renderExportNodesListButton()}</div><div class="floatright">${this.renderImportNodesListButton()}</div>
|
||||
<br><br>
|
||||
</div>
|
||||
<div style="min-height:100px; min-width: 300px; box-sizing: border-box; position: relative;">
|
||||
<hr><br>
|
||||
@ -99,7 +136,9 @@ class SettingsPage extends connect(store)(LitElement) {
|
||||
<hr>
|
||||
</div>
|
||||
<br>
|
||||
<mwc-select id="protocolList" label="${translate("settings.protocol")}" style="width:100%;">
|
||||
<mwc-textfield id="nameInput" style="width:100%;" label="${translate("login.name")}"></mwc-textfield>
|
||||
<br>
|
||||
<mwc-select id="protocolList" style="width:100%;" label="${translate("settings.protocol")}">
|
||||
<mwc-list-item value="http">http</mwc-list-item>
|
||||
<mwc-list-item value="https">https</mwc-list-item>
|
||||
</mwc-select>
|
||||
@ -120,6 +159,26 @@ class SettingsPage extends connect(store)(LitElement) {
|
||||
${translate("settings.addandsave")}
|
||||
</mwc-button>
|
||||
</mwc-dialog>
|
||||
|
||||
<mwc-dialog id="importQortalNodesListDialog">
|
||||
<div style="text-align:center">
|
||||
<h2>${translate("settings.import")}</h2>
|
||||
<hr>
|
||||
<br>
|
||||
</div>
|
||||
<div style="min-height: 150px; min-width: 500px; box-sizing: border-box; position: relative;">
|
||||
<frag-file-input accept=".nodes" @file-read-success="${(e) => this.importQortalNodesList(e.detail.result)}"></frag-file-input>
|
||||
<h4 style="color: #F44336; text-align: center;">${translate("walletpage.wchange56")}</h4>
|
||||
<h5 style="text-align: center;">${translate("settings.warning")}</h5>
|
||||
</div>
|
||||
<mwc-button
|
||||
slot="primaryAction"
|
||||
dialogAction="cancel"
|
||||
class="red"
|
||||
>
|
||||
${translate("general.close")}
|
||||
</mwc-button>
|
||||
</mwc-dialog>
|
||||
`
|
||||
}
|
||||
|
||||
@ -127,15 +186,46 @@ class SettingsPage extends connect(store)(LitElement) {
|
||||
// ...
|
||||
}
|
||||
|
||||
stateChanged(state) {
|
||||
this.config = state.config
|
||||
this.nodeConfig = state.app.nodeConfig
|
||||
}
|
||||
|
||||
show() {
|
||||
this.shadowRoot.getElementById('settingsDialog').show()
|
||||
}
|
||||
|
||||
close() {
|
||||
this.shadowRoot.getElementById('settingsDialog').close()
|
||||
}
|
||||
|
||||
removeList() {
|
||||
localStorage.removeItem("myQortalNodes")
|
||||
|
||||
const obj1 = {
|
||||
name: 'Local Node',
|
||||
protocol: 'http',
|
||||
domain: '127.0.0.1',
|
||||
port: 12391,
|
||||
enableManagement: true
|
||||
}
|
||||
|
||||
const obj2 = {
|
||||
name: 'Local Testnet',
|
||||
protocol: 'http',
|
||||
domain: '127.0.0.1',
|
||||
port: 62391,
|
||||
enableManagement: true
|
||||
}
|
||||
|
||||
var renewNodes = [];
|
||||
renewNodes.push(obj1,obj2)
|
||||
localStorage.setItem('myQortalNodes', JSON.stringify(renewNodes))
|
||||
|
||||
let snack1string = get("settings.snack1")
|
||||
snackbar.add({
|
||||
labelText: `${snack1string}`,
|
||||
dismiss: true
|
||||
})
|
||||
|
||||
store.dispatch(doLoadNodeConfig())
|
||||
}
|
||||
|
||||
nodeSelected(e) {
|
||||
const selectedNodeIndex = this.shadowRoot.getElementById('nodeSelect').value
|
||||
const selectedNode = this.nodeConfig.knownNodes[selectedNodeIndex]
|
||||
@ -144,22 +234,26 @@ class SettingsPage extends connect(store)(LitElement) {
|
||||
const index = parseInt(selectedNodeIndex)
|
||||
if (isNaN(index)) return
|
||||
|
||||
// Set selected node
|
||||
store.dispatch(doSetNode(selectedNodeIndex))
|
||||
|
||||
let snack2string = get("settings.snack2")
|
||||
snackbar.add({
|
||||
labelText: `UI Set To Node : ${selectedNodeUrl}`,
|
||||
labelText: `${snack2string} : ${selectedNodeUrl}`,
|
||||
dismiss: true
|
||||
})
|
||||
|
||||
this.shadowRoot.querySelector('#settingsDialog').close()
|
||||
}
|
||||
|
||||
addNode() {
|
||||
const nameInput = this.shadowRoot.getElementById('nameInput').value
|
||||
const protocolList = this.shadowRoot.getElementById('protocolList').value
|
||||
const domainInput = this.shadowRoot.getElementById('domainInput').value
|
||||
const portInput = this.shadowRoot.getElementById('portInput').value
|
||||
|
||||
if (protocolList.length >= 4 && domainInput.length >= 3 && portInput.length >= 4) {
|
||||
const nodeObject = {
|
||||
name: nameInput,
|
||||
protocol: protocolList,
|
||||
domain: domainInput,
|
||||
port: portInput,
|
||||
@ -168,19 +262,21 @@ class SettingsPage extends connect(store)(LitElement) {
|
||||
|
||||
store.dispatch(doAddNode(nodeObject))
|
||||
|
||||
const haveNodes = JSON.parse(localStorage.getItem('myQortalNodes'));
|
||||
const haveNodes = JSON.parse(localStorage.getItem('myQortalNodes'))
|
||||
|
||||
if (haveNodes === null || haveNodes.length === 0) {
|
||||
|
||||
var savedNodes = [];
|
||||
savedNodes.push(nodeObject);
|
||||
localStorage.setItem('myQortalNodes', JSON.stringify(savedNodes));
|
||||
localStorage.setItem('myQortalNodes', JSON.stringify(savedNodes))
|
||||
|
||||
let snack3string = get("settings.snack3")
|
||||
snackbar.add({
|
||||
labelText: 'Successfully Added And Saved Custom Node',
|
||||
labelText: `${snack3string}`,
|
||||
dismiss: true
|
||||
})
|
||||
|
||||
this.shadowRoot.getElementById('nameInput').value = ''
|
||||
this.shadowRoot.getElementById('protocolList').value = ''
|
||||
this.shadowRoot.getElementById('domainInput').value = ''
|
||||
this.shadowRoot.getElementById('portInput').value = ''
|
||||
@ -193,11 +289,13 @@ class SettingsPage extends connect(store)(LitElement) {
|
||||
stored.push(nodeObject);
|
||||
localStorage.setItem('myQortalNodes', JSON.stringify(stored));
|
||||
|
||||
let snack3string = get("settings.snack3")
|
||||
snackbar.add({
|
||||
labelText: 'Successfully Added And Saved Custom Node',
|
||||
labelText: `${snack3string}`,
|
||||
dismiss: true
|
||||
})
|
||||
|
||||
this.shadowRoot.getElementById('nameInput').value = ''
|
||||
this.shadowRoot.getElementById('protocolList').value = ''
|
||||
this.shadowRoot.getElementById('domainInput').value = ''
|
||||
this.shadowRoot.getElementById('portInput').value = ''
|
||||
@ -206,6 +304,59 @@ class SettingsPage extends connect(store)(LitElement) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
openImportNodesDialog() {
|
||||
this.shadowRoot.querySelector("#importQortalNodesListDialog").show()
|
||||
}
|
||||
|
||||
closeImportNodesDialog() {
|
||||
this.shadowRoot.querySelector("#importQortalNodesListDialog").close()
|
||||
}
|
||||
|
||||
renderExportNodesListButton() {
|
||||
return html`
|
||||
<mwc-button dense unelevated label="${translate("settings.export")}" @click="${() => this.exportQortalNodesList()}"></mwc-button>
|
||||
`
|
||||
}
|
||||
|
||||
exportQortalNodesList() {
|
||||
const qortalNodesList = JSON.stringify(localStorage.getItem("myQortalNodes"))
|
||||
const qortalNodesListSave = JSON.parse((qortalNodesList) || "[]")
|
||||
const blob = new Blob([qortalNodesListSave], { type: 'text/plain;charset=utf-8' })
|
||||
FileSaver.saveAs(blob, `qortal.nodes`)
|
||||
|
||||
let snack4string = get("settings.snack4")
|
||||
snackbar.add({
|
||||
labelText: `${snack4string} qortal.nodes`,
|
||||
dismiss: true
|
||||
})
|
||||
}
|
||||
|
||||
renderImportNodesListButton() {
|
||||
return html`
|
||||
<mwc-button dense unelevated label="${translate("settings.import")}" @click="${() => this.openImportNodesDialog()}"></mwc-button>
|
||||
`
|
||||
}
|
||||
|
||||
async importQortalNodesList(file) {
|
||||
localStorage.removeItem("myQortalNodes")
|
||||
const newItems = JSON.parse((file) || "[]")
|
||||
localStorage.setItem("myQortalNodes", JSON.stringify(newItems))
|
||||
this.shadowRoot.querySelector('#importQortalNodesListDialog').close()
|
||||
|
||||
let snack5string = get("settings.snack5")
|
||||
snackbar.add({
|
||||
labelText: `${snack5string}`,
|
||||
dismiss: true
|
||||
})
|
||||
|
||||
store.dispatch(doLoadNodeConfig())
|
||||
}
|
||||
|
||||
stateChanged(state) {
|
||||
this.config = state.config
|
||||
this.nodeConfig = state.app.nodeConfig
|
||||
}
|
||||
}
|
||||
|
||||
window.customElements.define('settings-page', SettingsPage)
|
||||
|
@ -23,7 +23,7 @@ export const doLoadNodeConfig = () => {
|
||||
|
||||
if (checkNodes === null || checkNodes.length === 0) {
|
||||
var saveNode = [];
|
||||
saveNode.push(obj1,obj2,obj3,obj4,obj5,obj6);
|
||||
saveNode.push(obj1,obj2);
|
||||
localStorage.setItem('myQortalNodes', JSON.stringify(saveNode));
|
||||
nodeConfig.knownNodes = JSON.parse(localStorage.getItem('myQortalNodes'));
|
||||
} else{
|
||||
@ -73,6 +73,7 @@ const addNode = (payload) => {
|
||||
}
|
||||
|
||||
const obj1 = {
|
||||
name: 'Local Node',
|
||||
protocol: 'http',
|
||||
domain: '127.0.0.1',
|
||||
port: 12391,
|
||||
@ -80,36 +81,10 @@ const obj1 = {
|
||||
}
|
||||
|
||||
const obj2 = {
|
||||
protocol: 'http',
|
||||
domain: 'node1.qortal.org',
|
||||
port: 12391,
|
||||
enableManagement: false
|
||||
}
|
||||
|
||||
const obj3 = {
|
||||
protocol: 'http',
|
||||
domain: 'node2.qortal.org',
|
||||
port: 12391,
|
||||
enableManagement: false
|
||||
}
|
||||
|
||||
const obj4 = {
|
||||
name: 'Local Testnet',
|
||||
protocol: 'http',
|
||||
domain: '127.0.0.1',
|
||||
port: 62391,
|
||||
enableManagement: true
|
||||
}
|
||||
|
||||
const obj5 = {
|
||||
protocol: 'http',
|
||||
domain: 'node1.qortal.org',
|
||||
port: 62391,
|
||||
enableManagement: false
|
||||
}
|
||||
|
||||
const obj6 = {
|
||||
protocol: 'http',
|
||||
domain: 'node2.qortal.org',
|
||||
port: 62391,
|
||||
enableManagement: false
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { updateAccountInfo } from './update-account-info.js'
|
||||
// import { doUpdateStoredWalletName } from '../user-actions.js'
|
||||
import { doUpdateStoredWalletName } from './store-wallet.js'
|
||||
|
||||
const GET_NAME_URL = 'names/address/'
|
||||
const CHECK_NAME_INTERVAL = 1000 * 3 // Every 3 seconds
|
||||
const CHECK_NAME_INTERVAL = 1000 * 10 // Every 10 seconds
|
||||
|
||||
export const UPDATE_NAME_STATUSES = {
|
||||
LOADING: 'LOADING',
|
||||
@ -21,8 +20,6 @@ export const doUpdateAccountName = (address, expectedName, awaitingConfirm) => {
|
||||
const state = getState()
|
||||
const config = state.config
|
||||
const node = config.coin.node.api
|
||||
// console.log(config.constants)
|
||||
// const url = config.constants.proxyURL + node.url + node.tail + GET_NAME_URL + address
|
||||
const url = node.url + node.tail + GET_NAME_URL + address
|
||||
return fetch(url)
|
||||
.then(res => res.json())
|
||||
|
@ -1,6 +1,7 @@
|
||||
$mdc-layout-grid-breakpoints: (
|
||||
desktop: 960px,
|
||||
tablet: 480px,
|
||||
desktop: 1440px,
|
||||
laptop: 1240px,
|
||||
tablet: 600px,
|
||||
phone: 0px
|
||||
);
|
||||
|
||||
@ -10,8 +11,6 @@ $mdc-layout-grid-breakpoints: (
|
||||
--layout-breakpoint-mobile: #{map-get($mdc-layout-grid-breakpoints, phone)};
|
||||
}
|
||||
|
||||
// @import '../../node_modules/@material/layout-grid/mdc-layout-grid.scss';
|
||||
|
||||
iframe.pluginJSFrame {
|
||||
display:none;
|
||||
}
|
||||
|
@ -249,6 +249,8 @@ const ERROR_CODES = {
|
||||
1000: "Not yet released."
|
||||
}
|
||||
|
||||
const CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP = 9999999999999
|
||||
|
||||
const QORT_DECIMALS = 1e8
|
||||
|
||||
const PROXY_URL = "/proxy/" // Proxy for api calls
|
||||
@ -265,7 +267,7 @@ const STATIC_BCRYPT_SALT = `$${BCRYPT_VERSION}$${BCRYPT_ROUNDS}$IxVE941tXVUD4cW0
|
||||
|
||||
const KDF_THREADS = 16 // 16 Threads seems like a good number :) . No you dumbass nigerian. Its not ! -_-
|
||||
|
||||
export { TX_TYPES, ERROR_CODES, QORT_DECIMALS, PROXY_URL, STATIC_SALT, ADDRESS_VERSION, KDF_THREADS, STATIC_BCRYPT_SALT }
|
||||
export { TX_TYPES, ERROR_CODES, QORT_DECIMALS, PROXY_URL, STATIC_SALT, ADDRESS_VERSION, KDF_THREADS, STATIC_BCRYPT_SALT, CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP }
|
||||
|
||||
//const TX_TYPES = {
|
||||
// GENESIS_TRANSACTION: 1,
|
||||
@ -291,4 +293,4 @@ export { TX_TYPES, ERROR_CODES, QORT_DECIMALS, PROXY_URL, STATIC_SALT, ADDRESS_V
|
||||
// DEPLOY_AT_TRANSACTION: 16,
|
||||
//
|
||||
// MESSAGE_TRANSACTION: 17
|
||||
//};
|
||||
//};
|
||||
|
@ -3,6 +3,7 @@ import ChatBase from "./ChatBase.js"
|
||||
import nacl from '../../deps/nacl-fast.js'
|
||||
import ed2curve from '../../deps/ed2curve.js'
|
||||
import { Sha256 } from 'asmcrypto.js'
|
||||
import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../../constants.js'
|
||||
|
||||
|
||||
export default class ChatTransaction extends ChatBase {
|
||||
@ -29,6 +30,15 @@ export default class ChatTransaction extends ChatBase {
|
||||
this._hasReceipient[0] = 1
|
||||
}
|
||||
|
||||
set hasChatReference(hasChatReference) {
|
||||
this._hasChatReference = new Uint8Array(1)
|
||||
this._hasChatReference[0] = hasChatReference
|
||||
}
|
||||
|
||||
set chatReference(chatReference) {
|
||||
this._chatReference = chatReference instanceof Uint8Array ? chatReference : this.constructor.Base58.decode(chatReference)
|
||||
}
|
||||
|
||||
set message(message) {
|
||||
|
||||
this.messageText = message;
|
||||
@ -72,6 +82,16 @@ export default class ChatTransaction extends ChatBase {
|
||||
this._isText,
|
||||
this._feeBytes
|
||||
)
|
||||
|
||||
// After the feature trigger timestamp we need to include chat reference
|
||||
if (new Date(this._timestamp).getTime() >= CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP) {
|
||||
params.push(this._hasChatReference)
|
||||
|
||||
if (this._hasChatReference[0] == 1) {
|
||||
params.push(this._chatReference)
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
"use strict";
|
||||
import ChatBase from "./ChatBase.js"
|
||||
import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../../constants.js'
|
||||
|
||||
export default class GroupChatTransaction extends ChatBase {
|
||||
constructor() {
|
||||
@ -18,6 +19,15 @@ export default class GroupChatTransaction extends ChatBase {
|
||||
this._hasReceipient[0] = hasReceipient
|
||||
}
|
||||
|
||||
set hasChatReference(hasChatReference) {
|
||||
this._hasChatReference = new Uint8Array(1)
|
||||
this._hasChatReference[0] = hasChatReference
|
||||
}
|
||||
|
||||
set chatReference(chatReference) {
|
||||
this._chatReference = chatReference instanceof Uint8Array ? chatReference : this.constructor.Base58.decode(chatReference)
|
||||
}
|
||||
|
||||
set message(message) {
|
||||
|
||||
this.messageText = message;
|
||||
@ -47,6 +57,16 @@ export default class GroupChatTransaction extends ChatBase {
|
||||
this._isText,
|
||||
this._feeBytes
|
||||
)
|
||||
|
||||
// After the feature trigger timestamp we need to include chat reference
|
||||
if (new Date(this._timestamp).getTime() >= CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP) {
|
||||
params.push(this._hasChatReference)
|
||||
|
||||
if (this._hasChatReference[0] == 1) {
|
||||
params.push(this._chatReference)
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +1,28 @@
|
||||
{
|
||||
"name": "qortal-ui-crypto",
|
||||
"version": "2.2.2",
|
||||
"description": "QORTAL-UI Crypto",
|
||||
"keywords": [
|
||||
"QORT",
|
||||
"QORTAL",
|
||||
"DECENTRALIZED"
|
||||
],
|
||||
"homepage": "https://qortal.org",
|
||||
"main": "api.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Qortal/qortal-ui.git",
|
||||
"directory": "qortal-ui-crypto"
|
||||
},
|
||||
"author": "QORTAL <admin@qortal.org>",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"asmcrypto.js": "2.3.2",
|
||||
"buffer": "6.0.3",
|
||||
"jssha": "3.2.0",
|
||||
"lodash": "4.17.21"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17.0"
|
||||
}
|
||||
"name": "qortal-ui-crypto",
|
||||
"version": "2.2.3",
|
||||
"description": "QORTAL-UI Crypto",
|
||||
"keywords": [
|
||||
"QORT",
|
||||
"QORTAL",
|
||||
"DECENTRALIZED"
|
||||
],
|
||||
"homepage": "https://qortal.org",
|
||||
"main": "api.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Qortal/qortal-ui.git",
|
||||
"directory": "qortal-ui-crypto"
|
||||
},
|
||||
"author": "QORTAL <admin@qortal.org>",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"asmcrypto.js": "2.3.2",
|
||||
"buffer": "6.0.3",
|
||||
"jssha": "3.2.0",
|
||||
"lodash": "4.17.21"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.15.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,66 +1,66 @@
|
||||
{
|
||||
"name": "qortal-ui-plugins",
|
||||
"version": "2.2.2",
|
||||
"description": "QORTAL-UI Plugins",
|
||||
"keywords": [
|
||||
"QORT",
|
||||
"QORTAL",
|
||||
"DECENTRALIZED"
|
||||
],
|
||||
"homepage": "https://qortal.org",
|
||||
"main": "default-plugins.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Qortal/qortal-ui.git",
|
||||
"directory": "qortal-ui-plugins"
|
||||
},
|
||||
"author": "QORTAL <admin@qortal.org>",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@material/mwc-list": "0.27.0",
|
||||
"@material/mwc-select": "0.27.0",
|
||||
"emoji-picker-js": "https://github.com/Qortal/emoji-picker-js",
|
||||
"name": "qortal-ui-plugins",
|
||||
"version": "2.2.3",
|
||||
"description": "QORTAL-UI Plugins",
|
||||
"keywords": [
|
||||
"QORT",
|
||||
"QORTAL",
|
||||
"DECENTRALIZED"
|
||||
],
|
||||
"homepage": "https://qortal.org",
|
||||
"main": "default-plugins.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Qortal/qortal-ui.git",
|
||||
"directory": "qortal-ui-plugins"
|
||||
},
|
||||
"author": "QORTAL <admin@qortal.org>",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@material/mwc-list": "0.27.0",
|
||||
"@material/mwc-select": "0.27.0",
|
||||
"emoji-picker-js": "https://github.com/Qortal/emoji-picker-js",
|
||||
"localforage": "^1.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.19.1",
|
||||
"@github/time-elements": "3.1.2",
|
||||
"@material/mwc-button": "0.27.0",
|
||||
"@material/mwc-checkbox": "0.27.0",
|
||||
"@material/mwc-dialog": "0.27.0",
|
||||
"@material/mwc-formfield": "0.27.0",
|
||||
"@material/mwc-icon": "0.27.0",
|
||||
"@material/mwc-icon-button": "0.27.0",
|
||||
"@material/mwc-slider": "0.27.0",
|
||||
"@material/mwc-snackbar": "0.27.0",
|
||||
"@material/mwc-tab": "0.27.0",
|
||||
"@material/mwc-tab-bar": "0.27.0",
|
||||
"@material/mwc-textfield": "0.27.0",
|
||||
"@polymer/iron-icons": "3.0.1",
|
||||
"@polymer/paper-icon-button": "3.0.2",
|
||||
"@polymer/paper-progress": "3.0.1",
|
||||
"@polymer/paper-slider": "3.0.1",
|
||||
"@polymer/paper-spinner": "3.0.2",
|
||||
"@polymer/paper-tooltip": "3.0.1",
|
||||
"@rollup/plugin-alias": "3.1.9",
|
||||
"@rollup/plugin-babel": "5.3.1",
|
||||
"@rollup/plugin-commonjs": "22.0.2",
|
||||
"@rollup/plugin-node-resolve": "14.1.0",
|
||||
"@rollup/plugin-replace": "4.0.0",
|
||||
"@vaadin/button": "23.2.1",
|
||||
"@vaadin/grid": "23.2.1",
|
||||
"@vaadin/icons": "23.2.1",
|
||||
"epml": "0.3.3",
|
||||
"file-saver": "2.0.5",
|
||||
"html-escaper": "3.0.3",
|
||||
"lit": "2.3.1",
|
||||
"lit-translate": "2.0.1",
|
||||
"rollup": "2.79.0",
|
||||
"rollup-plugin-node-globals": "1.4.0",
|
||||
"rollup-plugin-progress": "1.1.2",
|
||||
"rollup-plugin-terser": "7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17.0"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.19.3",
|
||||
"@github/time-elements": "3.1.2",
|
||||
"@material/mwc-button": "0.27.0",
|
||||
"@material/mwc-checkbox": "0.27.0",
|
||||
"@material/mwc-dialog": "0.27.0",
|
||||
"@material/mwc-formfield": "0.27.0",
|
||||
"@material/mwc-icon": "0.27.0",
|
||||
"@material/mwc-icon-button": "0.27.0",
|
||||
"@material/mwc-slider": "0.27.0",
|
||||
"@material/mwc-snackbar": "0.27.0",
|
||||
"@material/mwc-tab": "0.27.0",
|
||||
"@material/mwc-tab-bar": "0.27.0",
|
||||
"@material/mwc-textfield": "0.27.0",
|
||||
"@polymer/iron-icons": "3.0.1",
|
||||
"@polymer/paper-icon-button": "3.0.2",
|
||||
"@polymer/paper-progress": "3.0.1",
|
||||
"@polymer/paper-slider": "3.0.1",
|
||||
"@polymer/paper-spinner": "3.0.2",
|
||||
"@polymer/paper-tooltip": "3.0.1",
|
||||
"@rollup/plugin-alias": "4.0.0",
|
||||
"@rollup/plugin-babel": "6.0.0",
|
||||
"@rollup/plugin-commonjs": "23.0.0",
|
||||
"@rollup/plugin-node-resolve": "15.0.0",
|
||||
"@rollup/plugin-replace": "5.0.0",
|
||||
"@vaadin/button": "23.2.5",
|
||||
"@vaadin/grid": "23.2.5",
|
||||
"@vaadin/icons": "23.2.5",
|
||||
"epml": "0.3.3",
|
||||
"file-saver": "2.0.5",
|
||||
"html-escaper": "3.0.3",
|
||||
"lit": "2.4.0",
|
||||
"lit-translate": "2.0.1",
|
||||
"rollup": "2.79.1",
|
||||
"rollup-plugin-node-globals": "1.4.0",
|
||||
"rollup-plugin-progress": "1.1.2",
|
||||
"rollup-plugin-terser": "7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.15.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { LitElement, html, css} from 'lit-element';
|
||||
import { LitElement, html, css } from 'lit';
|
||||
import { render } from 'lit/html.js';
|
||||
import { get, translate } from 'lit-translate';
|
||||
import { Epml } from '../../../epml';
|
||||
import snackbar from './snackbar.js'
|
||||
@ -182,6 +183,7 @@ class ChatModals extends LitElement {
|
||||
timestamp: sendTimestamp,
|
||||
recipient: recipient,
|
||||
recipientPublicKey: _publicKey,
|
||||
hasChatReference: 0,
|
||||
message: messageText,
|
||||
lastReference: reference,
|
||||
proofOfWorkNonce: 0,
|
||||
@ -336,7 +338,6 @@ class ChatModals extends LitElement {
|
||||
dismiss: true
|
||||
})
|
||||
}
|
||||
console.log({ret})
|
||||
return ret
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,6 @@ class ChatPage extends LitElement {
|
||||
// Error Event
|
||||
directSocket.onerror = (e) => {
|
||||
clearTimeout(directSocketTimeout)
|
||||
console.log(`[DIRECT-SOCKET ==> ${cid}]: ${e.type}`);
|
||||
}
|
||||
|
||||
const pingDirectSocket = () => {
|
||||
@ -812,7 +811,6 @@ class ChatPage extends LitElement {
|
||||
// Error Event
|
||||
groupSocket.onerror = (e) => {
|
||||
clearTimeout(groupSocketTimeout)
|
||||
console.log(`[GROUP-SOCKET ==> ${groupId}]: ${e.type}`);
|
||||
}
|
||||
|
||||
const pingGroupSocket = () => {
|
||||
@ -901,6 +899,7 @@ class ChatPage extends LitElement {
|
||||
timestamp: Date.now(),
|
||||
recipient: this._chatId,
|
||||
recipientPublicKey: this._publicKey.key,
|
||||
hasChatReference: 0,
|
||||
message: messageText,
|
||||
lastReference: reference,
|
||||
proofOfWorkNonce: 0,
|
||||
@ -918,6 +917,7 @@ class ChatPage extends LitElement {
|
||||
timestamp: Date.now(),
|
||||
groupID: Number(this._chatId),
|
||||
hasReceipient: 0,
|
||||
hasChatReference: 0,
|
||||
message: messageText,
|
||||
lastReference: reference,
|
||||
proofOfWorkNonce: 0,
|
||||
|
@ -410,6 +410,7 @@ class ChatWelcomePage extends LitElement {
|
||||
timestamp: sendTimestamp,
|
||||
recipient: recipient,
|
||||
recipientPublicKey: _publicKey,
|
||||
hasChatReference: 0,
|
||||
message: messageText,
|
||||
lastReference: reference,
|
||||
proofOfWorkNonce: 0,
|
||||
|
@ -529,6 +529,7 @@ class NameMenu extends LitElement {
|
||||
timestamp: sendTimestamp,
|
||||
recipient: recipient,
|
||||
recipientPublicKey: _publicKey,
|
||||
hasChatReference: 0,
|
||||
message: messageText,
|
||||
lastReference: reference,
|
||||
proofOfWorkNonce: 0,
|
||||
|
@ -588,57 +588,42 @@ class GroupManagement extends LitElement {
|
||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
||||
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
|
||||
const url = `${nodeUrl}/transactions/unitfee?txType=CREATE_GROUP`;
|
||||
await fetch(url)
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
return Promise.reject(response);
|
||||
})
|
||||
.then((json) => {
|
||||
this.createFee = (Number(json) / 1e8).toFixed(8);
|
||||
})
|
||||
.catch((response) => {
|
||||
console.log(response.status, response.statusText, 'Need Core Update');
|
||||
})
|
||||
await fetch(url).then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
return Promise.reject(response);
|
||||
}).then((json) => {
|
||||
this.createFee = (Number(json) / 1e8).toFixed(8);
|
||||
})
|
||||
}
|
||||
|
||||
async unitJoinFee() {
|
||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
||||
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
|
||||
const url = `${nodeUrl}/transactions/unitfee?txType=JOIN_GROUP`;
|
||||
await fetch(url)
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
return Promise.reject(response);
|
||||
})
|
||||
.then((json) => {
|
||||
this.joinFee = (Number(json) / 1e8).toFixed(8);
|
||||
})
|
||||
.catch((response) => {
|
||||
console.log(response.status, response.statusText, 'Need Core Update');
|
||||
})
|
||||
await fetch(url).then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
return Promise.reject(response);
|
||||
}).then((json) => {
|
||||
this.joinFee = (Number(json) / 1e8).toFixed(8);
|
||||
})
|
||||
}
|
||||
|
||||
async unitLeaveFee() {
|
||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
||||
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
|
||||
const url = `${nodeUrl}/transactions/unitfee?txType=LEAVE_GROUP`;
|
||||
await fetch(url)
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
return Promise.reject(response);
|
||||
})
|
||||
.then((json) => {
|
||||
this.leaveFee = (Number(json) / 1e8).toFixed(8);
|
||||
})
|
||||
.catch((response) => {
|
||||
console.log(response.status, response.statusText, 'Need Core Update');
|
||||
})
|
||||
await fetch(url).then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
return Promise.reject(response);
|
||||
}).then((json) => {
|
||||
this.leaveFee = (Number(json) / 1e8).toFixed(8);
|
||||
})
|
||||
}
|
||||
|
||||
resetDefaultSettings() {
|
||||
|
@ -136,7 +136,6 @@ class GroupTransaction extends LitElement {
|
||||
let splitedUrl = decodeTempUrl.split('?')
|
||||
let myGroupId = splitedUrl[1]
|
||||
this.addMintingAccountMessage = myGroupId
|
||||
console.log(myGroupId);
|
||||
}
|
||||
|
||||
getGroupIdFromURL()
|
||||
|
@ -819,6 +819,7 @@ class Chat extends LitElement {
|
||||
timestamp: sendTimestamp,
|
||||
recipient: recipient,
|
||||
recipientPublicKey: _publicKey,
|
||||
hasChatReference: 0,
|
||||
message: messageText,
|
||||
lastReference: reference,
|
||||
proofOfWorkNonce: 0,
|
||||
|
@ -30,10 +30,11 @@ class MintingInfo extends LitElement {
|
||||
|
||||
static get styles() {
|
||||
return css`
|
||||
* {
|
||||
--mdc-theme-surface: var(--white);
|
||||
--mdc-dialog-content-ink-color: var(--black);
|
||||
}
|
||||
* {
|
||||
--mdc-theme-surface: var(--white);
|
||||
--mdc-dialog-content-ink-color: var(--black);
|
||||
}
|
||||
|
||||
@keyframes moveInBottom {
|
||||
0% {
|
||||
opacity: 0;
|
||||
@ -347,42 +348,37 @@ class MintingInfo extends LitElement {
|
||||
this.changeTheme()
|
||||
this.changeLanguage()
|
||||
|
||||
this.levelsCount()
|
||||
|
||||
const getAdminInfo = () => {
|
||||
parentEpml.request("apiCall", { url: `/admin/info` }).then((res) => {
|
||||
setTimeout(() => { this.adminInfo = res; }, 1);
|
||||
});
|
||||
setTimeout(getAdminInfo, 30000);
|
||||
setTimeout(() => { this.adminInfo = res; }, 1)
|
||||
})
|
||||
setTimeout(getAdminInfo, 30000)
|
||||
};
|
||||
|
||||
const getNodeInfo = () => {
|
||||
parentEpml.request("apiCall", { url: `/admin/status` }).then((res) => {
|
||||
this.nodeInfo = res;
|
||||
this.nodeInfo = res
|
||||
// Now look up the sample block
|
||||
getSampleBlock()
|
||||
});
|
||||
setTimeout(getNodeInfo, 30000);
|
||||
})
|
||||
setTimeout(getNodeInfo, 30000)
|
||||
};
|
||||
|
||||
const getSampleBlock = () => {
|
||||
let callBlock = parseFloat(this.nodeInfo.height) - 1440;
|
||||
let callBlock = parseFloat(this.nodeInfo.height) - 1440
|
||||
parentEpml.request("apiCall", { url: `/blocks/byheight/${callBlock}` }).then((res) => {
|
||||
setTimeout(() => { this.sampleBlock = res; }, 1);
|
||||
});
|
||||
};
|
||||
setTimeout(() => { this.sampleBlock = res }, 1)
|
||||
})
|
||||
}
|
||||
|
||||
const getAddressInfo = () => {
|
||||
parentEpml.request('apiCall', { url: `/addresses/${window.parent.reduxStore.getState().app.selectedAddress.address}` }).then((res) => {
|
||||
setTimeout(() => { this.addressInfo = res; }, 1);
|
||||
});
|
||||
setTimeout(getAddressInfo, 30000);
|
||||
};
|
||||
|
||||
const getAddressLevel = () => {
|
||||
parentEpml.request('apiCall', { url: `/addresses/online/levels` }).then((res) => {
|
||||
setTimeout(() => { this.addressLevel = res; }, 1);
|
||||
});
|
||||
setTimeout(getAddressLevel, 30000);
|
||||
};
|
||||
setTimeout(() => { this.addressInfo = res }, 1)
|
||||
})
|
||||
setTimeout(getAddressInfo, 30000)
|
||||
}
|
||||
|
||||
window.addEventListener('storage', () => {
|
||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||
@ -407,35 +403,54 @@ class MintingInfo extends LitElement {
|
||||
if (!selectedAddress || Object.entries(selectedAddress).length === 0) return
|
||||
this.selectedAddress = selectedAddress
|
||||
})
|
||||
});
|
||||
})
|
||||
|
||||
parentEpml.ready().then(() => {
|
||||
parentEpml.subscribe("config", async c => {
|
||||
if (!configLoaded) {
|
||||
setTimeout(getAdminInfo, 1);
|
||||
setTimeout(getNodeInfo, 1);
|
||||
setTimeout(getAddressInfo, 1);
|
||||
setTimeout(getAddressLevel, 1);
|
||||
configLoaded = true;
|
||||
setTimeout(getAdminInfo, 1)
|
||||
setTimeout(getNodeInfo, 1)
|
||||
setTimeout(getAddressInfo, 1)
|
||||
setInterval(this.getAddressLevel, 30000)
|
||||
configLoaded = true
|
||||
}
|
||||
this.config = JSON.parse(c);
|
||||
this.config = JSON.parse(c)
|
||||
})
|
||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
||||
if (value === 'false' && window.getSelection().toString().length !== 0) this.clearSelection();
|
||||
if (value === 'false' && window.getSelection().toString().length !== 0) this.clearSelection()
|
||||
})
|
||||
});
|
||||
|
||||
parentEpml.imReady();
|
||||
})
|
||||
parentEpml.imReady()
|
||||
}
|
||||
|
||||
async levelsCount() {
|
||||
await this.getAddressLevel()
|
||||
this.countForTier4()
|
||||
}
|
||||
|
||||
getAddressLevel = async () => {
|
||||
const callLevels = await parentEpml.request('apiCall', {
|
||||
url: `/addresses/online/levels`
|
||||
})
|
||||
this.addressLevel = callLevels
|
||||
}
|
||||
|
||||
countForTier4() {
|
||||
const minterOnline = (this.addressLevel[7].count + this.addressLevel[8].count)
|
||||
if (minterOnline < 30) {
|
||||
return "false"
|
||||
} else {
|
||||
return "true"
|
||||
}
|
||||
}
|
||||
changeTheme() {
|
||||
const checkTheme = localStorage.getItem('qortalTheme')
|
||||
if (checkTheme === 'dark') {
|
||||
this.theme = 'dark';
|
||||
this.theme = 'dark'
|
||||
} else {
|
||||
this.theme = 'light';
|
||||
this.theme = 'light'
|
||||
}
|
||||
document.querySelector('html').setAttribute('theme', this.theme);
|
||||
document.querySelector('html').setAttribute('theme', this.theme)
|
||||
}
|
||||
|
||||
changeLanguage() {
|
||||
@ -459,23 +474,23 @@ class MintingInfo extends LitElement {
|
||||
|
||||
_averageBlockTime() {
|
||||
let avgBlockString = (this.adminInfo.currentTimestamp - this.sampleBlock.timestamp).toString();
|
||||
let averageTimeString = ((avgBlockString / 1000) / 1440).toFixed(2);
|
||||
let averageBlockTimeString = (averageTimeString).toString();
|
||||
return "" + averageBlockTimeString;
|
||||
let averageTimeString = ((avgBlockString / 1000) / 1440).toFixed(2)
|
||||
let averageBlockTimeString = (averageTimeString).toString()
|
||||
return "" + averageBlockTimeString
|
||||
}
|
||||
|
||||
_timeCalc() {
|
||||
let timeString = (this.adminInfo.currentTimestamp - this.sampleBlock.timestamp).toString();
|
||||
let averageString = ((timeString / 1000) / 1440).toFixed(2);
|
||||
let averageBlockDay = (86400 / averageString).toFixed(2);
|
||||
let averageBlockDayString = (averageBlockDay).toString();
|
||||
return "" + averageBlockDayString;
|
||||
let timeString = (this.adminInfo.currentTimestamp - this.sampleBlock.timestamp).toString()
|
||||
let averageString = ((timeString / 1000) / 1440).toFixed(2)
|
||||
let averageBlockDay = (86400 / averageString).toFixed(2)
|
||||
let averageBlockDayString = (averageBlockDay).toString()
|
||||
return "" + averageBlockDayString
|
||||
}
|
||||
|
||||
_dayReward() {
|
||||
let rewardString = (this._timeCalc() * this._blockReward()).toFixed(2);
|
||||
let rewardDayString = (rewardString).toString();
|
||||
return "" + rewardDayString;
|
||||
let rewardString = (this._timeCalc() * this._blockReward()).toFixed(2)
|
||||
let rewardDayString = (rewardString).toString()
|
||||
return "" + rewardDayString
|
||||
}
|
||||
|
||||
_mintingStatus() {
|
||||
@ -498,21 +513,21 @@ class MintingInfo extends LitElement {
|
||||
|
||||
renderMintingHelp() {
|
||||
if (this._mintingStatus() === "Not Minting") {
|
||||
return html`${translate("mintingpage.mchange9")} <div class="level-blue">==></div> ${translate("mintingpage.mchange7")}<br><mwc-button class="red-button" @click=${() => this.shadowRoot.querySelector("#becomeMinterDialog").show()}><mwc-icon class="help-icon">help_outline</mwc-icon> ${translate("mintingpage.mchange31")}</mwc-button>`;
|
||||
return html`${translate("mintingpage.mchange9")} <div class="level-blue">==></div> ${translate("mintingpage.mchange7")}<br><mwc-button class="red-button" @click=${() => this.shadowRoot.querySelector("#becomeMinterDialog").show()}><mwc-icon class="help-icon">help_outline</mwc-icon> ${translate("mintingpage.mchange31")}</mwc-button>`
|
||||
} else {
|
||||
return html`${translate("mintingpage.mchange6")}`
|
||||
}
|
||||
}
|
||||
|
||||
_levelUpDays() {
|
||||
let countDays = ((this._blocksNeed() - (this.addressInfo.blocksMinted + this.addressInfo.blocksMintedAdjustment)) / this._timeCalc()).toFixed(2);
|
||||
let countString = (countDays).toString();
|
||||
return "" + countString;
|
||||
let countDays = ((this._blocksNeed() - (this.addressInfo.blocksMinted + this.addressInfo.blocksMintedAdjustment)) / this._timeCalc()).toFixed(2)
|
||||
let countString = (countDays).toString()
|
||||
return "" + countString
|
||||
}
|
||||
|
||||
_levelUpBlocks() {
|
||||
let countBlocksString = (this._blocksNeed() - (this.addressInfo.blocksMinted + this.addressInfo.blocksMintedAdjustment)).toString();
|
||||
return "" + countBlocksString;
|
||||
let countBlocksString = (this._blocksNeed() - (this.addressInfo.blocksMinted + this.addressInfo.blocksMintedAdjustment)).toString()
|
||||
return "" + countBlocksString
|
||||
}
|
||||
|
||||
_blocksNeed() {
|
||||
@ -593,25 +608,41 @@ class MintingInfo extends LitElement {
|
||||
if (this.addressInfo.level === 0) {
|
||||
return "0"
|
||||
} else if (this.addressInfo.level === 1) {
|
||||
return "5"
|
||||
return "6"
|
||||
} else if (this.addressInfo.level === 2) {
|
||||
return "5"
|
||||
return "6"
|
||||
} else if (this.addressInfo.level === 3) {
|
||||
return "10"
|
||||
return "13"
|
||||
} else if (this.addressInfo.level === 4) {
|
||||
return "10"
|
||||
return "13"
|
||||
} else if (this.addressInfo.level === 5) {
|
||||
return "15"
|
||||
if (this.countForTier4() === "false") {
|
||||
return "45"
|
||||
} else {
|
||||
return "19"
|
||||
}
|
||||
} else if (this.addressInfo.level === 6) {
|
||||
return "15"
|
||||
if (this.countForTier4() === "false") {
|
||||
return "45"
|
||||
} else {
|
||||
return "19"
|
||||
}
|
||||
} else if (this.addressInfo.level === 7) {
|
||||
return "20"
|
||||
if (this.countForTier4() === "false") {
|
||||
return "45"
|
||||
} else {
|
||||
return "26"
|
||||
}
|
||||
} else if (this.addressInfo.level === 8) {
|
||||
return "20"
|
||||
if (this.countForTier4() === "false") {
|
||||
return "45"
|
||||
} else {
|
||||
return "26"
|
||||
}
|
||||
} else if (this.addressInfo.level === 9) {
|
||||
return "25"
|
||||
return "32"
|
||||
} else if (this.addressInfo.level === 10) {
|
||||
return "25"
|
||||
return "32"
|
||||
}
|
||||
}
|
||||
|
||||
@ -647,29 +678,58 @@ class MintingInfo extends LitElement {
|
||||
|
||||
_countLevels() {
|
||||
if (this.addressInfo.level === 0) {
|
||||
let countTier0 = (this.addressLevel[0].count).toString();
|
||||
return "" + countTier0;
|
||||
let countTier0 = (this.addressLevel[0].count).toString()
|
||||
return "" + countTier0
|
||||
} else if (this.addressInfo.level === 1) {
|
||||
let countTier10 = (this.addressLevel[1].count + this.addressLevel[2].count).toString();
|
||||
return "" + countTier10;
|
||||
let countTier10 = (this.addressLevel[1].count + this.addressLevel[2].count).toString()
|
||||
return "" + countTier10
|
||||
} else if (this.addressInfo.level === 2) {
|
||||
let countTier11 = (this.addressLevel[1].count + this.addressLevel[2].count).toString();
|
||||
return "" + countTier11;
|
||||
let countTier11 = (this.addressLevel[1].count + this.addressLevel[2].count).toString()
|
||||
return "" + countTier11
|
||||
} else if (this.addressInfo.level === 3) {
|
||||
let countTier20 = (this.addressLevel[3].count + this.addressLevel[4].count).toString();
|
||||
return "" + countTier20;
|
||||
let countTier20 = (this.addressLevel[3].count + this.addressLevel[4].count).toString()
|
||||
return "" + countTier20
|
||||
} else if (this.addressInfo.level === 4) {
|
||||
let countTier21 = (this.addressLevel[3].count + this.addressLevel[4].count).toString();
|
||||
return "" + countTier21;
|
||||
let countTier21 = (this.addressLevel[3].count + this.addressLevel[4].count).toString()
|
||||
return "" + countTier21
|
||||
} else if (this.addressInfo.level === 5) {
|
||||
let countTier30 = (this.addressLevel[5].count + this.addressLevel[6].count).toString();
|
||||
return "" + countTier30;
|
||||
if (this.countForTier4() === "false") {
|
||||
let countTier30 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||
return "" + countTier30
|
||||
} else {
|
||||
let countTier30 = (this.addressLevel[5].count + this.addressLevel[6].count).toString()
|
||||
return "" + countTier30
|
||||
}
|
||||
} else if (this.addressInfo.level === 6) {
|
||||
let countTier31 = (this.addressLevel[5].count + this.addressLevel[6].count).toString();
|
||||
return "" + countTier31;
|
||||
if (this.countForTier4() === "false") {
|
||||
let countTier31 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||
return "" + countTier31
|
||||
} else {
|
||||
let countTier31 = (this.addressLevel[5].count + this.addressLevel[6].count).toString()
|
||||
return "" + countTier31
|
||||
}
|
||||
} else if (this.addressInfo.level === 7) {
|
||||
if (this.countForTier4() === "false") {
|
||||
let countTier40 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||
return "" + countTier40
|
||||
} else {
|
||||
let countTier40 = (this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||
return "" + countTier40
|
||||
}
|
||||
} else if (this.addressInfo.level === 8) {
|
||||
if (this.countForTier4() === "false") {
|
||||
let countTier40 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||
return "" + countTier40
|
||||
} else {
|
||||
let countTier41 = (this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||
return "" + countTier41
|
||||
}
|
||||
} else if (this.addressInfo.level === 9) {
|
||||
let countTier50 = (this.addressLevel[9].count + this.addressLevel[10].count).toString()
|
||||
return "" + countTier50
|
||||
} else if (this.addressInfo.level === 10) {
|
||||
let countTier101 = (this.addressLevel[7].count).toString();
|
||||
return "" + countTier101;
|
||||
let countTier51 = (this.addressLevel[9].count + this.addressLevel[10].count).toString()
|
||||
return "" + countTier51
|
||||
}
|
||||
}
|
||||
|
||||
@ -677,33 +737,69 @@ class MintingInfo extends LitElement {
|
||||
if (this.addressInfo.level === 0) {
|
||||
return "0"
|
||||
} else if (this.addressInfo.level === 1) {
|
||||
let countReward10 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count)).toFixed(8);
|
||||
let countReward11 = (countReward10).toString();
|
||||
return "" + countReward11;
|
||||
let countReward10 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count)).toFixed(8)
|
||||
let countReward11 = (countReward10).toString()
|
||||
return "" + countReward11
|
||||
} else if (this.addressInfo.level === 2) {
|
||||
let countReward20 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count)).toFixed(8);
|
||||
let countReward21 = (countReward20).toString();
|
||||
return "" + countReward21;
|
||||
let countReward20 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count)).toFixed(8)
|
||||
let countReward21 = (countReward20).toString()
|
||||
return "" + countReward21
|
||||
} else if (this.addressInfo.level === 3) {
|
||||
let countReward30 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count)).toFixed(8);
|
||||
let countReward31 = (countReward30).toString();
|
||||
let countReward30 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count)).toFixed(8)
|
||||
let countReward31 = (countReward30).toString()
|
||||
return "" + countReward31;
|
||||
} else if (this.addressInfo.level === 4) {
|
||||
let countReward40 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count)).toFixed(8);
|
||||
let countReward40 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count)).toFixed(8)
|
||||
let countReward41 = (countReward40).toString();
|
||||
return "" + countReward41;
|
||||
} else if (this.addressInfo.level === 5) {
|
||||
let countReward50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count)).toFixed(8);
|
||||
let countReward51 = (countReward50).toString();
|
||||
return "" + countReward51;
|
||||
if (this.countForTier4() === "false") {
|
||||
let countReward50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8)
|
||||
let countReward51 = (countReward50).toString();
|
||||
return "" + countReward51;
|
||||
} else {
|
||||
let countReward50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count)).toFixed(8)
|
||||
let countReward51 = (countReward50).toString();
|
||||
return "" + countReward51;
|
||||
}
|
||||
} else if (this.addressInfo.level === 6) {
|
||||
let countReward60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count)).toFixed(8);
|
||||
let countReward61 = (countReward60).toString();
|
||||
return "" + countReward61;
|
||||
if (this.countForTier4() === "false") {
|
||||
let countReward60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8)
|
||||
let countReward61 = (countReward60).toString()
|
||||
return "" + countReward61
|
||||
} else {
|
||||
let countReward60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count)).toFixed(8)
|
||||
let countReward61 = (countReward60).toString()
|
||||
return "" + countReward61
|
||||
}
|
||||
} else if (this.addressInfo.level === 7) {
|
||||
if (this.countForTier4() === "false") {
|
||||
let countReward70 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8)
|
||||
let countReward71 = (countReward70).toString()
|
||||
return "" + countReward71
|
||||
} else {
|
||||
let countReward70 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8)
|
||||
let countReward71 = (countReward70).toString()
|
||||
return "" + countReward71
|
||||
}
|
||||
} else if (this.addressInfo.level === 8) {
|
||||
if (this.countForTier4() === "false") {
|
||||
let countReward80 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8)
|
||||
let countReward81 = (countReward80).toString()
|
||||
return "" + countReward81
|
||||
} else {
|
||||
let countReward80 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8)
|
||||
let countReward81 = (countReward80).toString()
|
||||
return "" + countReward81
|
||||
}
|
||||
} else if (this.addressInfo.level === 9) {
|
||||
let countReward90 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count)).toFixed(8)
|
||||
let countReward91 = (countReward90).toString()
|
||||
return "" + countReward91
|
||||
} else if (this.addressInfo.level === 10) {
|
||||
let countReward100 = ((this._blockReward() / 100 * this._tierPercent()) / this.addressLevel[7].count).toFixed(8);
|
||||
let countReward101 = (countReward100).toString();
|
||||
return "" + countReward101;
|
||||
let countReward100 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count)).toFixed(8)
|
||||
let countReward101 = (countReward100).toString()
|
||||
return "" + countReward101
|
||||
}
|
||||
}
|
||||
|
||||
@ -711,33 +807,69 @@ class MintingInfo extends LitElement {
|
||||
if (this.addressInfo.level === 0) {
|
||||
return "0"
|
||||
} else if (this.addressInfo.level === 1) {
|
||||
let countRewardDay10 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count) * this._timeCalc()).toFixed(8);
|
||||
let countRewardDay11 = (countRewardDay10).toString();
|
||||
return "" + countRewardDay11;
|
||||
let countRewardDay10 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay11 = (countRewardDay10).toString()
|
||||
return "" + countRewardDay11
|
||||
} else if (this.addressInfo.level === 2) {
|
||||
let countRewardDay20 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count) * this._timeCalc()).toFixed(8);
|
||||
let countRewardDay21 = (countRewardDay20).toString();
|
||||
return "" + countRewardDay21;
|
||||
let countRewardDay20 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay21 = (countRewardDay20).toString()
|
||||
return "" + countRewardDay21
|
||||
} else if (this.addressInfo.level === 3) {
|
||||
let countRewardDay30 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count) * this._timeCalc()).toFixed(8);
|
||||
let countRewardDay31 = (countRewardDay30).toString();
|
||||
return "" + countRewardDay31;
|
||||
let countRewardDay30 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay31 = (countRewardDay30).toString()
|
||||
return "" + countRewardDay31
|
||||
} else if (this.addressInfo.level === 4) {
|
||||
let countRewardDay40 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count) * this._timeCalc()).toFixed(8);
|
||||
let countRewardDay41 = (countRewardDay40).toString();
|
||||
return "" + countRewardDay41;
|
||||
let countRewardDay40 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay41 = (countRewardDay40).toString()
|
||||
return "" + countRewardDay41
|
||||
} else if (this.addressInfo.level === 5) {
|
||||
let countRewardDay50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count) * this._timeCalc()).toFixed(8);
|
||||
let countRewardDay51 = (countRewardDay50).toString();
|
||||
return "" + countRewardDay51;
|
||||
if (this.countForTier4() === "false") {
|
||||
let countRewardDay50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay51 = (countRewardDay50).toString()
|
||||
return "" + countRewardDay51
|
||||
} else {
|
||||
let countRewardDay50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay51 = (countRewardDay50).toString()
|
||||
return "" + countRewardDay51
|
||||
}
|
||||
} else if (this.addressInfo.level === 6) {
|
||||
let countRewardDay60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count) * this._timeCalc()).toFixed(8);
|
||||
let countRewardDay61 = (countRewardDay60).toString();
|
||||
return "" + countRewardDay61;
|
||||
if (this.countForTier4() === "false") {
|
||||
let countRewardDay60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay61 = (countRewardDay60).toString()
|
||||
return "" + countRewardDay61
|
||||
} else {
|
||||
let countRewardDay60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay61 = (countRewardDay60).toString()
|
||||
return "" + countRewardDay61
|
||||
}
|
||||
} else if (this.addressInfo.level === 7) {
|
||||
if (this.countForTier4() === "false") {
|
||||
let countRewardDay70 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay71 = (countRewardDay70).toString()
|
||||
return "" + countRewardDay71
|
||||
} else {
|
||||
let countRewardDay70 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay71 = (countRewardDay70).toString()
|
||||
return "" + countRewardDay71
|
||||
}
|
||||
} else if (this.addressInfo.level === 8) {
|
||||
if (this.countForTier4() === "false") {
|
||||
let countRewardDay80 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay81 = (countRewardDay80).toString()
|
||||
return "" + countRewardDay81
|
||||
} else {
|
||||
let countRewardDay80 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay81 = (countRewardDay80).toString()
|
||||
return "" + countRewardDay81
|
||||
}
|
||||
} else if (this.addressInfo.level === 9) {
|
||||
let countRewardDay90 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay91 = (countRewardDay90).toString()
|
||||
return "" + countRewardDay91
|
||||
} else if (this.addressInfo.level === 10) {
|
||||
let countRewardDay100 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count) * this._timeCalc()).toFixed(8);
|
||||
let countRewardDay101 = (countRewardDay100).toString();
|
||||
return "" + countRewardDay101;
|
||||
let countRewardDay100 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count) * this._timeCalc()).toFixed(8)
|
||||
let countRewardDay101 = (countRewardDay100).toString()
|
||||
return "" + countRewardDay101
|
||||
}
|
||||
}
|
||||
|
||||
@ -747,8 +879,8 @@ class MintingInfo extends LitElement {
|
||||
}
|
||||
|
||||
isEmptyArray(arr) {
|
||||
if (!arr) return true;
|
||||
return arr.length === 0;
|
||||
if (!arr) return true
|
||||
return arr.length === 0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,19 +288,14 @@ class NameRegistration extends LitElement {
|
||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
||||
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
|
||||
const url = `${nodeUrl}/transactions/unitfee?txType=REGISTER_NAME`;
|
||||
await fetch(url)
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
return Promise.reject(response);
|
||||
})
|
||||
.then((json) => {
|
||||
this.fee = (Number(json) / 1e8).toFixed(2);
|
||||
})
|
||||
.catch((response) => {
|
||||
console.log(response.status, response.statusText, this.renderCoreText());
|
||||
})
|
||||
await fetch(url).then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
return Promise.reject(response);
|
||||
}).then((json) => {
|
||||
this.fee = (Number(json) / 1e8).toFixed(2);
|
||||
})
|
||||
}
|
||||
|
||||
getApiKey() {
|
||||
|
@ -437,7 +437,6 @@ class Puzzles extends LitElement {
|
||||
|
||||
let _guessAddress = publicKeyToAddress(_keyPair.publicKey)
|
||||
|
||||
console.log("Guess '" + _guessAddress + "' vs puzzle's address '" + this.selectedPuzzle.address + "'")
|
||||
if (_guessAddress !== this.selectedPuzzle.address) {
|
||||
this.error = true
|
||||
this.message = this.renderErr1Text()
|
||||
|
@ -140,7 +140,6 @@ class WebBrowser extends LitElement {
|
||||
url: `/render/authorize/${this.name}?apiKey=${this.getApiKey()}`,
|
||||
method: "POST"
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.error) {
|
||||
// Authorization problem - API key incorrect?
|
||||
}
|
||||
|
@ -219,7 +219,6 @@ class SponsorshipList extends LitElement {
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log({error})
|
||||
|
||||
this.isPageLoading = false
|
||||
}
|
||||
|
@ -1026,6 +1026,48 @@ class TradePortal extends LitElement {
|
||||
|
||||
this.getOpenOrdersGrid()
|
||||
|
||||
const getQortBtcPrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/BITCOIN?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortbtc = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortBtcPrice, 300000)
|
||||
}
|
||||
|
||||
const getQortLtcPrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/LITECOIN?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortltc = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortLtcPrice, 300000)
|
||||
}
|
||||
|
||||
const getQortDogePrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/DOGECOIN?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortdoge = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortDogePrice, 300000)
|
||||
}
|
||||
|
||||
const getQortDgbPrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/DIGIBYTE?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortdgb = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortDgbPrice, 300000)
|
||||
}
|
||||
|
||||
const getQortRvnPrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/RAVENCOIN?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortrvn = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortRvnPrice, 300000)
|
||||
}
|
||||
|
||||
const getQortArrrPrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/PIRATECHAIN?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortarrr = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortArrrPrice, 300000)
|
||||
}
|
||||
|
||||
window.addEventListener('contextmenu', (event) => {
|
||||
event.preventDefault()
|
||||
this._textMenu(event)},
|
||||
@ -1067,7 +1109,15 @@ class TradePortal extends LitElement {
|
||||
})
|
||||
|
||||
parentEpml.subscribe('config', (c) => {
|
||||
if (!configLoaded) configLoaded = true
|
||||
if (!configLoaded) {
|
||||
setTimeout(getQortBtcPrice, 1)
|
||||
setTimeout(getQortLtcPrice, 1)
|
||||
setTimeout(getQortDogePrice, 1)
|
||||
setTimeout(getQortDgbPrice, 1)
|
||||
setTimeout(getQortRvnPrice, 1)
|
||||
setTimeout(getQortArrrPrice, 1)
|
||||
configLoaded = true
|
||||
}
|
||||
this.config = JSON.parse(c)
|
||||
})
|
||||
|
||||
@ -1112,46 +1162,16 @@ class TradePortal extends LitElement {
|
||||
|
||||
exchangeRateQort() {
|
||||
if (this.listedCoins.get(this.selectedCoin).coinCode === "BTC") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/BITCOIN?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortbtc = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortbtc}`
|
||||
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "LTC") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/LITECOIN?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortltc = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortltc}`
|
||||
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "DOGE") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/DOGECOIN?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortdoge = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortdoge}`
|
||||
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "DGB") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/DIGIBYTE?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortdgb = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortdgb}`
|
||||
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "RVN") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/RAVENCOIN?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortrvn = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortrvn}`
|
||||
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "ARRR") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/PIRATECHAIN?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortarrr = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortarrr}`
|
||||
}
|
||||
}
|
||||
@ -1250,7 +1270,6 @@ class TradePortal extends LitElement {
|
||||
}
|
||||
|
||||
async fetchWalletAddress(coin) {
|
||||
console.log("fetchWalletAddress: " + coin)
|
||||
switch (coin) {
|
||||
case 'PIRATECHAIN':
|
||||
let res = await parentEpml.request('apiCall', {
|
||||
@ -1312,18 +1331,21 @@ class TradePortal extends LitElement {
|
||||
tabSellContent.style.display = (tab === 'sell') ? 'block' : 'none'
|
||||
}
|
||||
|
||||
reRenderHistoricTrades() {
|
||||
async reRenderHistoricTrades() {
|
||||
this.requestUpdate()
|
||||
await this.updateComplete
|
||||
this.isLoadingHistoricTrades = false
|
||||
}
|
||||
|
||||
reRenderOpenFilteredOrders() {
|
||||
async reRenderOpenFilteredOrders() {
|
||||
this.requestUpdate()
|
||||
await this.updateComplete
|
||||
this.isLoadingOpenTrades = false
|
||||
}
|
||||
|
||||
reRenderMyOpenOrders() {
|
||||
async reRenderMyOpenOrders() {
|
||||
this.requestUpdate()
|
||||
await this.updateComplete
|
||||
this.isLoadingMyOpenOrders = false
|
||||
}
|
||||
|
||||
@ -1868,7 +1890,6 @@ class TradePortal extends LitElement {
|
||||
|
||||
initSocket() {
|
||||
let _relatedCoin = ""
|
||||
let presenceTxns = null
|
||||
let tradePresenceTxns = null
|
||||
let offeringTrades = null
|
||||
|
||||
@ -1892,14 +1913,13 @@ class TradePortal extends LitElement {
|
||||
return timestamp > thirtyMinsAgo
|
||||
}
|
||||
|
||||
const filterOffersUsingEitherPresence = (offeringTrade) => {
|
||||
return lessThanThirtyMinsAgo(offeringTrade.lastSeen) || offeringTrade.tradePresenceExpiry > Date.now();
|
||||
const filterOffersUsingTradePresence = (offeringTrade) => {
|
||||
return offeringTrade.tradePresenceExpiry > Date.now();
|
||||
}
|
||||
|
||||
const processOffersWithPresence = () => {
|
||||
if (offeringTrades === null) return
|
||||
|
||||
const waitFor = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
async function asyncForEach(array, callback) {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array)
|
||||
@ -1907,23 +1927,15 @@ class TradePortal extends LitElement {
|
||||
}
|
||||
|
||||
const startOfferPresenceMapping = async () => {
|
||||
if (presenceTxns !== null) {
|
||||
await asyncForEach(presenceTxns, async (presence) => {
|
||||
await waitFor(250)
|
||||
let offerIndex = offeringTrades.findIndex((offeringTrade) => offeringTrade.qortalCreatorTradeAddress === presence.address)
|
||||
offerIndex !== -1 ? (offeringTrades[offerIndex].lastSeen = presence.timestamp) : null
|
||||
})
|
||||
}
|
||||
|
||||
if (tradePresenceTxns !== null) {
|
||||
await asyncForEach(tradePresenceTxns, async (tradePresence) => {
|
||||
await waitFor(250)
|
||||
let offerIndex = offeringTrades.findIndex((offeringTrade) => offeringTrade.qortalCreatorTradeAddress === tradePresence.tradeAddress)
|
||||
offerIndex !== -1 ? (offeringTrades[offerIndex].tradePresenceExpiry = tradePresence.timestamp) : null
|
||||
})
|
||||
}
|
||||
|
||||
let filteredOffers = offeringTrades.filter((offeringTrade) => filterOffersUsingEitherPresence(offeringTrade))
|
||||
let filteredOffers = offeringTrades.filter((offeringTrade) => filterOffersUsingTradePresence(offeringTrade))
|
||||
self.postMessage({ type: 'PRESENCE', data: { offers: offeringTrades, filteredOffers: filteredOffers, relatedCoin: _relatedCoin } })
|
||||
}
|
||||
|
||||
@ -1955,7 +1967,6 @@ class TradePortal extends LitElement {
|
||||
// Closed Event
|
||||
socket.onclose = () => {
|
||||
clearTimeout(socketTimeout)
|
||||
// Restart Socket Connection
|
||||
restartTradeOffersWebSocket()
|
||||
}
|
||||
// Error Event
|
||||
@ -1989,7 +2000,6 @@ class TradePortal extends LitElement {
|
||||
// Closed Event
|
||||
socket.onclose = () => {
|
||||
clearTimeout(socketTimeout)
|
||||
// Restart Socket Connection
|
||||
restartTradeBotWebSocket()
|
||||
}
|
||||
// Error Event
|
||||
@ -2019,7 +2029,6 @@ class TradePortal extends LitElement {
|
||||
// Closed Event
|
||||
socket.onclose = () => {
|
||||
clearTimeout(socketTimeout)
|
||||
// Restart Socket Connection
|
||||
restartTradePresenceWebSocket()
|
||||
}
|
||||
// Error Event
|
||||
@ -2032,59 +2041,21 @@ class TradePortal extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
// Will be removed in future - being replaced by tradepresence above
|
||||
const initPresenceWebSocket = (restarted = false) => {
|
||||
let socketTimeout
|
||||
let socketLink = `ws://NODEURL/websockets/presence?presenceType=TRADE_BOT`
|
||||
const socket = new WebSocket(socketLink)
|
||||
// Open Connection
|
||||
socket.onopen = () => {
|
||||
setTimeout(pingSocket, 250)
|
||||
}
|
||||
// Message Event
|
||||
socket.onmessage = (e) => {
|
||||
presenceTxns = JSON.parse(e.data)
|
||||
processOffersWithPresence()
|
||||
restarted = false
|
||||
}
|
||||
// Closed Event
|
||||
socket.onclose = () => {
|
||||
clearTimeout(socketTimeout)
|
||||
// Restart Socket Connection
|
||||
restartPresenceWebSocket()
|
||||
}
|
||||
// Error Event
|
||||
socket.onerror = (e) => {
|
||||
clearTimeout(socketTimeout)
|
||||
}
|
||||
const pingSocket = () => {
|
||||
socket.send('ping')
|
||||
socketTimeout = setTimeout(pingSocket, 295000)
|
||||
}
|
||||
}
|
||||
|
||||
const restartPresenceWebSocket = () => {
|
||||
setTimeout(() => initPresenceWebSocket(true), 20000)
|
||||
}
|
||||
|
||||
const restartTradePresenceWebSocket = () => {
|
||||
setTimeout(() => initTradePresenceWebSocket(true), 20000)
|
||||
setTimeout(() => initTradePresenceWebSocket(true), 1000)
|
||||
}
|
||||
|
||||
const restartTradeOffersWebSocket = () => {
|
||||
setTimeout(() => initTradeOffersWebSocket(true), 20000)
|
||||
setTimeout(() => initTradeOffersWebSocket(true), 1000)
|
||||
}
|
||||
|
||||
const restartTradeBotWebSocket = () => {
|
||||
setTimeout(() => initTradeBotWebSocket(true), 20000)
|
||||
setTimeout(() => initTradeBotWebSocket(true), 1000)
|
||||
}
|
||||
|
||||
// Start TradeOffersWebSocket
|
||||
initTradeOffersWebSocket()
|
||||
|
||||
// Start PresenceWebSocket
|
||||
initPresenceWebSocket()
|
||||
|
||||
// Start TradePresenceWebSocket
|
||||
initTradePresenceWebSocket()
|
||||
|
||||
@ -2582,7 +2553,7 @@ class TradePortal extends LitElement {
|
||||
})
|
||||
|
||||
const getCompletedTrades = async () => {
|
||||
const url = `http://NODEURL/crosschain/trades?limit=100&reverse=true&foreignBlockchain=FOREIGN_BLOCKCHAIN`
|
||||
const url = `http://NODEURL/crosschain/trades?limit=25&reverse=true&foreignBlockchain=FOREIGN_BLOCKCHAIN`
|
||||
const res = await fetch(url)
|
||||
const historicTrades = await res.json()
|
||||
const compareFn = (a, b) => {
|
||||
|
@ -3699,7 +3699,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateQortAll() {
|
||||
if (this.balance < 0.00100000) {
|
||||
if (this.balance < 0.00110000) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -3708,7 +3708,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateBtcAll() {
|
||||
if (this.balance < 0.00050000) {
|
||||
if (this.balance < 0.00051000) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -3718,17 +3718,17 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateLtcAll() {
|
||||
if (this.balance < 0.00050000) {
|
||||
if (this.balance < 0.00031000) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
this.ltcAmount = (this.balance - 0.00025000).toFixed(8)
|
||||
this.ltcAmount = (this.balance - 0.00030000).toFixed(8)
|
||||
this.ltcFeePerByte = 15
|
||||
}
|
||||
}
|
||||
|
||||
calculateDogeAll() {
|
||||
if (this.balance < 0.05000000) {
|
||||
if (this.balance < 0.05100000) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -3738,7 +3738,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateDgbAll() {
|
||||
if (this.balance < 0.00005000) {
|
||||
if (this.balance < 0.00005100) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -3748,7 +3748,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateRvnAll() {
|
||||
if (this.balance < 0.00562500) {
|
||||
if (this.balance < 0.00572500) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -3758,7 +3758,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateArrrAll() {
|
||||
if (this.balance < 0.00010000) {
|
||||
if (this.balance < 0.00011000) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -4449,7 +4449,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
const arrrSortedTransactions = arrrTxs.sort(arrrCompareFn)
|
||||
console.log(arrrSortedTransactions)
|
||||
|
||||
if (this._selectedWallet == coin) {
|
||||
this.wallets.get(this._selectedWallet).transactions = arrrSortedTransactions
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user