mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 09:45:52 +00:00
Send a base58 encoded, ARRR-specific seed derived from the master seed, to use as the entropy for the ARRR wallet seed in the core. This will need a lot of sanity checking before going live, as it may not be the best approach.
This commit is contained in:
parent
9b4a763bca
commit
b2ecd7a3af
@ -276,6 +276,8 @@ export default class AltcoinHDWallet {
|
||||
|
||||
const privateKeyHash = seedHash.slice(0, 32);
|
||||
|
||||
this.seed58 = Base58.encode(privateKeyHash);
|
||||
|
||||
const _privateKeyHash = [...privateKeyHash]
|
||||
let privateKeyBigInt = BigInteger.fromByteArrayUnsigned(_privateKeyHash);
|
||||
|
||||
@ -865,6 +867,7 @@ export default class AltcoinHDWallet {
|
||||
derivedMasterPublicKey: this.masterPublicKey,
|
||||
_tDerivedMasterPrivateKey: this._tMasterPrivateKey,
|
||||
_tDerivedmasterPublicKey: this._tmasterPublicKey,
|
||||
seed58: this.seed58,
|
||||
// derivedPrivateChildKey: this.xPrivateChildKey,
|
||||
// derivedPublicChildKey: this.xPublicChildKey,
|
||||
// derivedPrivateGrandChildKey: this.xPrivateGrandChildKey,
|
||||
|
@ -2430,14 +2430,14 @@ class MultiWallet extends LitElement {
|
||||
async sendArrr() {
|
||||
const arrrAmount = this.shadowRoot.getElementById('arrrAmountInput').value
|
||||
let arrrRecipient = this.shadowRoot.getElementById('arrrRecipient').value
|
||||
const xprv58 = this.wallets.get(this._selectedWallet).wallet.derivedMasterPrivateKey
|
||||
const seed58 = this.wallets.get(this._selectedWallet).wallet.seed58
|
||||
|
||||
this.sendMoneyLoading = true
|
||||
this.btnDisable = true
|
||||
|
||||
const makeRequest = async () => {
|
||||
const opts = {
|
||||
xprv58: xprv58,
|
||||
xprv58: seed58,
|
||||
receivingAddress: arrrRecipient,
|
||||
ravencoinAmount: arrrAmount,
|
||||
feePerByte: (this.arrrFeePerByte / 1e8).toFixed(8),
|
||||
@ -2525,7 +2525,6 @@ class MultiWallet extends LitElement {
|
||||
case 'doge':
|
||||
case 'dgb':
|
||||
case 'rvn':
|
||||
case 'arrr':
|
||||
const walletName = `${coin}Wallet`
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/${coin}/walletbalance?apiKey=${this.getApiKey()}`,
|
||||
@ -2562,6 +2561,43 @@ class MultiWallet extends LitElement {
|
||||
this.wallets.get(this._selectedWallet).transactions = sortedTransactions
|
||||
}
|
||||
break
|
||||
case 'arrr':
|
||||
const arrrWalletName = `${coin}Wallet`
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/${coin}/walletbalance?apiKey=${this.getApiKey()}`,
|
||||
method: 'POST',
|
||||
body: `${window.parent.reduxStore.getState().app.selectedAddress[arrrWalletName].seed58}`,
|
||||
})
|
||||
.then((res) => {
|
||||
if (isNaN(Number(res))) {
|
||||
let snack5string = get("walletpage.wchange33")
|
||||
let snack6string = get("walletpage.wchange34")
|
||||
parentEpml.request('showSnackBar', `${snack5string} ${coin.toLocaleUpperCase()} ${snack6string}!`)
|
||||
} else {
|
||||
if (this._selectedWallet == coin) {
|
||||
this.wallets.get(this._selectedWallet).balance = (Number(res) / 1e8).toFixed(8)
|
||||
this.balanceString = this.wallets.get(this._selectedWallet).balance + " " + this._selectedWallet.toLocaleUpperCase()
|
||||
this.balance = this.wallets.get(this._selectedWallet).balance
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const arrrTxs = await parentEpml.request('apiCall', {
|
||||
url: `/crosschain/${coin}/wallettransactions?apiKey=${this.getApiKey()}`,
|
||||
method: 'POST',
|
||||
body: `${window.parent.reduxStore.getState().app.selectedAddress[arrrWalletName].seed58}`,
|
||||
})
|
||||
|
||||
const arrrCompareFn = (a, b) => {
|
||||
return b.timestamp - a.timestamp
|
||||
}
|
||||
|
||||
const arrrSortedTransactions = arrrTxs.sort(arrrCompareFn)
|
||||
console.log(arrrSortedTransactions)
|
||||
if (this._selectedWallet == coin) {
|
||||
this.wallets.get(this._selectedWallet).transactions = arrrSortedTransactions
|
||||
}
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user