diff --git a/plugins/plugins/core/overview-page/overview-page.src.js b/plugins/plugins/core/overview-page/overview-page.src.js
index 792fcba3..919560df 100644
--- a/plugins/plugins/core/overview-page/overview-page.src.js
+++ b/plugins/plugins/core/overview-page/overview-page.src.js
@@ -1,6 +1,6 @@
import { LitElement, html, css } from 'lit'
import { Epml } from '../../../epml.js'
-import { use, get, translate, registerTranslateConfig } from 'lit-translate'
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
import { overviewStyle } from './overview-page-css.js'
import { asyncReplace } from 'lit/directives/async-replace.js'
import isElectron from 'is-electron'
@@ -10,9 +10,8 @@ import '@material/mwc-dialog'
import '@polymer/paper-spinner/paper-spinner-lite.js'
import '@vaadin/button'
-
registerTranslateConfig({
- loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()),
+ loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
})
async function* countDown(count, callback) {
@@ -36,7 +35,10 @@ class OverviewPage extends LitElement {
nodeInfo: { type: Array },
coreInfo: { type: Array },
imageUrl: { type: String },
- myBalance: { type: Number }
+ myBalance: { type: Number },
+ listAccounts: { type: Array },
+ check1: { type: Boolean },
+ check2: { type: Boolean }
}
}
@@ -54,6 +56,9 @@ class OverviewPage extends LitElement {
this.coreInfo = []
this.imageUrl = ''
this.myBalance = 0
+ this.listAccounts = []
+ this.check1 = false
+ this.check2 = false
}
render() {
@@ -134,7 +139,7 @@ class OverviewPage extends LitElement {
`
}
- firstUpdated() {
+ async firstUpdated() {
this.changeTheme()
this.changeLanguage()
@@ -144,6 +149,7 @@ class OverviewPage extends LitElement {
this.getNodeInfo()
this.getCoreInfo()
this.getBalanceInfo()
+ await this.getMintingKeysList()
window.addEventListener('storage', () => {
const checkLanguage = localStorage.getItem('qortalLanguage')
@@ -197,22 +203,87 @@ class OverviewPage extends LitElement {
}
}
- refreshItems() {
+ renderMyErrorMsg1() {
+ return html`${translate("startminting.smchange1")}`
+ }
+
+ async refreshItems() {
this.nodeConfig = window.parent.reduxStore.getState().app.nodeConfig
this.accountInfo = window.parent.reduxStore.getState().app.accountInfo
this.getNodeInfo()
this.getCoreInfo()
this.getBalanceInfo()
+ await this.getMintingKeysList()
+ }
+
+ async getMintingKeysList() {
+ this.check1 = false
+ this.check2 = false
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
+ const nodeStatus = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
+ const statusUrl = `${nodeStatus}/admin/mintingaccounts`
+
+ try {
+ const res = await fetch(statusUrl)
+ const listAccounts = await res.json()
+ this.listAccounts = listAccounts
+
+ const addressInfo = window.parent.reduxStore.getState().app.accountInfo.addressInfo
+ const address = window.parent.reduxStore.getState().app.selectedAddress.address
+ const findMyMintingAccount = this.listAccounts.find((myKey) => myKey.mintingAccount === address)
+ const findMyMintingRecipient = this.listAccounts.find((myKey) => myKey.recipientAccount === address)
+ const findRemovedSponsorsKey = this.listAccounts.filter((my) => my.address)
+
+ if (findMyMintingAccount === undefined) {
+ this.check1 = false
+ } else {
+ this.check1 = true
+ }
+
+ if (findMyMintingRecipient === undefined) {
+ this.check2 = false
+ } else {
+ this.check2 = true
+ }
+
+ if (findRemovedSponsorsKey.length > 0) {
+ this.removeBlankKey(findRemovedSponsorsKey.publicKey)
+ } else {
+ }
+ } catch (error) {
+ this.errorMsg = this.renderMyErrorMsg1()
+ }
+ }
+
+ removeBlankKey(myPublicKey) {
+ parentEpml.request("apiCall", {
+ url: `/admin/mintingaccounts?apiKey=${this.getApiKey()}`,
+ method: "DELETE",
+ body: myPublicKey,
+ }).then((res) => {
+ if (res === true) {
+ console.log('REMOVED BLANK KEY')
+ } else {
+ }
+ })
}
renderMintingStatus() {
- if (this.nodeInfo.isMintingPossible === true && this.nodeInfo.isSynchronizing === true) {
+ const addressInfo = window.parent.reduxStore.getState().app.accountInfo.addressInfo
+ const myMintingKey = addressInfo?.error !== 124 && +addressInfo?.level > 0
+
+ if (this.nodeInfo.isMintingPossible === true && this.nodeInfo.isSynchronizing === true && this.check1 === true && this.check2 === true && addressInfo.level > 0) {
this.cssStatus = ''
return html`${translate("walletprofile.wp1")}`
- } else if (this.nodeInfo.isMintingPossible === true && this.nodeInfo.isSynchronizing === false) {
+ } else if (this.nodeInfo.isMintingPossible === true && this.nodeInfo.isSynchronizing === false && this.check1 === true && this.check2 === true && addressInfo.level > 0) {
this.cssStatus = ''
return html`${translate("walletprofile.wp1")}`
- } else if (this.nodeInfo.isMintingPossible === false) {
+ } else if (this.nodeInfo.isMintingPossible === true && this.nodeInfo.isSynchronizing === false && this.check1 === false && this.check2 === true && addressInfo.level == 0 && addressInfo.blocksMinted < 7200) {
+ this.cssStatus = ''
+ return html`${translate("becomeMinterPage.bchange12")}`
+ } else if (this.check1 === false && this.check2 === false && myMintingKey === true) {
+ return html`