@xyo-network/xl1-cli 1.19.5 → 1.19.6

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/dist/cli-min.mjs +45 -31
  2. package/package.json +4 -5
package/dist/cli-min.mjs CHANGED
@@ -20795,23 +20795,29 @@ var uniq = (arr) => {
20795
20795
  };
20796
20796
 
20797
20797
  // src/assertDefinedEx.ts
20798
- function assertDefinedEx(expr, messageOrFunc) {
20798
+ function assertDefinedEx(expr, func) {
20799
20799
  if (expr !== void 0) return expr;
20800
- if (typeof messageOrFunc === "function") {
20801
- const errorOrMessage = messageOrFunc(expr);
20800
+ if (typeof func === "function") {
20801
+ const errorOrMessage = func(expr);
20802
20802
  throw typeof errorOrMessage === "string" ? new Error(errorOrMessage) : errorOrMessage;
20803
20803
  }
20804
- throw new Error(messageOrFunc);
20804
+ if (func !== void 0) {
20805
+ throw new Error("Invalid assertEx usage: second argument must be a function or undefined");
20806
+ }
20807
+ throw new Error("Assertion failed: value is undefined");
20805
20808
  }
20806
20809
 
20807
20810
  // src/assertEx.ts
20808
- function assertEx(expr, messageOrFunc) {
20811
+ function assertEx(expr, func) {
20809
20812
  if (expr) return expr;
20810
- if (typeof messageOrFunc === "function") {
20811
- const errorOrMessage = messageOrFunc(expr);
20813
+ if (typeof func === "function") {
20814
+ const errorOrMessage = func(expr);
20812
20815
  throw typeof errorOrMessage === "string" ? new Error(errorOrMessage) : errorOrMessage;
20813
20816
  }
20814
- throw new Error(messageOrFunc);
20817
+ if (func !== void 0) {
20818
+ throw new Error("Invalid assertEx usage: second argument must be a function or undefined");
20819
+ }
20820
+ throw new Error("Assertion failed");
20815
20821
  }
20816
20822
 
20817
20823
  /** A special constant with type `never` */
@@ -35312,6 +35318,8 @@ var toHex = (value, config = {}) => {
35312
35318
  const { prefix = false } = config;
35313
35319
  return hexFrom(value, { prefix, ...config });
35314
35320
  };
35321
+
35322
+ // src/address/AddressValidationZod.ts
35315
35323
  var AddressValidationZod = string$2().refine((x) => HexZod.safeParse(x)).refine((x) => x.length === ADDRESS_LENGTH, { error: (e) => new Error(`Address must have 40 characters [${e.input}]`) }).transform((v) => v);
35316
35324
 
35317
35325
  // src/address/AddressTransformZod.ts
@@ -35332,20 +35340,6 @@ union$1([string$2(), bigint$1(), number$3()]).transform((value) => {
35332
35340
  }
35333
35341
  }).refine((x) => AddressValidationZod.safeParse(x).data).transform((x) => x);
35334
35342
 
35335
- // src/address/to.ts
35336
- var toAddress = (value, config = {}) => {
35337
- const { bitLength = 160, prefix = false } = config;
35338
- return hexFrom(value, {
35339
- bitLength,
35340
- prefix,
35341
- ...config
35342
- });
35343
- };
35344
-
35345
- // src/address/addressDeprecated.ts
35346
- string$2().regex(AddressRegEx);
35347
- string$2().toLowerCase().regex(AddressRegEx).transform((v) => toAddress(v));
35348
-
35349
35343
  // src/address/is.ts
35350
35344
  var isAddress = (value, config = {}) => {
35351
35345
  const { bitLength = 160, prefix = false } = config;
@@ -35371,6 +35365,16 @@ function asAddress(value, assert) {
35371
35365
  return assertError(void 0, assert, error.message);
35372
35366
  }
35373
35367
  }
35368
+
35369
+ // src/address/to.ts
35370
+ var toAddress = (value, config = {}) => {
35371
+ const { bitLength = 160, prefix = false } = config;
35372
+ return hexFrom(value, {
35373
+ bitLength,
35374
+ prefix,
35375
+ ...config
35376
+ });
35377
+ };
35374
35378
  var EthAddressRegEx = HexRegExMinMaxMixedCaseWithPrefix(20, 20);
35375
35379
  string$2().regex(EthAddressRegEx);
35376
35380
  string$2().regex(EthAddressRegEx).transform((v) => toEthAddress(v));
@@ -89239,15 +89243,20 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
89239
89243
  return [isPayloadBundle(p) ? await bundledPayloadToHydratedBlock(p) : void 0, p];
89240
89244
  }));
89241
89245
  return blockBundles.map(([block, bundle3]) => {
89242
- const result = [block ? block[0].chain === chainId && block[0].block > headNumber && isSignedHydratedBlockWithHashMeta(block) ? block : void 0 : void 0, bundle3];
89243
- if (result[0] === void 0) {
89246
+ const blockCheckPassed = !!block;
89247
+ const chainIdPassed = blockCheckPassed ? block[0].chain === chainId : false;
89248
+ const blockNumberPassed = blockCheckPassed ? block[0].block > headNumber : false;
89249
+ const typeCheckPassed = blockCheckPassed ? isSignedHydratedBlockWithHashMeta(block) : false;
89250
+ const validationPassed = blockCheckPassed && chainIdPassed && blockNumberPassed && typeCheckPassed;
89251
+ const validatedBlock = validationPassed ? block : void 0;
89252
+ if (!validationPassed) {
89244
89253
  this.logger?.info(`Pruning block bundle ${bundle3._hash} during simpleValidationCheck`);
89245
- this.logger?.info(` - chainId match: ${block ? block[0].chain === chainId : "n/a"}`);
89246
- this.logger?.info(` - headNumber check: ${block ? block[0].block > headNumber : "n/a"}`);
89247
- this.logger?.info(` - isSignedHydratedBlockWithHashMeta: ${block ? isSignedHydratedBlockWithHashMeta(block) : "n/a"}`);
89248
- this.logger?.info(` - block value: ${block ? JSON.stringify(block, null, 2) : "n/a"}`);
89254
+ this.logger?.info(` - chainId match: ${chainIdPassed}`);
89255
+ this.logger?.info(` - blockNumber check: ${blockNumberPassed}`);
89256
+ this.logger?.info(` - typeCheck: ${typeCheckPassed}`);
89257
+ this.logger?.info(` - bundle hash: ${bundle3._hash}`);
89249
89258
  }
89250
- return result;
89259
+ return [validatedBlock, bundle3];
89251
89260
  });
89252
89261
  }
89253
89262
  };
@@ -343170,10 +343179,15 @@ var ChainStepRewardsClaimSentinel = class extends AbstractSentinel {
343170
343179
  this._claimCheckCounter?.add(1, claimCounterAttributes);
343171
343180
  const stepRewardAddress = completedStepRewardAddress(stepIdentity);
343172
343181
  const balance = await this.viewer.account.balance.accountBalance(stepRewardAddress);
343182
+ this.logger?.info(`Found balance of ${balance} to claim for step ${stepIdentity.step} at block ${stepIdentity.block} in step reward address ${stepRewardAddress}`);
343173
343183
  if (balance > 0n) {
343174
- this.logger?.info(`Found balance of ${balance} to claim for step ${stepIdentity.step} at block ${stepIdentity.block}`);
343175
343184
  this._claimAttemptsCounter?.add(1, claimCounterAttributes);
343176
343185
  const rewardsByStaker = await this.viewer.networkStakeStepRewardPoolRewards(stepIdentity);
343186
+ const rewardRecipients = Object.keys(rewardsByStaker).length;
343187
+ this.logger?.info(`Found ${rewardRecipients} reward recipients for step ${stepIdentity.step} at block ${stepIdentity.block}`);
343188
+ if (!this.config.claimEmptySteps) {
343189
+ assertEx(rewardRecipients > 0, () => "No reward recipients for step");
343190
+ }
343177
343191
  const addressDistributions = this.calculateAddressDistributions(rewardsByStaker, balance);
343178
343192
  this.logger?.info(`Calculated address distributions for step ${stepIdentity.step} at block ${stepIdentity.block} with ${Object.keys(addressDistributions).length} addresses`);
343179
343193
  const tx = await this.submitRewardDistributionTransaction(stepRewardAddress, addressDistributions, stepIdentity, this.gateway);
@@ -350487,7 +350501,7 @@ var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
350487
350501
 
350488
350502
  // src/runCLI.ts
350489
350503
  var configuration;
350490
- var version = isDefined("1.19.4") ? "1.19.4" : "unknown";
350504
+ var version = isDefined("1.19.5") ? "1.19.5" : "unknown";
350491
350505
  var getContextFromConfig = /* @__PURE__ */ __name(async (configuration2) => {
350492
350506
  const logger = initLogger(configuration2);
350493
350507
  const orchestrator = await Orchestrator.create({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/xl1-cli",
3
- "version": "1.19.5",
3
+ "version": "1.19.6",
4
4
  "description": "XYO Layer One CLI",
5
5
  "homepage": "https://xylabs.com",
6
6
  "bugs": {
@@ -62,11 +62,10 @@
62
62
  },
63
63
  "devDependencies": {
64
64
  "@rollup/plugin-node-resolve": "^16.0.3",
65
- "@xylabs/sdk-js": "~5.0.64",
66
- "@xylabs/telemetry": "~5.0.64",
65
+ "@xylabs/sdk-js": "~5.0.65",
67
66
  "@xylabs/ts-scripts-yarn3": "~7.3.2",
68
67
  "@xylabs/tsconfig": "~7.3.2",
69
- "@xylabs/vitest-extended": "~5.0.64",
68
+ "@xylabs/vitest-extended": "~5.0.65",
70
69
  "@xyo-network/account-model": "~5.3.2",
71
70
  "@xyo-network/archivist-lmdb": "~5.3.2",
72
71
  "@xyo-network/archivist-memory": "~5.3.2",
@@ -75,7 +74,7 @@
75
74
  "@xyo-network/payload-model": "~5.3.2",
76
75
  "@xyo-network/wallet": "~5.3.2",
77
76
  "@xyo-network/wallet-model": "~5.3.2",
78
- "@xyo-network/xl1-cli-lib": "~1.19.5",
77
+ "@xyo-network/xl1-cli-lib": "~1.19.6",
79
78
  "@xyo-network/xl1-sdk": "~1.21.10",
80
79
  "async-mutex": "~0.5.0",
81
80
  "dotenv": "~17.2.3",