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 3ad60f5f..d81042fb 100644 --- a/qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js +++ b/qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js @@ -53,6 +53,7 @@ class MultiWallet extends LitElement { arrrRecipient: { type: String }, arrrAmount: { type: Number }, errorMessage: { type: String }, + arrrWalletAddress: { type: String }, successMessage: { type: String }, sendMoneyLoading: { type: Boolean }, btnDisable: { type: Boolean }, @@ -577,6 +578,7 @@ class MultiWallet extends LitElement { this.dgbRecipient = '' this.rvnRecipient = '' this.arrrRecipient = '' + this.arrrWalletAddress = '' this.errorMessage = '' this.successMessage = '' this.sendMoneyLoading = false @@ -2484,6 +2486,7 @@ class MultiWallet extends LitElement { } } const coin = this._selectedWallet + await this.fetchWalletAddress(this._selectedWallet) await this.fetchWalletDetails(this._selectedWallet) if (this._selectedWallet == coin) { await this.renderTransactions() @@ -2603,6 +2606,27 @@ class MultiWallet extends LitElement { } } + async fetchWalletAddress(coin) { + switch (coin) { + case 'arrr': + const arrrWalletName = `${coin}Wallet` + let res = await parentEpml.request('apiCall', { + url: `/crosschain/${coin}/walletaddress?apiKey=${this.getApiKey()}`, + method: 'POST', + body: `${window.parent.reduxStore.getState().app.selectedAddress[arrrWalletName].seed58}`, + }) + if (res != null) { + this.arrrWalletAddress = res + console.log("this.arrrWalletAddress set to " + this.arrrWalletAddress) + } + break + + default: + // Not used for other coins yet + break + } + } + renderSendButton() { if ( this._selectedWallet === "qort" ) { return html` this.openSendQort()}> ${translate("walletpage.wchange17")} QORT` @@ -2673,9 +2697,15 @@ class MultiWallet extends LitElement { } getSelectedWalletAddress() { - return this._selectedWallet === 'qort' - ? this.wallets.get(this._selectedWallet).wallet.address - : this.wallets.get(this._selectedWallet).wallet.address + switch (this._selectedWallet) { + case "arrr": + // Use address returned by core API + return this.arrrWalletAddress + + default: + // Use locally derived address + return this.wallets.get(this._selectedWallet).wallet.address + } } async getTransactionGrid(coin) {