evernode-js-client 0.5.17-beta-v3.8 → 0.5.17-beta-v3.10

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 +40 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -12240,6 +12240,22 @@ class BaseEvernodeClient {
12240
12240
  }
12241
12241
 
12242
12242
  }
12243
+ else if (eventType === EventTypes.LINKED_CANDIDATE_REMOVE && eventData) {
12244
+ const eventDataBuf = Buffer.from(eventData, 'hex');
12245
+ const candidateId = eventDataBuf.slice(0, 32).toString('hex');
12246
+ const candidateType = StateHelpers.getCandidateType(candidateId);
12247
+
12248
+ if (candidateType === EvernodeConstants.CandidateTypes.DudHost) {
12249
+ return {
12250
+ name: EvernodeEvents.LinkedDudHostCandidateRemoved,
12251
+ data: {
12252
+ transaction: tx,
12253
+ candidateId: candidateId,
12254
+ host: codec.encodeAccountID(Buffer.from(candidateId, 'hex').slice(DUD_HOST_CANDID_ADDRESS_OFFSET, 32))
12255
+ }
12256
+ }
12257
+ }
12258
+ }
12243
12259
  else if (eventType === EventTypes.HOOK_UPDATE_RES && eventData) {
12244
12260
  return {
12245
12261
  name: EvernodeEvents.ChildHookUpdated,
@@ -12496,6 +12512,24 @@ class BaseEvernodeClient {
12496
12512
  return null;
12497
12513
  }
12498
12514
 
12515
+ /**
12516
+ *
12517
+ * @param {string} ownerAddress | Address of the owner
12518
+ * @returns An array of candidate information. Returns empty array if no candidates;
12519
+ */
12520
+ async getDudHostCandidatesByOwner(ownerAddress = this.xrplAcc.address) {
12521
+ try {
12522
+ let candidates = await this.#firestoreHandler.getCandidates({ ownerAddress: ownerAddress });
12523
+ if (candidates && candidates.length > 0) {
12524
+ candidates = candidates.filter(c => StateHelpers.getCandidateType(c.uniqueId) == EvernodeConstants.CandidateTypes.DudHost);
12525
+ return candidates;
12526
+ }
12527
+ } catch (error) {
12528
+ console.log(error)
12529
+ }
12530
+ return [];
12531
+ }
12532
+
12499
12533
  /**
12500
12534
  * Get proposed candidate info.
12501
12535
  * @param {string} candidateId Id of the candidate.
@@ -12849,7 +12883,8 @@ const GovernorEvents = {
12849
12883
  DudHostRemoved: EvernodeEvents.DudHostRemoved,
12850
12884
  DudHostStatusChanged: EvernodeEvents.DudHostStatusChanged,
12851
12885
  FallbackToPiloted: EvernodeEvents.FallbackToPiloted,
12852
- NewHookStatusChanged: EvernodeEvents.NewHookStatusChanged
12886
+ NewHookStatusChanged: EvernodeEvents.NewHookStatusChanged,
12887
+ LinkedDudHostCandidateRemoved: EvernodeEvents.LinkedDudHostCandidateRemoved
12853
12888
  }
12854
12889
 
12855
12890
  class GovernorClient extends BaseEvernodeClient {
@@ -14425,7 +14460,8 @@ const EventTypes = {
14425
14460
  CANDIDATE_STATUS_CHANGE: 'evnCandidateStatusChange',
14426
14461
  DUD_HOST_REPORT: 'evnDudHostReport',
14427
14462
  HOOK_UPDATE_RES: 'evnHookUpdateRes',
14428
- GOVERNANCE_MODE_CHANGE: 'evnGovernanceModeChange'
14463
+ GOVERNANCE_MODE_CHANGE: 'evnGovernanceModeChange',
14464
+ LINKED_CANDIDATE_REMOVE: 'evnRemoveLinkedCandidate'
14429
14465
  }
14430
14466
 
14431
14467
  const MemoFormats = {
@@ -14520,7 +14556,8 @@ const EvernodeEvents = {
14520
14556
  DudHostRemoved: "DudHostRemoved",
14521
14557
  DudHostStatusChanged: "DudHostStatusChanged",
14522
14558
  FallbackToPiloted: "FallbackToPiloted",
14523
- NewHookStatusChanged: "NewHookStatusChanged"
14559
+ NewHookStatusChanged: "NewHookStatusChanged",
14560
+ LinkedDudHostCandidateRemoved: "LinkedDudHostCandidateRemoved"
14524
14561
  }
14525
14562
 
14526
14563
  const URITokenTypes = {
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.5.17-beta-v3.8",
9
+ "version": "0.5.17-beta-v3.10",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",