Browse Source

ARRR wallet now uses address returned by the core API.

It would be great if we could derive the z addresses directly in the UI by the time this is released, but this is an alternative for now.
pirate-chain
CalDescent 2 years ago
parent
commit
0c682d0cbc
  1. 36
      qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js

36
qortal-ui-plugins/plugins/core/wallet/wallet-app.src.js

@ -53,6 +53,7 @@ class MultiWallet extends LitElement {
arrrRecipient: { type: String }, arrrRecipient: { type: String },
arrrAmount: { type: Number }, arrrAmount: { type: Number },
errorMessage: { type: String }, errorMessage: { type: String },
arrrWalletAddress: { type: String },
successMessage: { type: String }, successMessage: { type: String },
sendMoneyLoading: { type: Boolean }, sendMoneyLoading: { type: Boolean },
btnDisable: { type: Boolean }, btnDisable: { type: Boolean },
@ -577,6 +578,7 @@ class MultiWallet extends LitElement {
this.dgbRecipient = '' this.dgbRecipient = ''
this.rvnRecipient = '' this.rvnRecipient = ''
this.arrrRecipient = '' this.arrrRecipient = ''
this.arrrWalletAddress = ''
this.errorMessage = '' this.errorMessage = ''
this.successMessage = '' this.successMessage = ''
this.sendMoneyLoading = false this.sendMoneyLoading = false
@ -2484,6 +2486,7 @@ class MultiWallet extends LitElement {
} }
} }
const coin = this._selectedWallet const coin = this._selectedWallet
await this.fetchWalletAddress(this._selectedWallet)
await this.fetchWalletDetails(this._selectedWallet) await this.fetchWalletDetails(this._selectedWallet)
if (this._selectedWallet == coin) { if (this._selectedWallet == coin) {
await this.renderTransactions() 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() { renderSendButton() {
if ( this._selectedWallet === "qort" ) { if ( this._selectedWallet === "qort" ) {
return html`<vaadin-button theme="primary large" style="width: 75%;" @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 large" style="width: 75%;" @click=${() => this.openSendQort()}><vaadin-icon icon="vaadin:coin-piles" slot="prefix"></vaadin-icon> ${translate("walletpage.wchange17")} QORT</vaadin-button>`
@ -2673,9 +2697,15 @@ class MultiWallet extends LitElement {
} }
getSelectedWalletAddress() { getSelectedWalletAddress() {
return this._selectedWallet === 'qort' switch (this._selectedWallet) {
? this.wallets.get(this._selectedWallet).wallet.address case "arrr":
: this.wallets.get(this._selectedWallet).wallet.address // 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) { async getTransactionGrid(coin) {

Loading…
Cancel
Save