4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 17:55:51 +00:00

translate transaction send dialog

This commit is contained in:
AlphaX-Projects 2022-04-16 17:14:24 +02:00
parent 1ca80f87e4
commit f1c2cf9a8a
11 changed files with 57 additions and 47 deletions

View File

@ -557,5 +557,10 @@
"achange5": "Hinzufügen",
"achange6": "API-Schlüssel erfolgreich hinzugefügt",
"achange7": "API-Schlüssel falsch, kein API-Schlüssel hinzugefügt"
},
"transactions": {
"amount": "Menge",
"to": "Zu",
"declined": "Der Benutzer hat die Transaktion abgelehnt!"
}
}

View File

@ -557,5 +557,10 @@
"achange5": "Add",
"achange6": "Successfully added API Key",
"achange7": "API key wrong, no API key added"
},
"transactions": {
"amount": "Amount",
"to": "To",
"declined": "User declined transaction!"
}
}

View File

@ -557,5 +557,10 @@
"achange5": "Add",
"achange6": "Successfully added API Key",
"achange7": "API key wrong, no API key added"
},
"transactions": {
"amount": "Amount",
"to": "To",
"declined": "User declined transaction!"
}
}

View File

@ -557,5 +557,10 @@
"achange5": "Add",
"achange6": "Successfully added API Key",
"achange7": "API key wrong, no API key added"
},
"transactions": {
"amount": "Amount",
"to": "To",
"declined": "User declined transaction!"
}
}

View File

@ -557,5 +557,10 @@
"achange5": "Add",
"achange6": "Successfully added API Key",
"achange7": "API key wrong, no API key added"
},
"transactions": {
"amount": "Amount",
"to": "To",
"declined": "User declined transaction!"
}
}

View File

@ -557,5 +557,10 @@
"achange5": "添加",
"achange6": "成功添加此节点的API密钥。",
"achange7": "添加API密钥失败。"
},
"transactions": {
"amount": "Amount",
"to": "To",
"declined": "User declined transaction!"
}
}

View File

@ -557,5 +557,10 @@
"achange5": "添加",
"achange6": "成功添加此節點的API密鑰。",
"achange7": "添加API密鑰失敗。"
},
"transactions": {
"amount": "Amount",
"to": "To",
"declined": "User declined transaction!"
}
}

View File

@ -1,7 +1,7 @@
import { LitElement, html, css } from 'lit'
import { connect } from 'pwa-helpers'
import { store } from '../store.js'
import { translate, translateUnsafeHTML } from 'lit-translate'
import { get, translate, translateUnsafeHTML } from 'lit-translate'
import { listenForRequest } from '../transactionRequest.js'
@ -95,7 +95,8 @@ class ConfirmTransactionDialog extends connect(store)(LitElement) {
}
decline(e) {
this._reject(new Error('User declined transaction'))
const rejecterror = get("transactions.declined")
this._reject(new Error(rejecterror))
}
}

View File

@ -1,8 +1,6 @@
'use strict';
import TransactionBase from './TransactionBase.js'
// import { QORT_DECIMALS } from '../constants.js'
import Base58 from '../deps/Base58.js'
// import { store } from '../../store.js'
import { store } from '../../api.js'
export default class PaymentTransaction extends TransactionBase {
@ -28,12 +26,20 @@ export default class PaymentTransaction extends TransactionBase {
set recipient(recipient) { // Always Base58 encoded. Accepts Uint8Array or Base58 string.
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
}
set dialogto(dialogto) {
this._dialogto = dialogto
}
set dialogamount(dialogamount) {
this._dialogamount = dialogamount
}
set amount(amount) {
// console.log('=====DECIMALS ', store.getState().config.coin.decimals)
// console.log("IINIT AMOUNT: ", amount);
this._amount = amount * store.getState().config.coin.decimals
this._amountBytes = this.constructor.utils.int64ToBytes(this._amount)
}
get params() {
const params = super.params
params.push(
@ -46,51 +52,17 @@ export default class PaymentTransaction extends TransactionBase {
render(html) {
const conf = store.getState().config
// console.log(this)
return html`
<table>
<tr>
<th>To</th>
<th>${this._dialogto}</th>
<td>${Base58.encode(this._recipient)}</td>
</tr>
<tr>
<th>Amount</th>
<th>${this._dialogamount}</th>
<td>${this._amount / conf.coin.decimals} ${conf.coin.symbol}</td>
</tr>
</table>
`
}
}
//
// import txTypes from "./txTypes.js"
// import nacl from "./deps/nacl-fast.js"
// import Utils from "./Utils.js"
//
// function generateSignaturePaymentTransaction(keyPair, lastReference, recipient, amount, fee, timestamp) => {
// const data = generatePaymentTransactionBase(keyPair.publicKey, lastReference, recipient, amount, fee, timestamp);
// return nacl.sign.detached(data, keyPair.privateKey);
// }
//
// function generatePaymentTransaction(keyPair, lastReference, recipient, amount, fee, timestamp, signature) => {
// return Utils.appendBuffer(generatePaymentTransactionBase(keyPair.publicKey, lastReference, recipient, amount, fee, timestamp),signature);
// }
//
// function generatePaymentTransactionBase(publicKey, lastReference, recipient, amount, fee, timestamp) => {
// const txType = txTypes.PAYMENT_TRANSACTION;
// const typeBytes = Utils.int32ToBytes(txType);
// const timestampBytes = Utils.int64ToBytes(timestamp);
// const amountBytes = Utils.int64ToBytes(amount * 100000000);
// const feeBytes = Utils.int64ToBytes(fee * 100000000);
//
// let data = new Uint8Array();
//
// data = Utils.appendBuffer(data, typeBytes);
// data = Utils.appendBuffer(data, timestampBytes);
// data = Utils.appendBuffer(data, lastReference);
// data = Utils.appendBuffer(data, publicKey);
// data = Utils.appendBuffer(data, recipient);
// data = Utils.appendBuffer(data, amountBytes);
// data = Utils.appendBuffer(data, feeBytes);
//
// return data;
// }

View File

@ -20,9 +20,7 @@
"asmcrypto.js": "2.3.2",
"buffer": "6.0.3",
"jssha": "3.2.0",
"lodash": "4.17.21",
"lit": "2.2.2",
"lit-translate": "2.0.0"
"lodash": "4.17.21"
},
"engines": {
"node": ">=14.17.0"

View File

@ -1159,11 +1159,11 @@ class MultiWallet extends LitElement {
setInterval(() => {
this.errorMessage = '';
}, 5000)
}, 10000)
setInterval(() => {
this.successMessage = '';
}, 5000)
}, 10000)
this.currencyBoxes = this.shadowRoot.querySelectorAll('.currency-box')
this.transactionsDOM = this.shadowRoot.getElementById('transactionsDOM')
@ -1584,6 +1584,8 @@ class MultiWallet extends LitElement {
const makeTransactionRequest = async (receiver, lastRef) => {
let myReceiver = receiver
let mylastRef = lastRef
let dialogamount = get("transactions.amount")
let dialogto = get("transactions.to")
let myTxnrequest = await parentEpml.request('transaction', {
type: 2,
@ -1593,6 +1595,8 @@ class MultiWallet extends LitElement {
amount: amount,
lastReference: mylastRef,
fee: 0.001,
dialogamount: dialogamount,
dialogto: dialogto,
},
})
return myTxnrequest