evernode-js-client 0.6.5 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +18 -16
- 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.
|
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
|
-
|
12567
|
-
|
12568
|
-
|
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
|
-
|
12571
|
-
|
12572
|
-
|
12573
|
-
|
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
|
-
|
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
|
-
|
14491
|
-
|
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
|
-
|
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.
|
15349
|
-
status = '
|
15350
|
+
case EvernodeConstants.CandidateStatuses.CANDIDATE_PURGED:
|
15351
|
+
status = 'purged';
|
15350
15352
|
break;
|
15351
|
-
case EvernodeConstants.CandidateStatuses.
|
15352
|
-
status = '
|
15353
|
+
case EvernodeConstants.CandidateStatuses.CANDIDATE_WITHDRAWN:
|
15354
|
+
status = 'withdrawn';
|
15353
15355
|
break;
|
15354
15356
|
default:
|
15355
15357
|
status = 'rejected';
|