evernode-js-client 0.6.58 → 0.6.59

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
 
@@ -61229,7 +61242,8 @@ const OFFER_WAIT_TIMEOUT = 60;
61229
61242
 
61230
61243
  const HostEvents = {
61231
61244
  AcquireLease: EvernodeEvents.AcquireLease,
61232
- ExtendLease: EvernodeEvents.ExtendLease
61245
+ ExtendLease: EvernodeEvents.ExtendLease,
61246
+ TerminateLease: EvernodeEvents.TerminateLease,
61233
61247
  }
61234
61248
 
61235
61249
  const HOST_COUNTRY_CODE_PARAM_OFFSET = 0;
@@ -62611,6 +62625,7 @@ const { XrplAccount } = __nccwpck_require__(6099);
62611
62625
  const { UtilHelpers } = __nccwpck_require__(3726);
62612
62626
  const { EvernodeHelpers } = __nccwpck_require__(6384);
62613
62627
  const { TransactionHelper } = __nccwpck_require__(5358);
62628
+ const { XrplConstants } = __nccwpck_require__(8325);
62614
62629
 
62615
62630
  const DEFAULT_WAIT_TIMEOUT = 300000;
62616
62631
 
@@ -62960,6 +62975,27 @@ class TenantClient extends BaseEvernodeClient {
62960
62975
  }
62961
62976
  });
62962
62977
  }
62978
+
62979
+ /**
62980
+ * Terminate the lease instance.
62981
+ * @param {string} uriTokenId Hex URI token id of the lease.
62982
+ */
62983
+ async terminateLease(uriTokenId, options = {}) {
62984
+ const uriToken = await this.xrplApi.getURITokenByIndex(uriTokenId);
62985
+ if (uriToken && uriToken.Owner === this.xrplAcc.address) {
62986
+ await this.xrplAcc.makePayment(uriToken.Issuer, XrplConstants.MIN_DROPS, null, null, null,
62987
+ {
62988
+ hookParams: [
62989
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.TERMINATE_LEASE },
62990
+ { name: HookParamKeys.PARAM_EVENT_DATA_KEY, value: uriTokenId }
62991
+ ],
62992
+ ...options.transactionOptions
62993
+ });
62994
+ }
62995
+ else {
62996
+ console.log(`Uri token ${uriTokenId} not found or already burned. Burn skipped.`);
62997
+ }
62998
+ }
62963
62999
  }
62964
63000
 
62965
63001
  module.exports = {
@@ -63522,6 +63558,7 @@ const EventTypes = {
63522
63558
  EXTEND_SUCCESS: 'evnExtendSuccess',
63523
63559
  EXTEND_ERROR: 'evnExtendError',
63524
63560
  EXTEND_REF: 'evnExtendRef',
63561
+ TERMINATE_LEASE: 'evnTerminateLease',
63525
63562
  INIT: 'evnInitialize',
63526
63563
  REFUND: 'evnRefund',
63527
63564
  REFUND_REF: 'evnRefundRef',
@@ -63634,6 +63671,7 @@ const EvernodeEvents = {
63634
63671
  ExtendLease: "ExtendLease",
63635
63672
  ExtendSuccess: "ExtendSuccess",
63636
63673
  ExtendError: "ExtendError",
63674
+ TerminateLease: 'TerminateLease',
63637
63675
  HostRegUpdated: "HostRegUpdated",
63638
63676
  HostReRegistered: "HostReRegistered",
63639
63677
  Initialized: "Initialized",
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.59",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",
Binary file
Binary file