evernode-js-client 0.6.6 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +11 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -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);
12569
-
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 };
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);
12570
+
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 };
@@ -15174,7 +15176,6 @@ const FOUNDATION_LAST_VOTED_TIMESTAMP_OFFSET = 21;
15174
15176
  const ELECTED_PROPOSAL_UNIQUE_ID_OFFSET = 29;
15175
15177
  const PROPOSAL_ELECTED_TIMESTAMP_OFFSET = 61;
15176
15178
  const UPDATED_HOOK_COUNT_OFFSET = 69;
15177
- const FOUNDATION_SUPPORT_VOTE_FLAG_OFFSET = 70;
15178
15179
 
15179
15180
  const FEE_BASE_AVG_OFFSET = 0;
15180
15181
  const FEE_BASE_AVG_CHANGED_IDX_OFFSET = 4;
@@ -15576,8 +15577,7 @@ class StateHelpers {
15576
15577
  foundationLastVotedTimestamp: Number(stateData.readBigUInt64LE(FOUNDATION_LAST_VOTED_TIMESTAMP_OFFSET)),
15577
15578
  electedProposalUniqueId: stateData.slice(ELECTED_PROPOSAL_UNIQUE_ID_OFFSET, PROPOSAL_ELECTED_TIMESTAMP_OFFSET).toString('hex').toUpperCase(),
15578
15579
  proposalElectedTimestamp: Number(stateData.readBigUInt64LE(PROPOSAL_ELECTED_TIMESTAMP_OFFSET)),
15579
- updatedHookCount: stateData.readUInt8(UPDATED_HOOK_COUNT_OFFSET),
15580
- supportVoteSent: stateData.readUInt8(FOUNDATION_SUPPORT_VOTE_FLAG_OFFSET)
15580
+ updatedHookCount: stateData.readUInt8(UPDATED_HOOK_COUNT_OFFSET)
15581
15581
  }
15582
15582
  }
15583
15583
  }
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.6",
9
+ "version": "0.6.8",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",