evernode-js-client 0.6.21-definition-1.3 → 0.6.21-definition-1.4

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.
package/index.js CHANGED
@@ -9149,7 +9149,7 @@ module.exports = { mask, unmask };
9149
9149
 
9150
9150
 
9151
9151
  try {
9152
- module.exports = require(__nccwpck_require__.ab + "prebuilds/linux-x64/node.napi1.node");
9152
+ module.exports = require(__nccwpck_require__.ab + "prebuilds/linux-x64/node.napi.node");
9153
9153
  } catch (e) {
9154
9154
  module.exports = __nccwpck_require__(2567);
9155
9155
  }
@@ -33340,7 +33340,7 @@ module.exports = isValidUTF8;
33340
33340
 
33341
33341
 
33342
33342
  try {
33343
- module.exports = require(__nccwpck_require__.ab + "prebuilds/linux-x64/node.napi.node");
33343
+ module.exports = require(__nccwpck_require__.ab + "prebuilds/linux-x64/node.napi1.node");
33344
33344
  } catch (e) {
33345
33345
  module.exports = __nccwpck_require__(9372);
33346
33346
  }
@@ -51849,6 +51849,9 @@ const CANDIDATE_PROPOSE_PARAM_SIZE = 250;
51849
51849
 
51850
51850
  const DUD_HOST_CANDID_ADDRESS_OFFSET = 12;
51851
51851
 
51852
+ const REPUTATION_HOST_ADDRESS_PARAM_OFFSET = 0;
51853
+ const REPUTATION_VALUE_PARAM_OFFSET = 20;
51854
+
51852
51855
  const MAX_HOOK_PARAM_SIZE = 128;
51853
51856
 
51854
51857
  class BaseEvernodeClient {
@@ -52426,6 +52429,18 @@ class BaseEvernodeClient {
52426
52429
  }
52427
52430
  }
52428
52431
  }
52432
+ else if (eventType === EventTypes.HOST_UPDATE_REPUTATION && eventData) {
52433
+ const dataBuf = Buffer.from(eventData, 'hex');
52434
+
52435
+ return {
52436
+ name: EvernodeEvents.HostReputationUpdated,
52437
+ data: {
52438
+ transaction: tx,
52439
+ host: codec.encodeAccountID(dataBuf.slice(REPUTATION_HOST_ADDRESS_PARAM_OFFSET, 20)),
52440
+ reputation: dataBuf.readUInt8(REPUTATION_VALUE_PARAM_OFFSET)
52441
+ }
52442
+ }
52443
+ }
52429
52444
 
52430
52445
  return null;
52431
52446
  }
@@ -52881,6 +52896,7 @@ module.exports = {
52881
52896
  /***/ 2466:
52882
52897
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
52883
52898
 
52899
+ const codec = __nccwpck_require__(597);
52884
52900
  const { Buffer } = __nccwpck_require__(4300);
52885
52901
  const { EventTypes, HookParamKeys } = __nccwpck_require__(9849);
52886
52902
  const { StateHelpers } = __nccwpck_require__(3860);
@@ -52891,6 +52907,10 @@ const CANDIDATE_VOTE_UNIQUE_ID_PARAM_OFFSET = 0;
52891
52907
  const CANDIDATE_VOTE_VALUE_PARAM_OFFSET = 32;
52892
52908
  const CANDIDATE_VOTE_PARAM_SIZE = 33;
52893
52909
 
52910
+ const REPUTATION_HOST_ADDRESS_PARAM_OFFSET = 0;
52911
+ const REPUTATION_VALUE_PARAM_OFFSET = 20;
52912
+ const REPUTATION_PARAM_SIZE = 21;
52913
+
52894
52914
  const FoundationEvents = {}
52895
52915
 
52896
52916
  class FoundationClient extends BaseEvernodeClient {
@@ -52939,7 +52959,7 @@ class FoundationClient extends BaseEvernodeClient {
52939
52959
 
52940
52960
  const voteBuf = Buffer.alloc(CANDIDATE_VOTE_PARAM_SIZE);
52941
52961
  Buffer.from(candidateId, 'hex').copy(voteBuf, CANDIDATE_VOTE_UNIQUE_ID_PARAM_OFFSET);
52942
- voteBuf.writeUInt8(vote, CANDIDATE_VOTE_VALUE_PARAM_OFFSET)
52962
+ voteBuf.writeUInt8(vote, CANDIDATE_VOTE_VALUE_PARAM_OFFSET);
52943
52963
 
52944
52964
  return await this.xrplAcc.makePayment(this.config.heartbeatAddress,
52945
52965
  XrplConstants.MIN_XRP_AMOUNT,
@@ -53023,6 +53043,35 @@ class FoundationClient extends BaseEvernodeClient {
53023
53043
  ...options.transactionOptions
53024
53044
  });
53025
53045
  }
53046
+
53047
+ /**
53048
+ * Update the reputation of the host.
53049
+ * @param {string} hostAddress Address of the dud host.
53050
+ * @param {number} reputation Host reputation value.
53051
+ * @param {*} options [Optional] transaction options.
53052
+ * @returns Transaction result.
53053
+ */
53054
+ async updateHostReputation(hostAddress, reputation, options = {}) {
53055
+ if (this.xrplAcc.address !== this.config.foundationAddress)
53056
+ throw `Invalid foundation address ${this.xrplAcc.address}.`;
53057
+
53058
+ const reputationBuf = Buffer.alloc(REPUTATION_PARAM_SIZE);
53059
+ codec.decodeAccountID(hostAddress).copy(reputationBuf, REPUTATION_HOST_ADDRESS_PARAM_OFFSET);
53060
+ reputationBuf.writeUInt8(reputation, REPUTATION_VALUE_PARAM_OFFSET)
53061
+
53062
+ return await this.xrplAcc.makePayment(this.config.registryAddress,
53063
+ XrplConstants.MIN_XRP_AMOUNT,
53064
+ XrplConstants.XRP,
53065
+ null,
53066
+ null,
53067
+ {
53068
+ hookParams: [
53069
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.HOST_UPDATE_REPUTATION },
53070
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: reputationBuf.toString('hex').toUpperCase() }
53071
+ ],
53072
+ ...options.transactionOptions
53073
+ });
53074
+ }
53026
53075
  }
53027
53076
 
53028
53077
  module.exports = {
@@ -53169,7 +53218,8 @@ const RegistryEvents = {
53169
53218
  HostRegUpdated: EvernodeEvents.HostRegUpdated,
53170
53219
  DeadHostPrune: EvernodeEvents.DeadHostPrune,
53171
53220
  HostTransfer: EvernodeEvents.HostTransfer,
53172
- HostRebate: EvernodeEvents.HostRebate
53221
+ HostRebate: EvernodeEvents.HostRebate,
53222
+ HostReputationUpdated: EvernodeEvents.HostReputationUpdated
53173
53223
  }
53174
53224
 
53175
53225
  class RegistryClient extends BaseEvernodeClient {
@@ -54902,7 +54952,8 @@ const EventTypes = {
54902
54952
  DUD_HOST_REPORT: 'evnDudHostReport',
54903
54953
  HOOK_UPDATE_RES: 'evnHookUpdateRes',
54904
54954
  GOVERNANCE_MODE_CHANGE: 'evnGovernanceModeChange',
54905
- LINKED_CANDIDATE_REMOVE: 'evnRemoveLinkedCandidate'
54955
+ LINKED_CANDIDATE_REMOVE: 'evnRemoveLinkedCandidate',
54956
+ HOST_UPDATE_REPUTATION: 'evnHostUpdateReputation'
54906
54957
  }
54907
54958
 
54908
54959
  const MemoFormats = {
@@ -55000,7 +55051,8 @@ const EvernodeEvents = {
55000
55051
  DudHostStatusChanged: "DudHostStatusChanged",
55001
55052
  FallbackToPiloted: "FallbackToPiloted",
55002
55053
  NewHookStatusChanged: "NewHookStatusChanged",
55003
- LinkedDudHostCandidateRemoved: "LinkedDudHostCandidateRemoved"
55054
+ LinkedDudHostCandidateRemoved: "LinkedDudHostCandidateRemoved",
55055
+ HostReputationUpdated: "HostReputationUpdated"
55004
55056
  }
55005
55057
 
55006
55058
  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.6.21-definition-1.3",
9
+ "version": "0.6.21-definition-1.4",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",
Binary file
Binary file