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

Add unitFee

This commit is contained in:
AlphaX-Projects 2022-02-04 05:29:14 -08:00 committed by GitHub
parent 2752c869c2
commit 0a0b021a15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 21 deletions

View File

@ -1,19 +1,11 @@
"use strict";
import TransactionBase from "../TransactionBase.js"
import { QORT_DECIMALS } from "../../constants.js"
export default class CreateGroupTransaction extends TransactionBase {
constructor() {
super()
this.type = 22
this.fee = 0.001
// this.tests.push(
// () => {
// if (!(this._registrantAddress instanceof Uint8Array && this._registrantAddress.length == 25)) {
// return "Invalid Registrant " + Base58.encode(this._registrantAddress)
// }
// return true
// }
// )
}
render(html) {
@ -30,20 +22,19 @@ export default class CreateGroupTransaction extends TransactionBase {
`
}
// set registrantAddress(registrantAddress) {
// this._registrantAddress = registrantAddress instanceof Uint8Array ? registrantAddress : this.constructor.Base58.decode(registrantAddress);
// }
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
set rGroupName(rGroupName) {
this._rGroupName = rGroupName;
this._rGroupNameBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupName.toLocaleLowerCase())
this._rGroupNameLength = this.constructor.utils.int32ToBytes(this._rGroupNameBytes.length)
}
set rGroupDesc(rGroupDesc) {
this._rGroupDesc = rGroupDesc;
this._rGroupDescBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupDesc.toLocaleLowerCase())
this._rGroupDescLength = this.constructor.utils.int32ToBytes(this._rGroupDescBytes.length)
}
@ -61,20 +52,17 @@ export default class CreateGroupTransaction extends TransactionBase {
set rGroupMinimumBlockDelay(rGroupMinimumBlockDelay) {
this._rGroupMinimumBlockDelay = rGroupMinimumBlockDelay;
this._rGroupMinimumBlockDelayBytes = this.constructor.utils.int32ToBytes(this._rGroupMinimumBlockDelay)
}
set rGroupMaximumBlockDelay(rGroupMaximumBlockDelay) {
this._rGroupMaximumBlockDelay = rGroupMaximumBlockDelay;
this._rGroupMaximumBlockDelayBytes = this.constructor.utils.int32ToBytes(this._rGroupMaximumBlockDelay)
}
get params() {
const params = super.params;
params.push(
// this._registrantAddress,
this._rGroupNameLength,
this._rGroupNameBytes,
this._rGroupDescLength,

View File

@ -1,11 +1,11 @@
"use strict";
import TransactionBase from "../TransactionBase.js"
import { QORT_DECIMALS } from "../../constants.js"
export default class JoinGroupTransaction extends TransactionBase {
constructor() {
super()
this.type = 31
this.fee = 0.001 // THOUGHTS: Fee should be easily set and dynamic in future... (0.001)
this.tests.push(
() => {
if (!(this._registrantAddress instanceof Uint8Array && this._registrantAddress.length == 25)) {
@ -26,13 +26,17 @@ export default class JoinGroupTransaction extends TransactionBase {
`
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
set registrantAddress(registrantAddress) {// Always Base58 encoded. Accepts Uint8Array or Base58 string.
this._registrantAddress = registrantAddress instanceof Uint8Array ? registrantAddress : this.constructor.Base58.decode(registrantAddress);
}
set rGroupId(rGroupId) {
this._rGroupId = rGroupId;
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
}

View File

@ -1,11 +1,11 @@
"use strict";
import TransactionBase from "../TransactionBase.js"
import { QORT_DECIMALS } from "../../constants.js"
export default class LeaveGroupTransaction extends TransactionBase {
constructor() {
super()
this.type = 32
this.fee = 0.001 // THOUGHTS: Fee should be easily set and dynamic in future... (0.001)
this.tests.push(
() => {
if (!(this._registrantAddress instanceof Uint8Array && this._registrantAddress.length == 25)) {
@ -26,13 +26,17 @@ export default class LeaveGroupTransaction extends TransactionBase {
`
}
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
set registrantAddress(registrantAddress) {// Always Base58 encoded. Accepts Uint8Array or Base58 string.
this._registrantAddress = registrantAddress instanceof Uint8Array ? registrantAddress : this.constructor.Base58.decode(registrantAddress);
}
set rGroupId(rGroupId) {
this._rGroupId = rGroupId;
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
}