mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-16 04:05:48 +00:00
Add unitFee and fallback fee
This commit is contained in:
parent
fb64a3f1ea
commit
5f96fb1e59
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import { LitElement, html, css } from 'lit-element'
|
import { LitElement, html, css } from 'lit-element'
|
||||||
import { render } from 'lit-html'
|
import { render } from 'lit-html'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
@ -42,6 +41,7 @@ class GroupManagement extends LitElement {
|
|||||||
--mdc-theme-primary: rgb(3, 169, 244);
|
--mdc-theme-primary: rgb(3, 169, 244);
|
||||||
--paper-input-container-focus-color: var(--mdc-theme-primary);
|
--paper-input-container-focus-color: var(--mdc-theme-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
#group-management-page {
|
#group-management-page {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 12px 24px;
|
padding: 12px 24px;
|
||||||
@ -68,7 +68,6 @@ class GroupManagement extends LitElement {
|
|||||||
.divCard {
|
.divCard {
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
/** box-shadow: 0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 2px 0 rgba(0,0,0,0.20); **/
|
|
||||||
box-shadow: 0 .3px 1px 0 rgba(0,0,0,0.14), 0 1px 1px -1px rgba(0,0,0,0.12), 0 1px 2px 0 rgba(0,0,0,0.20);
|
box-shadow: 0 .3px 1px 0 rgba(0,0,0,0.14), 0 1px 1px -1px rgba(0,0,0,0.12), 0 1px 2px 0 rgba(0,0,0,0.20);
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
@ -86,14 +85,17 @@ class GroupManagement extends LitElement {
|
|||||||
display: hidden !important;
|
display: hidden !important;
|
||||||
visibility: none !important;
|
visibility: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.details {
|
.details {
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
padding: 13px 20px;
|
padding: 13px 20px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -101,19 +103,17 @@ class GroupManagement extends LitElement {
|
|||||||
color: #555;
|
color: #555;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-weight:600;
|
font-weight:600;
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
opacity: 0.66;
|
opacity: 0.66;
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemList {
|
.itemList {
|
||||||
padding:0;
|
padding:0;
|
||||||
}
|
}
|
||||||
/* .itemList > * {
|
|
||||||
padding-left:24px;
|
|
||||||
padding-right:24px;
|
|
||||||
} */
|
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +128,9 @@ class GroupManagement extends LitElement {
|
|||||||
this.recipientPublicKey = ''
|
this.recipientPublicKey = ''
|
||||||
this.btnDisable = false
|
this.btnDisable = false
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
|
this.createFee = 0.001
|
||||||
|
this.joinFee = 0.001
|
||||||
|
this.leaveFee = 0.001
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -138,22 +141,6 @@ class GroupManagement extends LitElement {
|
|||||||
<mwc-button style="float:right;" @click=${() => this.shadowRoot.querySelector('#createGroupDialog').show()}><mwc-icon>add</mwc-icon>Create Group</mwc-button>
|
<mwc-button style="float:right;" @click=${() => this.shadowRoot.querySelector('#createGroupDialog').show()}><mwc-icon>add</mwc-icon>Create Group</mwc-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divCard">
|
|
||||||
<h3 style="margin: 0; margin-bottom: 1em; text-align: center;">Public Groups</h3>
|
|
||||||
<vaadin-grid id="publicGroupsGrid" style="height:auto;" ?hidden="${this.isEmptyArray(this.publicGroups)}" aria-label="Public Open Groups" .items="${this.publicGroups}" height-by-rows>
|
|
||||||
<vaadin-grid-column path="groupName"></vaadin-grid-column>
|
|
||||||
<vaadin-grid-column header="Description" path="description"></vaadin-grid-column>
|
|
||||||
<vaadin-grid-column path="owner"></vaadin-grid-column>
|
|
||||||
<vaadin-grid-column width="9.8rem" flex-grow="0" header="Action" .renderer=${(root, column, data) => {
|
|
||||||
render(html`<mwc-button @click=${() => this.joinGroup(data.item)}><mwc-icon>queue</mwc-icon>Join</mwc-button>`, root)
|
|
||||||
}}></vaadin-grid-column>
|
|
||||||
</vaadin-grid>
|
|
||||||
</vaadin-grid>
|
|
||||||
${this.isEmptyArray(this.publicGroups) ? html`
|
|
||||||
No Open Public Groups available!
|
|
||||||
`: ''}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="divCard">
|
<div class="divCard">
|
||||||
<h3 style="margin: 0; margin-bottom: 1em; text-align: center;">Your Joined Groups</h3>
|
<h3 style="margin: 0; margin-bottom: 1em; text-align: center;">Your Joined Groups</h3>
|
||||||
<vaadin-grid id="joinedGroupsGrid" style="height:auto;" ?hidden="${this.isEmptyArray(this.joinedGroups)}" aria-label="Joined Groups" .items="${this.joinedGroups}" height-by-rows>
|
<vaadin-grid id="joinedGroupsGrid" style="height:auto;" ?hidden="${this.isEmptyArray(this.joinedGroups)}" aria-label="Joined Groups" .items="${this.joinedGroups}" height-by-rows>
|
||||||
@ -171,6 +158,21 @@ class GroupManagement extends LitElement {
|
|||||||
`: ''}
|
`: ''}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="divCard">
|
||||||
|
<h3 style="margin: 0; margin-bottom: 1em; text-align: center;">Public Groups</h3>
|
||||||
|
<vaadin-grid id="publicGroupsGrid" style="height:auto;" ?hidden="${this.isEmptyArray(this.publicGroups)}" aria-label="Public Open Groups" .items="${this.publicGroups}" height-by-rows>
|
||||||
|
<vaadin-grid-column path="groupName"></vaadin-grid-column>
|
||||||
|
<vaadin-grid-column header="Description" path="description"></vaadin-grid-column>
|
||||||
|
<vaadin-grid-column path="owner"></vaadin-grid-column>
|
||||||
|
<vaadin-grid-column width="9.8rem" flex-grow="0" header="Action" .renderer=${(root, column, data) => {
|
||||||
|
render(html`<mwc-button @click=${() => this.joinGroup(data.item)}><mwc-icon>queue</mwc-icon>Join</mwc-button>`, root)
|
||||||
|
}}></vaadin-grid-column>
|
||||||
|
</vaadin-grid>
|
||||||
|
${this.isEmptyArray(this.publicGroups) ? html`
|
||||||
|
No Open Public Groups available!
|
||||||
|
`: ''}
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Create Group Dialog -->
|
<!-- Create Group Dialog -->
|
||||||
<mwc-dialog id="createGroupDialog" scrimClickAction="${this.isLoading ? '' : 'close'}">
|
<mwc-dialog id="createGroupDialog" scrimClickAction="${this.isLoading ? '' : 'close'}">
|
||||||
<div style="text-align:center">
|
<div style="text-align:center">
|
||||||
@ -415,6 +417,135 @@ class GroupManagement extends LitElement {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstUpdated() {
|
||||||
|
this.unitCreateFee()
|
||||||
|
this.unitJoinFee()
|
||||||
|
this.unitLeaveFee()
|
||||||
|
|
||||||
|
const getOpenPublicGroups = async () => {
|
||||||
|
let openG = await parentEpml.request('apiCall', {
|
||||||
|
url: `/groups?limit=0&reverse=true`
|
||||||
|
})
|
||||||
|
let myGs = openG.filter(myG => myG.isOpen === true)
|
||||||
|
return myGs
|
||||||
|
}
|
||||||
|
|
||||||
|
const getJoinedGroups = async () => {
|
||||||
|
let joinedG = await parentEpml.request('apiCall', {
|
||||||
|
url: `/groups/member/${this.selectedAddress.address}`
|
||||||
|
})
|
||||||
|
return joinedG
|
||||||
|
}
|
||||||
|
|
||||||
|
const getOpen_JoinedGroups = async () => {
|
||||||
|
let _joinedGroups = await getJoinedGroups()
|
||||||
|
let _publicGroups = await getOpenPublicGroups()
|
||||||
|
let results = _publicGroups.filter(myOpenGroup => {
|
||||||
|
let value = _joinedGroups.some(myJoinedGroup => myOpenGroup.groupId === myJoinedGroup.groupId)
|
||||||
|
return !value
|
||||||
|
});
|
||||||
|
this.publicGroups = results
|
||||||
|
this.joinedGroups = _joinedGroups
|
||||||
|
setTimeout(getOpen_JoinedGroups, this.config.user.nodeSettings.pingInterval)
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("contextmenu", (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
this._textMenu(event)
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("click", () => {
|
||||||
|
parentEpml.request('closeCopyTextMenu', null)
|
||||||
|
});
|
||||||
|
|
||||||
|
window.onkeyup = (e) => {
|
||||||
|
if (e.keyCode === 27) {
|
||||||
|
parentEpml.request('closeCopyTextMenu', null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let configLoaded = false
|
||||||
|
|
||||||
|
parentEpml.ready().then(() => {
|
||||||
|
parentEpml.subscribe('selected_address', async selectedAddress => {
|
||||||
|
this.selectedAddress = {}
|
||||||
|
selectedAddress = JSON.parse(selectedAddress)
|
||||||
|
if (!selectedAddress || Object.entries(selectedAddress).length === 0) return
|
||||||
|
this.selectedAddress = selectedAddress
|
||||||
|
})
|
||||||
|
parentEpml.subscribe('config', c => {
|
||||||
|
if (!configLoaded) {
|
||||||
|
setTimeout(getOpen_JoinedGroups, 1)
|
||||||
|
configLoaded = true
|
||||||
|
}
|
||||||
|
this.config = JSON.parse(c)
|
||||||
|
})
|
||||||
|
parentEpml.subscribe('copy_menu_switch', async value => {
|
||||||
|
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
||||||
|
this.clearSelection()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
parentEpml.imReady()
|
||||||
|
}
|
||||||
|
|
||||||
|
async unitCreateFee() {
|
||||||
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
||||||
|
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
|
||||||
|
const url = `${nodeUrl}/transactions/unitfee?txType=CREATE_GROUP`;
|
||||||
|
await fetch(url)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
return Promise.reject(response);
|
||||||
|
})
|
||||||
|
.then((json) => {
|
||||||
|
this.createFee = (Number(json) / 1e8).toFixed(8);
|
||||||
|
})
|
||||||
|
.catch((response) => {
|
||||||
|
console.log(response.status, response.statusText, 'Need Core Update');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async unitJoinFee() {
|
||||||
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
||||||
|
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
|
||||||
|
const url = `${nodeUrl}/transactions/unitfee?txType=JOIN_GROUP`;
|
||||||
|
await fetch(url)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
return Promise.reject(response);
|
||||||
|
})
|
||||||
|
.then((json) => {
|
||||||
|
this.joinFee = (Number(json) / 1e8).toFixed(8);
|
||||||
|
})
|
||||||
|
.catch((response) => {
|
||||||
|
console.log(response.status, response.statusText, 'Need Core Update');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async unitLeaveFee() {
|
||||||
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
||||||
|
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
|
||||||
|
const url = `${nodeUrl}/transactions/unitfee?txType=LEAVE_GROUP`;
|
||||||
|
await fetch(url)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
return Promise.reject(response);
|
||||||
|
})
|
||||||
|
.then((json) => {
|
||||||
|
this.leaveFee = (Number(json) / 1e8).toFixed(8);
|
||||||
|
})
|
||||||
|
.catch((response) => {
|
||||||
|
console.log(response.status, response.statusText, 'Need Core Update');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
resetDefaultSettings() {
|
resetDefaultSettings() {
|
||||||
this.error = false
|
this.error = false
|
||||||
this.message = ''
|
this.message = ''
|
||||||
@ -424,28 +555,24 @@ class GroupManagement extends LitElement {
|
|||||||
manageGroupOwner(groupObj) {
|
manageGroupOwner(groupObj) {
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
this.manageGroupObj = groupObj
|
this.manageGroupObj = groupObj
|
||||||
|
|
||||||
this.shadowRoot.querySelector('#manageGroupOwnerDialog').show()
|
this.shadowRoot.querySelector('#manageGroupOwnerDialog').show()
|
||||||
}
|
}
|
||||||
|
|
||||||
manageGroupAdmin(groupObj) {
|
manageGroupAdmin(groupObj) {
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
this.manageGroupObj = groupObj
|
this.manageGroupObj = groupObj
|
||||||
|
|
||||||
this.shadowRoot.querySelector('#manageGroupAdminDialog').show()
|
this.shadowRoot.querySelector('#manageGroupAdminDialog').show()
|
||||||
}
|
}
|
||||||
|
|
||||||
joinGroup(groupObj) {
|
joinGroup(groupObj) {
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
this.joinGroupObj = groupObj
|
this.joinGroupObj = groupObj
|
||||||
|
|
||||||
this.shadowRoot.querySelector('#joinDialog').show()
|
this.shadowRoot.querySelector('#joinDialog').show()
|
||||||
}
|
}
|
||||||
|
|
||||||
leaveGroup(groupObj) {
|
leaveGroup(groupObj) {
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
this.leaveGroupObj = groupObj
|
this.leaveGroupObj = groupObj
|
||||||
|
|
||||||
this.shadowRoot.querySelector('#leaveDialog').show()
|
this.shadowRoot.querySelector('#leaveDialog').show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +606,6 @@ class GroupManagement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
_textMenu(event) {
|
||||||
|
|
||||||
const getSelectedText = () => {
|
const getSelectedText = () => {
|
||||||
var text = "";
|
var text = "";
|
||||||
if (typeof window.getSelection != "undefined") {
|
if (typeof window.getSelection != "undefined") {
|
||||||
@ -493,108 +619,18 @@ class GroupManagement extends LitElement {
|
|||||||
const checkSelectedTextAndShowMenu = () => {
|
const checkSelectedTextAndShowMenu = () => {
|
||||||
let selectedText = getSelectedText();
|
let selectedText = getSelectedText();
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
if (selectedText && typeof selectedText === 'string') {
|
||||||
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
||||||
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
||||||
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
parentEpml.request('openCopyTextMenu', textMenuObject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkSelectedTextAndShowMenu()
|
checkSelectedTextAndShowMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
firstUpdated() {
|
|
||||||
|
|
||||||
// Call getNamesGrid
|
|
||||||
// this.getNamesGrid()
|
|
||||||
|
|
||||||
const getOpenPublicGroups = async () => {
|
|
||||||
let openG = await parentEpml.request('apiCall', {
|
|
||||||
url: `/groups?limit=0&reverse=true`
|
|
||||||
})
|
|
||||||
|
|
||||||
let myGs = openG.filter(myG => myG.isOpen === true)
|
|
||||||
return myGs
|
|
||||||
}
|
|
||||||
|
|
||||||
const getJoinedGroups = async () => {
|
|
||||||
let joinedG = await parentEpml.request('apiCall', {
|
|
||||||
url: `/groups/member/${this.selectedAddress.address}`
|
|
||||||
})
|
|
||||||
|
|
||||||
return joinedG
|
|
||||||
}
|
|
||||||
|
|
||||||
const getOpen_JoinedGroups = async () => {
|
|
||||||
// this.publicGroups = []
|
|
||||||
// this.joinedGroups = []
|
|
||||||
|
|
||||||
let _joinedGroups = await getJoinedGroups()
|
|
||||||
let _publicGroups = await getOpenPublicGroups()
|
|
||||||
|
|
||||||
let results = _publicGroups.filter(myOpenGroup => {
|
|
||||||
let value = _joinedGroups.some(myJoinedGroup => myOpenGroup.groupId === myJoinedGroup.groupId)
|
|
||||||
return !value
|
|
||||||
});
|
|
||||||
this.publicGroups = results
|
|
||||||
this.joinedGroups = _joinedGroups
|
|
||||||
setTimeout(getOpen_JoinedGroups, this.config.user.nodeSettings.pingInterval)
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
this._textMenu(event)
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener("click", () => {
|
|
||||||
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
});
|
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
|
||||||
if (e.keyCode === 27) {
|
|
||||||
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let configLoaded = false
|
|
||||||
|
|
||||||
parentEpml.ready().then(() => {
|
|
||||||
parentEpml.subscribe('selected_address', async selectedAddress => {
|
|
||||||
this.selectedAddress = {}
|
|
||||||
selectedAddress = JSON.parse(selectedAddress)
|
|
||||||
if (!selectedAddress || Object.entries(selectedAddress).length === 0) return
|
|
||||||
this.selectedAddress = selectedAddress
|
|
||||||
})
|
|
||||||
parentEpml.subscribe('config', c => {
|
|
||||||
if (!configLoaded) {
|
|
||||||
setTimeout(getOpen_JoinedGroups, 1)
|
|
||||||
configLoaded = true
|
|
||||||
}
|
|
||||||
this.config = JSON.parse(c)
|
|
||||||
})
|
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
parentEpml.imReady()
|
|
||||||
}
|
|
||||||
|
|
||||||
async createGroup(e) {
|
async createGroup(e) {
|
||||||
// Reset Default Settings...
|
// Reset Default Settings...
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
|
const createFeeInput = this.createFee
|
||||||
const groupNameInput = this.shadowRoot.getElementById("groupNameInput").value
|
const groupNameInput = this.shadowRoot.getElementById("groupNameInput").value
|
||||||
const groupDescInput = this.shadowRoot.getElementById("groupDescInput").value
|
const groupDescInput = this.shadowRoot.getElementById("groupDescInput").value
|
||||||
const groupTypeInput = this.shadowRoot.getElementById("groupTypeInput").value
|
const groupTypeInput = this.shadowRoot.getElementById("groupTypeInput").value
|
||||||
@ -628,11 +664,11 @@ class GroupManagement extends LitElement {
|
|||||||
|
|
||||||
// Make Transaction Request
|
// Make Transaction Request
|
||||||
const makeTransactionRequest = async (_groupTypeInput, _groupApprovalInput, _groupMinDelayInput, _groupMaxDelayInput, lastRef) => {
|
const makeTransactionRequest = async (_groupTypeInput, _groupApprovalInput, _groupMinDelayInput, _groupMaxDelayInput, lastRef) => {
|
||||||
|
|
||||||
let myTxnrequest = await parentEpml.request('transaction', {
|
let myTxnrequest = await parentEpml.request('transaction', {
|
||||||
type: 22,
|
type: 22,
|
||||||
nonce: this.selectedAddress.nonce,
|
nonce: this.selectedAddress.nonce,
|
||||||
params: {
|
params: {
|
||||||
|
fee: createFeeInput,
|
||||||
registrantAddress: this.selectedAddress.address,
|
registrantAddress: this.selectedAddress.address,
|
||||||
rGroupName: groupNameInput,
|
rGroupName: groupNameInput,
|
||||||
rGroupDesc: groupDescInput,
|
rGroupDesc: groupDescInput,
|
||||||
@ -643,15 +679,10 @@ class GroupManagement extends LitElement {
|
|||||||
lastReference: lastRef,
|
lastReference: lastRef,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return myTxnrequest
|
return myTxnrequest
|
||||||
}
|
}
|
||||||
|
|
||||||
// FAILED txnResponse = {success: false, message: "User declined transaction"}
|
|
||||||
// SUCCESS txnResponse = { success: true, data: true }
|
|
||||||
|
|
||||||
const getTxnRequestResponse = (txnResponse) => {
|
const getTxnRequestResponse = (txnResponse) => {
|
||||||
|
|
||||||
if (txnResponse.success === false && txnResponse.message) {
|
if (txnResponse.success === false && txnResponse.message) {
|
||||||
this.error = true
|
this.error = true
|
||||||
this.message = txnResponse.message
|
this.message = txnResponse.message
|
||||||
@ -695,12 +726,12 @@ class GroupManagement extends LitElement {
|
|||||||
// Call validateReceiver
|
// Call validateReceiver
|
||||||
validateReceiver()
|
validateReceiver()
|
||||||
}
|
}
|
||||||
// this.resetDefaultSettings()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async _joinGroup(groupId, groupName) {
|
async _joinGroup(groupId, groupName) {
|
||||||
// Reset Default Settings...
|
// Reset Default Settings...
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
|
const joinFeeInput = this.joinFee
|
||||||
|
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
|
|
||||||
@ -715,7 +746,6 @@ class GroupManagement extends LitElement {
|
|||||||
|
|
||||||
const validateReceiver = async () => {
|
const validateReceiver = async () => {
|
||||||
let lastRef = await getLastRef();
|
let lastRef = await getLastRef();
|
||||||
|
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
let myTransaction = await makeTransactionRequest(lastRef)
|
let myTransaction = await makeTransactionRequest(lastRef)
|
||||||
getTxnRequestResponse(myTransaction)
|
getTxnRequestResponse(myTransaction)
|
||||||
@ -724,26 +754,21 @@ class GroupManagement extends LitElement {
|
|||||||
|
|
||||||
// Make Transaction Request
|
// Make Transaction Request
|
||||||
const makeTransactionRequest = async (lastRef) => {
|
const makeTransactionRequest = async (lastRef) => {
|
||||||
|
|
||||||
let myTxnrequest = await parentEpml.request('transaction', {
|
let myTxnrequest = await parentEpml.request('transaction', {
|
||||||
type: 31,
|
type: 31,
|
||||||
nonce: this.selectedAddress.nonce,
|
nonce: this.selectedAddress.nonce,
|
||||||
params: {
|
params: {
|
||||||
|
fee: joinFeeInput,
|
||||||
registrantAddress: this.selectedAddress.address,
|
registrantAddress: this.selectedAddress.address,
|
||||||
rGroupName: groupName,
|
rGroupName: groupName,
|
||||||
rGroupId: groupId,
|
rGroupId: groupId,
|
||||||
lastReference: lastRef,
|
lastReference: lastRef,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return myTxnrequest
|
return myTxnrequest
|
||||||
}
|
}
|
||||||
|
|
||||||
// FAILED txnResponse = {success: false, message: "User declined transaction"}
|
|
||||||
// SUCCESS txnResponse = { success: true, data: true }
|
|
||||||
|
|
||||||
const getTxnRequestResponse = (txnResponse) => {
|
const getTxnRequestResponse = (txnResponse) => {
|
||||||
|
|
||||||
if (txnResponse.success === false && txnResponse.message) {
|
if (txnResponse.success === false && txnResponse.message) {
|
||||||
this.error = true
|
this.error = true
|
||||||
this.message = txnResponse.message
|
this.message = txnResponse.message
|
||||||
@ -757,15 +782,14 @@ class GroupManagement extends LitElement {
|
|||||||
throw new Error(txnResponse)
|
throw new Error(txnResponse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validateReceiver()
|
validateReceiver()
|
||||||
|
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
async _leaveGroup(groupId, groupName) {
|
async _leaveGroup(groupId, groupName) {
|
||||||
// Reset Default Settings...
|
// Reset Default Settings...
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
|
const leaveFeeInput = this.leaveFee
|
||||||
|
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
|
|
||||||
@ -780,7 +804,6 @@ class GroupManagement extends LitElement {
|
|||||||
|
|
||||||
const validateReceiver = async () => {
|
const validateReceiver = async () => {
|
||||||
let lastRef = await getLastRef();
|
let lastRef = await getLastRef();
|
||||||
|
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
let myTransaction = await makeTransactionRequest(lastRef)
|
let myTransaction = await makeTransactionRequest(lastRef)
|
||||||
getTxnRequestResponse(myTransaction)
|
getTxnRequestResponse(myTransaction)
|
||||||
@ -789,24 +812,20 @@ class GroupManagement extends LitElement {
|
|||||||
|
|
||||||
// Make Transaction Request
|
// Make Transaction Request
|
||||||
const makeTransactionRequest = async (lastRef) => {
|
const makeTransactionRequest = async (lastRef) => {
|
||||||
|
|
||||||
let myTxnrequest = await parentEpml.request('transaction', {
|
let myTxnrequest = await parentEpml.request('transaction', {
|
||||||
type: 32,
|
type: 32,
|
||||||
nonce: this.selectedAddress.nonce,
|
nonce: this.selectedAddress.nonce,
|
||||||
params: {
|
params: {
|
||||||
|
fee: leaveFeeInput,
|
||||||
registrantAddress: this.selectedAddress.address,
|
registrantAddress: this.selectedAddress.address,
|
||||||
rGroupName: groupName,
|
rGroupName: groupName,
|
||||||
rGroupId: groupId,
|
rGroupId: groupId,
|
||||||
lastReference: lastRef,
|
lastReference: lastRef,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return myTxnrequest
|
return myTxnrequest
|
||||||
}
|
}
|
||||||
|
|
||||||
// FAILED txnResponse = {success: false, message: "User declined transaction"}
|
|
||||||
// SUCCESS txnResponse = { success: true, data: true }
|
|
||||||
|
|
||||||
const getTxnRequestResponse = (txnResponse) => {
|
const getTxnRequestResponse = (txnResponse) => {
|
||||||
|
|
||||||
if (txnResponse.success === false && txnResponse.message) {
|
if (txnResponse.success === false && txnResponse.message) {
|
||||||
@ -822,14 +841,11 @@ class GroupManagement extends LitElement {
|
|||||||
throw new Error(txnResponse)
|
throw new Error(txnResponse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validateReceiver()
|
validateReceiver()
|
||||||
|
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
clearSelection() {
|
||||||
|
|
||||||
window.getSelection().removeAllRanges()
|
window.getSelection().removeAllRanges()
|
||||||
window.parent.getSelection().removeAllRanges()
|
window.parent.getSelection().removeAllRanges()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user