mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 17:55:51 +00:00
added deploy_at action
This commit is contained in:
parent
b30dfb62aa
commit
ae9917b939
@ -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.",
|
"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.",
|
"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:",
|
"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": {
|
"sponsorshipspage": {
|
||||||
"schange1": "Active Sponsorships",
|
"schange1": "Active Sponsorships",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
import TransactionBase from './TransactionBase.js'
|
import TransactionBase from './TransactionBase.js'
|
||||||
import { store } from '../../api.js'
|
import { store } from '../../api.js'
|
||||||
|
import { QORT_DECIMALS } from '../constants.js'
|
||||||
|
|
||||||
export default class DeployAtTransaction extends TransactionBase {
|
export default class DeployAtTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -8,17 +9,22 @@ export default class DeployAtTransaction extends TransactionBase {
|
|||||||
this.type = 16
|
this.type = 16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
render(html) {
|
render(html) {
|
||||||
return html`
|
return html`
|
||||||
${this._groupdialog5}
|
${this._atDeployDialog1}:
|
||||||
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
|
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
|
||||||
<div>${this._atDeployDialog1}: <span style="color: #000;">${this._rName}</span></div>
|
<span style="color: #000;">${this._rName}</span>
|
||||||
<br>
|
|
||||||
<div>${this.atDeployDialog2}: <span style="color: #000;">${this._rDescription}</span></div>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
${this._groupdialog6}
|
${this._atDeployDialog4}:
|
||||||
|
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
|
||||||
|
<span style="color: #000;">${this._feeToShow}</span>
|
||||||
|
</div>
|
||||||
|
${this._atDeployDialog3}:
|
||||||
|
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
|
||||||
|
<span style="color: #000;">${this._amountToShow}</span>
|
||||||
|
</div>
|
||||||
|
${this._atDeployDialog2}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,12 +34,20 @@ export default class DeployAtTransaction extends TransactionBase {
|
|||||||
set atDeployDialog2(atDeployDialog2) {
|
set atDeployDialog2(atDeployDialog2) {
|
||||||
this._atDeployDialog2 = atDeployDialog2
|
this._atDeployDialog2 = atDeployDialog2
|
||||||
}
|
}
|
||||||
|
set atDeployDialog3(atDeployDialog3) {
|
||||||
|
this._atDeployDialog3 = atDeployDialog3
|
||||||
|
}
|
||||||
|
set atDeployDialog4(atDeployDialog4) {
|
||||||
|
this._atDeployDialog4 = atDeployDialog4
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee
|
this._feeToShow = fee
|
||||||
|
this._fee = fee * QORT_DECIMALS
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
||||||
}
|
}
|
||||||
set rAmount(rAmount) {
|
set rAmount(rAmount) {
|
||||||
|
this._amountToShow = rAmount
|
||||||
this._rAmount = Math.round(rAmount * store.getState().config.coin.decimals)
|
this._rAmount = Math.round(rAmount * store.getState().config.coin.decimals)
|
||||||
this._rAmountBytes = this.constructor.utils.int64ToBytes(this._rAmount)
|
this._rAmountBytes = this.constructor.utils.int64ToBytes(this._rAmount)
|
||||||
}
|
}
|
||||||
|
@ -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 deployAtFee = await this.deployAtFee()
|
||||||
const getLastRef = async () => {
|
const getLastRef = async () => {
|
||||||
let myRef = await parentEpml.request('apiCall', {
|
let myRef = await parentEpml.request('apiCall', {
|
||||||
@ -527,13 +527,15 @@ class WebBrowser extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const makeTransactionRequest = async (lastRef) => {
|
const makeTransactionRequest = async (lastRef) => {
|
||||||
let groupdialog1 = get("transactions.groupdialog1")
|
let deployAtdialog1 = get("transactions.deployAtdialog1")
|
||||||
let groupdialog2 = get("transactions.groupdialog2")
|
let deployAtdialog2 = get("transactions.deployAtdialog2")
|
||||||
|
let deployAtdialog3 = get("transactions.deployAtdialog3")
|
||||||
|
let deployAtdialog4 = get("walletpage.wchange12")
|
||||||
let myTxnrequest = await parentEpml.request('transaction', {
|
let myTxnrequest = await parentEpml.request('transaction', {
|
||||||
type: 16,
|
type: 16,
|
||||||
nonce: this.selectedAddress.nonce,
|
nonce: this.selectedAddress.nonce,
|
||||||
params: {
|
params: {
|
||||||
fee: fee || deployAtFee,
|
fee: deployAtFee,
|
||||||
rName: name,
|
rName: name,
|
||||||
rDescription: description,
|
rDescription: description,
|
||||||
rTags: tags,
|
rTags: tags,
|
||||||
@ -542,8 +544,10 @@ class WebBrowser extends LitElement {
|
|||||||
rCreationBytes: creationBytes,
|
rCreationBytes: creationBytes,
|
||||||
atType: atType,
|
atType: atType,
|
||||||
lastReference: lastRef,
|
lastReference: lastRef,
|
||||||
atDeployDialog1: groupdialog1,
|
atDeployDialog1: deployAtdialog1,
|
||||||
atDeployDialog2: groupdialog2
|
atDeployDialog2: deployAtdialog2,
|
||||||
|
atDeployDialog3: deployAtdialog3,
|
||||||
|
atDeployDialog4: deployAtdialog4
|
||||||
},
|
},
|
||||||
apiVersion: 2
|
apiVersion: 2
|
||||||
})
|
})
|
||||||
@ -1645,41 +1649,41 @@ class WebBrowser extends LitElement {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// case 'DEPLOY_AT': {
|
case 'DEPLOY_AT': {
|
||||||
// const requiredFields = ['name', 'description', 'tags', 'creationBytes', 'amount', 'assetId', 'type'];
|
const requiredFields = ['name', 'description', 'tags', 'creationBytes', 'amount', 'assetId', 'type'];
|
||||||
// const missingFields = [];
|
const missingFields = [];
|
||||||
|
|
||||||
// requiredFields.forEach((field) => {
|
requiredFields.forEach((field) => {
|
||||||
// if (!data[field]) {
|
if (!data[field] && data[field] !== 0) {
|
||||||
// missingFields.push(field);
|
missingFields.push(field);
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
// if (missingFields.length > 0) {
|
if (missingFields.length > 0) {
|
||||||
// const missingFieldsString = missingFields.join(', ');
|
const missingFieldsString = missingFields.join(', ');
|
||||||
// const errorMsg = `Missing fields: ${missingFieldsString}`
|
const errorMsg = `Missing fields: ${missingFieldsString}`
|
||||||
// let data = {};
|
let data = {};
|
||||||
// data['error'] = errorMsg;
|
data['error'] = errorMsg;
|
||||||
// response = JSON.stringify(data);
|
response = JSON.stringify(data);
|
||||||
// break
|
break
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
// try {
|
try {
|
||||||
// this.loader.show();
|
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)
|
const resDeployAt = await this._deployAt(data.name, data.description, data.tags, data.creationBytes, data.amount, data.assetId, data.type)
|
||||||
// response = JSON.stringify(resJoinGroup);
|
response = JSON.stringify(resDeployAt);
|
||||||
// } catch (error) {
|
} catch (error) {
|
||||||
// const obj = {};
|
const obj = {};
|
||||||
// const errorMsg = error.message || 'Failed to join the group.';
|
const errorMsg = error.message || 'Failed to join the group.';
|
||||||
// obj['error'] = errorMsg;
|
obj['error'] = errorMsg;
|
||||||
// response = JSON.stringify(obj);
|
response = JSON.stringify(obj);
|
||||||
// } finally {
|
} finally {
|
||||||
// this.loader.hide();
|
this.loader.hide();
|
||||||
// }
|
}
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
case actions.GET_WALLET_BALANCE: {
|
case actions.GET_WALLET_BALANCE: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user