evernode-js-client 0.6.21-definition-1.7 → 0.6.21-definition-1.8

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 +32 -33
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -52626,8 +52626,8 @@ class BaseEvernodeClient {
52626
52626
 
52627
52627
  if (validPrune) {
52628
52628
  await this.xrplAcc.makePayment(this.config.registryAddress,
52629
- XrplConstants.MIN_XRP_AMOUNT,
52630
- XrplConstants.XRP,
52629
+ XrplConstants.MIN_DROPS,
52630
+ null,
52631
52631
  null,
52632
52632
  null,
52633
52633
  {
@@ -52846,8 +52846,8 @@ class BaseEvernodeClient {
52846
52846
  async _withdraw(candidateId, options = {}) {
52847
52847
  const candidateIdBuf = Buffer.from(candidateId, 'hex');
52848
52848
  return await this.xrplAcc.makePayment(this.governorAddress,
52849
- XrplConstants.MIN_XRP_AMOUNT,
52850
- XrplConstants.XRP,
52849
+ XrplConstants.MIN_DROPS,
52850
+ null,
52851
52851
  null,
52852
52852
  null,
52853
52853
  {
@@ -52962,8 +52962,8 @@ class FoundationClient extends BaseEvernodeClient {
52962
52962
  voteBuf.writeUInt8(vote, CANDIDATE_VOTE_VALUE_PARAM_OFFSET);
52963
52963
 
52964
52964
  return await this.xrplAcc.makePayment(this.config.heartbeatAddress,
52965
- XrplConstants.MIN_XRP_AMOUNT,
52966
- XrplConstants.XRP,
52965
+ XrplConstants.MIN_DROPS,
52966
+ null,
52967
52967
  null,
52968
52968
  null,
52969
52969
  {
@@ -53031,8 +53031,8 @@ class FoundationClient extends BaseEvernodeClient {
53031
53031
  modeBuf.writeUInt8(mode);
53032
53032
 
53033
53033
  return await this.xrplAcc.makePayment(this.governorAddress,
53034
- XrplConstants.MIN_XRP_AMOUNT,
53035
- XrplConstants.XRP,
53034
+ XrplConstants.MIN_DROPS,
53035
+ null,
53036
53036
  null,
53037
53037
  null,
53038
53038
  {
@@ -53060,8 +53060,8 @@ class FoundationClient extends BaseEvernodeClient {
53060
53060
  reputationBuf.writeUInt8(reputation, REPUTATION_VALUE_PARAM_OFFSET)
53061
53061
 
53062
53062
  return await this.xrplAcc.makePayment(this.config.registryAddress,
53063
- XrplConstants.MIN_XRP_AMOUNT,
53064
- XrplConstants.XRP,
53063
+ XrplConstants.MIN_DROPS,
53064
+ null,
53065
53065
  null,
53066
53066
  null,
53067
53067
  {
@@ -53642,8 +53642,8 @@ class HostClient extends BaseEvernodeClient {
53642
53642
  const regUriToken = await this.getRegistrationUriToken();
53643
53643
 
53644
53644
  await this.xrplAcc.makePayment(this.config.registryAddress,
53645
- XrplConstants.MIN_XRP_AMOUNT,
53646
- XrplConstants.XRP,
53645
+ XrplConstants.MIN_DROPS,
53646
+ null,
53647
53647
  null,
53648
53648
  null,
53649
53649
  {
@@ -53703,8 +53703,8 @@ class HostClient extends BaseEvernodeClient {
53703
53703
  }
53704
53704
 
53705
53705
  return await this.xrplAcc.makePayment(this.config.registryAddress,
53706
- XrplConstants.MIN_XRP_AMOUNT,
53707
- XrplConstants.XRP,
53706
+ XrplConstants.MIN_DROPS,
53707
+ null,
53708
53708
  null,
53709
53709
  null,
53710
53710
  {
@@ -53734,8 +53734,8 @@ class HostClient extends BaseEvernodeClient {
53734
53734
 
53735
53735
  try {
53736
53736
  const res = await this.xrplAcc.makePayment(this.config.heartbeatAddress,
53737
- XrplConstants.MIN_XRP_AMOUNT,
53738
- XrplConstants.XRP,
53737
+ XrplConstants.MIN_DROPS,
53738
+ null,
53739
53739
  null,
53740
53740
  null,
53741
53741
  {
@@ -53798,8 +53798,8 @@ class HostClient extends BaseEvernodeClient {
53798
53798
  }
53799
53799
 
53800
53800
  return this.xrplAcc.makePayment(tenantAddress,
53801
- XrplConstants.MIN_XRP_AMOUNT,
53802
- XrplConstants.XRP,
53801
+ XrplConstants.MIN_DROPS,
53802
+ null,
53803
53803
  null,
53804
53804
  [
53805
53805
  { type: EventTypes.ACQUIRE_SUCCESS, format: MemoFormats.BASE64, data: data }
@@ -53853,8 +53853,8 @@ class HostClient extends BaseEvernodeClient {
53853
53853
  buf.writeUInt32BE(expiryMoment);
53854
53854
 
53855
53855
  return this.xrplAcc.makePayment(tenantAddress,
53856
- XrplConstants.MIN_XRP_AMOUNT,
53857
- XrplConstants.XRP,
53856
+ XrplConstants.MIN_DROPS,
53857
+ null,
53858
53858
  null,
53859
53859
  [
53860
53860
  { type: EventTypes.EXTEND_SUCCESS, format: MemoFormats.HEX, data: buf.toString('hex') }
@@ -53928,8 +53928,8 @@ class HostClient extends BaseEvernodeClient {
53928
53928
  */
53929
53929
  async requestRebate(options = {}) {
53930
53930
  return this.xrplAcc.makePayment(this.config.registryAddress,
53931
- XrplConstants.MIN_XRP_AMOUNT,
53932
- XrplConstants.XRP,
53931
+ XrplConstants.MIN_DROPS,
53932
+ null,
53933
53933
  null,
53934
53934
  [
53935
53935
  { type: EventTypes.HOST_REBATE, format: "", data: "" }
@@ -53965,8 +53965,8 @@ class HostClient extends BaseEvernodeClient {
53965
53965
  const regUriToken = await this.getRegistrationUriToken();
53966
53966
 
53967
53967
  await this.xrplAcc.sellURIToken(regUriToken.index,
53968
- XrplConstants.MIN_XRP_AMOUNT,
53969
- XrplConstants.XRP,
53968
+ XrplConstants.MIN_DROPS,
53969
+ null,
53970
53970
  null,
53971
53971
  this.config.registryAddress,
53972
53972
  null,
@@ -54099,7 +54099,7 @@ class TenantClient extends BaseEvernodeClient {
54099
54099
  async getLeaseHost(hostAddress) {
54100
54100
  const host = new XrplAccount(hostAddress, null, { xrplApi: this.xrplApi });
54101
54101
  // Find an owned URI token with matching Evernode host NFT prefix.
54102
- const uriToken = (await host.getURITokens()).find(n => n.URI.startsWith(EvernodeConstants.TOKEN_PREFIX_HEX));
54102
+ const uriToken = (await host.getURITokens()).find(n => n.URI.startsWith(EvernodeConstants.TOKEN_PREFIX_HEX) && n.Issuer === this.config.registryAddress);
54103
54103
  if (!uriToken)
54104
54104
  throw { reason: ErrorReasons.HOST_INVALID, error: "Host is not registered." };
54105
54105
 
@@ -55083,7 +55083,6 @@ module.exports = {
55083
55083
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
55084
55084
 
55085
55085
  const { EvernodeConstants, URITokenTypes } = __nccwpck_require__(9849);
55086
- const { UtilHelpers } = __nccwpck_require__(6687);
55087
55086
  const { TransactionHelper } = __nccwpck_require__(7071);
55088
55087
 
55089
55088
  const NFT_PAGE_LEDGER_ENTRY_TYPE_HEX = '0050';
@@ -56771,12 +56770,12 @@ class XrplAccount {
56771
56770
  return await this.#prepareSubmissionTransaction(signerListTx, options);
56772
56771
  }
56773
56772
 
56774
- async makePayment(toAddr, amount, currency, issuer = null, memos = null, options = {}) {
56773
+ async makePayment(toAddr, amount, currency = null, issuer = null, memos = null, options = {}) {
56775
56774
  const preparedTxn = await this.prepareMakePayment(toAddr, amount, currency, issuer, memos, options);
56776
56775
  return await this.signAndSubmit(preparedTxn);
56777
56776
  }
56778
56777
 
56779
- async prepareMakePayment(toAddr, amount, currency, issuer = null, memos = null, options = {}) {
56778
+ async prepareMakePayment(toAddr, amount, currency = null, issuer = null, memos = null, options = {}) {
56780
56779
 
56781
56780
  const amountObj = makeAmountObject(amount, currency, issuer);
56782
56781
 
@@ -57309,13 +57308,11 @@ class XrplAccount {
57309
57308
  }
57310
57309
  }
57311
57310
 
57312
- function makeAmountObject(amount, currency, issuer) {
57311
+ function makeAmountObject(amount, currency = null, issuer = null) {
57313
57312
  if (typeof amount !== 'string')
57314
57313
  throw "Amount must be a string.";
57315
- if (currency !== XrplConstants.XRP && !issuer)
57316
- throw "Non-XRP currency must have an issuer.";
57317
57314
 
57318
- const amountObj = (currency == XrplConstants.XRP) ? amount : {
57315
+ const amountObj = !issuer ? amount : {
57319
57316
  currency: currency,
57320
57317
  issuer: issuer,
57321
57318
  value: amount
@@ -57940,7 +57937,9 @@ const XrplApiEvents = {
57940
57937
  const XrplConstants = {
57941
57938
  MAX_LEDGER_OFFSET: 10,
57942
57939
  XRP: 'XRP',
57943
- MIN_XRP_AMOUNT: '1' // drops
57940
+ XAH: 'XAH',
57941
+ MIN_XRP_AMOUNT: '1', // drops - deprecated
57942
+ MIN_DROPS: '1'
57944
57943
  }
57945
57944
 
57946
57945
  const XrplTransactionTypes = {
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.7",
9
+ "version": "0.6.21-definition-1.8",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",