diff --git a/core/language/us.json b/core/language/us.json index 768d9ac7..a511f919 100644 --- a/core/language/us.json +++ b/core/language/us.json @@ -1008,7 +1008,10 @@ "rewarddialog3": "If yes, you will need to save the key below in order to mint. It can be supplied to any node in order to allow it to mint on your behalf.", "rewarddialog4": "On pressing confirm, the rewardshare will be created, but you will still need to supply the above key to a node in order to mint with the account.", "rewarddialog5": "You are removing a reward share transaction associated with account:", - "rewarddialog6": "On pressing confirm, the rewardshare will be removed and the minting key will become invalid." + "rewarddialog6": "On pressing confirm, the rewardshare will be removed and the minting key will become invalid.", + "deployAtdialog1": "You are deploying the AT", + "deployAtdialog2": "On pressing confirm, the AT will be deployed!", + "deployAtdialog3": "Initial amount balance" }, "sponsorshipspage": { "schange1": "Active Sponsorships", diff --git a/crypto/api/transactions/DeployAtTransaction.js b/crypto/api/transactions/DeployAtTransaction.js index a9b3ad5f..23e50255 100644 --- a/crypto/api/transactions/DeployAtTransaction.js +++ b/crypto/api/transactions/DeployAtTransaction.js @@ -1,6 +1,7 @@ 'use strict' import TransactionBase from './TransactionBase.js' import { store } from '../../api.js' +import { QORT_DECIMALS } from '../constants.js' export default class DeployAtTransaction extends TransactionBase { constructor() { @@ -8,17 +9,22 @@ export default class DeployAtTransaction extends TransactionBase { this.type = 16 } + render(html) { return html` - ${this._groupdialog5} + ${this._atDeployDialog1}: +
+ ${this._rName} +
+ ${this._atDeployDialog4}:
-
${this._atDeployDialog1}: ${this._rName}
-
-
${this.atDeployDialog2}: ${this._rDescription}
-
-
+ ${this._feeToShow} - ${this._groupdialog6} + ${this._atDeployDialog3}: +
+ ${this._amountToShow} +
+ ${this._atDeployDialog2} ` } @@ -28,12 +34,20 @@ export default class DeployAtTransaction extends TransactionBase { set atDeployDialog2(atDeployDialog2) { this._atDeployDialog2 = atDeployDialog2 } + set atDeployDialog3(atDeployDialog3) { + this._atDeployDialog3 = atDeployDialog3 + } + set atDeployDialog4(atDeployDialog4) { + this._atDeployDialog4 = atDeployDialog4 + } set fee(fee) { - this._fee = fee + this._feeToShow = fee + this._fee = fee * QORT_DECIMALS this._feeBytes = this.constructor.utils.int64ToBytes(this._fee) } set rAmount(rAmount) { + this._amountToShow = rAmount this._rAmount = Math.round(rAmount * store.getState().config.coin.decimals) this._rAmountBytes = this.constructor.utils.int64ToBytes(this._rAmount) } diff --git a/plugins/plugins/core/qdn/browser/browser.src.js b/plugins/plugins/core/qdn/browser/browser.src.js index 02b8aa9b..caf54c70 100644 --- a/plugins/plugins/core/qdn/browser/browser.src.js +++ b/plugins/plugins/core/qdn/browser/browser.src.js @@ -509,7 +509,7 @@ class WebBrowser extends LitElement { } - async _deployAt(name, description, tags, creationBytes, amount, assetId, fee, atType) { + async _deployAt(name, description, tags, creationBytes, amount, assetId, atType) { const deployAtFee = await this.deployAtFee() const getLastRef = async () => { let myRef = await parentEpml.request('apiCall', { @@ -527,13 +527,15 @@ class WebBrowser extends LitElement { } const makeTransactionRequest = async (lastRef) => { - let groupdialog1 = get("transactions.groupdialog1") - let groupdialog2 = get("transactions.groupdialog2") + let deployAtdialog1 = get("transactions.deployAtdialog1") + let deployAtdialog2 = get("transactions.deployAtdialog2") + let deployAtdialog3 = get("transactions.deployAtdialog3") + let deployAtdialog4 = get("walletpage.wchange12") let myTxnrequest = await parentEpml.request('transaction', { type: 16, nonce: this.selectedAddress.nonce, params: { - fee: fee || deployAtFee, + fee: deployAtFee, rName: name, rDescription: description, rTags: tags, @@ -542,8 +544,10 @@ class WebBrowser extends LitElement { rCreationBytes: creationBytes, atType: atType, lastReference: lastRef, - atDeployDialog1: groupdialog1, - atDeployDialog2: groupdialog2 + atDeployDialog1: deployAtdialog1, + atDeployDialog2: deployAtdialog2, + atDeployDialog3: deployAtdialog3, + atDeployDialog4: deployAtdialog4 }, apiVersion: 2 }) @@ -1645,41 +1649,41 @@ class WebBrowser extends LitElement { break; } - // case 'DEPLOY_AT': { - // const requiredFields = ['name', 'description', 'tags', 'creationBytes', 'amount', 'assetId', 'type']; - // const missingFields = []; - - // requiredFields.forEach((field) => { - // if (!data[field]) { - // missingFields.push(field); - // } - // }); - - // if (missingFields.length > 0) { - // const missingFieldsString = missingFields.join(', '); - // const errorMsg = `Missing fields: ${missingFieldsString}` - // let data = {}; - // data['error'] = errorMsg; - // response = JSON.stringify(data); - // break - // } - - - // try { - // this.loader.show(); - // const fee = data.fee || undefined - // const resJoinGroup = await this._deployAt(data.name, data.description, data.tags, data.creationBytes, data.amount, data.assetId, fee, data.type) - // response = JSON.stringify(resJoinGroup); - // } catch (error) { - // const obj = {}; - // const errorMsg = error.message || 'Failed to join the group.'; - // obj['error'] = errorMsg; - // response = JSON.stringify(obj); - // } finally { - // this.loader.hide(); - // } - // break; - // } + case 'DEPLOY_AT': { + const requiredFields = ['name', 'description', 'tags', 'creationBytes', 'amount', 'assetId', 'type']; + const missingFields = []; + + requiredFields.forEach((field) => { + if (!data[field] && data[field] !== 0) { + missingFields.push(field); + } + }); + + if (missingFields.length > 0) { + const missingFieldsString = missingFields.join(', '); + const errorMsg = `Missing fields: ${missingFieldsString}` + let data = {}; + data['error'] = errorMsg; + response = JSON.stringify(data); + break + } + + + try { + this.loader.show(); + + const resDeployAt = await this._deployAt(data.name, data.description, data.tags, data.creationBytes, data.amount, data.assetId, data.type) + response = JSON.stringify(resDeployAt); + } catch (error) { + const obj = {}; + const errorMsg = error.message || 'Failed to join the group.'; + obj['error'] = errorMsg; + response = JSON.stringify(obj); + } finally { + this.loader.hide(); + } + break; + } case actions.GET_WALLET_BALANCE: {