evernode-js-client 0.6.43 → 0.6.45

Sign up to get free protection for your applications and to get access to all the features.
package/index.js CHANGED
@@ -59582,7 +59582,7 @@ const { Buffer } = __nccwpck_require__(4300);
59582
59582
  const { XrplApi } = __nccwpck_require__(1850);
59583
59583
  const { XrplAccount } = __nccwpck_require__(9329);
59584
59584
  const { XrplApiEvents, XrplConstants } = __nccwpck_require__(3307);
59585
- const { EvernodeEvents, EventTypes, MemoFormats, EvernodeConstants, HookStateKeys, HookParamKeys, RegExp } = __nccwpck_require__(9849);
59585
+ const { EvernodeEvents, EventTypes, MemoFormats, EvernodeConstants, HookStateKeys, HookParamKeys, RegExp, ReputationConstants } = __nccwpck_require__(9849);
59586
59586
  const { Defaults } = __nccwpck_require__(8262);
59587
59587
  const { EncryptionHelper } = __nccwpck_require__(4832);
59588
59588
  const { EventEmitter } = __nccwpck_require__(6170);
@@ -59593,10 +59593,12 @@ const { HookHelpers } = __nccwpck_require__(4675);
59593
59593
  const xrpl = __nccwpck_require__(4666);
59594
59594
 
59595
59595
  const CANDIDATE_PROPOSE_HASHES_PARAM_OFFSET = 0;
59596
- const CANDIDATE_PROPOSE_KEYLETS_PARAM_OFFSET = 96;
59597
- const CANDIDATE_PROPOSE_UNIQUE_ID_PARAM_OFFSET = 198;
59598
- const CANDIDATE_PROPOSE_SHORT_NAME_PARAM_OFFSET = 230;
59599
- const CANDIDATE_PROPOSE_PARAM_SIZE = 250;
59596
+ const CANDIDATE_PROPOSE_KEYLETS_PARAM_OFFSET = 128;
59597
+ const CANDIDATE_PROPOSE_UNIQUE_ID_PARAM_OFFSET = 264;
59598
+ const CANDIDATE_PROPOSE_SHORT_NAME_PARAM_OFFSET = 296;
59599
+ const CANDIDATE_PROPOSE_PARAM_SIZE = 316;
59600
+
59601
+ const MAX_HOOK_PARAM_SIZE = 256;
59600
59602
 
59601
59603
  const DUD_HOST_CANDID_ADDRESS_OFFSET = 12;
59602
59604
 
@@ -59766,6 +59768,7 @@ class BaseEvernodeClient {
59766
59768
  const configStateKeys = {
59767
59769
  registryAddress: HookStateKeys.REGISTRY_ADDR,
59768
59770
  heartbeatAddress: HookStateKeys.HEARTBEAT_ADDR,
59771
+ reputationAddress: HookStateKeys.REPUTATION_ADDR,
59769
59772
  evrIssuerAddress: HookStateKeys.EVR_ISSUER_ADDR,
59770
59773
  foundationAddress: HookStateKeys.FOUNDATION_ADDR,
59771
59774
  hostRegFee: HookStateKeys.HOST_REG_FEE,
@@ -60482,6 +60485,74 @@ class BaseEvernodeClient {
60482
60485
  return null;
60483
60486
  }
60484
60487
 
60488
+ /**
60489
+ * Get reputation info of given host.
60490
+ * @param {string} hostReputationAddress Host's reputation address.
60491
+ * @param {number} moment (optional) Moment to get reputation info for.
60492
+ * @returns Reputation info object.
60493
+ */
60494
+ async _getReputationInfoByAddress(hostReputationAddress, moment = null) {
60495
+ try {
60496
+ const addrStateKey = StateHelpers.generateHostReputationAddrStateKey(hostReputationAddress);
60497
+ const addrStateIndex = StateHelpers.getHookStateIndex(this.config.reputationAddress, addrStateKey);
60498
+ const addrLedgerEntry = await this.xrplApi.getLedgerEntry(addrStateIndex);
60499
+ const addrStateData = addrLedgerEntry?.HookStateData;
60500
+ let data = {};
60501
+
60502
+ if (addrStateData) {
60503
+ const addrStateDecoded = StateHelpers.decodeHostReputationAddressState(Buffer.from(addrStateKey, 'hex'), Buffer.from(addrStateData, 'hex'));
60504
+ data = addrStateDecoded;
60505
+ }
60506
+
60507
+ const repMoment = moment ?? await this.getMoment();
60508
+ const orderedAddrStateKey = StateHelpers.generateHostReputationOrderAddressStateKey(hostReputationAddress, repMoment);
60509
+ const orderedAddrStateIndex = StateHelpers.getHookStateIndex(this.config.reputationAddress, orderedAddrStateKey);
60510
+ const orderedAddrLedgerEntry = await this.xrplApi.getLedgerEntry(orderedAddrStateIndex);
60511
+ const orderedAddrStateData = orderedAddrLedgerEntry?.HookStateData;
60512
+
60513
+ if (orderedAddrStateData) {
60514
+ const orderedAddrStateDecoded = StateHelpers.decodeHostReputationOrderAddressState(Buffer.from(orderedAddrStateKey, 'hex'), Buffer.from(orderedAddrStateData, 'hex'));
60515
+ data = { ...data, ...orderedAddrStateDecoded };
60516
+ }
60517
+
60518
+ const hostRepAcc = new XrplAccount(hostReputationAddress, null, { xrplApi: this.xrplApi });
60519
+ const [msgKey, rep] = await Promise.all([
60520
+ hostRepAcc.getMessageKey(),
60521
+ hostRepAcc.getDomain()]);
60522
+
60523
+ if (msgKey && rep && rep.length > 0) {
60524
+ const hostAddress = UtilHelpers.deriveAddress(msgKey);
60525
+ const hostAcc = new XrplAccount(hostAddress, null, { xrplApi: this.xrplApi });
60526
+
60527
+ const repBuf = Buffer.from(rep, 'hex');
60528
+ const publicKey = repBuf.slice(0, ReputationConstants.REP_INFO_PEER_PORT_OFFSET).toString('hex').toLocaleLowerCase();
60529
+ const peerPort = repBuf.readUInt16LE(ReputationConstants.REP_INFO_PEER_PORT_OFFSET);
60530
+ const instanceMoment = (repBuf.length > ReputationConstants.REP_INFO_MOMENT_OFFSET) ? Number(repBuf.readBigUInt64LE(ReputationConstants.REP_INFO_MOMENT_OFFSET)) : null;
60531
+ const domain = await hostAcc.getDomain();
60532
+
60533
+ if (instanceMoment === repMoment) {
60534
+ data = {
60535
+ ...data,
60536
+ contract: {
60537
+ domain: domain,
60538
+ pubkey: publicKey,
60539
+ peerPort: peerPort
60540
+ }
60541
+ }
60542
+ }
60543
+ }
60544
+
60545
+ return Object.keys(data).length > 0 ? data : null;
60546
+ }
60547
+ catch (e) {
60548
+ // If the exception is entryNotFound from Rippled there's no entry for the host, So return null.
60549
+ if (e?.data?.error !== 'entryNotFound')
60550
+ throw e;
60551
+ }
60552
+
60553
+ return null;
60554
+ }
60555
+
60485
60556
  /**
60486
60557
  * Propose a new hook candidate.
60487
60558
  * @param {string} hashes Hook candidate hashes in hex format, <GOVERNOR_HASH(32)><REGISTRY_HASH(32)><HEARTBEAT_HASH(32)>.
@@ -60491,8 +60562,8 @@ class BaseEvernodeClient {
60491
60562
  */
60492
60563
  async _propose(hashes, shortName, options = {}) {
60493
60564
  const hashesBuf = Buffer.from(hashes, 'hex');
60494
- if (!hashesBuf || hashesBuf.length != 96)
60495
- throw 'Invalid hashes: Hashes should contain all three Governor, Registry, Heartbeat hook hashes.';
60565
+ if (!hashesBuf || hashesBuf.length != 128)
60566
+ throw 'Invalid hashes: Hashes should contain all three Governor, Registry, Heartbeat, Reputation hook hashes.';
60496
60567
 
60497
60568
  // Check whether hook hashes exist in the definition.
60498
60569
  let keylets = [];
@@ -60502,7 +60573,7 @@ class BaseEvernodeClient {
60502
60573
  if (!ledgerEntry)
60503
60574
  throw `No hook exists with the specified ${hook} hook hash.`;
60504
60575
  else
60505
- keylets.push(HookHelpers.getHookDefinitionKeylet(index));
60576
+ keylets.push(HookHelpers.getKeylet('HOOK_DEFINITION',index));
60506
60577
  }
60507
60578
 
60508
60579
  const uniqueId = StateHelpers.getNewHookCandidateId(hashesBuf);
@@ -60523,7 +60594,9 @@ class BaseEvernodeClient {
60523
60594
  {
60524
60595
  hookParams: [
60525
60596
  { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.CANDIDATE_PROPOSE },
60526
- { name: HookParamKeys.PARAM_EVENT_DATA_KEY, value: paramBuf.toString('hex').toUpperCase() }
60597
+ { name: HookParamKeys.PARAM_EVENT_DATA_KEY, value: paramBuf.slice(0, MAX_HOOK_PARAM_SIZE).toString('hex').toUpperCase() },
60598
+ { name: HookParamKeys.PARAM_EVENT_DATA2_KEY, value: paramBuf.slice(MAX_HOOK_PARAM_SIZE).toString('hex').toUpperCase() }
60599
+
60527
60600
  ],
60528
60601
  ...options.transactionOptions
60529
60602
  });
@@ -60840,6 +60913,7 @@ const { HookTypes } = __nccwpck_require__(8262);
60840
60913
  const { RegistryClient } = __nccwpck_require__(8074);
60841
60914
  const { GovernorClient } = __nccwpck_require__(335);
60842
60915
  const { HeartbeatClient } = __nccwpck_require__(6510);
60916
+ const { ReputationClient } = __nccwpck_require__(7541);
60843
60917
 
60844
60918
  class HookClientFactory {
60845
60919
  /**
@@ -60864,6 +60938,11 @@ class HookClientFactory {
60864
60938
  hookClient = new HeartbeatClient({ heartbeatAddress: heartbeatAddress });
60865
60939
  break;
60866
60940
  }
60941
+ case HookTypes.reputation: {
60942
+ const reputationAddress = await HookClientFactory.#getAccountAddress(hookType);
60943
+ hookClient = new ReputationClient({ reputationAddress: reputationAddress });
60944
+ break;
60945
+ }
60867
60946
  default: {
60868
60947
  hookClient = null;
60869
60948
  break;
@@ -60890,7 +60969,8 @@ class HookClientFactory {
60890
60969
  return configs.registryAddress;
60891
60970
  else if (hookType == HookTypes.heartbeat)
60892
60971
  return configs.heartbeatAddress;
60893
-
60972
+ else if (hookType == HookTypes.reputation)
60973
+ return configs.reputationAddress;
60894
60974
  }
60895
60975
  }
60896
60976
 
@@ -60940,12 +61020,91 @@ module.exports = {
60940
61020
 
60941
61021
  /***/ }),
60942
61022
 
61023
+ /***/ 7541:
61024
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
61025
+
61026
+ const { StateHelpers } = __nccwpck_require__(3860);
61027
+ const { BaseEvernodeClient } = __nccwpck_require__(6263);
61028
+
61029
+ const ReputationEvents = {}
61030
+
61031
+ class ReputationClient extends BaseEvernodeClient {
61032
+
61033
+ constructor(options = {}) {
61034
+ super(options.reputationAddress, null, Object.values(ReputationEvents), false, options);
61035
+ }
61036
+
61037
+ /**
61038
+ * Get reputation info of given host reputation orderId.
61039
+ * @param {number} hostReputationOrderedId Reputation order id of the host.
61040
+ * @param {number} moment (optional) Moment to get reputation info for.
61041
+ * @returns Reputation info object.
61042
+ */
61043
+ async getReputationInfoByOrderedId(hostReputationOrderedId, moment = null) {
61044
+ try {
61045
+ const repMoment = moment ?? await this.getMoment();
61046
+ const orderedIdStateKey = StateHelpers.generateHostReputationOrderedIdStateKey(hostReputationOrderedId, repMoment);
61047
+ const orderedIdStateIndex = StateHelpers.getHookStateIndex(this.xrplAcc.address, orderedIdStateKey);
61048
+ const orderedIdLedgerEntry = await this.xrplApi.getLedgerEntry(orderedIdStateIndex);
61049
+ const orderedIdStateData = orderedIdLedgerEntry?.HookStateData;
61050
+
61051
+ if (orderedIdStateData) {
61052
+ const orderedIdStateDecoded = StateHelpers.decodeHostReputationOrderedIdState(Buffer.from(orderedIdStateKey, 'hex'), Buffer.from(orderedIdStateData, 'hex'));
61053
+ return await this._getReputationInfoByAddress(orderedIdStateDecoded.address, moment);
61054
+ }
61055
+ }
61056
+ catch (e) {
61057
+ // If the exception is entryNotFound from Rippled there's no entry for the host, So return null.
61058
+ if (e?.data?.error !== 'entryNotFound')
61059
+ throw e;
61060
+ }
61061
+
61062
+ return null;
61063
+ }
61064
+
61065
+ /**
61066
+ * Get reputation info of the moment.
61067
+ * @param {number} moment (optional) Moment to get reputation info for.
61068
+ * @returns Reputation info object.
61069
+ */
61070
+ async getReputationInfo(moment = null) {
61071
+ try {
61072
+ const repMoment = moment ?? await this.getMoment();
61073
+ const hostCountStateKey = StateHelpers.generateReputationHostCountStateKey(repMoment);
61074
+ const hostCountStateIndex = StateHelpers.getHookStateIndex(this.xrplAcc.address, hostCountStateKey);
61075
+ const hostCountLedgerEntry = await this.xrplApi.getLedgerEntry(hostCountStateIndex);
61076
+ const hostCountStateData = hostCountLedgerEntry?.HookStateData;
61077
+
61078
+ if (hostCountStateData) {
61079
+ const hostCountStateDecoded = StateHelpers.decodeReputationHostCountState(Buffer.from(hostCountStateKey, 'hex'), Buffer.from(hostCountStateData, 'hex'));
61080
+ return hostCountStateDecoded;
61081
+ }
61082
+ }
61083
+ catch (e) {
61084
+ // If the exception is entryNotFound from Rippled there's no entry for the host, So return null.
61085
+ if (e?.data?.error !== 'entryNotFound')
61086
+ throw e;
61087
+ }
61088
+
61089
+ return null;
61090
+ }
61091
+ }
61092
+
61093
+ module.exports = {
61094
+ ReputationClient,
61095
+ ReputationEvents
61096
+ }
61097
+
61098
+ /***/ }),
61099
+
60943
61100
  /***/ 1437:
60944
61101
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
60945
61102
 
60946
61103
  const { XrplConstants } = __nccwpck_require__(3307);
60947
61104
  const { BaseEvernodeClient } = __nccwpck_require__(6263);
60948
- const { EvernodeEvents, EvernodeConstants, MemoFormats, EventTypes, ErrorCodes, HookParamKeys, RegExp } = __nccwpck_require__(9849);
61105
+ const { HookClientFactory } = __nccwpck_require__(2344);
61106
+ const { HookTypes } = __nccwpck_require__(8262);
61107
+ const { EvernodeEvents, EvernodeConstants, MemoFormats, EventTypes, ErrorCodes, HookParamKeys, RegExp, ReputationConstants } = __nccwpck_require__(9849);
60949
61108
  const { XrplAccount } = __nccwpck_require__(9329);
60950
61109
  const { EncryptionHelper } = __nccwpck_require__(4832);
60951
61110
  const { Buffer } = __nccwpck_require__(4300);
@@ -61001,6 +61160,27 @@ class HostClient extends BaseEvernodeClient {
61001
61160
  super(xrpAddress, xrpSecret, Object.values(HostEvents), true, options);
61002
61161
  }
61003
61162
 
61163
+ async connect(options = {}) {
61164
+ const res = await super.connect();
61165
+ await this.setReputationAcc(options.reputationAddress, options.reputationSecret);
61166
+ return res;
61167
+ }
61168
+
61169
+ async setReputationAcc(reputationAddress = null, reputationSecret = null) {
61170
+ let hostReputationAccId;
61171
+ if (!reputationAddress && !reputationSecret) {
61172
+ hostReputationAccId = (await this.xrplAcc.getWalletLocator()).slice(0, 20);
61173
+ if (hostReputationAccId)
61174
+ reputationAddress = codec.encodeAccountID(Buffer.from(hostReputationAccId, 'hex'));
61175
+ }
61176
+
61177
+ if (reputationAddress || reputationSecret)
61178
+ this.reputationAcc = new XrplAccount(reputationAddress, reputationSecret, { xrplApi: this.xrplApi });
61179
+
61180
+ if (!this.reputationAcc || this.reputationAcc.address === this.xrplAcc.address || this.reputationAcc.address !== reputationAddress)
61181
+ this.reputationAcc = null;
61182
+ }
61183
+
61004
61184
  /**
61005
61185
  * Get max ledger sequence for host client.
61006
61186
  * @returns Max ledger sequence number.
@@ -61034,6 +61214,18 @@ class HostClient extends BaseEvernodeClient {
61034
61214
  return null;
61035
61215
  }
61036
61216
 
61217
+ /**
61218
+ * Get lease token by index.
61219
+ * @param index Index of the token.
61220
+ * @returns Lease token.
61221
+ */
61222
+ async getLeaseByIndex(index) {
61223
+ const token = await EvernodeHelpers.getLeaseByIndex(this.xrplApi, index);
61224
+ if (token.Issuer !== this.xrplAcc.address)
61225
+ return null;
61226
+ return token;
61227
+ }
61228
+
61037
61229
  /**
61038
61230
  * Get offered and unoffered leases created by the host.
61039
61231
  * @returns Array of lease offer objects.
@@ -61131,6 +61323,147 @@ class HostClient extends BaseEvernodeClient {
61131
61323
  }
61132
61324
  }
61133
61325
 
61326
+ /**
61327
+ * Prepare the reputation account with account fields and trust lines.
61328
+ * @param {string} reputationAddress Address of the reputation account.
61329
+ * @param {string} reputationSecret Secret of the reputation account.
61330
+ */
61331
+ async prepareReputationAccount(reputationAddress, reputationSecret, options = {}) {
61332
+ const repAcc = new XrplAccount(reputationAddress, reputationSecret, { xrplApi: this.xrplApi });
61333
+ const [trustLines, walletLocator, hostWalletLocator] = await Promise.all([
61334
+ repAcc.getTrustLines(EvernodeConstants.EVR, this.config.evrIssuerAddress),
61335
+ repAcc.getWalletLocator(),
61336
+ this.xrplAcc.getWalletLocator()]);
61337
+
61338
+ const hostRegAccId = (codec.decodeAccountID(this.xrplAcc.address).toString('hex').toUpperCase()).padEnd(64, '0');
61339
+ const hostReputationAccId = (codec.decodeAccountID(repAcc.address).toString('hex').toUpperCase()).padEnd(64, '0');
61340
+
61341
+ let accountSetFields = {};
61342
+ accountSetFields = (!walletLocator || walletLocator != hostRegAccId) ? { ...accountSetFields, WalletLocator: hostRegAccId } : accountSetFields;
61343
+
61344
+ if (Object.keys(accountSetFields).length !== 0) {
61345
+ await this.#submitWithRetry(async (feeUplift, submissionRef) => {
61346
+ await repAcc.setAccountFields(accountSetFields, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
61347
+ }, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
61348
+ }
61349
+
61350
+ if (trustLines.length === 0) {
61351
+ await this.#submitWithRetry(async (feeUplift, submissionRef) => {
61352
+ await repAcc.setTrustLine(EvernodeConstants.EVR, this.config.evrIssuerAddress, "99999999999999", null, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
61353
+ }, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
61354
+ }
61355
+
61356
+ let hostAccountSetFields = {};
61357
+ hostAccountSetFields = (!hostWalletLocator || hostWalletLocator != hostReputationAccId) ? { ...hostAccountSetFields, WalletLocator: hostReputationAccId } : hostAccountSetFields;
61358
+ if (Object.keys(hostAccountSetFields).length !== 0) {
61359
+ await this.#submitWithRetry(async (feeUplift, submissionRef) => {
61360
+ await this.xrplAcc.setAccountFields(hostAccountSetFields, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
61361
+ }, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
61362
+ }
61363
+
61364
+ await this.setReputationAcc(reputationAddress, reputationSecret);
61365
+ }
61366
+
61367
+ /**
61368
+ * Set the reputation contract info.
61369
+ * @param {number} peerPort Peer port of the reputation contract instance.
61370
+ * @param {string} publicKey Public key of the reputation contract instance.
61371
+ */
61372
+ async setReputationContractInfo(peerPort, publicKey, moment = null, options = {}) {
61373
+ const repMoment = moment ?? await this.getMoment();
61374
+
61375
+ var buffer = Buffer.alloc(ReputationConstants.REP_INFO_BUFFER_SIZE, 0);
61376
+ Buffer.from(publicKey.toUpperCase(), "hex").copy(buffer, ReputationConstants.REP_INFO_PUBKEY_OFFSET);
61377
+ buffer.writeUInt16LE(peerPort, ReputationConstants.REP_INFO_PEER_PORT_OFFSET);
61378
+ buffer.writeBigUInt64LE(BigInt(repMoment), ReputationConstants.REP_INFO_MOMENT_OFFSET);
61379
+ const domain = buffer.toString('hex');
61380
+
61381
+ let accountSetFields = {};
61382
+ accountSetFields = { ...accountSetFields, Domain: domain };
61383
+
61384
+ if (Object.keys(accountSetFields).length !== 0) {
61385
+ await this.#submitWithRetry(async (feeUplift, submissionRef) => {
61386
+ await this.reputationAcc.setAccountFields(accountSetFields, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
61387
+ }, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
61388
+ }
61389
+ }
61390
+
61391
+ /**
61392
+ * Get reputation info of this host.
61393
+ * @param {number} moment (optional) Moment to get reputation info for.
61394
+ * @returns Reputation info object.
61395
+ */
61396
+ async getReputationInfo(moment = null) {
61397
+ if (!this.reputationAcc)
61398
+ return null;
61399
+
61400
+ return await this._getReputationInfoByAddress(this.reputationAcc.address, moment);
61401
+ }
61402
+
61403
+ /**
61404
+ * Prepare host reputation score to a common format for submission.
61405
+ * @param {object} collectedScores
61406
+ * @returns Unified reputation score array.
61407
+ */
61408
+ async prepareHostReputationScores(collectedScores = {}) {
61409
+ const myReputationInfo = await this.getReputationInfo();
61410
+ const myOrderId = myReputationInfo.orderedId;
61411
+
61412
+ // Deciding universe.
61413
+ const universeStartIndex = Math.floor(myOrderId / 64) * 64;
61414
+
61415
+ const reputationClient = await HookClientFactory.create(HookTypes.reputation);
61416
+ await reputationClient.connect();
61417
+ let data = {};
61418
+ await Promise.all(Array.from({ length: 64 }, (_, i) => i + universeStartIndex).map(async (i) => {
61419
+ try {
61420
+ const hostReputationInfo = await reputationClient.getReputationInfoByOrderedId(i);
61421
+ if (!hostReputationInfo)
61422
+ throw 'No reputation info for this order id';
61423
+ data[i.toString()] = {
61424
+ publicKey: hostReputationInfo.contract.pubkey,
61425
+ reputationAddress: hostReputationInfo.address,
61426
+ orderId: i
61427
+ };
61428
+ } catch (error) {
61429
+ data[i.toString()] = { publicKey: "-1", orderId: i };
61430
+ }
61431
+ }));
61432
+ await reputationClient.disconnect();
61433
+
61434
+ return Object.entries(data).map(e => ({
61435
+ ...e[1],
61436
+ scoreValue: collectedScores[e[1]?.publicKey] || 0
61437
+ }));
61438
+ }
61439
+
61440
+ /**
61441
+ * Send reputation scores to the reputation hook.
61442
+ * @param {object} scores [Optional] Score object in { host: score } format.
61443
+ */
61444
+ async sendReputations(scores = null, options = {}) {
61445
+ let buffer = Buffer.alloc(64, 0);
61446
+ if (scores) {
61447
+ const preparedScores = await this.prepareHostReputationScores(scores);
61448
+ let i = 0;
61449
+ for (const reputationScore of preparedScores) {
61450
+ buffer.writeUIntLE(Number(reputationScore.scoreValue), i, 1);
61451
+ i++;
61452
+ }
61453
+ }
61454
+
61455
+ await this.reputationAcc.invoke(this.config.reputationAddress,
61456
+ scores ? { isHex: true, data: buffer.toString('hex') } : null,
61457
+ {
61458
+ hookParams: [
61459
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.HOST_SEND_REPUTATION }
61460
+ ],
61461
+ maxLedgerIndex: this.#getMaxLedgerSequence(),
61462
+ ...options.transactionOptions,
61463
+ submissionRef: options.submissionRef
61464
+ });
61465
+ }
61466
+
61134
61467
  /**
61135
61468
  * Create a lease offer.
61136
61469
  * @param {number} leaseIndex Index number for the lease.
@@ -61986,7 +62319,7 @@ const { UtilHelpers } = __nccwpck_require__(6687);
61986
62319
  const { EvernodeHelpers } = __nccwpck_require__(2523);
61987
62320
  const { TransactionHelper } = __nccwpck_require__(7071);
61988
62321
 
61989
- const DEFAULT_WAIT_TIMEOUT = 60000;
62322
+ const DEFAULT_WAIT_TIMEOUT = 300000;
61990
62323
 
61991
62324
  const TenantEvents = {
61992
62325
  AcquireSuccess: EvernodeEvents.AcquireSuccess,
@@ -62341,7 +62674,8 @@ const DefaultValues = {
62341
62674
  const HookTypes = {
62342
62675
  governor: 'GOVERNOR',
62343
62676
  registry: 'REGISTRY',
62344
- heartbeat: 'HEARTBEAT'
62677
+ heartbeat: 'HEARTBEAT',
62678
+ reputation: 'REPUTATION'
62345
62679
  }
62346
62680
 
62347
62681
  const getDefinitions = async () => {
@@ -62831,7 +63165,8 @@ const EvernodeConstants = {
62831
63165
  HOOKS: [
62832
63166
  "Governor",
62833
63167
  "Registry",
62834
- "Heartbeat"
63168
+ "Heartbeat",
63169
+ "Reputation"
62835
63170
  ],
62836
63171
  CandidateVote: {
62837
63172
  Reject: 0,
@@ -62884,7 +63219,8 @@ const EventTypes = {
62884
63219
  HOOK_UPDATE_RES: 'evnHookUpdateRes',
62885
63220
  GOVERNANCE_MODE_CHANGE: 'evnGovernanceModeChange',
62886
63221
  LINKED_CANDIDATE_REMOVE: 'evnRemoveLinkedCandidate',
62887
- HOST_UPDATE_REPUTATION: 'evnHostUpdateReputation'
63222
+ HOST_UPDATE_REPUTATION: 'evnHostUpdateReputation',
63223
+ HOST_SEND_REPUTATION: 'evnHostSendReputation'
62888
63224
  }
62889
63225
 
62890
63226
  const MemoFormats = {
@@ -62911,6 +63247,13 @@ const ErrorReasons = {
62911
63247
  NO_STATE_KEY: 'NO_STATE_KEY'
62912
63248
  }
62913
63249
 
63250
+ const ReputationConstants = {
63251
+ REP_INFO_BUFFER_SIZE: 43,
63252
+ REP_INFO_PUBKEY_OFFSET: 0,
63253
+ REP_INFO_PEER_PORT_OFFSET: 33,
63254
+ REP_INFO_MOMENT_OFFSET: 35
63255
+ }
63256
+
62914
63257
  // All keys are prefixed with 'EVR' (0x455652)
62915
63258
  // Config keys sub-prefix: 0x01
62916
63259
  const HookStateKeys = {
@@ -62930,6 +63273,7 @@ const HookStateKeys = {
62930
63273
  REGISTRY_ADDR: "455652010000000000000000000000000000000000000000000000000000000D",
62931
63274
  GOVERNANCE_CONFIGURATION: "455652010000000000000000000000000000000000000000000000000000000E",
62932
63275
  NETWORK_CONFIGURATION: "455652010000000000000000000000000000000000000000000000000000000F",
63276
+ REPUTATION_ADDR: "4556520100000000000000000000000000000000000000000000000000000010",
62933
63277
 
62934
63278
  // Singleton
62935
63279
  HOST_COUNT: "4556523200000000000000000000000000000000000000000000000000000000",
@@ -62953,6 +63297,7 @@ const HookParamKeys = {
62953
63297
  PARAM_STATE_HOOK_KEY: "4556520100000000000000000000000000000000000000000000000000000001",
62954
63298
  PARAM_EVENT_TYPE_KEY: "4556520100000000000000000000000000000000000000000000000000000002",
62955
63299
  PARAM_EVENT_DATA_KEY: "4556520100000000000000000000000000000000000000000000000000000003",
63300
+ PARAM_EVENT_DATA2_KEY: "4556520100000000000000000000000000000000000000000000000000000004",
62956
63301
  }
62957
63302
 
62958
63303
  const EvernodeEvents = {
@@ -63004,7 +63349,8 @@ module.exports = {
63004
63349
  EvernodeEvents,
63005
63350
  URITokenTypes,
63006
63351
  HookParamKeys,
63007
- RegExp
63352
+ RegExp,
63353
+ ReputationConstants
63008
63354
  }
63009
63355
 
63010
63356
  /***/ }),
@@ -63023,6 +63369,13 @@ class EvernodeHelpers {
63023
63369
  return hostUriOffers;
63024
63370
  }
63025
63371
 
63372
+ static async getLeaseByIndex(xrplApi, index) {
63373
+ const entry = await xrplApi.getLedgerEntry(index);
63374
+ if (!entry || entry.LedgerEntryType !== 'URIToken' || !(this.isValidURI(entry.URI, EvernodeConstants.LEASE_TOKEN_PREFIX_HEX) && entry.Flags == 1))
63375
+ return null;
63376
+ return entry;
63377
+ }
63378
+
63026
63379
  static async getLeaseOffers(xrplAcc) {
63027
63380
  const hostUriOffers = (await this.getLeases(xrplAcc)).filter(uriToken => uriToken.Amount);
63028
63381
  return hostUriOffers;
@@ -63054,7 +63407,7 @@ class EvernodeHelpers {
63054
63407
 
63055
63408
  const nftPageInfo = page.NFTokens.map((n, loc) => { return { NFTPage: NFT_PAGE_LEDGER_ENTRY_TYPE_HEX + page.index, NFTokenID: n.NFToken.NFTokenID, location: loc } }).find(n => n.NFTokenID == nfTokenId);
63056
63409
  if (buffer) {
63057
- let locBuf = Buffer.alloc(2,0);
63410
+ let locBuf = Buffer.alloc(2, 0);
63058
63411
  locBuf.writeUInt16BE(nftPageInfo.location);
63059
63412
  // <NFT_PAGE_KEYLET(34 bytes)><LOCATION(2 bytes)>
63060
63413
  return Buffer.concat([Buffer.from(nftPageInfo.NFTPage, "hex"), locBuf]);
@@ -63088,13 +63441,26 @@ module.exports = {
63088
63441
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
63089
63442
 
63090
63443
  const crypto = __nccwpck_require__(6113);
63444
+ const codec = __nccwpck_require__(597);
63091
63445
 
63092
- const HOOK_DEFINITION_LEDGER_TYPE_PREFIX = 68; // Decimal value of ASCII 'D'
63446
+ const LEDGER_ENTRY_TYPES = {
63447
+ HOOK_DEFINITION: 68, // Decimal value of ASCII 'D'
63448
+ ACCOUNT: 97 // Decimal value of ASCII 'a'
63449
+ }
63093
63450
 
63094
63451
  class HookHelpers {
63452
+
63453
+ static getKeylet(type, index) {
63454
+ const keyletBuf = Buffer.alloc(34, 0);
63455
+ keyletBuf.writeInt16BE(LEDGER_ENTRY_TYPES[type.toUpperCase()]);
63456
+ Buffer.from(index, 'hex').copy(keyletBuf, 2);
63457
+
63458
+ return keyletBuf.toString('hex');
63459
+ }
63460
+
63095
63461
  static getHookDefinitionIndex(hookHash) {
63096
63462
  const typeBuf = Buffer.alloc(2, 0);
63097
- typeBuf.writeInt16BE(HOOK_DEFINITION_LEDGER_TYPE_PREFIX);
63463
+ typeBuf.writeInt16BE(LEDGER_ENTRY_TYPES.HOOK_DEFINITION);
63098
63464
 
63099
63465
  const hookHashBuf = Buffer.from(hookHash, 'hex');
63100
63466
 
@@ -63108,12 +63474,20 @@ class HookHelpers {
63108
63474
  return digest.substring(0, 64).toUpperCase();
63109
63475
  }
63110
63476
 
63111
- static getHookDefinitionKeylet(index) {
63112
- const keyletBuf = Buffer.alloc(34, 0);
63113
- keyletBuf.writeInt16BE(HOOK_DEFINITION_LEDGER_TYPE_PREFIX);
63114
- Buffer.from(index, 'hex').copy(keyletBuf, 2);
63477
+ static getAccountIndex(address) {
63478
+ const typeBuf = Buffer.alloc(2, 0);
63479
+ typeBuf.writeInt16BE(LEDGER_ENTRY_TYPES.ACCOUNT);
63115
63480
 
63116
- return keyletBuf.toString('hex');
63481
+ const accountBuf = Buffer.from(codec.decodeAccountID(address), "hex");
63482
+
63483
+ let hash = crypto.createHash('sha512');
63484
+
63485
+ let data = hash.update(typeBuf);
63486
+ data = hash.update(accountBuf);
63487
+
63488
+ const digest = data.digest('hex');
63489
+ // Get the first 32 bytes of hash.
63490
+ return digest.substring(0, 64).toUpperCase();
63117
63491
  }
63118
63492
  }
63119
63493
 
@@ -63263,6 +63637,10 @@ const HOST_DISK_MB_OFFSET = 72;
63263
63637
  const HOST_EMAIL_ADDRESS_OFFSET = 76;
63264
63638
  const HOST_ACCUMULATED_REWARD_OFFSET = 116;
63265
63639
 
63640
+ const HOST_REP_LAST_REG_MOMENT_OFFSET = 0;
63641
+ const HOST_REP_SCORE_NUMERATOR_OFFSET = 8;
63642
+ const HOST_REP_SCORE_DENOMINATOR_OFFSET = 16;
63643
+
63266
63644
  const PREV_HOST_ADDRESS_OFFSET = 0;
63267
63645
  const TRANSFER_LEDGER_IDX_OFFSET = 20;
63268
63646
  const TRANSFERRED_NFT_ID_OFFSET = 28;
@@ -63270,6 +63648,7 @@ const TRANSFERRED_NFT_ID_OFFSET = 28;
63270
63648
  const CANDIDATE_GOVERNOR_HOOK_HASH_OFFSET = 0;
63271
63649
  const CANDIDATE_REGISTRY_HOOK_HASH_OFFSET = 32;
63272
63650
  const CANDIDATE_HEARTBEAT_HOOK_HASH_OFFSET = 64;
63651
+ const CANDIDATE_REPUTATION_HOOK_HASH_OFFSET = 96;
63273
63652
 
63274
63653
  const CANDIDATE_OWNER_ADDRESS_OFFSET = 0;
63275
63654
  const CANDIDATE_IDX_OFFSET = 20;
@@ -63314,6 +63693,8 @@ const CANDIDATE_OWNER_KEY_ZERO_COUNT = 8;
63314
63693
  const HOOK_STATE_LEDGER_TYPE_PREFIX = 118; // Decimal value of ASCII 'v'
63315
63694
  const PENDING_TRANSFER = 1;
63316
63695
  const HOST_EMAIL_ADDRESS_LEN = 40;
63696
+ const STATE_KEY_SIZE = 32;
63697
+ const ACCOUNT_ID_SIZE = 20;
63317
63698
 
63318
63699
  class StateHelpers {
63319
63700
  static StateTypes = {
@@ -63338,6 +63719,46 @@ class StateHelpers {
63338
63719
  return state.data;
63339
63720
  }
63340
63721
 
63722
+ static decodeHostReputationAddressState(stateKeyBuf, stateDataBuf) {
63723
+ const keyOffset = STATE_KEY_SIZE - ACCOUNT_ID_SIZE;
63724
+ const data = {
63725
+ address: codec.encodeAccountID(stateKeyBuf.slice(keyOffset)),
63726
+ lastRegisteredMoment: Number(stateDataBuf.readBigUInt64LE(HOST_REP_LAST_REG_MOMENT_OFFSET)),
63727
+ scoreNumerator: Number(stateDataBuf.readBigUInt64LE(HOST_REP_SCORE_NUMERATOR_OFFSET)),
63728
+ scoreDenominator: Number(stateDataBuf.readBigUInt64LE(HOST_REP_SCORE_DENOMINATOR_OFFSET))
63729
+ }
63730
+ return data;
63731
+ }
63732
+
63733
+ static decodeHostReputationOrderAddressState(stateKeyBuf, stateDataBuf) {
63734
+ const keyOffset = STATE_KEY_SIZE - ACCOUNT_ID_SIZE - 8;
63735
+ const data = {
63736
+ moment: Number(stateKeyBuf.readBigUInt64LE(keyOffset)),
63737
+ address: codec.encodeAccountID(stateKeyBuf.slice(keyOffset + 8)),
63738
+ orderedId: Number(stateDataBuf.readBigUInt64LE(0))
63739
+ }
63740
+ return data;
63741
+ }
63742
+
63743
+ static decodeHostReputationOrderedIdState(stateKeyBuf, stateDataBuf) {
63744
+ const keyOffset = STATE_KEY_SIZE - 16;
63745
+ const data = {
63746
+ moment: Number(stateKeyBuf.readBigUInt64LE(keyOffset)),
63747
+ orderedId: Number(stateKeyBuf.readBigUInt64LE(keyOffset + 8)),
63748
+ address: codec.encodeAccountID(stateDataBuf.slice(0))
63749
+ }
63750
+ return data;
63751
+ }
63752
+
63753
+ static decodeReputationHostCountState(stateKeyBuf, stateDataBuf) {
63754
+ const keyOffset = STATE_KEY_SIZE - 8;
63755
+ const data = {
63756
+ moment: Number(stateKeyBuf.readBigUInt64LE(keyOffset)),
63757
+ count: Number(stateDataBuf.readBigUInt64LE())
63758
+ }
63759
+ return data;
63760
+ }
63761
+
63341
63762
  static decodeHostAddressState(stateKeyBuf, stateDataBuf) {
63342
63763
  let data = {
63343
63764
  address: codec.encodeAccountID(stateKeyBuf.slice(12)),
@@ -63405,6 +63826,8 @@ class StateHelpers {
63405
63826
  governorHookHash: stateDataBuf.slice(CANDIDATE_GOVERNOR_HOOK_HASH_OFFSET, CANDIDATE_REGISTRY_HOOK_HASH_OFFSET).toString('hex').toUpperCase(),
63406
63827
  registryHookHash: stateDataBuf.slice(CANDIDATE_REGISTRY_HOOK_HASH_OFFSET, CANDIDATE_HEARTBEAT_HOOK_HASH_OFFSET).toString('hex').toUpperCase(),
63407
63828
  heartbeatHookHash: stateDataBuf.slice(CANDIDATE_HEARTBEAT_HOOK_HASH_OFFSET, CANDIDATE_HEARTBEAT_HOOK_HASH_OFFSET + 32).toString('hex').toUpperCase(),
63829
+ reputationHookHash: stateDataBuf.slice(CANDIDATE_REPUTATION_HOOK_HASH_OFFSET, CANDIDATE_REPUTATION_HOOK_HASH_OFFSET + 32).toString('hex').toUpperCase(),
63830
+
63408
63831
  }
63409
63832
  return data;
63410
63833
  }
@@ -63534,7 +63957,8 @@ class StateHelpers {
63534
63957
  else if (Buffer.from(HookStateKeys.REGISTRY_ADDR, 'hex').compare(stateKey) === 0 ||
63535
63958
  Buffer.from(HookStateKeys.HEARTBEAT_ADDR, 'hex').compare(stateKey) === 0 ||
63536
63959
  Buffer.from(HookStateKeys.EVR_ISSUER_ADDR, 'hex').compare(stateKey) === 0 ||
63537
- Buffer.from(HookStateKeys.FOUNDATION_ADDR, 'hex').compare(stateKey) === 0) {
63960
+ Buffer.from(HookStateKeys.FOUNDATION_ADDR, 'hex').compare(stateKey) === 0 ||
63961
+ Buffer.from(HookStateKeys.REPUTATION_ADDR, 'hex').compare(stateKey) === 0) {
63538
63962
  return {
63539
63963
  type: this.StateTypes.CONFIGURATION,
63540
63964
  key: hexKey,
@@ -63745,7 +64169,8 @@ class StateHelpers {
63745
64169
  Buffer.from(HookStateKeys.REGISTRY_ADDR, 'hex').compare(stateKey) === 0 ||
63746
64170
  Buffer.from(HookStateKeys.HEARTBEAT_ADDR, 'hex').compare(stateKey) === 0 ||
63747
64171
  Buffer.from(HookStateKeys.GOVERNANCE_CONFIGURATION, 'hex').compare(stateKey) === 0 ||
63748
- Buffer.from(HookStateKeys.NETWORK_CONFIGURATION, 'hex').compare(stateKey) === 0) {
64172
+ Buffer.from(HookStateKeys.NETWORK_CONFIGURATION, 'hex').compare(stateKey) === 0 ||
64173
+ Buffer.from(HookStateKeys.REPUTATION_ADDR, 'hex').compare(stateKey) === 0) {
63749
64174
  return {
63750
64175
  key: hexKey,
63751
64176
  type: this.StateTypes.CONFIGURATION
@@ -63779,6 +64204,39 @@ class StateHelpers {
63779
64204
  return stateKeyBuf.toString('hex').toUpperCase();
63780
64205
  }
63781
64206
 
64207
+ static generateHostReputationAddrStateKey(address) {
64208
+ const buf = Buffer.alloc(STATE_KEY_SIZE, 0);
64209
+ Buffer.from(codec.decodeAccountID(address), "hex").copy(buf, buf.length - ACCOUNT_ID_SIZE);
64210
+
64211
+ return buf.toString('hex').toUpperCase();
64212
+ }
64213
+
64214
+ static generateHostReputationOrderAddressStateKey(address, moment) {
64215
+ const buf = Buffer.alloc(STATE_KEY_SIZE, 0);
64216
+ const offset = buf.length - ACCOUNT_ID_SIZE - 8;
64217
+ buf.writeBigUInt64LE(BigInt(moment), offset);
64218
+ Buffer.from(codec.decodeAccountID(address), "hex").copy(buf, offset + 8);
64219
+
64220
+ return buf.toString('hex').toUpperCase();
64221
+ }
64222
+
64223
+ static generateHostReputationOrderedIdStateKey(orderedId, moment) {
64224
+ let buf = Buffer.alloc(STATE_KEY_SIZE, 0);
64225
+ const offset = buf.length - 16;
64226
+ buf.writeBigUInt64LE(BigInt(moment), offset);
64227
+ buf.writeBigUInt64LE(BigInt(orderedId), offset + 8);
64228
+
64229
+ return buf.toString('hex').toUpperCase();
64230
+ }
64231
+
64232
+ static generateReputationHostCountStateKey(moment) {
64233
+ let buf = Buffer.alloc(STATE_KEY_SIZE, 0);
64234
+ const offset = buf.length - 8;
64235
+ buf.writeBigUInt64LE(BigInt(moment), offset);
64236
+
64237
+ return buf.toString('hex').toUpperCase();
64238
+ }
64239
+
63782
64240
  static generateTransfereeAddrStateKey(address) {
63783
64241
  // 1 byte - Key Type.
63784
64242
  // 8 bytes - Zeros.
@@ -63961,6 +64419,7 @@ module.exports = {
63961
64419
  /***/ 6687:
63962
64420
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
63963
64421
 
64422
+ const kp = __nccwpck_require__(8150);
63964
64423
  const { Buffer } = __nccwpck_require__(4300);
63965
64424
  const { XflHelpers } = __nccwpck_require__(3243);
63966
64425
  const { EvernodeConstants } = __nccwpck_require__(9849);
@@ -64017,6 +64476,13 @@ class UtilHelpers {
64017
64476
  }
64018
64477
  }
64019
64478
 
64479
+ static deriveKeypair(secret) {
64480
+ return kp.deriveKeypair(secret);
64481
+ }
64482
+
64483
+ static deriveAddress(publicKey) {
64484
+ return kp.deriveAddress(publicKey);
64485
+ }
64020
64486
  }
64021
64487
 
64022
64488
  module.exports = {
@@ -64165,13 +64631,13 @@ module.exports = {
64165
64631
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
64166
64632
 
64167
64633
  const xrpl = __nccwpck_require__(4666);
64168
- const kp = __nccwpck_require__(8150);
64169
64634
  const codec = __nccwpck_require__(597);
64170
64635
  const crypto = __nccwpck_require__(6113);
64171
64636
  const { XrplConstants, XrplTransactionTypes } = __nccwpck_require__(3307);
64172
64637
  const { TransactionHelper } = __nccwpck_require__(7071);
64173
64638
  const { EventEmitter } = __nccwpck_require__(6170);
64174
64639
  const { Defaults } = __nccwpck_require__(8262);
64640
+ const { UtilHelpers } = __nccwpck_require__(6687);
64175
64641
 
64176
64642
  class XrplAccount {
64177
64643
 
@@ -64194,8 +64660,8 @@ class XrplAccount {
64194
64660
  this.wallet = xrpl.Wallet.fromSeed(this.secret);
64195
64661
  this.address = this.wallet.classicAddress;
64196
64662
  } else if (this.secret) {
64197
- const keypair = kp.deriveKeypair(this.secret);
64198
- const derivedPubKeyAddress = kp.deriveAddress(keypair.publicKey);
64663
+ const keypair = UtilHelpers.deriveKeypair(this.secret);
64664
+ const derivedPubKeyAddress = UtilHelpers.deriveAddress(keypair.publicKey);
64199
64665
  if (this.address == derivedPubKeyAddress)
64200
64666
  this.wallet = xrpl.Wallet.fromSeed(this.secret);
64201
64667
  else
@@ -64223,7 +64689,7 @@ class XrplAccount {
64223
64689
  if (!this.secret)
64224
64690
  throw 'Cannot derive key pair: Account secret is empty.';
64225
64691
 
64226
- return kp.deriveKeypair(this.secret);
64692
+ return UtilHelpers.deriveKeypair(this.secret);
64227
64693
  }
64228
64694
 
64229
64695
  async exists() {
@@ -64250,6 +64716,10 @@ class XrplAccount {
64250
64716
  return (await this.getInfo())?.MessageKey;
64251
64717
  }
64252
64718
 
64719
+ async getWalletLocator() {
64720
+ return (await this.getInfo())?.WalletLocator;
64721
+ }
64722
+
64253
64723
  async getDomain() {
64254
64724
  const domain = (await this.getInfo())?.Domain;
64255
64725
  return domain ? TransactionHelper.hexToASCII(domain) : null;
@@ -64400,6 +64870,30 @@ class XrplAccount {
64400
64870
  return await this.#prepareSubmissionTransaction(signerListTx, options);
64401
64871
  }
64402
64872
 
64873
+ async invoke(toAddr, blobObj = null, options = {}) {
64874
+ const preparedTxn = await this.prepareInvoke(toAddr, blobObj, options);
64875
+ return await this.signAndSubmit(preparedTxn, options.submissionRef);
64876
+ }
64877
+
64878
+ async prepareInvoke(toAddr, blobObj = null, options = {}) {
64879
+
64880
+ var txObj = {
64881
+ TransactionType: XrplTransactionTypes.INVOKE,
64882
+ Account: this.address,
64883
+ Destination: toAddr,
64884
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
64885
+ };
64886
+
64887
+ if (blobObj) {
64888
+ txObj = {
64889
+ ...txObj,
64890
+ Blob: blobObj.isHex ? blobObj.data : TransactionHelper.asciiToHex(blobObj.data)
64891
+ }
64892
+ }
64893
+
64894
+ return await this.#prepareSubmissionTransaction(txObj, options);
64895
+ }
64896
+
64403
64897
  async makePayment(toAddr, amount, currency = null, issuer = null, memos = null, options = {}) {
64404
64898
  const preparedTxn = await this.prepareMakePayment(toAddr, amount, currency, issuer, memos, options);
64405
64899
  return await this.signAndSubmit(preparedTxn, options.submissionRef);
@@ -64971,7 +65465,8 @@ const { Defaults } = __nccwpck_require__(8262);
64971
65465
  const { TransactionHelper } = __nccwpck_require__(7071);
64972
65466
  const { XrplApiEvents } = __nccwpck_require__(3307);
64973
65467
  const { XrplAccount } = __nccwpck_require__(9329);
64974
- const { XrplHelpers } = __nccwpck_require__(3189)
65468
+ const { XrplHelpers } = __nccwpck_require__(3189);
65469
+ const { UtilHelpers } = __nccwpck_require__(6687);
64975
65470
 
64976
65471
  const MAX_PAGE_LIMIT = 400;
64977
65472
  const API_REQ_TYPE = {
@@ -65407,7 +65902,7 @@ class XrplApi {
65407
65902
  const info = await this.getAccountInfo(address);
65408
65903
  const accountFlags = xrpl.parseAccountRootFlags(info.Flags);
65409
65904
  const regularKey = info.RegularKey;
65410
- const derivedPubKeyAddress = kp.deriveAddress(publicKey);
65905
+ const derivedPubKeyAddress = UtilHelpers.deriveAddress(publicKey);
65411
65906
 
65412
65907
  // If the master key is disabled the derived pubkey address should be the regular key.
65413
65908
  // Otherwise it could be account address or the regular key
@@ -65704,6 +66199,7 @@ const XrplConstants = {
65704
66199
  }
65705
66200
 
65706
66201
  const XrplTransactionTypes = {
66202
+ INVOKE: 'Invoke',
65707
66203
  PAYMENT: 'Payment',
65708
66204
  SIGNER_LIST_SET: 'SignerListSet',
65709
66205
  TRUST_SET: 'TrustSet',
Binary file
Binary file
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  ],
7
7
  "homepage": "https://github.com/HotPocketDev/evernode-js-client",
8
8
  "license": "SEE LICENSE IN https://raw.githubusercontent.com/EvernodeXRPL/evernode-resources/main/license/evernode-license.pdf",
9
- "version": "0.6.43",
9
+ "version": "0.6.45",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",
package/secp256k1.node ADDED
Binary file