evernode-js-client 0.5.17-beta-v3.2 → 0.5.17-beta-v3.1

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.
Files changed (2) hide show
  1. package/index.js +2 -53
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -13100,20 +13100,7 @@ class HostClient extends BaseEvernodeClient {
13100
13100
  Buffer.from(tosHash, 'hex').copy(uriBuf, prefixLen + 2, 0, halfToSLen);
13101
13101
  uriBuf.writeBigInt64BE(XflHelpers.getXfl(leaseAmount.toString()), prefixLen + 2 + halfToSLen);
13102
13102
  const uri = uriBuf.toString('base64');
13103
-
13104
- try {
13105
- await this.xrplAcc.mintURIToken(uri, null, { isBurnable: true, isHexUri: false });
13106
- } catch (e) {
13107
- // Re-minting the URIToken after burning that sold URIToken.
13108
- if (e.code === "tecDUPLICATE") {
13109
- const uriTokenId = this.xrplAcc.generateIssuedURITokenId(uri);
13110
- console.log(`Burning URIToken related to a previously sold lease.`);
13111
- await this.xrplAcc.burnURIToken(uriTokenId);
13112
- console.log("Re-mint the URIToken for the new lease offer.")
13113
- await this.xrplAcc.mintURIToken(uri, null, { isBurnable: true, isHexUri: false });
13114
- }
13115
- }
13116
-
13103
+ await this.xrplAcc.mintURIToken(uri, null, { isBurnable: true, isHexUri: false });
13117
13104
  const uriToken = await this.xrplAcc.getURITokenByUri(uri);
13118
13105
  if (!uriToken)
13119
13106
  throw "Offer lease NFT creation error.";
@@ -13159,15 +13146,6 @@ class HostClient extends BaseEvernodeClient {
13159
13146
  if (await this.isRegistered())
13160
13147
  throw "Host already registered.";
13161
13148
 
13162
- // Check whether are there lease offers in for the host due to a previous registration.
13163
- const existingLeaseURITokens = (await this.xrplAcc.getURITokens()).filter(n => EvernodeHelpers.isValidURI(n.URI, EvernodeConstants.LEASE_TOKEN_PREFIX_HEX));
13164
- if (existingLeaseURITokens) {
13165
- console.log("Burning unsold URITokens related to the previous leases.");
13166
- for (const uriToken of existingLeaseURITokens) {
13167
- await this.xrplAcc.burnURIToken(uriToken.index);
13168
- }
13169
- }
13170
-
13171
13149
  // Check whether is there any missed NFT sell offer that needs to be accepted
13172
13150
  // from the client-side in order to complete the registration.
13173
13151
  const registryAcc = new XrplAccount(this.config.registryAddress, null, { xrplApi: this.xrplApi });
@@ -15353,7 +15331,7 @@ class StateHelpers {
15353
15331
  voteBaseCountChangedTimestamp: Number(stateData.readBigUInt64BE(VOTER_BASE_COUNT_CHANGED_TIMESTAMP_OFFSET)),
15354
15332
  foundationLastVotedCandidateIdx: stateData.readUInt32BE(FOUNDATION_LAST_VOTED_CANDIDATE_IDX),
15355
15333
  foundationLastVotedTimestamp: Number(stateData.readBigUInt64BE(FOUNDATION_LAST_VOTED_TIMESTAMP_OFFSET)),
15356
- electedProposalUniqueId: stateData.slice(ELECTED_PROPOSAL_UNIQUE_ID_OFFSET, PROPOSAL_ELECTED_TIMESTAMP_OFFSET).toString('hex').toUpperCase(),
15334
+ electedProposalUniqueId: stateData.readUInt32BE(ELECTED_PROPOSAL_UNIQUE_ID_OFFSET),
15357
15335
  proposalElectedTimestamp: Number(stateData.readBigUInt64BE(PROPOSAL_ELECTED_TIMESTAMP_OFFSET)),
15358
15336
  updatedHookCount: stateData.readUInt8(UPDATED_HOOK_COUNT_OFFSET),
15359
15337
  supportVoteSent: stateData.readUInt8(FOUNDATION_SUPPORT_VOTE_FLAG_OFFSET)
@@ -16459,35 +16437,6 @@ class XrplAccount {
16459
16437
  const hexUri = isHexUri ? uri : TransactionHelper.asciiToHex(uri).toUpperCase();
16460
16438
  return tokens.find(t => t.URI == hexUri);
16461
16439
  }
16462
-
16463
-
16464
- generateIssuedURITokenId(uri) {
16465
- if (uri.length < 1 || uri.length > 256)
16466
- throw 'Invalid URI';
16467
-
16468
- const URITOKEN_LEDGER_TYPE_PREFIX = 85; // Decimal value of ASCII 'U'
16469
- const accIdHex = (codec.decodeAccountID(this.address)).toString('hex').toUpperCase();
16470
- let uriHex = '';
16471
- for (let n in uri) {
16472
- let digit = uri.charCodeAt(n).toString(16).toUpperCase();
16473
- uriHex += (digit.length == 1 ? '0' : '') + digit
16474
- }
16475
-
16476
- let hash = crypto.createHash('sha512');
16477
-
16478
- const typeBuf = Buffer.allocUnsafe(2);
16479
- typeBuf.writeInt16BE(URITOKEN_LEDGER_TYPE_PREFIX);
16480
-
16481
- const dataBuf = Buffer.from(`${accIdHex}${uriHex}`, 'hex');
16482
-
16483
- let output = hash.update(typeBuf);
16484
- output = hash.update(dataBuf);
16485
-
16486
- const digest = output.digest('hex');
16487
-
16488
- // Get the first 32 bytes of hash.
16489
- return digest.substring(0, 64).toUpperCase();
16490
- }
16491
16440
  }
16492
16441
 
16493
16442
  function makeAmountObject(amount, currency, issuer) {
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.5.17-beta-v3.2",
9
+ "version": "0.5.17-beta-v3.1",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",