evernode-js-client 0.6.5 → 0.6.7

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 +18 -16
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -12215,7 +12215,7 @@ class BaseEvernodeClient {
12215
12215
  }
12216
12216
  else if (eventType === EventTypes.CANDIDATE_WITHDRAW && eventData) {
12217
12217
  return {
12218
- name: EvernodeEvents.CandidateWithdrew,
12218
+ name: EvernodeEvents.CandidateWithdrawn,
12219
12219
  data: {
12220
12220
  transaction: tx,
12221
12221
  owner: tx.Account,
@@ -12563,14 +12563,16 @@ class BaseEvernodeClient {
12563
12563
  if (idStateData) {
12564
12564
  const idStateDecoded = StateHelpers.decodeCandidateIdState(Buffer.from(idStateData, 'hex'));
12565
12565
 
12566
- const ownerStateKey = StateHelpers.generateCandidateOwnerStateKey(idStateDecoded.ownerAddress);
12567
- const ownerStateIndex = StateHelpers.getHookStateIndex(this.governorAddress, ownerStateKey);
12568
- const ownerLedgerEntry = await this.xrplApi.getLedgerEntry(ownerStateIndex);
12566
+ if (StateHelpers.getCandidateType(candidateId) === EvernodeConstants.CandidateTypes.NewHook) {
12567
+ const ownerStateKey = StateHelpers.generateCandidateOwnerStateKey(idStateDecoded.ownerAddress);
12568
+ const ownerStateIndex = StateHelpers.getHookStateIndex(this.governorAddress, ownerStateKey);
12569
+ const ownerLedgerEntry = await this.xrplApi.getLedgerEntry(ownerStateIndex);
12569
12570
 
12570
- const ownerStateData = ownerLedgerEntry?.HookStateData;
12571
- if (ownerStateData) {
12572
- const ownerStateDecoded = StateHelpers.decodeCandidateOwnerState(Buffer.from(ownerStateKey, 'hex'), Buffer.from(ownerStateData, 'hex'));
12573
- return { ...ownerStateDecoded, ...idStateDecoded };
12571
+ const ownerStateData = ownerLedgerEntry?.HookStateData;
12572
+ if (ownerStateData) {
12573
+ const ownerStateDecoded = StateHelpers.decodeCandidateOwnerState(Buffer.from(ownerStateKey, 'hex'), Buffer.from(ownerStateData, 'hex'));
12574
+ return { ...ownerStateDecoded, ...idStateDecoded };
12575
+ }
12574
12576
  }
12575
12577
 
12576
12578
  return { ...idStateDecoded, uniqueId: candidateId };
@@ -12895,7 +12897,7 @@ const { EvernodeEvents } = __nccwpck_require__(9849);
12895
12897
  const GovernorEvents = {
12896
12898
  Initialized: EvernodeEvents.Initialized,
12897
12899
  CandidateProposed: EvernodeEvents.CandidateProposed,
12898
- CandidateWithdrew: EvernodeEvents.CandidateWithdrew,
12900
+ CandidateWithdrawn: EvernodeEvents.CandidateWithdrawn,
12899
12901
  ChildHookUpdated: EvernodeEvents.ChildHookUpdated,
12900
12902
  GovernanceModeChanged: EvernodeEvents.GovernanceModeChanged,
12901
12903
  DudHostReported: EvernodeEvents.DudHostReported,
@@ -14487,8 +14489,8 @@ const EvernodeConstants = {
14487
14489
  CANDIDATE_REJECTED: 0,
14488
14490
  CANDIDATE_SUPPORTED: 1,
14489
14491
  CANDIDATE_ELECTED: 2,
14490
- CANDIDATE_VETOED: 3,
14491
- CANDIDATE_EXPIRED: 4
14492
+ CANDIDATE_PURGED: 3,
14493
+ CANDIDATE_WITHDRAWN: 4
14492
14494
  }
14493
14495
  }
14494
14496
 
@@ -14608,7 +14610,7 @@ const EvernodeEvents = {
14608
14610
  DeadHostPrune: "DeadHostPrune",
14609
14611
  HostRebate: "HostRebate",
14610
14612
  CandidateProposed: "CandidateProposed",
14611
- CandidateWithdrew: "CandidateWithdrew",
14613
+ CandidateWithdrawn: "CandidateWithdrawn",
14612
14614
  ChildHookUpdated: "ChildHookUpdated",
14613
14615
  GovernanceModeChanged: "GovernanceModeChanged",
14614
14616
  FoundationVoted: "FoundationVoted",
@@ -15345,11 +15347,11 @@ class StateHelpers {
15345
15347
  case EvernodeConstants.CandidateStatuses.CANDIDATE_ELECTED:
15346
15348
  status = 'elected';
15347
15349
  break;
15348
- case EvernodeConstants.CandidateStatuses.CANDIDATE_VETOED:
15349
- status = 'vetoed';
15350
+ case EvernodeConstants.CandidateStatuses.CANDIDATE_PURGED:
15351
+ status = 'purged';
15350
15352
  break;
15351
- case EvernodeConstants.CandidateStatuses.CANDIDATE_EXPIRED:
15352
- status = 'expired';
15353
+ case EvernodeConstants.CandidateStatuses.CANDIDATE_WITHDRAWN:
15354
+ status = 'withdrawn';
15353
15355
  break;
15354
15356
  default:
15355
15357
  status = 'rejected';
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.5",
9
+ "version": "0.6.7",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",