From 73b5c675047ed0ac00f825e8e26c1da52c1b917d Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Sat, 11 Feb 2023 14:43:05 -0500 Subject: [PATCH 1/2] Add unused foreign address button --- .../plugins/core/wallet/wallet-app.src.js | 216 +++++++++++++++++- 1 file changed, 207 insertions(+), 9 deletions(-) diff --git a/qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js b/qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js index 5f1228c7..6064cc83 100644 --- a/qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js +++ b/qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js @@ -62,6 +62,7 @@ class MultiWallet extends LitElement { arrrMemo: { type: String }, errorMessage: { type: String }, arrrWalletAddress: { type: String }, + unusedWalletAddress: { type: String }, successMessage: { type: String }, sendMoneyLoading: { type: Boolean }, btnDisable: { type: Boolean }, @@ -357,8 +358,8 @@ class MultiWallet extends LitElement { .wallet-address { display: flex; align-items: center; - font-size: 18px; - color: var(--black); + font-size: 18px; + color: var(--black); margin: 4px 0 20px; } @@ -366,7 +367,7 @@ class MultiWallet extends LitElement { display: inline-block; font-weight: 600; font-size: 32px; - color: var(--black); + color: var(--black); } #transactions { @@ -505,6 +506,13 @@ class MultiWallet extends LitElement { position: relative; } + .unused-address-dialog { + min-height: 300px; + min-width: 300px; + box-sizing: border-box; + position: relative; + } + .btn-clear-success { --mdc-icon-button-size: 32px; color: red; @@ -561,6 +569,12 @@ class MultiWallet extends LitElement { width: 185px; } + .unused-pos { + margin-top: -44px; + margin-left: 410px; + width: 250px; + } + @media (max-width: 863px) { .wallet { width: 100%; @@ -673,6 +687,7 @@ class MultiWallet extends LitElement { this.arrrRecipient = '' this.arrrMemo = '' this.arrrWalletAddress = '' + this.unusedWalletAddress = '' this.errorMessage = '' this.successMessage = '' this.myElementId = '' @@ -799,7 +814,7 @@ class MultiWallet extends LitElement { ${translate("walletpage.wchange2")}
${this.getSelectedWalletAddress()} - ${this.renderAddressbookButton()}
+
+ ${this.renderUnusedAddressButton()} +
@@ -1968,6 +1986,106 @@ class MultiWallet extends LitElement { + +
+
+ +

Unused BTC Address

+
+
+

+ ${this.wallets.get(this._selectedWallet).unusedWalletAddress} +

+
+ + ${translate("general.close")} + +
+ + +
+
+ +

Unused LTC Address

+
+
+

+ ${this.wallets.get(this._selectedWallet).unusedWalletAddress} +

+
+ + ${translate("general.close")} + +
+ + +
+
+ +

Unused DOGE Address

+
+
+

+ ${this.wallets.get(this._selectedWallet).unusedWalletAddress} +

+
+ + ${translate("general.close")} + +
+ + +
+
+ +

Unused DGB Address

+
+
+

+ ${this.wallets.get(this._selectedWallet).unusedWalletAddress} +

+
+ + ${translate("general.close")} + +
+ + +
+
+ +

Unused RVN Address

+
+
+

+ ${this.wallets.get(this._selectedWallet).unusedWalletAddress} +

+
+ + ${translate("general.close")} + +
+
@@ -3846,7 +3964,7 @@ class MultiWallet extends LitElement { renderCAB() { return html` ${this.selectedTransaction.aTAddress} - { try { - + const getNames = await parentEpml.request("apiCall", { type: "api", url: `/names/address/${recipient}`, @@ -4501,10 +4619,10 @@ class MultiWallet extends LitElement { this.balance = this.wallets.get(this._selectedWallet).balance } } - }) + }) const txsQort = await parentEpml.request('apiCall', { url: `/transactions/search?address=${this.wallets.get('qort').wallet.address}&confirmationStatus=CONFIRMED&reverse=true&txType=PAYMENT&txType=REGISTER_NAME&txType=UPDATE_NAME&txType=SELL_NAME&txType=CANCEL_SELL_NAME&txType=BUY_NAME&txType=CREATE_POLL&txType=VOTE_ON_POLL&txType=ISSUE_ASSET&txType=TRANSFER_ASSET&txType=CREATE_ASSET_ORDER&txType=CANCEL_ASSET_ORDER&txType=MULTI_PAYMENT&txType=DEPLOY_AT&txType=MESSAGE&txType=PUBLICIZE&txType=AIRDROP&txType=AT&txType=CREATE_GROUP&txType=UPDATE_GROUP&txType=ADD_GROUP_ADMIN&txType=REMOVE_GROUP_ADMIN&txType=GROUP_BAN&txType=CANCEL_GROUP_BAN&txType=GROUP_KICK&txType=GROUP_INVITE&txType=CANCEL_GROUP_INVITE&txType=JOIN_GROUP&txType=LEAVE_GROUP&txType=GROUP_APPROVAL&txType=SET_GROUP&txType=UPDATE_ASSET&txType=ACCOUNT_FLAGS&txType=ENABLE_FORGING&txType=REWARD_SHARE&txType=ACCOUNT_LEVEL&txType=TRANSFER_PRIVS&txType=PRESENCE`, - }) + }) const pendingTxsQort = await parentEpml.request('apiCall', { url: `/transactions/unconfirmed?creator=${this.wallets.get('qort').wallet.base58PublicKey}&reverse=true&txType=PAYMENT&txType=REGISTER_NAME&txType=UPDATE_NAME&txType=SELL_NAME&txType=CANCEL_SELL_NAME&txType=BUY_NAME&txType=CREATE_POLL&txType=VOTE_ON_POLL&txType=ISSUE_ASSET&txType=TRANSFER_ASSET&txType=CREATE_ASSET_ORDER&txType=CANCEL_ASSET_ORDER&txType=MULTI_PAYMENT&txType=DEPLOY_AT&txType=MESSAGE&txType=PUBLICIZE&txType=AIRDROP&txType=AT&txType=CREATE_GROUP&txType=UPDATE_GROUP&txType=ADD_GROUP_ADMIN&txType=REMOVE_GROUP_ADMIN&txType=GROUP_BAN&txType=CANCEL_GROUP_BAN&txType=GROUP_KICK&txType=GROUP_INVITE&txType=CANCEL_GROUP_INVITE&txType=JOIN_GROUP&txType=LEAVE_GROUP&txType=GROUP_APPROVAL&txType=SET_GROUP&txType=UPDATE_ASSET&txType=ACCOUNT_FLAGS&txType=ENABLE_FORGING&txType=REWARD_SHARE&txType=ACCOUNT_LEVEL&txType=TRANSFER_PRIVS&txType=PRESENCE`, }) @@ -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() { if ( this._selectedWallet === "qort" ) { return html` this.openSendQort()}> ${translate("walletpage.wchange17")} QORT` @@ -4678,6 +4860,22 @@ class MultiWallet extends LitElement { } } + renderUnusedAddressButton() { + switch (this._selectedWallet) { + case "qort": + case "arrr": + return html` this.getUnusedAddress(this._selectedWallet)}>Get Unused Address` + case "btc": + case "ltc": + case "doge": + case "dgb": + case "rvn": + return html` this.getUnusedAddress(this._selectedWallet)}>Get Unused Address` + default: + return html`` + } + } + renderExportAddressbookButton() { if ( this._selectedWallet === "qort" ) { return html` this.exportQortAddressbook()}> ${translate("walletpage.wchange54")}` @@ -5556,4 +5754,4 @@ class MultiWallet extends LitElement { } } -window.customElements.define('multi-wallet', MultiWallet) \ No newline at end of file +window.customElements.define('multi-wallet', MultiWallet) From 310291a0747aaeac77dee62c266d137bbfbd2b3c Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Sat, 11 Feb 2023 18:20:10 -0500 Subject: [PATCH 2/2] Languages and copy support for New Address button --- qortal-ui-core/language/de.json | 3 +- qortal-ui-core/language/es.json | 3 +- qortal-ui-core/language/fr.json | 3 +- qortal-ui-core/language/hindi.json | 3 +- qortal-ui-core/language/hr.json | 3 +- qortal-ui-core/language/hu.json | 3 +- qortal-ui-core/language/it.json | 3 +- qortal-ui-core/language/ko.json | 3 +- qortal-ui-core/language/no.json | 3 +- qortal-ui-core/language/pl.json | 3 +- qortal-ui-core/language/pt.json | 3 +- qortal-ui-core/language/ro.json | 3 +- qortal-ui-core/language/rs.json | 3 +- qortal-ui-core/language/ru.json | 3 +- qortal-ui-core/language/us.json | 3 +- qortal-ui-core/language/zhc.json | 3 +- qortal-ui-core/language/zht.json | 3 +- .../plugins/core/wallet/wallet-app.src.js | 87 ++++++++++++++++--- 18 files changed, 110 insertions(+), 28 deletions(-) diff --git a/qortal-ui-core/language/de.json b/qortal-ui-core/language/de.json index 89e22f0a..c0421968 100644 --- a/qortal-ui-core/language/de.json +++ b/qortal-ui-core/language/de.json @@ -283,7 +283,8 @@ "wchange54": "Adressbuch exportieren", "wchange55": "Ihr bestehendes Adressbuch wird gelöscht und aus einem Backup neu erstellt.", "wchange56": "WARNUNG!", - "wchange57": "Memo" + "wchange57": "Memo", + "wchange58": "Neue Adresse" }, "tradepage": { "tchange1": "Handelsportal", diff --git a/qortal-ui-core/language/es.json b/qortal-ui-core/language/es.json index f214975c..8cc4177f 100644 --- a/qortal-ui-core/language/es.json +++ b/qortal-ui-core/language/es.json @@ -283,7 +283,8 @@ "wchange54": "Exportar libreta de direcciones", "wchange55": "Su libreta de direcciones existente se eliminará y se creará una nueva copia de seguridad.", "wchange56": "ADVERTENCIA!", - "wchange57": "Memorándum" + "wchange57": "Memorándum", + "wchange58": "Nueva Dirección" }, "tradepage": { "tchange1": "Portal de Comercio", diff --git a/qortal-ui-core/language/fr.json b/qortal-ui-core/language/fr.json index 1c675ae8..6a774c6f 100644 --- a/qortal-ui-core/language/fr.json +++ b/qortal-ui-core/language/fr.json @@ -283,7 +283,8 @@ "wchange54": "Exporter le carnet d'adresses", "wchange55": "Votre carnet d'adresses existant sera supprimé et une nouvelle sauvegarde sera créée.", "wchange56": "ATTENTION!", - "wchange57": "Mémo" + "wchange57": "Mémo", + "wchange58": "Nouvelle Adresse" }, "tradepage": { "tchange1": "Portail de commerce", diff --git a/qortal-ui-core/language/hindi.json b/qortal-ui-core/language/hindi.json index fcc46ed9..ee85ecb9 100644 --- a/qortal-ui-core/language/hindi.json +++ b/qortal-ui-core/language/hindi.json @@ -284,7 +284,8 @@ "wchange54": "निर्यात पता पुस्तिका", "wchange55": "आपकी मौजूदा पता पुस्तिका हटा दी जाएगी और बैकअप से नया बनाया जाएगा।", "wchange56": "चेतावनी!", - "wchange57": "ज्ञापन" + "wchange57": "ज्ञापन", + "wchange58": "नया पता" }, "tradepage": { "tchange1": "व्यापार पोर्टल", diff --git a/qortal-ui-core/language/hr.json b/qortal-ui-core/language/hr.json index 287904ce..be605ccd 100644 --- a/qortal-ui-core/language/hr.json +++ b/qortal-ui-core/language/hr.json @@ -283,7 +283,8 @@ "wchange54": "Izvezi adresar", "wchange55": "Vaš postojeći adresar bit će izbrisan i novi će se stvoriti iz sigurnosne kopije.", "wchange56": "UPOZORENJE!", - "wchange57": "Dopis" + "wchange57": "Dopis", + "wchange58": "Nova Adresa" }, "tradepage": { "tchange1": "Portal razmjene", diff --git a/qortal-ui-core/language/hu.json b/qortal-ui-core/language/hu.json index 0ddb80d5..84898ba0 100644 --- a/qortal-ui-core/language/hu.json +++ b/qortal-ui-core/language/hu.json @@ -283,7 +283,8 @@ "wchange54": "Címjegyzék exportálása", "wchange55": "Meglévő címjegyzéke törlésre kerül, és a biztonsági másolatból új jön létre.", "wchange56": "FIGYELEM!", - "wchange57": "Memo" + "wchange57": "Memo", + "wchange58": "Új Cím" }, "tradepage": { "tchange1": "Kereskedelmi Portál", diff --git a/qortal-ui-core/language/it.json b/qortal-ui-core/language/it.json index bae18193..e3fc1a17 100644 --- a/qortal-ui-core/language/it.json +++ b/qortal-ui-core/language/it.json @@ -283,7 +283,8 @@ "wchange54": "Esporta rubrica", "wchange55": "La tua rubrica esistente verrà eliminata e dal backup verrà creata una nuova.", "wchange56": "AVVERTIMENTO!", - "wchange57": "Memo" + "wchange57": "Memo", + "wchange58": "Nuovo Indirizzo" }, "tradepage": { "tchange1": "Portale commerciale", diff --git a/qortal-ui-core/language/ko.json b/qortal-ui-core/language/ko.json index e07e921e..e4b607c1 100644 --- a/qortal-ui-core/language/ko.json +++ b/qortal-ui-core/language/ko.json @@ -283,7 +283,8 @@ "wchange54": "주소록 내보내기", "wchange55": "기존 주소록이 삭제되고 백업에서 새로 생성됩니다.", "wchange56": "경고!", - "wchange57": "메모" + "wchange57": "메모", + "wchange58": "새 주소" }, "tradepage": { "tchange1": "무역 포털", diff --git a/qortal-ui-core/language/no.json b/qortal-ui-core/language/no.json index f32175ed..66d07aab 100644 --- a/qortal-ui-core/language/no.json +++ b/qortal-ui-core/language/no.json @@ -283,7 +283,8 @@ "wchange54": "Eksporter adressebok", "wchange55": "Din eksisterende adressebok vil bli slettet og ny opprettet fra sikkerhetskopi.", "wchange56": "ADVARSEL!", - "wchange57": "Memo" + "wchange57": "Memo", + "wchange58": "Ny Adresse" }, "tradepage": { "tchange1": "Handelsportal", diff --git a/qortal-ui-core/language/pl.json b/qortal-ui-core/language/pl.json index ee1d4b14..19fb9bf4 100644 --- a/qortal-ui-core/language/pl.json +++ b/qortal-ui-core/language/pl.json @@ -283,7 +283,8 @@ "wchange54": "Eksportuj książkę adresową", "wchange55": "Twoja istniejąca książka adresowa zostanie usunięta, az kopii zapasowej utworzona nowa.", "wchange56": "OSTRZEŻENIE!", - "wchange57": "Memo" + "wchange57": "Memo", + "wchange58": "Nowy Adres" }, "tradepage": { "tchange1": "Portal Handlowy", diff --git a/qortal-ui-core/language/pt.json b/qortal-ui-core/language/pt.json index 6558c1f4..f4dd06c2 100644 --- a/qortal-ui-core/language/pt.json +++ b/qortal-ui-core/language/pt.json @@ -283,7 +283,8 @@ "wchange54": "Exportar catálogo de endereços", "wchange55": "Seu catálogo de endereços existente será excluído e o backup será criado novamente.", "wchange56": "AVISO!", - "wchange57": "Memorando" + "wchange57": "Memorando", + "wchange58": "Novo Endereço" }, "tradepage": { "tchange1": "Portal do Comércio", diff --git a/qortal-ui-core/language/ro.json b/qortal-ui-core/language/ro.json index e5908fb5..b1060649 100644 --- a/qortal-ui-core/language/ro.json +++ b/qortal-ui-core/language/ro.json @@ -283,7 +283,8 @@ "wchange54": "Exportati agenda de adrese", "wchange55": "Agenda dvs. existenta va fi stearsa si din backup va fi creata o noua.", "wchange56": "AVERTIZARE!", - "wchange57": "Nota" + "wchange57": "Nota", + "wchange58": "Adresa noua" }, "tradepage": { "tchange1": "Portal de Tranzactionare", diff --git a/qortal-ui-core/language/rs.json b/qortal-ui-core/language/rs.json index 1873c837..96f7a473 100644 --- a/qortal-ui-core/language/rs.json +++ b/qortal-ui-core/language/rs.json @@ -283,7 +283,8 @@ "wchange54": "Izvezi adresar", "wchange55": "Vaš postojeći adresar će biti obrisan, a iz rezervne kopije biće kreiran novi.", "wchange56": "UPOZORENJE!", - "wchange57": "Beleška" + "wchange57": "Beleška", + "wchange58": "Nova Adresa" }, "tradepage": { "tchange1": "Trgovinski prozor", diff --git a/qortal-ui-core/language/ru.json b/qortal-ui-core/language/ru.json index a27dce40..d8acd09f 100644 --- a/qortal-ui-core/language/ru.json +++ b/qortal-ui-core/language/ru.json @@ -283,7 +283,8 @@ "wchange54": "Экспорт адресной книги", "wchange55": "Ваша существующая адресная книга будет удалена, а из резервной копии создана новая.", "wchange56": "ПРЕДУПРЕЖДЕНИЕ!", - "wchange57": "Памятка" + "wchange57": "Памятка", + "wchange58": "Новый Адрес" }, "tradepage": { "tchange1": "Торговый портал", diff --git a/qortal-ui-core/language/us.json b/qortal-ui-core/language/us.json index 02bb9586..a47f6f5f 100644 --- a/qortal-ui-core/language/us.json +++ b/qortal-ui-core/language/us.json @@ -283,7 +283,8 @@ "wchange54": "Export Address Book", "wchange55": "Your existing address book will be deleted and from backup new created.", "wchange56": "WARNING!", - "wchange57": "Memo" + "wchange57": "Memo", + "wchange58": "New Address" }, "tradepage": { "tchange1": "Trade Portal", diff --git a/qortal-ui-core/language/zhc.json b/qortal-ui-core/language/zhc.json index ee0c77b5..6165e0f1 100644 --- a/qortal-ui-core/language/zhc.json +++ b/qortal-ui-core/language/zhc.json @@ -283,7 +283,8 @@ "wchange54": "导出通讯录", "wchange55": "您现有的通讯簿将被删除并从新创建的备份中。", "wchange56": "警告!", - "wchange57": "备忘录" + "wchange57": "备忘录", + "wchange58": "新的钱包地址" }, "tradepage": { "tchange1": "交易门户", diff --git a/qortal-ui-core/language/zht.json b/qortal-ui-core/language/zht.json index 1842d4d9..a7b440ba 100644 --- a/qortal-ui-core/language/zht.json +++ b/qortal-ui-core/language/zht.json @@ -283,7 +283,8 @@ "wchange54": "導出通訊錄", "wchange55": "您現有的通訊簿將被刪除並從新創建的備份中。", "wchange56": "警告!", - "wchange57": "備忘錄" + "wchange57": "備忘錄", + "wchange58": "新的錢包地址" }, "tradepage": { "tchange1": "交易門戶", diff --git a/qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js b/qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js index 6064cc83..01cf544f 100644 --- a/qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js +++ b/qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js @@ -507,8 +507,8 @@ class MultiWallet extends LitElement { } .unused-address-dialog { - min-height: 300px; - min-width: 300px; + min-height: 150px; + min-width: 550px; box-sizing: border-box; position: relative; } @@ -572,7 +572,7 @@ class MultiWallet extends LitElement { .unused-pos { margin-top: -44px; margin-left: 410px; - width: 250px; + width: 185px; } @media (max-width: 863px) { @@ -1990,11 +1990,24 @@ class MultiWallet extends LitElement {
-

Unused BTC Address

+

BTC


${this.wallets.get(this._selectedWallet).unusedWalletAddress} + + +
+ ${translate("walletpage.wchange38")}

-

Unused LTC Address

+

LTC


${this.wallets.get(this._selectedWallet).unusedWalletAddress} + + +
+ ${translate("walletpage.wchange38")}

-

Unused DOGE Address

+

DOGE


${this.wallets.get(this._selectedWallet).unusedWalletAddress} + + +
+ ${translate("walletpage.wchange38")}

-

Unused DGB Address

+

DGB


${this.wallets.get(this._selectedWallet).unusedWalletAddress} + + +
+ ${translate("walletpage.wchange38")}

-

Unused RVN Address

+

RVN


${this.wallets.get(this._selectedWallet).unusedWalletAddress} + + +
+ ${translate("walletpage.wchange38")}

this.getUnusedAddress(this._selectedWallet)}>Get Unused Address` + return html` this.getUnusedAddress(this._selectedWallet)}> ${translate("walletpage.wchange58")}` case "btc": case "ltc": case "doge": case "dgb": case "rvn": - return html` this.getUnusedAddress(this._selectedWallet)}>Get Unused Address` + return html` this.getUnusedAddress(this._selectedWallet)}> ${translate("walletpage.wchange58")}` default: return html`` }