evernode-js-client 0.6.4 → 0.6.6

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 +50 -14
  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)) {
@@ -12213,7 +12215,7 @@ class BaseEvernodeClient {
12213
12215
  }
12214
12216
  else if (eventType === EventTypes.CANDIDATE_WITHDRAW && eventData) {
12215
12217
  return {
12216
- name: EvernodeEvents.CandidateWithdrew,
12218
+ name: EvernodeEvents.CandidateWithdrawn,
12217
12219
  data: {
12218
12220
  transaction: tx,
12219
12221
  owner: tx.Account,
@@ -12893,7 +12895,7 @@ const { EvernodeEvents } = __nccwpck_require__(9849);
12893
12895
  const GovernorEvents = {
12894
12896
  Initialized: EvernodeEvents.Initialized,
12895
12897
  CandidateProposed: EvernodeEvents.CandidateProposed,
12896
- CandidateWithdrew: EvernodeEvents.CandidateWithdrew,
12898
+ CandidateWithdrawn: EvernodeEvents.CandidateWithdrawn,
12897
12899
  ChildHookUpdated: EvernodeEvents.ChildHookUpdated,
12898
12900
  GovernanceModeChanged: EvernodeEvents.GovernanceModeChanged,
12899
12901
  DudHostReported: EvernodeEvents.DudHostReported,
@@ -14485,8 +14487,8 @@ const EvernodeConstants = {
14485
14487
  CANDIDATE_REJECTED: 0,
14486
14488
  CANDIDATE_SUPPORTED: 1,
14487
14489
  CANDIDATE_ELECTED: 2,
14488
- CANDIDATE_VETOED: 3,
14489
- CANDIDATE_EXPIRED: 4
14490
+ CANDIDATE_PURGED: 3,
14491
+ CANDIDATE_WITHDRAWN: 4
14490
14492
  }
14491
14493
  }
14492
14494
 
@@ -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",
@@ -14604,7 +14608,7 @@ const EvernodeEvents = {
14604
14608
  DeadHostPrune: "DeadHostPrune",
14605
14609
  HostRebate: "HostRebate",
14606
14610
  CandidateProposed: "CandidateProposed",
14607
- CandidateWithdrew: "CandidateWithdrew",
14611
+ CandidateWithdrawn: "CandidateWithdrawn",
14608
14612
  ChildHookUpdated: "ChildHookUpdated",
14609
14613
  GovernanceModeChanged: "GovernanceModeChanged",
14610
14614
  FoundationVoted: "FoundationVoted",
@@ -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,
@@ -15333,11 +15345,11 @@ class StateHelpers {
15333
15345
  case EvernodeConstants.CandidateStatuses.CANDIDATE_ELECTED:
15334
15346
  status = 'elected';
15335
15347
  break;
15336
- case EvernodeConstants.CandidateStatuses.CANDIDATE_VETOED:
15337
- status = 'vetoed';
15348
+ case EvernodeConstants.CandidateStatuses.CANDIDATE_PURGED:
15349
+ status = 'purged';
15338
15350
  break;
15339
- case EvernodeConstants.CandidateStatuses.CANDIDATE_EXPIRED:
15340
- status = 'expired';
15351
+ case EvernodeConstants.CandidateStatuses.CANDIDATE_WITHDRAWN:
15352
+ status = 'withdrawn';
15341
15353
  break;
15342
15354
  default:
15343
15355
  status = 'rejected';
@@ -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.length >= (prefixLen + 10 + halfToSLen) ? uriBuf.readUInt32BE(prefixLen + 10 + halfToSLen) : null
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.4",
9
+ "version": "0.6.6",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",