Add Group Management and update deps

This commit is contained in:
AlphaX-Projects 2022-12-31 18:54:54 +01:00
parent 746d8a4873
commit 7c66ea34a2
15 changed files with 2915 additions and 72 deletions

View File

@ -70,12 +70,11 @@
"file-saver": "2.0.5",
"lit": "2.5.0",
"lit-translate": "2.0.1",
"postcss": "8.4.20",
"pwa-helpers": "0.9.1",
"random-sentence-generator": "0.0.8",
"redux": "4.2.0",
"redux-thunk": "2.4.2",
"rollup": "3.8.1",
"rollup": "3.9.0",
"rollup-plugin-node-globals": "1.4.0",
"rollup-plugin-progress": "1.1.2",
"rollup-plugin-scss": "3.0.0"

View File

@ -0,0 +1,42 @@
'use strict';
import TransactionBase from './TransactionBase.js'
import Base58 from '../deps/Base58.js'
import { store } from '../../api.js'
import { QORT_DECIMALS } from '../constants.js'
export default class TransferPrivsTransaction extends TransactionBase {
constructor() {
super()
this.type = 40
}
render(html) {
const conf = store.getState().config
return html`
Are you sure to transfer privileges to this account ?
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.theRecipient}</span>
</div>
On pressing confirm, the transfer privileges request will be sent!
`
}
set recipient(recipient) {
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
this.theRecipient = recipient
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
get params() {
const params = super.params
params.push(
this._recipient,
this._feeBytes
)
return params
}
}

View File

@ -0,0 +1,53 @@
'use strict';
import TransactionBase from "../TransactionBase.js"
import { QORT_DECIMALS } from "../../constants.js"
export default class AddGroupAdminTransaction extends TransactionBase {
constructor() {
super()
this.type = 24
}
render(html) {
return html`
${this._addAdminDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.theRecipient}</span>
</div>
${this._addAdminDialog2}
`
}
set addAdminDialog1(addAdminDialog1) {
this._addAdminDialog1 = addAdminDialog1
}
set addAdminDialog2(addAdminDialog2) {
this._addAdminDialog2 = addAdminDialog2
}
set rGroupId(rGroupId) {
this._rGroupId = rGroupId;
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
}
set recipient(recipient) {
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
this.theRecipient = recipient
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
get params() {
const params = super.params
params.push(
this._rGroupIdBytes,
this._recipient,
this._feeBytes
)
return params
}
}

View File

@ -0,0 +1,53 @@
'use strict';
import TransactionBase from "../TransactionBase.js"
import { QORT_DECIMALS } from "../../constants.js"
export default class CancelGroupBanTransaction extends TransactionBase {
constructor() {
super()
this.type = 27
}
render(html) {
return html`
${this._cancelBanMemberDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.theRecipient}</span>
</div>
${this._cancelBanMemberDialog2}
`
}
set cancelBanMemberDialog1(cancelBanMemberDialog1) {
this._cancelBanMemberDialog1= cancelBanMemberDialog1
}
set cancelBanMemberDialog2(cancelBanMemberDialog2) {
this._cancelBanMemberDialog2 = cancelBanMemberDialog2
}
set rGroupId(rGroupId) {
this._rGroupId = rGroupId
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
}
set recipient(recipient) {
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
this.theRecipient = recipient
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
get params() {
const params = super.params
params.push(
this._rGroupIdBytes,
this._recipient,
this._feeBytes
)
return params
}
}

View File

@ -0,0 +1,60 @@
'use strict';
import TransactionBase from "../TransactionBase.js"
import { QORT_DECIMALS } from "../../constants.js"
export default class CancelGroupInviteTransaction extends TransactionBase {
constructor() {
super()
this.type = 30
}
render(html) {
return html`
${this._cancelInviteDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this._memberName}</span>
</div>
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.theRecipient}</span>
</div>
${this._cancelInviteDialog2}
`
}
set memberName(memberName) {
this._memberName = memberName
}
set cancelInviteDialog1(cancelInviteDialog1) {
this._cancelInviteDialog1 = cancelInviteDialog1
}
set cancelInviteDialog2(cancelInviteDialog2) {
this._cancelInviteDialog2 = cancelInviteDialog2
}
set rGroupId(rGroupId) {
this._rGroupId = rGroupId;
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
}
set recipient(recipient) {
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
this.theRecipient = recipient
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
get params() {
const params = super.params
params.push(
this._rGroupIdBytes,
this._recipient,
this._feeBytes
)
return params
}
}

View File

@ -0,0 +1,67 @@
'use strict';
import TransactionBase from "../TransactionBase.js"
import { QORT_DECIMALS } from "../../constants.js"
export default class GroupBanTransaction extends TransactionBase {
constructor() {
super()
this.type = 26
}
render(html) {
return html`
${this._banMemberDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.theRecipient}</span>
</div>
${this._banMemberDialog2}
`
}
set banMemberDialog1(banMemberDialog1) {
this._banMemberDialog1= banMemberDialog1
}
set banMemberDialog2(banMemberDialog2) {
this._banMemberDialog2 = banMemberDialog2
}
set rGroupId(rGroupId) {
this._rGroupId = rGroupId;
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
}
set rBanReason(rBanReason) {
this._rBanReason = rBanReason
this._rBanReasonBytes = this.constructor.utils.stringtoUTF8Array(this._rBanReason.toLocaleLowerCase())
this._rBanReasonLength = this.constructor.utils.int32ToBytes(this._rBanReasonBytes.length)
}
set rBanTime(rBanTime) {
this._rBanTime = rBanTime
this._rBanTimeBytes = this.constructor.utils.int32ToBytes(this._rBanTime)
}
set recipient(recipient) {
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
this.theRecipient = recipient
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
get params() {
const params = super.params
params.push(
this._rGroupIdBytes,
this._recipient,
this._rBanReasonLength,
this._rBanReasonBytes,
this._rBanTimeBytes,
this._feeBytes
)
return params
}
}

View File

@ -0,0 +1,59 @@
'use strict';
import TransactionBase from "../TransactionBase.js"
import { QORT_DECIMALS } from "../../constants.js"
export default class GroupInviteTransaction extends TransactionBase {
constructor() {
super()
this.type = 29
}
render(html) {
return html`
${this._inviteMemberDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.theRecipient}</span>
</div>
${this._inviteMemberDialog2}
`
}
set inviteMemberDialog1(inviteMemberDialog1) {
this._inviteMemberDialog1= inviteMemberDialog1
}
set inviteMemberDialog2(inviteMemberDialog2) {
this._inviteMemberDialog2 = inviteMemberDialog2
}
set rGroupId(rGroupId) {
this._rGroupId = rGroupId;
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
}
set rInviteTime(rInviteTime) {
this._rInviteTime = rInviteTime
this._rInviteTimeBytes = this.constructor.utils.int32ToBytes(this._rInviteTime)
}
set recipient(recipient) {
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
this.theRecipient = recipient
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
get params() {
const params = super.params
params.push(
this._rGroupIdBytes,
this._recipient,
this._rInviteTimeBytes,
this._feeBytes
)
return params
}
}

View File

@ -0,0 +1,61 @@
'use strict';
import TransactionBase from "../TransactionBase.js"
import { QORT_DECIMALS } from "../../constants.js"
export default class GroupKickTransaction extends TransactionBase {
constructor() {
super()
this.type = 28
}
render(html) {
return html`
${this._kickMemberDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.theRecipient}</span>
</div>
${this._kickMemberDialog2}
`
}
set kickMemberDialog1(kickMemberDialog1) {
this._kickMemberDialog1= kickMemberDialog1
}
set kickMemberDialog2(kickMemberDialog2) {
this._kickMemberDialog2 = kickMemberDialog2
}
set rGroupId(rGroupId) {
this._rGroupId = rGroupId;
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
}
set rBanReason(rBanReason) {
this._rBanReason = rBanReason
this._rBanReasonBytes = this.constructor.utils.stringtoUTF8Array(this._rBanReason.toLocaleLowerCase())
this._rBanReasonLength = this.constructor.utils.int32ToBytes(this._rBanReasonBytes.length)
}
set recipient(recipient) {
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
this.theRecipient = recipient
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
get params() {
const params = super.params
params.push(
this._rGroupIdBytes,
this._recipient,
this._rBanReasonLength,
this._rBanReasonBytes,
this._feeBytes
)
return params
}
}

View File

@ -0,0 +1,53 @@
'use strict';
import TransactionBase from "../TransactionBase.js"
import { QORT_DECIMALS } from "../../constants.js"
export default class RemoveGroupAdminTransaction extends TransactionBase {
constructor() {
super()
this.type = 25
}
render(html) {
return html`
${this._kickAdminDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.theRecipient}</span>
</div>
${this._kickAdminDialog2}
`
}
set kickAdminDialog1(kickAdminDialog1) {
this._kickAdminDialog1 = kickAdminDialog1
}
set kickAdminDialog2(kickAdminDialog2) {
this._kickAdminDialog2 = kickAdminDialog2
}
set rGroupId(rGroupId) {
this._rGroupId = rGroupId;
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
}
set recipient(recipient) {
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
this.theRecipient = recipient
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
get params() {
const params = super.params
params.push(
this._rGroupIdBytes,
this._recipient,
this._feeBytes
)
return params
}
}

View File

@ -0,0 +1,70 @@
'use strict';
import TransactionBase from '../TransactionBase.js'
import { QORT_DECIMALS } from '../../constants.js'
export default class BuyNameTransacion extends TransactionBase {
constructor() {
super()
this.type = 7
}
render(html) {
return html`
${this._buyNameDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.nameText}</span>
</div>
${this._buyNameDialog2}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.showSellPrice}</span>
</div>
${this._buyNameDialog3}
`
}
set buyNameDialog1(buyNameDialog1) {
this._buyNameDialog1 = buyNameDialog1
}
set buyNameDialog2(buyNameDialog2) {
this._buyNameDialog2 = buyNameDialog2
}
set buyNameDialog3(buyNameDialog3) {
this._buyNameDialog3 = buyNameDialog3
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
set name(name) {
this.nameText = name
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
}
set sellPrice(sellPrice) {
this.showSellPrice = sellPrice
this._sellPrice = sellPrice * QORT_DECIMALS
this._sellPriceBytes = this.constructor.utils.int64ToBytes(this._sellPrice)
}
set recipient(recipient) {
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
this.theRecipient = recipient
}
get params() {
const params = super.params
params.push(
this._nameLength,
this._nameBytes,
this._sellPriceBytes,
this._recipient,
this._feeBytes
)
return params
}
}

View File

@ -0,0 +1,49 @@
'use strict';
import TransactionBase from '../TransactionBase.js'
import { QORT_DECIMALS } from '../../constants.js'
export default class CancelSellNameTransacion extends TransactionBase {
constructor() {
super()
this.type = 6
}
render(html) {
return html`
${this._cancelSellNameDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.nameText}</span>
</div>
${this._cancelSellNameDialog2}
`
}
set cancelSellNameDialog1(cancelSellNameDialog1) {
this._cancelSellNameDialog1 = cancelSellNameDialog1
}
set cancelSellNameDialog2(cancelSellNameDialog2) {
this._cancelSellNameDialog2 = cancelSellNameDialog2
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
set name(name) {
this.nameText = name
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
}
get params() {
const params = super.params
params.push(
this._nameLength,
this._nameBytes,
this._feeBytes
)
return params
}
}

View File

@ -0,0 +1,64 @@
'use strict';
import TransactionBase from '../TransactionBase.js'
import { QORT_DECIMALS } from '../../constants.js'
export default class SellNameTransacion extends TransactionBase {
constructor() {
super()
this.type = 5
}
render(html) {
return html`
${this._sellNameDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.nameText}</span>
</div>
${this._sellNameDialog2}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.showSellPrice}</span>
</div>
${this._sellNameDialog3}
`
}
set sellNameDialog1(sellNameDialog1) {
this._sellNameDialog1 = sellNameDialog1
}
set sellNameDialog2(sellNameDialog2) {
this._sellNameDialog2 = sellNameDialog2
}
set sellNameDialog3(sellNameDialog3) {
this._sellNameDialog3 = sellNameDialog3
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
set name(name) {
this.nameText = name
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
}
set sellPrice(sellPrice) {
this.showSellPrice = sellPrice
this._sellPrice = sellPrice * QORT_DECIMALS
this._sellPriceBytes = this.constructor.utils.int64ToBytes(this._sellPrice)
}
get params() {
const params = super.params
params.push(
this._nameLength,
this._nameBytes,
this._sellPriceBytes,
this._feeBytes
)
return params
}
}

View File

@ -1,25 +1,47 @@
import PaymentTransaction from './PaymentTransaction.js'
import MessageTransaction from './MessageTransaction.js'
import RegisterNameTransaction from './names/RegisterNameTransaction.js'
import SellNameTransacion from './names/SellNameTransacion.js'
import CancelSellNameTransacion from './names/CancelSellNameTransacion.js'
import BuyNameTransacion from './names/BuyNameTransacion.js'
import MessageTransaction from './MessageTransaction.js'
import ChatTransaction from './chat/ChatTransaction.js'
import GroupChatTransaction from './chat/GroupChatTransaction.js';
import RewardShareTransaction from './reward-share/RewardShareTransaction.js'
import RemoveRewardShareTransaction from './reward-share/RemoveRewardShareTransaction.js'
import CreateGroupTransaction from './groups/CreateGroupTransaction.js';
import GroupChatTransaction from './chat/GroupChatTransaction.js'
import PublicizeTransaction from './PublicizeTransaction.js'
import CreateGroupTransaction from './groups/CreateGroupTransaction.js'
import AddGroupAdminTransaction from './groups/AddGroupAdminTransaction.js'
import RemoveGroupAdminTransaction from './groups/RemoveGroupAdminTransaction.js'
import GroupBanTransaction from './groups/GroupBanTransaction.js'
import CancelGroupBanTransaction from './groups/CancelGroupBanTransaction.js'
import GroupKickTransaction from './groups/GroupKickTransaction.js'
import GroupInviteTransaction from './groups/GroupInviteTransaction.js'
import CancelGroupInviteTransaction from './groups/CancelGroupInviteTransaction.js'
import JoinGroupTransaction from './groups/JoinGroupTransaction.js'
import LeaveGroupTransaction from './groups/LeaveGroupTransaction.js'
import PublicizeTransaction from './PublicizeTransaction.js'
import RewardShareTransaction from './reward-share/RewardShareTransaction.js'
import RemoveRewardShareTransaction from './reward-share/RemoveRewardShareTransaction.js'
import TransferPrivsTransaction from './TransferPrivsTransaction.js'
export const transactionTypes = {
2: PaymentTransaction,
3: RegisterNameTransaction,
5: SellNameTransacion,
6: CancelSellNameTransacion,
7: BuyNameTransacion,
17: MessageTransaction,
18: ChatTransaction,
181: GroupChatTransaction,
19: PublicizeTransaction,
22: CreateGroupTransaction,
24: AddGroupAdminTransaction,
25: RemoveGroupAdminTransaction,
26: GroupBanTransaction,
27: CancelGroupBanTransaction,
28: GroupKickTransaction,
29: GroupInviteTransaction,
30: CancelGroupInviteTransaction,
31: JoinGroupTransaction,
32: LeaveGroupTransaction,
38: RewardShareTransaction,
381: RemoveRewardShareTransaction
381: RemoveRewardShareTransaction,
40: TransferPrivsTransaction
}

View File

@ -59,7 +59,7 @@
"html-escaper": "3.0.3",
"lit": "2.5.0",
"lit-translate": "2.0.1",
"rollup": "3.8.1",
"rollup": "3.9.0",
"rollup-plugin-node-globals": "1.4.0",
"rollup-plugin-progress": "1.1.2"
},