evernode-js-client 0.6.8 → 0.6.10

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 +20 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -12477,10 +12477,20 @@ class BaseEvernodeClient {
12477
12477
  let paramData = Buffer.allocUnsafe(20);
12478
12478
  codec.decodeAccountID(hostAddress).copy(paramData);
12479
12479
 
12480
- // To obtain registration NFT Page Keylet and index.
12481
- const hostAcc = new XrplAccount(hostAddress, null, { xrplApi: this.xrplApi });
12482
- const regUriToken = (await hostAcc.getURITokens()).find(n => n.URI.startsWith(EvernodeConstants.TOKEN_PREFIX_HEX) && n.Issuer === this.config.registryAddress);
12483
- if (regUriToken) {
12480
+ const hostInfo = await this.getHostInfo(hostAddress);
12481
+
12482
+ let validPrune = false;
12483
+ // If this host is a transferer, it does not own a registration token
12484
+ if (!hostInfo.isATransferer) {
12485
+ const hostAcc = new XrplAccount(hostAddress, null, { xrplApi: this.xrplApi });
12486
+ const regUriToken = (await hostAcc.getURITokens()).find(n => n.URI.startsWith(EvernodeConstants.TOKEN_PREFIX_HEX) && n.Issuer === this.config.registryAddress);
12487
+ validPrune = !!regUriToken;
12488
+ }
12489
+ else
12490
+ validPrune = true;
12491
+
12492
+
12493
+ if (validPrune) {
12484
12494
  await this.xrplAcc.makePayment(this.config.registryAddress,
12485
12495
  XrplConstants.MIN_XRP_AMOUNT,
12486
12496
  XrplConstants.XRP,
@@ -13102,7 +13112,8 @@ const HOST_UPDATE_TOT_INS_COUNT_PARAM_OFFSET = 46;
13102
13112
  const HOST_UPDATE_ACT_INS_COUNT_PARAM_OFFSET = 50;
13103
13113
  const HOST_UPDATE_DESCRIPTION_PARAM_OFFSET = 54;
13104
13114
  const HOST_UPDATE_VERSION_PARAM_OFFSET = 80;
13105
- const HOST_UPDATE_PARAM_SIZE = 83;
13115
+ const HOST_UPDATE_EMAIL_ADDRESS_PARAM_OFFSET = 83;
13116
+ const HOST_UPDATE_PARAM_SIZE = 123;
13106
13117
 
13107
13118
  const VOTE_VALIDATION_ERR = "VOTE_VALIDATION_ERR";
13108
13119
 
@@ -13368,8 +13379,8 @@ class HostClient extends BaseEvernodeClient {
13368
13379
  return await this.isRegistered();
13369
13380
  }
13370
13381
 
13371
- async updateRegInfo(activeInstanceCount = null, version = null, totalInstanceCount = null, tokenID = null, countryCode = null, cpuMicroSec = null, ramMb = null, diskMb = null, description = null, options = {}) {
13372
- // <token_id(32)><country_code(2)><cpu_microsec(4)><ram_mb(4)><disk_mb(4)><total_instance_count(4)><active_instances(4)><description(26)><version(3)>
13382
+ async updateRegInfo(activeInstanceCount = null, version = null, totalInstanceCount = null, tokenID = null, countryCode = null, cpuMicroSec = null, ramMb = null, diskMb = null, description = null, emailAddress = null, options = {}) {
13383
+ // <token_id(32)><country_code(2)><cpu_microsec(4)><ram_mb(4)><disk_mb(4)><total_instance_count(4)><active_instances(4)><description(26)><version(3)><email(40)>
13373
13384
  const paramBuf = Buffer.alloc(HOST_UPDATE_PARAM_SIZE, 0);
13374
13385
  if (tokenID)
13375
13386
  Buffer.from(tokenID.substr(0, 32), "hex").copy(paramBuf, HOST_UPDATE_TOKEN_ID_PARAM_OFFSET);
@@ -13387,6 +13398,8 @@ class HostClient extends BaseEvernodeClient {
13387
13398
  paramBuf.writeUInt32LE(activeInstanceCount, HOST_UPDATE_ACT_INS_COUNT_PARAM_OFFSET);
13388
13399
  if (description)
13389
13400
  Buffer.from(description.substr(0, 26), "utf-8").copy(paramBuf, HOST_UPDATE_DESCRIPTION_PARAM_OFFSET);
13401
+ if (emailAddress)
13402
+ Buffer.from(emailAddress.substr(0, 40), "utf-8").copy(paramBuf, HOST_UPDATE_EMAIL_ADDRESS_PARAM_OFFSET);
13390
13403
  if (version) {
13391
13404
  const components = version.split('.').map(v => parseInt(v));
13392
13405
  if (components.length != 3)
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.8",
9
+ "version": "0.6.10",
10
10
  "dependencies": {
11
11
  "elliptic": "6.5.4",
12
12
  "libsodium-wrappers": "0.7.10",