evernode-js-client 0.6.58 → 0.6.60

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
@@ -9189,7 +9189,7 @@ module.exports = { mask, unmask };
9189
9189
 
9190
9190
 
9191
9191
  try {
9192
- module.exports = require(__nccwpck_require__.ab + "prebuilds/linux-x64/node.napi1.node");
9192
+ module.exports = require(__nccwpck_require__.ab + "prebuilds/linux-x64/node.napi.node");
9193
9193
  } catch (e) {
9194
9194
  module.exports = __nccwpck_require__(9467);
9195
9195
  }
@@ -38321,7 +38321,7 @@ module.exports = isValidUTF8;
38321
38321
 
38322
38322
 
38323
38323
  try {
38324
- module.exports = require(__nccwpck_require__.ab + "prebuilds/linux-x64/node.napi.node");
38324
+ module.exports = require(__nccwpck_require__.ab + "prebuilds/linux-x64/node.napi1.node");
38325
38325
  } catch (e) {
38326
38326
  module.exports = __nccwpck_require__(6982);
38327
38327
  }
@@ -59581,7 +59581,7 @@ const codec = __nccwpck_require__(597);
59581
59581
  const { Buffer } = __nccwpck_require__(4300);
59582
59582
  const { XrplApi } = __nccwpck_require__(7609);
59583
59583
  const { XrplAccount } = __nccwpck_require__(6099);
59584
- const { XrplApiEvents, XrplConstants } = __nccwpck_require__(8325);
59584
+ const { XrplApiEvents, XrplConstants, XrplTransactionTypes } = __nccwpck_require__(8325);
59585
59585
  const { EvernodeEvents, EventTypes, MemoFormats, EvernodeConstants, HookStateKeys, HookParamKeys, RegExp, ReputationConstants } = __nccwpck_require__(5732);
59586
59586
  const { Defaults } = __nccwpck_require__(1001);
59587
59587
  const { EncryptionHelper } = __nccwpck_require__(2731);
@@ -59847,7 +59847,7 @@ class BaseEvernodeClient {
59847
59847
  eventType = tx.HookParameters.find(p => p.name === HookParamKeys.PARAM_EVENT_TYPE_KEY)?.value;
59848
59848
  eventData = tx.HookParameters.find(p => p.name === HookParamKeys.PARAM_EVENT_DATA_KEY)?.value ?? '';
59849
59849
  }
59850
- if (tx.TransactionType === 'URITokenBuy' && eventType === EventTypes.ACQUIRE_LEASE && tx.Memos.length &&
59850
+ if (tx.TransactionType === XrplTransactionTypes.URI_TOKEN_BUY_OFFER && eventType === EventTypes.ACQUIRE_LEASE && tx.Memos.length &&
59851
59851
  tx.Memos[0].type === EventTypes.ACQUIRE_LEASE && tx.Memos[0].format === MemoFormats.BASE64 && tx.Memos[0].data) {
59852
59852
 
59853
59853
  // If our account is the destination host account, then decrypt the payload if it is encrypted.
@@ -59880,7 +59880,6 @@ class BaseEvernodeClient {
59880
59880
  }
59881
59881
  }
59882
59882
  }
59883
-
59884
59883
  else if (eventType === EventTypes.ACQUIRE_SUCCESS && eventData && tx.Memos.length &&
59885
59884
  tx.Memos[0].type === EventTypes.ACQUIRE_SUCCESS && tx.Memos[0].data) {
59886
59885
 
@@ -59985,6 +59984,20 @@ class BaseEvernodeClient {
59985
59984
  }
59986
59985
  }
59987
59986
  }
59987
+ else if (eventType === EventTypes.TERMINATE_LEASE && eventData) {
59988
+
59989
+ let uriTokenId = eventData;
59990
+
59991
+ return {
59992
+ name: EvernodeEvents.TerminateLease,
59993
+ data: {
59994
+ transaction: tx,
59995
+ terminateRefId: tx.hash,
59996
+ tenant: tx.Account,
59997
+ uriTokenId: uriTokenId
59998
+ }
59999
+ }
60000
+ }
59988
60001
  else if (eventType === EventTypes.EXTEND_SUCCESS && eventData && tx.Memos.length &&
59989
60002
  tx.Memos[0].type === EventTypes.EXTEND_SUCCESS && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
59990
60003
 
@@ -60618,8 +60631,6 @@ class BaseEvernodeClient {
60618
60631
 
60619
60632
  if (addrStateData) {
60620
60633
  let addrStateDecoded = StateHelpers.decodeReputationHostAddressState(Buffer.from(addrStateKey, 'hex'), Buffer.from(addrStateData, 'hex'));
60621
- const curMoment = await this.getMoment();
60622
- addrStateDecoded.valid = !!(addrStateDecoded.lastScoredMoment && (curMoment - addrStateDecoded.lastScoredMoment) <= ReputationConstants.SCORE_EXPIRY_MOMENT_COUNT);
60623
60634
  return addrStateDecoded;
60624
60635
  }
60625
60636
  }
@@ -61229,7 +61240,8 @@ const OFFER_WAIT_TIMEOUT = 60;
61229
61240
 
61230
61241
  const HostEvents = {
61231
61242
  AcquireLease: EvernodeEvents.AcquireLease,
61232
- ExtendLease: EvernodeEvents.ExtendLease
61243
+ ExtendLease: EvernodeEvents.ExtendLease,
61244
+ TerminateLease: EvernodeEvents.TerminateLease,
61233
61245
  }
61234
61246
 
61235
61247
  const HOST_COUNTRY_CODE_PARAM_OFFSET = 0;
@@ -62611,6 +62623,7 @@ const { XrplAccount } = __nccwpck_require__(6099);
62611
62623
  const { UtilHelpers } = __nccwpck_require__(3726);
62612
62624
  const { EvernodeHelpers } = __nccwpck_require__(6384);
62613
62625
  const { TransactionHelper } = __nccwpck_require__(5358);
62626
+ const { XrplConstants } = __nccwpck_require__(8325);
62614
62627
 
62615
62628
  const DEFAULT_WAIT_TIMEOUT = 300000;
62616
62629
 
@@ -62960,6 +62973,27 @@ class TenantClient extends BaseEvernodeClient {
62960
62973
  }
62961
62974
  });
62962
62975
  }
62976
+
62977
+ /**
62978
+ * Terminate the lease instance.
62979
+ * @param {string} uriTokenId Hex URI token id of the lease.
62980
+ */
62981
+ async terminateLease(uriTokenId, options = {}) {
62982
+ const uriToken = await this.xrplApi.getURITokenByIndex(uriTokenId);
62983
+ if (uriToken && uriToken.Owner === this.xrplAcc.address) {
62984
+ await this.xrplAcc.makePayment(uriToken.Issuer, XrplConstants.MIN_DROPS, null, null, null,
62985
+ {
62986
+ hookParams: [
62987
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.TERMINATE_LEASE },
62988
+ { name: HookParamKeys.PARAM_EVENT_DATA_KEY, value: uriTokenId }
62989
+ ],
62990
+ ...options.transactionOptions
62991
+ });
62992
+ }
62993
+ else {
62994
+ console.log(`Uri token ${uriTokenId} not found or already burned. Burn skipped.`);
62995
+ }
62996
+ }
62963
62997
  }
62964
62998
 
62965
62999
  module.exports = {
@@ -63522,6 +63556,7 @@ const EventTypes = {
63522
63556
  EXTEND_SUCCESS: 'evnExtendSuccess',
63523
63557
  EXTEND_ERROR: 'evnExtendError',
63524
63558
  EXTEND_REF: 'evnExtendRef',
63559
+ TERMINATE_LEASE: 'evnTerminateLease',
63525
63560
  INIT: 'evnInitialize',
63526
63561
  REFUND: 'evnRefund',
63527
63562
  REFUND_REF: 'evnRefundRef',
@@ -63634,6 +63669,7 @@ const EvernodeEvents = {
63634
63669
  ExtendLease: "ExtendLease",
63635
63670
  ExtendSuccess: "ExtendSuccess",
63636
63671
  ExtendError: "ExtendError",
63672
+ TerminateLease: 'TerminateLease',
63637
63673
  HostRegUpdated: "HostRegUpdated",
63638
63674
  HostReRegistered: "HostReRegistered",
63639
63675
  Initialized: "Initialized",
@@ -65072,7 +65108,6 @@ class XrplAccount {
65072
65108
 
65073
65109
  async getTrustLines(currency, issuer) {
65074
65110
  const lines = await this.xrplApi.getTrustlines(this.address, {
65075
- limit: 399,
65076
65111
  peer: issuer
65077
65112
  });
65078
65113
  return currency ? lines.filter(l => l.currency === currency) : lines;
@@ -66157,7 +66192,11 @@ class XrplApi {
66157
66192
 
66158
66193
  while ((!count || count > 0) && (!checked || resp?.result?.marker)) {
66159
66194
  checked = true;
66160
- requestObj.limit = count ? Math.min(count, MAX_PAGE_LIMIT) : MAX_PAGE_LIMIT;
66195
+ if (requestObj.command === 'account_lines') {
66196
+ requestObj.limit = 1000;
66197
+ } else {
66198
+ requestObj.limit = count ? Math.min(count, MAX_PAGE_LIMIT) : MAX_PAGE_LIMIT;
66199
+ }
66161
66200
  if (resp?.result?.marker)
66162
66201
  requestObj.marker = resp?.result?.marker;
66163
66202
  else
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.58",
9
+ "version": "0.6.60",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",
Binary file
Binary file