mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-07-31 14:11:45 +00:00
Update UI
Refactor and added new functioms
This commit is contained in:
@@ -5,7 +5,6 @@ import signChat from './transactions/chat/signChat.js'
|
||||
import signArbitrary from './transactions/arbitrary/signArbitrary.js'
|
||||
import signArbitraryWithFee from './transactions/arbitrary/signArbitraryWithFee.js'
|
||||
|
||||
|
||||
export const createTransaction = (type, keyPair, params) => {
|
||||
const tx = new transactions[type]()
|
||||
tx.keyPair = keyPair
|
||||
@@ -36,8 +35,6 @@ export const signArbitraryWithFeeTransaction = (arbitraryBytesBase58, arbitraryB
|
||||
return signArbitraryWithFee(arbitraryBytesBase58, arbitraryBytesForSigningBase58, keyPair)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Process Transactions
|
||||
export const processTransaction = bytes => request('/transactions/process', {
|
||||
method: 'POST',
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import {waitForConfig, watchConfig} from '../config.js'
|
||||
|
||||
let config = {}
|
||||
|
||||
watchConfig((c) => {
|
||||
config = c
|
||||
})
|
||||
@@ -15,6 +16,7 @@ export async function request(url, options) {
|
||||
|
||||
const n = config.nodeConfig.knownNodes[config.nodeConfig.node]
|
||||
const node = n.protocol + '://' + n.domain + ':' + n.port
|
||||
|
||||
return fetch(node + url, {
|
||||
method,
|
||||
headers,
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from './TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../constants.js'
|
||||
import TransactionBase from './TransactionBase'
|
||||
import {QORT_DECIMALS} from '../constants'
|
||||
|
||||
export default class PaymentTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,5 +1,4 @@
|
||||
'use strict'
|
||||
import TransactionBase from './TransactionBase.js'
|
||||
import TransactionBase from './TransactionBase'
|
||||
|
||||
export default class DelegationTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,7 +1,6 @@
|
||||
'use strict'
|
||||
import TransactionBase from './TransactionBase.js'
|
||||
import {store} from '../../api.js'
|
||||
import {QORT_DECIMALS} from '../constants.js'
|
||||
import TransactionBase from './TransactionBase'
|
||||
import {store} from '../../api'
|
||||
import {QORT_DECIMALS} from '../constants'
|
||||
|
||||
export default class DeployAtTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
@@ -9,7 +8,6 @@ export default class DeployAtTransaction extends TransactionBase {
|
||||
this.type = 16
|
||||
}
|
||||
|
||||
|
||||
render(html) {
|
||||
return html`
|
||||
${this._atDeployDialog1}:
|
||||
@@ -31,12 +29,15 @@ export default class DeployAtTransaction extends TransactionBase {
|
||||
set atDeployDialog1(atDeployDialog1) {
|
||||
this._atDeployDialog1 = atDeployDialog1
|
||||
}
|
||||
|
||||
set atDeployDialog2(atDeployDialog2) {
|
||||
this._atDeployDialog2 = atDeployDialog2
|
||||
}
|
||||
|
||||
set atDeployDialog3(atDeployDialog3) {
|
||||
this._atDeployDialog3 = atDeployDialog3
|
||||
}
|
||||
|
||||
set atDeployDialog4(atDeployDialog4) {
|
||||
this._atDeployDialog4 = atDeployDialog4
|
||||
}
|
||||
@@ -46,6 +47,7 @@ export default class DeployAtTransaction extends TransactionBase {
|
||||
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)
|
||||
@@ -63,26 +65,29 @@ export default class DeployAtTransaction extends TransactionBase {
|
||||
this._rDescriptionBytes = this.constructor.utils.stringtoUTF8Array(this._rDescription.toLocaleLowerCase())
|
||||
this._rDescriptionLength = this.constructor.utils.int32ToBytes(this._rDescriptionBytes.length)
|
||||
}
|
||||
|
||||
set atType(atType) {
|
||||
this._atType = atType
|
||||
this._atTypeBytes = this.constructor.utils.stringtoUTF8Array(this._atType)
|
||||
this._atTypeLength = this.constructor.utils.int32ToBytes(this._atTypeBytes.length)
|
||||
}
|
||||
|
||||
set rTags(rTags) {
|
||||
this._rTags = rTags
|
||||
this._rTagsBytes = this.constructor.utils.stringtoUTF8Array(this._rTags.toLocaleLowerCase())
|
||||
this._rTagsLength = this.constructor.utils.int32ToBytes(this._rTagsBytes.length)
|
||||
}
|
||||
|
||||
set rCreationBytes(rCreationBytes) {
|
||||
const decode = this.constructor.Base58.decode(rCreationBytes)
|
||||
this._rCreationBytes = this.constructor.utils.stringtoUTF8Array(decode)
|
||||
this._rCreationBytesLength = this.constructor.utils.int32ToBytes(this._rCreationBytes.length)
|
||||
}
|
||||
|
||||
set rAssetId(rAssetId) {
|
||||
this._rAssetId = this.constructor.utils.int64ToBytes(rAssetId)
|
||||
}
|
||||
|
||||
|
||||
get params() {
|
||||
const params = super.params
|
||||
params.push(
|
||||
|
@@ -1,13 +1,12 @@
|
||||
'use strict'
|
||||
import PaymentTransaction from './PaymentTransaction.js'
|
||||
import PaymentTransaction from './PaymentTransaction'
|
||||
|
||||
export default class MessageTransaction extends PaymentTransaction {
|
||||
constructor() {
|
||||
super()
|
||||
this.type = 17
|
||||
this._key = this.constructor.utils.int64ToBytes(0);
|
||||
this._isEncrypted = new Uint8Array(1); // Defaults to false
|
||||
this._isText = new Uint8Array(1); // Defaults to false
|
||||
this._key = this.constructor.utils.int64ToBytes(0)
|
||||
this._isEncrypted = new Uint8Array(1) // Defaults to false
|
||||
this._isText = new Uint8Array(1) // Defaults to false
|
||||
}
|
||||
|
||||
set message(message /* UTF8 String */) {
|
||||
|
@@ -1,7 +1,6 @@
|
||||
'use strict'
|
||||
import TransactionBase from './TransactionBase.js'
|
||||
import Base58 from '../deps/Base58.js'
|
||||
import {store} from '../../api.js'
|
||||
import TransactionBase from './TransactionBase'
|
||||
import Base58 from '../deps/Base58'
|
||||
import {store} from '../../api'
|
||||
|
||||
export default class PaymentTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
import ChatBase from "./chat/ChatBase.js"
|
||||
import {QORT_DECIMALS} from "../constants.js"
|
||||
import ChatBase from './chat/ChatBase'
|
||||
import {QORT_DECIMALS} from '../constants'
|
||||
|
||||
export default class PublicizeTransaction extends ChatBase {
|
||||
constructor() {
|
||||
@@ -12,16 +11,18 @@ export default class PublicizeTransaction extends ChatBase {
|
||||
set proofOfWorkNonce(proofOfWorkNonce) {
|
||||
this._proofOfWorkNonce = this.constructor.utils.int32ToBytes(proofOfWorkNonce)
|
||||
}
|
||||
|
||||
set fee(fee) {
|
||||
this._fee = fee * QORT_DECIMALS
|
||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
||||
}
|
||||
|
||||
get params() {
|
||||
const params = super.params;
|
||||
const params = super.params
|
||||
params.push(
|
||||
this._proofOfWorkNonce,
|
||||
this._feeBytes
|
||||
)
|
||||
return params;
|
||||
return params
|
||||
}
|
||||
}
|
||||
|
@@ -1,16 +1,17 @@
|
||||
'use strict'
|
||||
import {QORT_DECIMALS, TX_TYPES} from '../constants.js'
|
||||
import nacl from '../deps/nacl-fast.js'
|
||||
import Base58 from '../deps/Base58.js'
|
||||
import utils from '../deps/utils.js'
|
||||
import {QORT_DECIMALS, TX_TYPES} from '../constants'
|
||||
import nacl from '../deps/nacl-fast'
|
||||
import Base58 from '../deps/Base58'
|
||||
import utils from '../deps/utils'
|
||||
|
||||
export default class TransactionBase {
|
||||
static get utils() {
|
||||
return utils
|
||||
}
|
||||
|
||||
static get nacl() {
|
||||
return nacl
|
||||
}
|
||||
|
||||
static get Base58() {
|
||||
return Base58
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
'use strict'
|
||||
import TransactionBase from './TransactionBase.js'
|
||||
import {store} from '../../api.js'
|
||||
import {QORT_DECIMALS} from '../constants.js'
|
||||
import TransactionBase from './TransactionBase'
|
||||
import {store} from '../../api'
|
||||
import {QORT_DECIMALS} from '../constants'
|
||||
|
||||
export default class TransferPrivsTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
@@ -12,12 +11,12 @@ export default class TransferPrivsTransaction extends TransactionBase {
|
||||
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!
|
||||
`
|
||||
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) {
|
||||
|
@@ -1,9 +1,8 @@
|
||||
import nacl from '../../deps/nacl-fast.js'
|
||||
import utils from '../../deps/utils.js'
|
||||
import Base58 from '../../deps/Base58.js'
|
||||
import nacl from '../../deps/nacl-fast'
|
||||
import utils from '../../deps/utils'
|
||||
import Base58 from '../../deps/Base58'
|
||||
|
||||
const signArbitrary = (arbitraryBytesBase58, arbitraryBytesForSigningBase58, nonce, keyPair) => {
|
||||
|
||||
if (!arbitraryBytesBase58) {
|
||||
throw new Error('ArbitraryBytesBase58 not defined')
|
||||
}
|
||||
@@ -19,12 +18,11 @@ const signArbitrary = (arbitraryBytesBase58, arbitraryBytesForSigningBase58, non
|
||||
const arbitraryBytes = Base58.decode(arbitraryBytesBase58)
|
||||
const _arbitraryBytesBuffer = Object.keys(arbitraryBytes).map(function (key) { return arbitraryBytes[key]; })
|
||||
const arbitraryBytesBuffer = new Uint8Array(_arbitraryBytesBuffer)
|
||||
|
||||
const arbitraryBytesForSigning = Base58.decode(arbitraryBytesForSigningBase58)
|
||||
const _arbitraryBytesForSigningBuffer = Object.keys(arbitraryBytesForSigning).map(function (key) { return arbitraryBytesForSigning[key]; })
|
||||
const arbitraryBytesForSigningBuffer = new Uint8Array(_arbitraryBytesForSigningBuffer)
|
||||
|
||||
const _nonce = utils.int32ToBytes(nonce)
|
||||
|
||||
arbitraryBytesBuffer.set(_nonce, 112)
|
||||
arbitraryBytesForSigningBuffer.set(_nonce, 112)
|
||||
|
||||
|
@@ -1,14 +1,12 @@
|
||||
import nacl from '../../deps/nacl-fast.js'
|
||||
import utils from '../../deps/utils.js'
|
||||
import Base58 from '../../deps/Base58.js'
|
||||
import nacl from '../../deps/nacl-fast'
|
||||
import utils from '../../deps/utils'
|
||||
import Base58 from '../../deps/Base58'
|
||||
|
||||
const signArbitraryWithFee = (arbitraryBytesBase58, arbitraryBytesForSigningBase58, keyPair) => {
|
||||
|
||||
if (!arbitraryBytesBase58) {
|
||||
throw new Error('ArbitraryBytesBase58 not defined')
|
||||
}
|
||||
|
||||
|
||||
if (!keyPair) {
|
||||
throw new Error('keyPair not defined')
|
||||
}
|
||||
@@ -16,13 +14,9 @@ const signArbitraryWithFee = (arbitraryBytesBase58, arbitraryBytesForSigningBase
|
||||
const arbitraryBytes = Base58.decode(arbitraryBytesBase58)
|
||||
const _arbitraryBytesBuffer = Object.keys(arbitraryBytes).map(function (key) { return arbitraryBytes[key]; })
|
||||
const arbitraryBytesBuffer = new Uint8Array(_arbitraryBytesBuffer)
|
||||
|
||||
const arbitraryBytesForSigning = Base58.decode(arbitraryBytesForSigningBase58)
|
||||
const _arbitraryBytesForSigningBuffer = Object.keys(arbitraryBytesForSigning).map(function (key) { return arbitraryBytesForSigning[key]; })
|
||||
const arbitraryBytesForSigningBuffer = new Uint8Array(_arbitraryBytesForSigningBuffer)
|
||||
|
||||
|
||||
|
||||
const signature = nacl.sign.detached(arbitraryBytesForSigningBuffer, keyPair.privateKey)
|
||||
|
||||
return utils.appendBuffer(arbitraryBytesBuffer, signature)
|
||||
|
@@ -26,6 +26,7 @@
|
||||
data = appendBuffer(data, lastReference)
|
||||
data = appendBuffer(data, publicKey)
|
||||
data = appendBuffer(data, paymentsLengthBytes)
|
||||
|
||||
// Here it is necessary to insert the payments, if there are
|
||||
data = appendBuffer(data, serviceBytes)
|
||||
data = appendBuffer(data, dataSizeBytes)
|
||||
|
@@ -1,16 +1,17 @@
|
||||
'use strict'
|
||||
import {QORT_DECIMALS, TX_TYPES} from '../../constants.js'
|
||||
import nacl from '../../deps/nacl-fast.js'
|
||||
import Base58 from '../../deps/Base58.js'
|
||||
import utils from '../../deps/utils.js'
|
||||
import {QORT_DECIMALS, TX_TYPES} from '../../constants'
|
||||
import nacl from '../../deps/nacl-fast'
|
||||
import Base58 from '../../deps/Base58'
|
||||
import utils from '../../deps/utils'
|
||||
|
||||
export default class ChatBase {
|
||||
static get utils() {
|
||||
return utils
|
||||
}
|
||||
|
||||
static get nacl() {
|
||||
return nacl
|
||||
}
|
||||
|
||||
static get Base58() {
|
||||
return Base58
|
||||
}
|
||||
@@ -135,6 +136,7 @@ export default class ChatBase {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
return finalResult
|
||||
}
|
||||
|
||||
|
@@ -1,10 +1,8 @@
|
||||
'use strict'
|
||||
import ChatBase from "./ChatBase.js"
|
||||
import nacl from '../../deps/nacl-fast.js'
|
||||
import ed2curve from '../../deps/ed2curve.js'
|
||||
import ChatBase from './ChatBase'
|
||||
import nacl from '../../deps/nacl-fast'
|
||||
import ed2curve from '../../deps/ed2curve'
|
||||
import {Sha256} from 'asmcrypto.js'
|
||||
import {CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP} from '../../constants.js'
|
||||
|
||||
import {CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP} from '../../constants'
|
||||
|
||||
export default class ChatTransaction extends ChatBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import ChatBase from "./ChatBase.js"
|
||||
import {CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP} from '../../constants.js'
|
||||
import ChatBase from './ChatBase'
|
||||
import {CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP} from '../../constants'
|
||||
|
||||
export default class GroupChatTransaction extends ChatBase {
|
||||
constructor() {
|
||||
@@ -34,7 +33,7 @@ export default class GroupChatTransaction extends ChatBase {
|
||||
}
|
||||
|
||||
set isEncrypted(isEncrypted) {
|
||||
this._isEncrypted = new Uint8Array(1);
|
||||
this._isEncrypted = new Uint8Array(1)
|
||||
this._isEncrypted[0] = isEncrypted
|
||||
}
|
||||
|
||||
@@ -63,6 +62,7 @@ export default class GroupChatTransaction extends ChatBase {
|
||||
params.push(this._chatReference)
|
||||
}
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import nacl from '../../deps/nacl-fast.js'
|
||||
import Base58 from '../../deps/Base58.js'
|
||||
import ed2curve from '../../deps/ed2curve.js'
|
||||
import nacl from '../../deps/nacl-fast'
|
||||
import Base58 from '../../deps/Base58'
|
||||
import ed2curve from '../../deps/ed2curve'
|
||||
import {Sha256} from 'asmcrypto.js'
|
||||
|
||||
export const decryptChatMessage = (encryptedMessage, privateKey, recipientPublicKey, lastReference) => {
|
||||
@@ -8,12 +8,11 @@ export const decryptChatMessage = (encryptedMessage, privateKey, recipientPublic
|
||||
|
||||
const _base58RecipientPublicKey = recipientPublicKey instanceof Uint8Array ? Base58.encode(recipientPublicKey) : recipientPublicKey
|
||||
const _recipientPublicKey = Base58.decode(_base58RecipientPublicKey)
|
||||
|
||||
const _lastReference = lastReference instanceof Uint8Array ? lastReference : Base58.decode(lastReference)
|
||||
|
||||
const convertedPrivateKey = ed2curve.convertSecretKey(privateKey)
|
||||
const convertedPublicKey = ed2curve.convertPublicKey(_recipientPublicKey)
|
||||
const sharedSecret = new Uint8Array(32);
|
||||
const sharedSecret = new Uint8Array(32)
|
||||
|
||||
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey)
|
||||
|
||||
const _chatEncryptionSeed = new Sha256().process(sharedSecret).finish().result
|
||||
@@ -26,32 +25,30 @@ export const decryptChatMessage = (encryptedMessage, privateKey, recipientPublic
|
||||
}
|
||||
|
||||
export const decryptChatMessageBase64 = (encryptedMessage, privateKey, recipientPublicKey, lastReference) => {
|
||||
let _encryptedMessage = atob(encryptedMessage);
|
||||
const binaryLength = _encryptedMessage.length;
|
||||
const bytes = new Uint8Array(binaryLength);
|
||||
let _encryptedMessage = atob(encryptedMessage)
|
||||
|
||||
const binaryLength = _encryptedMessage.length
|
||||
const bytes = new Uint8Array(binaryLength)
|
||||
|
||||
for (let i = 0; i < binaryLength; i++) {
|
||||
bytes[i] = _encryptedMessage.charCodeAt(i);
|
||||
bytes[i] = _encryptedMessage.charCodeAt(i)
|
||||
}
|
||||
|
||||
const _base58RecipientPublicKey = recipientPublicKey instanceof Uint8Array ? Base58.encode(recipientPublicKey) : recipientPublicKey
|
||||
const _recipientPublicKey = Base58.decode(_base58RecipientPublicKey)
|
||||
|
||||
const _lastReference = lastReference instanceof Uint8Array ? lastReference : Base58.decode(lastReference)
|
||||
|
||||
const convertedPrivateKey = ed2curve.convertSecretKey(privateKey)
|
||||
const convertedPublicKey = ed2curve.convertPublicKey(_recipientPublicKey)
|
||||
const sharedSecret = new Uint8Array(32);
|
||||
const sharedSecret = new Uint8Array(32)
|
||||
|
||||
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey)
|
||||
|
||||
const _chatEncryptionSeed = new Sha256().process(sharedSecret).finish().result
|
||||
const _decryptedMessage = nacl.secretbox.open(bytes, _lastReference.slice(0, 24), _chatEncryptionSeed)
|
||||
|
||||
|
||||
if (_decryptedMessage === false) {
|
||||
return _decryptedMessage
|
||||
}
|
||||
|
||||
return new TextDecoder('utf-8').decode(_decryptedMessage)
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import nacl from '../../deps/nacl-fast.js'
|
||||
import utils from '../../deps/utils.js'
|
||||
import nacl from '../../deps/nacl-fast'
|
||||
import utils from '../../deps/utils'
|
||||
|
||||
const signChat = (chatBytes, nonce, keyPair) => {
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class AddGroupAdminTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class CancelGroupBanTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class CancelGroupInviteTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class CreateGroupTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
@@ -12,11 +11,11 @@ export default class CreateGroupTransaction extends TransactionBase {
|
||||
return html`
|
||||
${this._groupdialog5}
|
||||
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
|
||||
<div>${this._groupdialog7}: <span style="color: #000;">${this._rGroupName}</span></div>
|
||||
<br>
|
||||
<div>${this._groupdialog8}: <span style="color: #000;">${this._rGroupDesc}</span></div>
|
||||
<br>
|
||||
<div>${this._groupdialog9}: <span style="color: #000;">${this.myGroupType === 1 ? "Public" : "Private"}</span></div>
|
||||
<div><span style="color: #000;">${this._groupdialog7}: ${this._rGroupName}</span></div>
|
||||
<hr style="border: 2px solid #03a9f4;">
|
||||
<div><span style="color: #000;">${this._groupdialog8}: ${this._rGroupDesc}</span></div>
|
||||
<hr style="border: 2px solid #03a9f4;">
|
||||
<div><span style="color: #000;">${this._groupdialog9}: ${this._rGroupTypeDesc}</span></div>
|
||||
</div>
|
||||
${this._groupdialog6}
|
||||
`
|
||||
@@ -42,6 +41,10 @@ export default class CreateGroupTransaction extends TransactionBase {
|
||||
this._groupdialog9 = groupdialog9
|
||||
}
|
||||
|
||||
set groupTypeDesc(groupTypeDesc) {
|
||||
this._rGroupTypeDesc = groupTypeDesc
|
||||
}
|
||||
|
||||
set fee(fee) {
|
||||
this._fee = fee * QORT_DECIMALS
|
||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
||||
@@ -49,18 +52,17 @@ export default class CreateGroupTransaction extends TransactionBase {
|
||||
|
||||
set rGroupName(rGroupName) {
|
||||
this._rGroupName = rGroupName
|
||||
this._rGroupNameBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupName.toLocaleLowerCase())
|
||||
this._rGroupNameBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupName)
|
||||
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._rGroupDescBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupDesc)
|
||||
this._rGroupDescLength = this.constructor.utils.int32ToBytes(this._rGroupDescBytes.length)
|
||||
}
|
||||
|
||||
set rGroupType(rGroupType) {
|
||||
this.myGroupType = rGroupType
|
||||
this._rGroupType = new Uint8Array(1)
|
||||
this._rGroupType[0] = rGroupType
|
||||
}
|
||||
@@ -71,13 +73,11 @@ export default class CreateGroupTransaction extends TransactionBase {
|
||||
}
|
||||
|
||||
set rGroupMinimumBlockDelay(rGroupMinimumBlockDelay) {
|
||||
this._rGroupMinimumBlockDelay = rGroupMinimumBlockDelay
|
||||
this._rGroupMinimumBlockDelayBytes = this.constructor.utils.int32ToBytes(this._rGroupMinimumBlockDelay)
|
||||
this._rGroupMinimumBlockDelayBytes = this.constructor.utils.int32ToBytes(rGroupMinimumBlockDelay)
|
||||
}
|
||||
|
||||
set rGroupMaximumBlockDelay(rGroupMaximumBlockDelay) {
|
||||
this._rGroupMaximumBlockDelay = rGroupMaximumBlockDelay
|
||||
this._rGroupMaximumBlockDelayBytes = this.constructor.utils.int32ToBytes(this._rGroupMaximumBlockDelay)
|
||||
this._rGroupMaximumBlockDelayBytes = this.constructor.utils.int32ToBytes(rGroupMaximumBlockDelay)
|
||||
}
|
||||
|
||||
get params() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class GroupBanTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
@@ -33,7 +32,7 @@ export default class GroupBanTransaction extends TransactionBase {
|
||||
|
||||
set rBanReason(rBanReason) {
|
||||
this._rBanReason = rBanReason
|
||||
this._rBanReasonBytes = this.constructor.utils.stringtoUTF8Array(this._rBanReason.toLocaleLowerCase())
|
||||
this._rBanReasonBytes = this.constructor.utils.stringtoUTF8Array(this._rBanReason)
|
||||
this._rBanReasonLength = this.constructor.utils.int32ToBytes(this._rBanReasonBytes.length)
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class GroupInviteTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class GroupKickTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
@@ -33,7 +32,7 @@ export default class GroupKickTransaction extends TransactionBase {
|
||||
|
||||
set rBanReason(rBanReason) {
|
||||
this._rBanReason = rBanReason
|
||||
this._rBanReasonBytes = this.constructor.utils.stringtoUTF8Array(this._rBanReason.toLocaleLowerCase())
|
||||
this._rBanReasonBytes = this.constructor.utils.stringtoUTF8Array(this._rBanReason)
|
||||
this._rBanReasonLength = this.constructor.utils.int32ToBytes(this._rBanReasonBytes.length)
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class JoinGroupTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class LeaveGroupTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class RemoveGroupAdminTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,74 +1,109 @@
|
||||
'use strict';
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {store} from '../../../api.js'
|
||||
import {QORT_DECIMALS} from "../../constants.js"
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class UpdateGroupTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
super()
|
||||
this.type = 23
|
||||
}
|
||||
constructor() {
|
||||
super()
|
||||
this.type = 23
|
||||
}
|
||||
|
||||
render(html) {
|
||||
const conf = store.getState().config
|
||||
return html`
|
||||
Are you sure to update this group ?
|
||||
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
|
||||
render(html) {
|
||||
return html`
|
||||
${this._updategroupdialog1}
|
||||
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
|
||||
<div><span style="color: #000;">${this._updategroupdialog3}: ${this._rGroupNewOwnerDesc}</span></div>
|
||||
<hr style="border: 2px solid #03a9f4;">
|
||||
<div><span style="color: #000;">${this._updategroupdialog4}: ${this._rGroupNewName}</span></div>
|
||||
<hr style="border: 2px solid #03a9f4;">
|
||||
<div><span style="color: #000;">${this._updategroupdialog5}: ${this._rGroupNewDesc}</span></div>
|
||||
<hr style="border: 2px solid #03a9f4;">
|
||||
<div><span style="color: #000;">${this._updategroupdialog6}: ${this._rGroupTypeDesc}</span></div>
|
||||
</div>
|
||||
${this._updategroupdialog2}
|
||||
`
|
||||
}
|
||||
|
||||
</div>
|
||||
On pressing confirm, the group details will be updated!
|
||||
`
|
||||
}
|
||||
set updategroupdialog1(updategroupdialog1) {
|
||||
this._updategroupdialog1 = updategroupdialog1
|
||||
}
|
||||
|
||||
set fee(fee) {
|
||||
this._fee = fee * QORT_DECIMALS
|
||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
||||
}
|
||||
set updategroupdialog2(updategroupdialog2) {
|
||||
this._updategroupdialog2 = updategroupdialog2
|
||||
}
|
||||
|
||||
set newOwner(newOwner) {
|
||||
this._newOwner = newOwner instanceof Uint8Array ? newOwner : this.constructor.Base58.decode(newOwner)
|
||||
}
|
||||
set updategroupdialog3(updategroupdialog3) {
|
||||
this._updategroupdialog3 = updategroupdialog3
|
||||
}
|
||||
|
||||
set newIsOpen(newIsOpen) {
|
||||
this._rGroupType = new Uint8Array(1)
|
||||
this._rGroupType[0] = newIsOpen
|
||||
}
|
||||
set updategroupdialog4(updategroupdialog4) {
|
||||
this._updategroupdialog4 = updategroupdialog4
|
||||
}
|
||||
|
||||
set newDescription(newDescription) {
|
||||
this._rGroupDescBytes = this.constructor.utils.stringtoUTF8Array(newDescription.toLocaleLowerCase())
|
||||
this._rGroupDescLength = this.constructor.utils.int32ToBytes(this._rGroupDescBytes.length)
|
||||
}
|
||||
set updategroupdialog5(updategroupdialog5) {
|
||||
this._updategroupdialog5 = updategroupdialog5
|
||||
}
|
||||
|
||||
set newApprovalThreshold(newApprovalThreshold) {
|
||||
this._rGroupApprovalThreshold = new Uint8Array(1)
|
||||
this._rGroupApprovalThreshold[0] = newApprovalThreshold;
|
||||
}
|
||||
set groupTypeDesc(groupTypeDesc) {
|
||||
this._rGroupTypeDesc = groupTypeDesc
|
||||
}
|
||||
|
||||
set newMinimumBlockDelay(newMinimumBlockDelay) {
|
||||
this._rGroupMinimumBlockDelayBytes = this.constructor.utils.int32ToBytes(newMinimumBlockDelay)
|
||||
}
|
||||
set fee(fee) {
|
||||
this._fee = fee * QORT_DECIMALS
|
||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
||||
}
|
||||
|
||||
set newMaximumBlockDelay(newMaximumBlockDelay) {
|
||||
this._rGroupMaximumBlockDelayBytes = this.constructor.utils.int32ToBytes(newMaximumBlockDelay)
|
||||
}
|
||||
set newGroupId(newGroupId) {
|
||||
this._rGroupNewBytes = this.constructor.utils.int32ToBytes(newGroupId)
|
||||
}
|
||||
|
||||
set _groupId(_groupId){
|
||||
this._groupBytes = this.constructor.utils.int32ToBytes(_groupId)
|
||||
}
|
||||
set newOwner(newOwner) {
|
||||
this._rGroupNewOwnerDesc = newOwner
|
||||
this._rGroupNewOwner = newOwner instanceof Uint8Array ? newOwner : this.constructor.Base58.decode(newOwner)
|
||||
}
|
||||
|
||||
get params() {
|
||||
const params = super.params
|
||||
params.push(
|
||||
this._groupBytes,
|
||||
this._newOwner,
|
||||
this._rGroupDescLength,
|
||||
this._rGroupDescBytes,
|
||||
this._rGroupType,
|
||||
this._rGroupApprovalThreshold,
|
||||
this._rGroupMinimumBlockDelayBytes,
|
||||
this._rGroupMaximumBlockDelayBytes,
|
||||
this._feeBytes
|
||||
)
|
||||
return params
|
||||
}
|
||||
set newName(newName) {
|
||||
this._rGroupNewName = newName
|
||||
this._rGroupNewNameBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupNewName)
|
||||
this._rGroupNewNameLength = this.constructor.utils.int32ToBytes(this._rGroupNewNameBytes.length)
|
||||
}
|
||||
|
||||
set newDescription(newDescription) {
|
||||
this._rGroupNewDesc = newDescription
|
||||
this._rGroupNewDescBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupNewDesc)
|
||||
this._rGroupNewDescLength = this.constructor.utils.int32ToBytes(this._rGroupNewDescBytes.length)
|
||||
}
|
||||
|
||||
set newIsOpen(newIsOpen) {
|
||||
this._rGroupNewType = new Uint8Array(1)
|
||||
this._rGroupNewType[0] = newIsOpen
|
||||
}
|
||||
|
||||
set newApprovalThreshold(newApprovalThreshold) {
|
||||
this._rGroupNewApprovalThreshold = new Uint8Array(1)
|
||||
this._rGroupNewApprovalThreshold[0] = newApprovalThreshold
|
||||
}
|
||||
|
||||
set newMinimumBlockDelay(newMinimumBlockDelay) {
|
||||
this._rGroupNewMinimumBlockDelayBytes = this.constructor.utils.int32ToBytes(newMinimumBlockDelay)
|
||||
}
|
||||
|
||||
set newMaximumBlockDelay(newMaximumBlockDelay) {
|
||||
this._rGroupNewMaximumBlockDelayBytes = this.constructor.utils.int32ToBytes(newMaximumBlockDelay)
|
||||
}
|
||||
|
||||
get params() {
|
||||
const params = super.params
|
||||
params.push(
|
||||
this._rGroupNewBytes,
|
||||
this._rGroupNewOwner,
|
||||
this._rGroupNewDescLength,
|
||||
this._rGroupNewDescBytes,
|
||||
this._rGroupNewType,
|
||||
this._rGroupNewApprovalThreshold,
|
||||
this._rGroupNewMinimumBlockDelayBytes,
|
||||
this._rGroupNewMaximumBlockDelayBytes,
|
||||
this._feeBytes
|
||||
)
|
||||
return params
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class BuyNameTransacion extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class CancelSellNameTransacion extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class RegisterNameTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class SellNameTransacion extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class UpdateNameTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class CreatePollTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
@@ -25,15 +24,15 @@ export default class CreatePollTransaction extends TransactionBase {
|
||||
</div>
|
||||
${this._votedialog6}
|
||||
<div style="margin-top: 10px; font-weight: bold">
|
||||
${this._feeDialog}: ${this._feeDisplay}
|
||||
${this._feeDialog}: ${this._feeDisplay}
|
||||
</div>
|
||||
`
|
||||
}
|
||||
|
||||
addOption(option) {
|
||||
const optionBytes = this.constructor.utils.stringtoUTF8Array(option);
|
||||
const optionLength = this.constructor.utils.int32ToBytes(optionBytes.length);
|
||||
this._options.push({ length: optionLength, bytes: optionBytes });
|
||||
const optionBytes = this.constructor.utils.stringtoUTF8Array(option)
|
||||
const optionLength = this.constructor.utils.int32ToBytes(optionBytes.length)
|
||||
this._options.push({ length: optionLength, bytes: optionBytes })
|
||||
}
|
||||
|
||||
set feeDialog(feeDialog){
|
||||
@@ -69,7 +68,7 @@ export default class CreatePollTransaction extends TransactionBase {
|
||||
set rPollName(rPollName) {
|
||||
this._rPollName = rPollName
|
||||
this._rPollNameBytes = this.constructor.utils.stringtoUTF8Array(this._rPollName)
|
||||
this._rPollNameLength = this.constructor.utils.int32ToBytes(this._rPollNameBytes.length);
|
||||
this._rPollNameLength = this.constructor.utils.int32ToBytes(this._rPollNameBytes.length)
|
||||
|
||||
}
|
||||
|
||||
@@ -80,13 +79,14 @@ export default class CreatePollTransaction extends TransactionBase {
|
||||
}
|
||||
|
||||
set rOptions(rOptions) {
|
||||
const optionsArray = rOptions[0].split(', ').map(opt => opt.trim());
|
||||
const optionsArray = rOptions[0].split(', ').map(opt => opt.trim())
|
||||
this._pollOptions = optionsArray
|
||||
|
||||
for (let i = 0; i < optionsArray.length; i++) {
|
||||
this.addOption(optionsArray[i]);
|
||||
this.addOption(optionsArray[i])
|
||||
}
|
||||
|
||||
this._rNumberOfOptionsBytes = this.constructor.utils.int32ToBytes(optionsArray.length);
|
||||
this._rNumberOfOptionsBytes = this.constructor.utils.int32ToBytes(optionsArray.length)
|
||||
}
|
||||
|
||||
|
||||
@@ -100,9 +100,10 @@ export default class CreatePollTransaction extends TransactionBase {
|
||||
this._rPollDescBytes,
|
||||
this._rNumberOfOptionsBytes
|
||||
)
|
||||
|
||||
// Push the dynamic options
|
||||
for (let i = 0; i < this._options.length; i++) {
|
||||
params.push(this._options[i].length, this._options[i].bytes);
|
||||
params.push(this._options[i].length, this._options[i].bytes)
|
||||
}
|
||||
|
||||
params.push(this._feeBytes);
|
||||
|
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import {QORT_DECIMALS} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import {QORT_DECIMALS} from '../../constants'
|
||||
|
||||
export default class VoteOnPollTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
@@ -16,7 +15,7 @@ export default class VoteOnPollTransaction extends TransactionBase {
|
||||
</div>
|
||||
${this._votedialog2}
|
||||
<div style="margin-top: 10px; font-weight: bold">
|
||||
${this._feeDialog}: ${this._feeDisplay}
|
||||
${this._feeDialog}: ${this._feeDisplay}
|
||||
</div>
|
||||
`
|
||||
}
|
||||
@@ -39,14 +38,12 @@ export default class VoteOnPollTransaction extends TransactionBase {
|
||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
||||
}
|
||||
|
||||
|
||||
set rPollName(rPollName) {
|
||||
this._rPollName = rPollName
|
||||
this._rPollNameBytes = this.constructor.utils.stringtoUTF8Array(this._rPollName)
|
||||
this._rPollNameLength = this.constructor.utils.int32ToBytes(this._rPollNameBytes.length)
|
||||
this._rPollNameLength = this.constructor.utils.int32ToBytes(this._rPollNameBytes.length)
|
||||
}
|
||||
|
||||
|
||||
set rOptionIndex(rOptionIndex) {
|
||||
this._rOptionIndex = rOptionIndex
|
||||
this._rOptionIndexBytes = this.constructor.utils.int32ToBytes(this._rOptionIndex)
|
||||
@@ -55,7 +52,7 @@ export default class VoteOnPollTransaction extends TransactionBase {
|
||||
get params() {
|
||||
const params = super.params
|
||||
params.push(
|
||||
this._rPollNameLength,
|
||||
this._rPollNameLength,
|
||||
this._rPollNameBytes,
|
||||
this._rOptionIndexBytes,
|
||||
this._feeBytes
|
||||
|
@@ -1,8 +1,7 @@
|
||||
'use strict'
|
||||
import TransactionBase from '../TransactionBase.js'
|
||||
import publicKeyToAddress from '../../wallet/publicKeyToAddress.js'
|
||||
import {Base58} from '../../deps/deps.js'
|
||||
import {DYNAMIC_FEE_TIMESTAMP} from '../../constants.js'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import publicKeyToAddress from '../../wallet/publicKeyToAddress'
|
||||
import {Base58} from '../../deps/deps'
|
||||
import {DYNAMIC_FEE_TIMESTAMP} from '../../constants'
|
||||
|
||||
export default class RemoveRewardShareTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
|
@@ -1,10 +1,9 @@
|
||||
'use strict'
|
||||
import publicKeyToAddress from '../../wallet/publicKeyToAddress.js'
|
||||
import TransactionBase from "../TransactionBase.js"
|
||||
import nacl from '../../deps/nacl-fast.js'
|
||||
import ed2curve from '../../deps/ed2curve.js'
|
||||
import publicKeyToAddress from '../../wallet/publicKeyToAddress'
|
||||
import TransactionBase from '../TransactionBase'
|
||||
import nacl from '../../deps/nacl-fast'
|
||||
import ed2curve from '../../deps/ed2curve'
|
||||
import {Sha256} from 'asmcrypto.js'
|
||||
import {DYNAMIC_FEE_TIMESTAMP} from '../../constants.js'
|
||||
import {DYNAMIC_FEE_TIMESTAMP} from '../../constants'
|
||||
|
||||
export default class RewardShareTransaction extends TransactionBase {
|
||||
constructor() {
|
||||
@@ -42,18 +41,16 @@ export default class RewardShareTransaction extends TransactionBase {
|
||||
set recipientPublicKey(recipientPublicKey) {
|
||||
this._base58RecipientPublicKey = recipientPublicKey instanceof Uint8Array ? this.constructor.Base58.encode(recipientPublicKey) : recipientPublicKey
|
||||
this._recipientPublicKey = this.constructor.Base58.decode(this._base58RecipientPublicKey)
|
||||
|
||||
this.recipient = publicKeyToAddress(this._recipientPublicKey)
|
||||
|
||||
this.fee = (recipientPublicKey === this.constructor.Base58.encode(this._keyPair.publicKey) ? 0 : 0.001)
|
||||
|
||||
const convertedPrivateKey = ed2curve.convertSecretKey(this._keyPair.privateKey)
|
||||
const convertedPublicKey = ed2curve.convertPublicKey(this._recipientPublicKey)
|
||||
const sharedSecret = new Uint8Array(32);
|
||||
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey);
|
||||
const sharedSecret = new Uint8Array(32)
|
||||
|
||||
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey)
|
||||
|
||||
this._rewardShareSeed = new Sha256().process(sharedSecret).finish().result
|
||||
this._base58RewardShareSeed = this.constructor.Base58.encode(this._rewardShareSeed)
|
||||
|
||||
this._rewardShareKeyPair = nacl.sign.keyPair.fromSeed(this._rewardShareSeed)
|
||||
|
||||
if (new Date(this._timestamp).getTime() >= DYNAMIC_FEE_TIMESTAMP) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import Base58 from '../../../deps/Base58.js'
|
||||
import nacl from '../../../deps/nacl-fast.js'
|
||||
import utils from '../../../deps/utils.js'
|
||||
import Base58 from '../../../deps/Base58'
|
||||
import nacl from '../../../deps/nacl-fast'
|
||||
import utils from '../../../deps/utils'
|
||||
|
||||
const signTradeBotTransaction = (unsignedTxn, keyPair) => {
|
||||
if (!unsignedTxn) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import {request} from '../../../fetch-request.js'
|
||||
import {deleteTradeOffer, signTradeBotTxn} from '../../../tradeRequest.js'
|
||||
import {processTransaction} from '../../../createTransaction.js'
|
||||
import {request} from '../../../fetch-request'
|
||||
import {deleteTradeOffer, signTradeBotTxn} from '../../../tradeRequest'
|
||||
import {processTransaction} from '../../../createTransaction'
|
||||
|
||||
export const cancelAllOffers = async (requestObject) => {
|
||||
const keyPair = requestObject.keyPair
|
||||
@@ -13,6 +13,7 @@ export const cancelAllOffers = async (requestObject) => {
|
||||
}
|
||||
|
||||
const myOpenOffers = await getMyOpenOffers()
|
||||
|
||||
let response = true
|
||||
|
||||
myOpenOffers.forEach(async (openOffer) => {
|
||||
@@ -20,5 +21,6 @@ export const cancelAllOffers = async (requestObject) => {
|
||||
let signedTxnBytes = await signTradeBotTxn(unsignedTxn, keyPair)
|
||||
await processTransaction(signedTxnBytes)
|
||||
})
|
||||
|
||||
return response
|
||||
}
|
||||
|
@@ -1,29 +1,30 @@
|
||||
import PaymentTransaction from './PaymentTransaction.js'
|
||||
import RegisterNameTransaction from './names/RegisterNameTransaction.js'
|
||||
import UpdateNameTransaction from './names/UpdateNameTransaction.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 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 RewardShareTransaction from './reward-share/RewardShareTransaction.js'
|
||||
import RemoveRewardShareTransaction from './reward-share/RemoveRewardShareTransaction.js'
|
||||
import TransferPrivsTransaction from './TransferPrivsTransaction.js'
|
||||
import DeployAtTransaction from './DeployAtTransaction.js'
|
||||
import VoteOnPollTransaction from './polls/VoteOnPollTransaction.js'
|
||||
import CreatePollTransaction from './polls/CreatePollTransaction.js'
|
||||
import PaymentTransaction from './PaymentTransaction'
|
||||
import RegisterNameTransaction from './names/RegisterNameTransaction'
|
||||
import UpdateNameTransaction from './names/UpdateNameTransaction'
|
||||
import SellNameTransacion from './names/SellNameTransacion'
|
||||
import CancelSellNameTransacion from './names/CancelSellNameTransacion'
|
||||
import BuyNameTransacion from './names/BuyNameTransacion'
|
||||
import MessageTransaction from './MessageTransaction'
|
||||
import ChatTransaction from './chat/ChatTransaction'
|
||||
import GroupChatTransaction from './chat/GroupChatTransaction'
|
||||
import PublicizeTransaction from './PublicizeTransaction'
|
||||
import CreateGroupTransaction from './groups/CreateGroupTransaction'
|
||||
import UpdateGroupTransaction from './groups/UpdateGroupTransaction'
|
||||
import AddGroupAdminTransaction from './groups/AddGroupAdminTransaction'
|
||||
import RemoveGroupAdminTransaction from './groups/RemoveGroupAdminTransaction'
|
||||
import GroupBanTransaction from './groups/GroupBanTransaction'
|
||||
import CancelGroupBanTransaction from './groups/CancelGroupBanTransaction'
|
||||
import GroupKickTransaction from './groups/GroupKickTransaction'
|
||||
import GroupInviteTransaction from './groups/GroupInviteTransaction'
|
||||
import CancelGroupInviteTransaction from './groups/CancelGroupInviteTransaction'
|
||||
import JoinGroupTransaction from './groups/JoinGroupTransaction'
|
||||
import LeaveGroupTransaction from './groups/LeaveGroupTransaction'
|
||||
import RewardShareTransaction from './reward-share/RewardShareTransaction'
|
||||
import RemoveRewardShareTransaction from './reward-share/RemoveRewardShareTransaction'
|
||||
import TransferPrivsTransaction from './TransferPrivsTransaction'
|
||||
import DeployAtTransaction from './DeployAtTransaction'
|
||||
import VoteOnPollTransaction from './polls/VoteOnPollTransaction'
|
||||
import CreatePollTransaction from './polls/CreatePollTransaction'
|
||||
|
||||
export const transactionTypes = {
|
||||
2: PaymentTransaction,
|
||||
@@ -40,6 +41,7 @@ export const transactionTypes = {
|
||||
181: GroupChatTransaction,
|
||||
19: PublicizeTransaction,
|
||||
22: CreateGroupTransaction,
|
||||
23: UpdateGroupTransaction,
|
||||
24: AddGroupAdminTransaction,
|
||||
25: RemoveGroupAdminTransaction,
|
||||
26: GroupBanTransaction,
|
||||
|
Reference in New Issue
Block a user