diff --git a/crypto/api/constants.js b/crypto/api/constants.js index e6e17f35..f9bc0b43 100644 --- a/crypto/api/constants.js +++ b/crypto/api/constants.js @@ -161,6 +161,10 @@ const PROXY_URL = "/proxy/" // Chat reference timestamp const CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP = 1674316800000 +// Dynamic fee timestamp +const DYNAMIC_FEE_TIMESTAMP = 1692118800000 + + // Used as a salt for all Qora addresses. Salts used for storing your private keys in local storage will be randomly generated const STATIC_SALT = new Uint8Array([54, 190, 201, 206, 65, 29, 123, 129, 147, 231, 180, 166, 171, 45, 95, 165, 78, 200, 208, 194, 44, 207, 221, 146, 45, 238, 68, 68, 69, 102, 62, 6]) const BCRYPT_ROUNDS = 10 // Remember that the total work spent on key derivation is BCRYPT_ROUNDS * KDF_THREADS @@ -168,4 +172,4 @@ const BCRYPT_VERSION = "2a" const STATIC_BCRYPT_SALT = `$${BCRYPT_VERSION}$${BCRYPT_ROUNDS}$IxVE941tXVUD4cW0TNVm.O` const KDF_THREADS = 16 -export { TX_TYPES, ERROR_CODES, QORT_DECIMALS, PROXY_URL, STATIC_SALT, ADDRESS_VERSION, KDF_THREADS, STATIC_BCRYPT_SALT, CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } +export { TX_TYPES, ERROR_CODES, QORT_DECIMALS, PROXY_URL, STATIC_SALT, ADDRESS_VERSION, KDF_THREADS, STATIC_BCRYPT_SALT, CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP, DYNAMIC_FEE_TIMESTAMP } diff --git a/crypto/api/transactions/reward-share/RemoveRewardShareTransaction.js b/crypto/api/transactions/reward-share/RemoveRewardShareTransaction.js index 5610830e..38719b56 100644 --- a/crypto/api/transactions/reward-share/RemoveRewardShareTransaction.js +++ b/crypto/api/transactions/reward-share/RemoveRewardShareTransaction.js @@ -2,6 +2,7 @@ import TransactionBase from '../TransactionBase.js' import publicKeyToAddress from '../../wallet/publicKeyToAddress.js' import { Base58 } from '../../deps/deps.js' +import { DYNAMIC_FEE_TIMESTAMP } from '../../constants.js' export default class RemoveRewardShareTransaction extends TransactionBase { constructor() { @@ -34,7 +35,12 @@ export default class RemoveRewardShareTransaction extends TransactionBase { set recipient(recipient) { const _address = publicKeyToAddress(this._keyPair.publicKey) this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient) - this.fee = _address === recipient ? 0 : 0.001 + + if (new Date(this._timestamp).getTime() >= DYNAMIC_FEE_TIMESTAMP) { + this.fee = _address === recipient ? 0 : 0.01 + } else { + this.fee = _address === recipient ? 0 : 0.001 + } } set percentageShare(share) { diff --git a/crypto/api/transactions/reward-share/RewardShareTransaction.js b/crypto/api/transactions/reward-share/RewardShareTransaction.js index 939552f9..af0d6bba 100644 --- a/crypto/api/transactions/reward-share/RewardShareTransaction.js +++ b/crypto/api/transactions/reward-share/RewardShareTransaction.js @@ -4,6 +4,7 @@ import TransactionBase from "../TransactionBase.js" import nacl from '../../deps/nacl-fast.js' import ed2curve from '../../deps/ed2curve.js' import { Sha256 } from 'asmcrypto.js' +import { DYNAMIC_FEE_TIMESTAMP } from '../../constants.js' export default class RewardShareTransaction extends TransactionBase { constructor() { @@ -54,6 +55,12 @@ export default class RewardShareTransaction extends TransactionBase { 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) { + this.fee = (recipientPublicKey === this.constructor.Base58.encode(this._keyPair.publicKey) ? 0 : 0.01) + } else { + this.fee = (recipientPublicKey === this.constructor.Base58.encode(this._keyPair.publicKey) ? 0 : 0.001) + } } set recipient(recipient) {