evernode-js-client 0.6.3 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +41 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -11923,7 +11923,9 @@ class BaseEvernodeClient {
11923
11923
  momentTransitInfo: HookStateKeys.MOMENT_TRANSIT_INFO,
11924
11924
  registryMaxTrxEmitFee: HookStateKeys.MAX_TRX_EMISSION_FEE,
11925
11925
  governanceConfiguration: HookStateKeys.GOVERNANCE_CONFIGURATION,
11926
- governanceInfo: HookStateKeys.GOVERNANCE_INFO
11926
+ governanceInfo: HookStateKeys.GOVERNANCE_INFO,
11927
+ transactionFeeBaseInfo: HookStateKeys.TRX_FEE_BASE_INFO,
11928
+ networkConfiguration: HookStateKeys.NETWORK_CONFIGURATION,
11927
11929
  }
11928
11930
  let config = {};
11929
11931
  for (const [key, value] of Object.entries(configStateKeys)) {
@@ -14562,6 +14564,7 @@ const HookStateKeys = {
14562
14564
  HEARTBEAT_ADDR: "455652010000000000000000000000000000000000000000000000000000000C",
14563
14565
  REGISTRY_ADDR: "455652010000000000000000000000000000000000000000000000000000000D",
14564
14566
  GOVERNANCE_CONFIGURATION: "455652010000000000000000000000000000000000000000000000000000000E",
14567
+ NETWORK_CONFIGURATION: "455652010000000000000000000000000000000000000000000000000000000F",
14565
14568
 
14566
14569
  // Singleton
14567
14570
  HOST_COUNT: "4556523200000000000000000000000000000000000000000000000000000000",
@@ -14570,6 +14573,7 @@ const HookStateKeys = {
14570
14573
  MAX_REG: "4556523500000000000000000000000000000000000000000000000000000000",
14571
14574
  REWARD_INFO: "4556523600000000000000000000000000000000000000000000000000000000",
14572
14575
  GOVERNANCE_INFO: "4556523700000000000000000000000000000000000000000000000000000000",
14576
+ TRX_FEE_BASE_INFO: "4556523800000000000000000000000000000000000000000000000000000000",
14573
14577
 
14574
14578
  // Prefixes
14575
14579
  PREFIX_HOST_TOKENID: "45565202",
@@ -15172,6 +15176,11 @@ const PROPOSAL_ELECTED_TIMESTAMP_OFFSET = 61;
15172
15176
  const UPDATED_HOOK_COUNT_OFFSET = 69;
15173
15177
  const FOUNDATION_SUPPORT_VOTE_FLAG_OFFSET = 70;
15174
15178
 
15179
+ const FEE_BASE_AVG_OFFSET = 0;
15180
+ const FEE_BASE_AVG_CHANGED_IDX_OFFSET = 4;
15181
+ const FEE_BASE_AVG_ACCUMULATOR_OFFSET = 12;
15182
+ const FEE_BASE_COUNTER_OFFSET = 16;
15183
+
15175
15184
  const HOST_TOKEN_ID_OFFSET = 0;
15176
15185
  const HOST_COUNTRY_CODE_OFFSET = 32;
15177
15186
  const HOST_RESERVED_OFFSET = 34;
@@ -15217,6 +15226,9 @@ const CANDIDATE_STATUS_OFFSET = 72;
15217
15226
  const CANDIDATE_STATUS_CHANGE_TIMESTAMP_OFFSET = 73;
15218
15227
  const CANDIDATE_FOUNDATION_VOTE_STATUS_OFFSET = 81;
15219
15228
 
15229
+ const NETWORK_BUSYNESS_DETECT_PERIOD_OFFSET = 0;
15230
+ const NETWORK_BUSYNESS_DETECT_AVERAGE_OFFSET = 4;
15231
+
15220
15232
  const STATE_KEY_TYPES = {
15221
15233
  TOKEN_ID: 2,
15222
15234
  HOST_ADDR: 3,
@@ -15553,7 +15565,7 @@ class StateHelpers {
15553
15565
  break;
15554
15566
  }
15555
15567
  return {
15556
- type: this.StateTypes.CONFIGURATION,
15568
+ type: this.StateTypes.SIGLETON,
15557
15569
  key: hexKey,
15558
15570
  value: {
15559
15571
  governanceMode: mode,
@@ -15569,6 +15581,28 @@ class StateHelpers {
15569
15581
  }
15570
15582
  }
15571
15583
  }
15584
+ else if (Buffer.from(HookStateKeys.NETWORK_CONFIGURATION, 'hex').compare(stateKey) === 0) {
15585
+ return {
15586
+ type: this.StateTypes.CONFIGURATION,
15587
+ key: hexKey,
15588
+ value: {
15589
+ busynessDetectPeriod: stateData.readUInt32LE(NETWORK_BUSYNESS_DETECT_PERIOD_OFFSET),
15590
+ busynessDetectAverage: stateData.readUInt16LE(NETWORK_BUSYNESS_DETECT_AVERAGE_OFFSET)
15591
+ }
15592
+ }
15593
+ }
15594
+ else if (Buffer.from(HookStateKeys.TRX_FEE_BASE_INFO, 'hex').compare(stateKey) === 0) {
15595
+ return {
15596
+ type: this.StateTypes.SIGLETON,
15597
+ key: hexKey,
15598
+ value: {
15599
+ feeBaseAvg: stateData.readUInt32LE(FEE_BASE_AVG_OFFSET),
15600
+ avgChangedIdx: Number(stateData.readBigUInt64LE(FEE_BASE_AVG_CHANGED_IDX_OFFSET)),
15601
+ avgAccumulator: stateData.readUInt32LE(FEE_BASE_AVG_ACCUMULATOR_OFFSET),
15602
+ counter: stateData.readUInt16LE(FEE_BASE_COUNTER_OFFSET)
15603
+ }
15604
+ }
15605
+ }
15572
15606
  else
15573
15607
  throw { type: 'Validation Error', message: 'Invalid state key.' };
15574
15608
  }
@@ -15609,7 +15643,9 @@ class StateHelpers {
15609
15643
  Buffer.from(HookStateKeys.MOMENT_BASE_INFO, 'hex').compare(stateKey) === 0 ||
15610
15644
  Buffer.from(HookStateKeys.HOST_REG_FEE, 'hex').compare(stateKey) === 0 ||
15611
15645
  Buffer.from(HookStateKeys.MAX_REG, 'hex').compare(stateKey) === 0 ||
15612
- Buffer.from(HookStateKeys.REWARD_INFO, 'hex').compare(stateKey) === 0) {
15646
+ Buffer.from(HookStateKeys.REWARD_INFO, 'hex').compare(stateKey) === 0 ||
15647
+ Buffer.from(HookStateKeys.GOVERNANCE_INFO, 'hex').compare(stateKey) === 0 ||
15648
+ Buffer.from(HookStateKeys.TRX_FEE_BASE_INFO, 'hex').compare(stateKey) === 0) {
15613
15649
  return {
15614
15650
  key: hexKey,
15615
15651
  type: this.StateTypes.SIGLETON
@@ -15629,7 +15665,7 @@ class StateHelpers {
15629
15665
  Buffer.from(HookStateKeys.REGISTRY_ADDR, 'hex').compare(stateKey) === 0 ||
15630
15666
  Buffer.from(HookStateKeys.HEARTBEAT_ADDR, 'hex').compare(stateKey) === 0 ||
15631
15667
  Buffer.from(HookStateKeys.GOVERNANCE_CONFIGURATION, 'hex').compare(stateKey) === 0 ||
15632
- Buffer.from(HookStateKeys.GOVERNANCE_INFO, 'hex').compare(stateKey) === 0) {
15668
+ Buffer.from(HookStateKeys.NETWORK_CONFIGURATION, 'hex').compare(stateKey) === 0) {
15633
15669
  return {
15634
15670
  key: hexKey,
15635
15671
  type: this.StateTypes.CONFIGURATION
@@ -15865,7 +15901,7 @@ class UtilHelpers {
15865
15901
  leaseIndex: uriBuf.readUint16BE(prefixLen),
15866
15902
  halfTos: uriBuf.slice(prefixLen + 2, halfToSLen),
15867
15903
  leaseAmount: parseFloat(XflHelpers.toString(uriBuf.readBigInt64BE(prefixLen + 2 + halfToSLen))),
15868
- identifier: uriBuf.readUInt32BE(prefixLen + 10 + halfToSLen)
15904
+ identifier: uriBuf.length >= (prefixLen + 14 + halfToSLen) ? uriBuf.readUInt32BE(prefixLen + 10 + halfToSLen) : null
15869
15905
  }
15870
15906
  }
15871
15907
 
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  ],
7
7
  "homepage": "https://github.com/HotPocketDev/evernode-js-client",
8
8
  "license": "MIT",
9
- "version": "0.6.3",
9
+ "version": "0.6.5",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",