mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-06-01 14:16:57 +00:00
Add unused foreign address button
This commit is contained in:
parent
ac935e8871
commit
73b5c67504
@ -62,6 +62,7 @@ class MultiWallet extends LitElement {
|
|||||||
arrrMemo: { type: String },
|
arrrMemo: { type: String },
|
||||||
errorMessage: { type: String },
|
errorMessage: { type: String },
|
||||||
arrrWalletAddress: { type: String },
|
arrrWalletAddress: { type: String },
|
||||||
|
unusedWalletAddress: { type: String },
|
||||||
successMessage: { type: String },
|
successMessage: { type: String },
|
||||||
sendMoneyLoading: { type: Boolean },
|
sendMoneyLoading: { type: Boolean },
|
||||||
btnDisable: { type: Boolean },
|
btnDisable: { type: Boolean },
|
||||||
@ -505,6 +506,13 @@ class MultiWallet extends LitElement {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unused-address-dialog {
|
||||||
|
min-height: 300px;
|
||||||
|
min-width: 300px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-clear-success {
|
.btn-clear-success {
|
||||||
--mdc-icon-button-size: 32px;
|
--mdc-icon-button-size: 32px;
|
||||||
color: red;
|
color: red;
|
||||||
@ -561,6 +569,12 @@ class MultiWallet extends LitElement {
|
|||||||
width: 185px;
|
width: 185px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unused-pos {
|
||||||
|
margin-top: -44px;
|
||||||
|
margin-left: 410px;
|
||||||
|
width: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 863px) {
|
@media (max-width: 863px) {
|
||||||
.wallet {
|
.wallet {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -673,6 +687,7 @@ class MultiWallet extends LitElement {
|
|||||||
this.arrrRecipient = ''
|
this.arrrRecipient = ''
|
||||||
this.arrrMemo = ''
|
this.arrrMemo = ''
|
||||||
this.arrrWalletAddress = ''
|
this.arrrWalletAddress = ''
|
||||||
|
this.unusedWalletAddress = ''
|
||||||
this.errorMessage = ''
|
this.errorMessage = ''
|
||||||
this.successMessage = ''
|
this.successMessage = ''
|
||||||
this.myElementId = ''
|
this.myElementId = ''
|
||||||
@ -822,6 +837,9 @@ class MultiWallet extends LitElement {
|
|||||||
<div class="book-pos" ?hidden="${this.getSelectedWalletAddress().length < 1}">
|
<div class="book-pos" ?hidden="${this.getSelectedWalletAddress().length < 1}">
|
||||||
${this.renderAddressbookButton()}
|
${this.renderAddressbookButton()}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="unused-pos" ?hidden="${this.getSelectedWalletAddress().length < 1}">
|
||||||
|
${this.renderUnusedAddressButton()}
|
||||||
|
</div>
|
||||||
<div class="qrcode-pos" ?hidden="${this.getSelectedWalletAddress().length < 1}">
|
<div class="qrcode-pos" ?hidden="${this.getSelectedWalletAddress().length < 1}">
|
||||||
<qortal-qrcode-generator data="${this.getSelectedWalletAddress()}" mode="octet" format="html" auto></qortal-qrcode-generator>
|
<qortal-qrcode-generator data="${this.getSelectedWalletAddress()}" mode="octet" format="html" auto></qortal-qrcode-generator>
|
||||||
</div>
|
</div>
|
||||||
@ -1968,6 +1986,106 @@ class MultiWallet extends LitElement {
|
|||||||
</mwc-button>
|
</mwc-button>
|
||||||
</mwc-dialog>
|
</mwc-dialog>
|
||||||
|
|
||||||
|
<mwc-dialog id="btcUnusedAddressDialog" scrimClickAction="" escapeKeyAction="">
|
||||||
|
<div class="unused-address-dialog">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<img src="/img/btc.png" width="32" height="32">
|
||||||
|
<h2>Unused BTC Address</h2>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<span style="font-weight: bold;">${this.wallets.get(this._selectedWallet).unusedWalletAddress}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<mwc-button
|
||||||
|
slot="primaryAction"
|
||||||
|
dialogAction="cancel"
|
||||||
|
class="red"
|
||||||
|
>
|
||||||
|
${translate("general.close")}
|
||||||
|
</mwc-button>
|
||||||
|
</mwc-dialog>
|
||||||
|
|
||||||
|
<mwc-dialog id="ltcUnusedAddressDialog" scrimClickAction="" escapeKeyAction="">
|
||||||
|
<div class="unused-address-dialog">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<img src="/img/ltc.png" width="32" height="32">
|
||||||
|
<h2>Unused LTC Address</h2>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<span style="font-weight: bold;">${this.wallets.get(this._selectedWallet).unusedWalletAddress}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<mwc-button
|
||||||
|
slot="primaryAction"
|
||||||
|
dialogAction="cancel"
|
||||||
|
class="red"
|
||||||
|
>
|
||||||
|
${translate("general.close")}
|
||||||
|
</mwc-button>
|
||||||
|
</mwc-dialog>
|
||||||
|
|
||||||
|
<mwc-dialog id="dogeUnusedAddressDialog" scrimClickAction="" escapeKeyAction="">
|
||||||
|
<div class="unused-address-dialog">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<img src="/img/doge.png" width="32" height="32">
|
||||||
|
<h2>Unused DOGE Address</h2>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<span style="font-weight: bold;">${this.wallets.get(this._selectedWallet).unusedWalletAddress}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<mwc-button
|
||||||
|
slot="primaryAction"
|
||||||
|
dialogAction="cancel"
|
||||||
|
class="red"
|
||||||
|
>
|
||||||
|
${translate("general.close")}
|
||||||
|
</mwc-button>
|
||||||
|
</mwc-dialog>
|
||||||
|
|
||||||
|
<mwc-dialog id="dgbUnusedAddressDialog" scrimClickAction="" escapeKeyAction="">
|
||||||
|
<div class="unused-address-dialog">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<img src="/img/dgb.png" width="32" height="32">
|
||||||
|
<h2>Unused DGB Address</h2>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<span style="font-weight: bold;">${this.wallets.get(this._selectedWallet).unusedWalletAddress}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<mwc-button
|
||||||
|
slot="primaryAction"
|
||||||
|
dialogAction="cancel"
|
||||||
|
class="red"
|
||||||
|
>
|
||||||
|
${translate("general.close")}
|
||||||
|
</mwc-button>
|
||||||
|
</mwc-dialog>
|
||||||
|
|
||||||
|
<mwc-dialog id="rvnUnusedAddressDialog" scrimClickAction="" escapeKeyAction="">
|
||||||
|
<div class="unused-address-dialog">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<img src="/img/rvn.png" width="32" height="32">
|
||||||
|
<h2>Unused RVN Address</h2>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<span style="font-weight: bold;">${this.wallets.get(this._selectedWallet).unusedWalletAddress}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<mwc-button
|
||||||
|
slot="primaryAction"
|
||||||
|
dialogAction="cancel"
|
||||||
|
class="red"
|
||||||
|
>
|
||||||
|
${translate("general.close")}
|
||||||
|
</mwc-button>
|
||||||
|
</mwc-dialog>
|
||||||
|
|
||||||
<mwc-dialog id="addQortAddressDialog" scrimClickAction="" escapeKeyAction="">
|
<mwc-dialog id="addQortAddressDialog" scrimClickAction="" escapeKeyAction="">
|
||||||
<div style="text-align:center">
|
<div style="text-align:center">
|
||||||
<img src="/img/qort.png" width="32" height="32">
|
<img src="/img/qort.png" width="32" height="32">
|
||||||
@ -4638,6 +4756,70 @@ class MultiWallet extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getUnusedAddress(coin) {
|
||||||
|
this.wallets.get(this._selectedWallet).unusedWalletAddress = 'Loading...'
|
||||||
|
let _url = ``
|
||||||
|
let _body = null
|
||||||
|
|
||||||
|
switch (coin) {
|
||||||
|
case 'qort':
|
||||||
|
case 'arrr':
|
||||||
|
_url = ``
|
||||||
|
_body = null
|
||||||
|
break
|
||||||
|
case 'btc':
|
||||||
|
case 'ltc':
|
||||||
|
case 'doge':
|
||||||
|
case 'dgb':
|
||||||
|
case 'rvn':
|
||||||
|
const walletName = `${coin}Wallet`
|
||||||
|
_url = `/crosschain/${coin}/unusedaddress?apiKey=${this.getApiKey()}`
|
||||||
|
_body = `${window.parent.reduxStore.getState().app.selectedAddress[walletName].derivedMasterPublicKey}`
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_body === null) {
|
||||||
|
this.unusedAddressString = ""
|
||||||
|
} else {
|
||||||
|
await parentEpml.request('apiCall', {
|
||||||
|
url: _url,
|
||||||
|
method: 'POST',
|
||||||
|
body: _body,
|
||||||
|
}).then((res) => {
|
||||||
|
this.wallets.get(this._selectedWallet).unusedWalletAddress = res
|
||||||
|
this.unusedAddressString = this.wallets.get(this._selectedWallet).unusedWalletAddress
|
||||||
|
this.openUnusedAddressDialog(coin)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
openUnusedAddressDialog(coin) {
|
||||||
|
switch (coin) {
|
||||||
|
case 'qort':
|
||||||
|
case 'arrr':
|
||||||
|
break
|
||||||
|
case 'btc':
|
||||||
|
this.shadowRoot.querySelector("#btcUnusedAddressDialog").show();
|
||||||
|
break
|
||||||
|
case 'ltc':
|
||||||
|
this.shadowRoot.querySelector("#ltcUnusedAddressDialog").show();
|
||||||
|
break
|
||||||
|
case 'doge':
|
||||||
|
this.shadowRoot.querySelector("#dogeUnusedAddressDialog").show();
|
||||||
|
break
|
||||||
|
case 'dgb':
|
||||||
|
this.shadowRoot.querySelector("#dgbUnusedAddressDialog").show();
|
||||||
|
break
|
||||||
|
case 'rvn':
|
||||||
|
this.shadowRoot.querySelector("#rvnUnusedAddressDialog").show();
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderSendButton() {
|
renderSendButton() {
|
||||||
if ( this._selectedWallet === "qort" ) {
|
if ( this._selectedWallet === "qort" ) {
|
||||||
return html`<vaadin-button theme="primary medium" style="width: 100%;" @click=${() => this.openSendQort()}><vaadin-icon icon="vaadin:coin-piles" slot="prefix"></vaadin-icon> ${translate("walletpage.wchange17")} QORT</vaadin-button>`
|
return html`<vaadin-button theme="primary medium" style="width: 100%;" @click=${() => this.openSendQort()}><vaadin-icon icon="vaadin:coin-piles" slot="prefix"></vaadin-icon> ${translate("walletpage.wchange17")} QORT</vaadin-button>`
|
||||||
@ -4678,6 +4860,22 @@ class MultiWallet extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderUnusedAddressButton() {
|
||||||
|
switch (this._selectedWallet) {
|
||||||
|
case "qort":
|
||||||
|
case "arrr":
|
||||||
|
return html`<vaadin-button disabled theme="primary medium" style="width: 100%;" @click=${() => this.getUnusedAddress(this._selectedWallet)}><vaadin-icon icon="vaadin:magic" slot="prefix"></vaadin-icon>Get Unused Address</vaadin-button>`
|
||||||
|
case "btc":
|
||||||
|
case "ltc":
|
||||||
|
case "doge":
|
||||||
|
case "dgb":
|
||||||
|
case "rvn":
|
||||||
|
return html`<vaadin-button theme="primary medium" style="width: 100%;" @click=${() => this.getUnusedAddress(this._selectedWallet)}><vaadin-icon icon="vaadin:magic" slot="prefix"></vaadin-icon>Get Unused Address</vaadin-button>`
|
||||||
|
default:
|
||||||
|
return html``
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderExportAddressbookButton() {
|
renderExportAddressbookButton() {
|
||||||
if ( this._selectedWallet === "qort" ) {
|
if ( this._selectedWallet === "qort" ) {
|
||||||
return html`<vaadin-button theme="primary small" style="width: 100%;" @click=${() => this.exportQortAddressbook()}><vaadin-icon icon="vaadin:cloud-download" slot="prefix"></vaadin-icon> ${translate("walletpage.wchange54")}</vaadin-button>`
|
return html`<vaadin-button theme="primary small" style="width: 100%;" @click=${() => this.exportQortAddressbook()}><vaadin-icon icon="vaadin:cloud-download" slot="prefix"></vaadin-icon> ${translate("walletpage.wchange54")}</vaadin-button>`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user