diff --git a/qortal-ui-plugins/plugins/core/become-minter/become-minter.src.js b/qortal-ui-plugins/plugins/core/become-minter/become-minter.src.js index c5fa9e04..d14dd6ab 100644 --- a/qortal-ui-plugins/plugins/core/become-minter/become-minter.src.js +++ b/qortal-ui-plugins/plugins/core/become-minter/become-minter.src.js @@ -13,8 +13,8 @@ import '@material/mwc-button'; import '@material/mwc-textfield'; import '@vaadin/button'; import { pageStyles } from './become-minter-css.js'; -import './components/not-sponsored'; -import './components/yes-sponsored'; +import './components/not-sponsored.src'; +import './components/yes-sponsored.src'; const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }); class BecomeMinter extends LitElement { diff --git a/qortal-ui-plugins/plugins/core/become-minter/components/not-sponsored.src.js b/qortal-ui-plugins/plugins/core/become-minter/components/not-sponsored.src.js new file mode 100644 index 00000000..572292fc --- /dev/null +++ b/qortal-ui-plugins/plugins/core/become-minter/components/not-sponsored.src.js @@ -0,0 +1,139 @@ +import { LitElement, html } from 'lit'; +import { Epml } from '../../../../epml.js'; +import '../../components/ButtonIconCopy.js'; +import { use, translate, registerTranslateConfig } from 'lit-translate'; + +registerTranslateConfig({ + loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()), +}); +import '@polymer/paper-spinner/paper-spinner-lite.js'; + +import '@material/mwc-button'; +import '@material/mwc-textfield'; +import '@vaadin/button'; +import { pageStyles } from '../become-minter-css.js'; +const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }); +// hello +class NotSponsored extends LitElement { + static get properties() { + return { + isLoadingSponsorshipKeySubmit: { type: Boolean }, + sponsorshipKeyValue: { type: String }, + addMintingAccountMessage: { type: String }, + }; + } + + static styles = [pageStyles]; + + constructor() { + super(); + this.isLoadingSponsorshipKeySubmit = false; + this.sponsorshipKeyValue = ''; + this.addMintingAccountMessage = ''; + } + + renderErr1Text() { + return html`${translate('nodepage.nchange27')}`; + } + + renderErr2Text() { + return html`${translate('nodepage.nchange28')}`; + } + + getApiKey() { + const myNode = + window.parent.reduxStore.getState().app.nodeConfig.knownNodes[ + window.parent.reduxStore.getState().app.nodeConfig.node + ]; + let apiKey = myNode.apiKey; + return apiKey; + } + + addMintingAccount(e) { + this.isLoadingSponsorshipKeySubmit = true; + this.addMintingAccountMessage = 'Loading...'; + + parentEpml + .request('apiCall', { + url: `/admin/mintingaccounts?apiKey=${this.getApiKey()}`, + method: 'POST', + body: this.sponsorshipKeyValue, + }) + .then((res) => { + if (res === true) { + this.updateMintingAccounts(); + this.sponsorshipKeyValue = ''; + this.addMintingAccountMessage = this.renderErr1Text(); + this.isLoadingSponsorshipKeySubmit = false; + } else { + this.sponsorshipKeyValue = ''; + this.addMintingAccountMessage = this.renderErr2Text(); + this.isLoadingSponsorshipKeySubmit = false; + } + }); + } + + inputHandler(e) { + this.sponsorshipKeyValue = e.target.value; + } + + render() { + return html` +
+ ${translate('becomeMinterPage.bchange3')} +
++ ${translate('becomeMinterPage.bchange5')} +
++ ${translate('becomeMinterPage.bchange6')} +
+ + ++ ${this.rewardSharePublicKey} +
+