genlayer 0.33.1 → 0.34.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 (128) hide show
  1. package/dist/index.js +68 -31
  2. package/package.json +11 -2
  3. package/.eslintignore +0 -2
  4. package/.github/workflows/cli-docs.yml +0 -121
  5. package/.github/workflows/publish-beta.yml +0 -41
  6. package/.github/workflows/publish.yml +0 -43
  7. package/.github/workflows/validate-code.yml +0 -47
  8. package/.prettierignore +0 -19
  9. package/.prettierrc +0 -12
  10. package/.release-it.json +0 -64
  11. package/CHANGELOG.md +0 -419
  12. package/CLAUDE.md +0 -55
  13. package/CONTRIBUTING.md +0 -117
  14. package/docker-compose.yml +0 -154
  15. package/docs/delegator-guide.md +0 -203
  16. package/docs/validator-guide.md +0 -329
  17. package/esbuild.config.dev.js +0 -17
  18. package/esbuild.config.js +0 -22
  19. package/esbuild.config.prod.js +0 -17
  20. package/eslint.config.js +0 -60
  21. package/renovate.json +0 -22
  22. package/src/commands/account/create.ts +0 -29
  23. package/src/commands/account/export.ts +0 -106
  24. package/src/commands/account/import.ts +0 -135
  25. package/src/commands/account/index.ts +0 -126
  26. package/src/commands/account/list.ts +0 -34
  27. package/src/commands/account/lock.ts +0 -39
  28. package/src/commands/account/remove.ts +0 -30
  29. package/src/commands/account/send.ts +0 -156
  30. package/src/commands/account/show.ts +0 -74
  31. package/src/commands/account/unlock.ts +0 -51
  32. package/src/commands/account/use.ts +0 -21
  33. package/src/commands/config/getSetReset.ts +0 -51
  34. package/src/commands/config/index.ts +0 -30
  35. package/src/commands/contracts/call.ts +0 -39
  36. package/src/commands/contracts/code.ts +0 -33
  37. package/src/commands/contracts/deploy.ts +0 -157
  38. package/src/commands/contracts/index.ts +0 -86
  39. package/src/commands/contracts/schema.ts +0 -31
  40. package/src/commands/contracts/write.ts +0 -49
  41. package/src/commands/general/index.ts +0 -45
  42. package/src/commands/general/init.ts +0 -179
  43. package/src/commands/general/start.ts +0 -116
  44. package/src/commands/general/stop.ts +0 -26
  45. package/src/commands/localnet/index.ts +0 -100
  46. package/src/commands/localnet/validators.ts +0 -269
  47. package/src/commands/network/index.ts +0 -29
  48. package/src/commands/network/setNetwork.ts +0 -77
  49. package/src/commands/scaffold/index.ts +0 -16
  50. package/src/commands/scaffold/new.ts +0 -34
  51. package/src/commands/staking/StakingAction.ts +0 -267
  52. package/src/commands/staking/delegatorClaim.ts +0 -41
  53. package/src/commands/staking/delegatorExit.ts +0 -56
  54. package/src/commands/staking/delegatorJoin.ts +0 -44
  55. package/src/commands/staking/index.ts +0 -346
  56. package/src/commands/staking/setIdentity.ts +0 -78
  57. package/src/commands/staking/setOperator.ts +0 -46
  58. package/src/commands/staking/stakingInfo.ts +0 -584
  59. package/src/commands/staking/validatorClaim.ts +0 -43
  60. package/src/commands/staking/validatorDeposit.ts +0 -48
  61. package/src/commands/staking/validatorExit.ts +0 -63
  62. package/src/commands/staking/validatorHistory.ts +0 -298
  63. package/src/commands/staking/validatorJoin.ts +0 -47
  64. package/src/commands/staking/validatorPrime.ts +0 -73
  65. package/src/commands/staking/wizard.ts +0 -809
  66. package/src/commands/transactions/appeal.ts +0 -39
  67. package/src/commands/transactions/index.ts +0 -39
  68. package/src/commands/transactions/receipt.ts +0 -90
  69. package/src/commands/update/index.ts +0 -25
  70. package/src/commands/update/ollama.ts +0 -103
  71. package/src/lib/actions/BaseAction.ts +0 -295
  72. package/src/lib/clients/jsonRpcClient.ts +0 -41
  73. package/src/lib/clients/system.ts +0 -73
  74. package/src/lib/config/ConfigFileManager.ts +0 -194
  75. package/src/lib/config/KeychainManager.ts +0 -89
  76. package/src/lib/config/simulator.ts +0 -68
  77. package/src/lib/config/text.ts +0 -2
  78. package/src/lib/errors/missingRequirement.ts +0 -9
  79. package/src/lib/errors/versionRequired.ts +0 -9
  80. package/src/lib/interfaces/ISimulatorService.ts +0 -37
  81. package/src/lib/services/simulator.ts +0 -351
  82. package/src/types/node-fetch.d.ts +0 -1
  83. package/tests/actions/appeal.test.ts +0 -99
  84. package/tests/actions/call.test.ts +0 -94
  85. package/tests/actions/code.test.ts +0 -87
  86. package/tests/actions/create.test.ts +0 -65
  87. package/tests/actions/deploy.test.ts +0 -420
  88. package/tests/actions/getSetReset.test.ts +0 -88
  89. package/tests/actions/init.test.ts +0 -467
  90. package/tests/actions/lock.test.ts +0 -86
  91. package/tests/actions/new.test.ts +0 -80
  92. package/tests/actions/ollama.test.ts +0 -193
  93. package/tests/actions/receipt.test.ts +0 -261
  94. package/tests/actions/schema.test.ts +0 -94
  95. package/tests/actions/setNetwork.test.ts +0 -160
  96. package/tests/actions/staking.test.ts +0 -279
  97. package/tests/actions/start.test.ts +0 -235
  98. package/tests/actions/stop.test.ts +0 -77
  99. package/tests/actions/unlock.test.ts +0 -139
  100. package/tests/actions/validators.test.ts +0 -750
  101. package/tests/actions/write.test.ts +0 -102
  102. package/tests/commands/account.test.ts +0 -146
  103. package/tests/commands/appeal.test.ts +0 -58
  104. package/tests/commands/call.test.ts +0 -78
  105. package/tests/commands/code.test.ts +0 -69
  106. package/tests/commands/config.test.ts +0 -54
  107. package/tests/commands/deploy.test.ts +0 -83
  108. package/tests/commands/init.test.ts +0 -101
  109. package/tests/commands/localnet.test.ts +0 -131
  110. package/tests/commands/network.test.ts +0 -60
  111. package/tests/commands/new.test.ts +0 -68
  112. package/tests/commands/receipt.test.ts +0 -142
  113. package/tests/commands/schema.test.ts +0 -67
  114. package/tests/commands/staking.test.ts +0 -329
  115. package/tests/commands/stop.test.ts +0 -27
  116. package/tests/commands/up.test.ts +0 -105
  117. package/tests/commands/update.test.ts +0 -45
  118. package/tests/commands/write.test.ts +0 -76
  119. package/tests/index.test.ts +0 -56
  120. package/tests/libs/baseAction.test.ts +0 -516
  121. package/tests/libs/configFileManager.test.ts +0 -117
  122. package/tests/libs/jsonRpcClient.test.ts +0 -59
  123. package/tests/libs/keychainManager.test.ts +0 -156
  124. package/tests/libs/system.test.ts +0 -148
  125. package/tests/services/simulator.test.ts +0 -705
  126. package/tests/utils.ts +0 -13
  127. package/tsconfig.json +0 -120
  128. package/vitest.config.ts +0 -12
package/dist/index.js CHANGED
@@ -20078,7 +20078,7 @@ var require_cli_table3 = __commonJS({
20078
20078
  import { program } from "commander";
20079
20079
 
20080
20080
  // package.json
20081
- var version = "0.33.1";
20081
+ var version = "0.34.1";
20082
20082
  var package_default = {
20083
20083
  name: "genlayer",
20084
20084
  version,
@@ -20088,10 +20088,19 @@ var package_default = {
20088
20088
  bin: {
20089
20089
  genlayer: "./dist/index.js"
20090
20090
  },
20091
+ files: [
20092
+ "dist",
20093
+ "scripts",
20094
+ "templates",
20095
+ ".env.example",
20096
+ "README.md",
20097
+ "LICENSE"
20098
+ ],
20091
20099
  scripts: {
20092
20100
  test: "vitest",
20093
20101
  "test:watch": "vitest --watch",
20094
20102
  "test:coverage": "vitest run --coverage",
20103
+ "test:smoke": "vitest run --config vitest.smoke.config.ts",
20095
20104
  dev: "cross-env NODE_ENV=development node esbuild.config.js",
20096
20105
  build: "cross-env NODE_ENV=production node esbuild.config.js",
20097
20106
  release: "release-it --ci",
@@ -20101,7 +20110,7 @@ var package_default = {
20101
20110
  },
20102
20111
  repository: {
20103
20112
  type: "git",
20104
- url: "git+https://github.com/yeagerai/genlayer-cli.git"
20113
+ url: "git+https://github.com/genlayerlabs/genlayer-cli.git"
20105
20114
  },
20106
20115
  keywords: [
20107
20116
  "genlayer",
@@ -48674,17 +48683,22 @@ var _BaseAction = class _BaseAction extends ConfigFileManager {
48674
48683
  getAddress(keystoreData) {
48675
48684
  return keystoreData.address;
48676
48685
  }
48677
- async createKeypairByName(accountName, overwrite) {
48686
+ async createKeypairByName(accountName, overwrite, passwordInput) {
48678
48687
  const keystorePath = this.getKeystorePath(accountName);
48679
48688
  this.stopSpinner();
48680
48689
  if (existsSync(keystorePath) && !overwrite) {
48681
48690
  this.failSpinner(`Account '${accountName}' already exists. Use '--overwrite' to replace it.`);
48682
48691
  }
48683
48692
  const wallet = ethers.Wallet.createRandom();
48684
- const password = await this.promptPassword("Enter a password to encrypt your keystore (minimum 8 characters):");
48685
- const confirmPassword = await this.promptPassword("Confirm password:");
48686
- if (password !== confirmPassword) {
48687
- this.failSpinner("Passwords do not match");
48693
+ let password;
48694
+ if (passwordInput) {
48695
+ password = passwordInput;
48696
+ } else {
48697
+ password = await this.promptPassword("Enter a password to encrypt your keystore (minimum 8 characters):");
48698
+ const confirmPassword = await this.promptPassword("Confirm password:");
48699
+ if (password !== confirmPassword) {
48700
+ this.failSpinner("Passwords do not match");
48701
+ }
48688
48702
  }
48689
48703
  if (password.length < _BaseAction.MIN_PASSWORD_LENGTH) {
48690
48704
  this.failSpinner(`Password must be at least ${_BaseAction.MIN_PASSWORD_LENGTH} characters long`);
@@ -50011,7 +50025,7 @@ var CreateAccountAction = class extends BaseAction {
50011
50025
  async execute(options) {
50012
50026
  try {
50013
50027
  this.startSpinner(`Creating account '${options.name}'...`);
50014
- await this.createKeypairByName(options.name, options.overwrite);
50028
+ await this.createKeypairByName(options.name, options.overwrite, options.password);
50015
50029
  if (options.setActive !== false) {
50016
50030
  this.setActiveAccount(options.name);
50017
50031
  }
@@ -50216,9 +50230,14 @@ var UnlockAccountAction = class extends BaseAction {
50216
50230
  this.failSpinner("Invalid keystore format.");
50217
50231
  return;
50218
50232
  }
50219
- this.stopSpinner();
50220
50233
  try {
50221
- const password = await this.promptPassword(`Enter password to unlock '${accountName}':`);
50234
+ let password;
50235
+ if (options?.password) {
50236
+ password = options.password;
50237
+ } else {
50238
+ this.stopSpinner();
50239
+ password = await this.promptPassword(`Enter password to unlock '${accountName}':`);
50240
+ }
50222
50241
  const wallet = await ethers4.Wallet.fromEncryptedJson(keystoreJson, password);
50223
50242
  await this.keychainManager.storePrivateKey(accountName, wallet.privateKey);
50224
50243
  this.succeedSpinner(`Account '${accountName}' unlocked! Private key cached in OS keychain.`);
@@ -50308,9 +50327,14 @@ var SendAction = class extends BaseAction {
50308
50327
  if (cachedKey) {
50309
50328
  privateKey = cachedKey;
50310
50329
  } else {
50311
- this.stopSpinner();
50312
- const password = await this.promptPassword(`Enter password to unlock account '${accountName}':`);
50313
- this.startSpinner("Preparing transfer...");
50330
+ let password;
50331
+ if (options.password) {
50332
+ password = options.password;
50333
+ } else {
50334
+ this.stopSpinner();
50335
+ password = await this.promptPassword(`Enter password to unlock account '${accountName}':`);
50336
+ this.startSpinner("Preparing transfer...");
50337
+ }
50314
50338
  const wallet = await ethers5.Wallet.fromEncryptedJson(keystoreJson, password);
50315
50339
  privateKey = wallet.privateKey;
50316
50340
  }
@@ -50458,7 +50482,7 @@ function initializeAccountCommands(program2) {
50458
50482
  const showAction = new ShowAccountAction();
50459
50483
  await showAction.execute(options);
50460
50484
  });
50461
- accountCommand.command("create").description("Create a new account with encrypted keystore").requiredOption("--name <name>", "Name for the account").option("--overwrite", "Overwrite existing account", false).option("--no-set-active", "Do not set as active account").action(async (options) => {
50485
+ accountCommand.command("create").description("Create a new account with encrypted keystore").requiredOption("--name <name>", "Name for the account").option("--password <password>", "Password for the keystore (skips interactive prompt)").option("--overwrite", "Overwrite existing account", false).option("--no-set-active", "Do not set as active account").action(async (options) => {
50462
50486
  const createAction = new CreateAccountAction();
50463
50487
  await createAction.execute(options);
50464
50488
  });
@@ -50478,11 +50502,11 @@ function initializeAccountCommands(program2) {
50478
50502
  const removeAction = new RemoveAccountAction();
50479
50503
  await removeAction.execute(name, options);
50480
50504
  });
50481
- accountCommand.command("send <to> <amount>").description("Send GEN to an address").option("--rpc <rpcUrl>", "RPC URL for the network").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--account <name>", "Account to send from").action(async (to, amount, options) => {
50505
+ accountCommand.command("send <to> <amount>").description("Send GEN to an address").option("--rpc <rpcUrl>", "RPC URL for the network").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--account <name>", "Account to send from").option("--password <password>", "Password to unlock account (skips interactive prompt)").action(async (to, amount, options) => {
50482
50506
  const sendAction = new SendAction();
50483
- await sendAction.execute({ to, amount, rpc: options.rpc, network: options.network, account: options.account });
50507
+ await sendAction.execute({ to, amount, rpc: options.rpc, network: options.network, account: options.account, password: options.password });
50484
50508
  });
50485
- accountCommand.command("unlock").description("Unlock account by caching private key in OS keychain").option("--account <name>", "Account to unlock").action(async (options) => {
50509
+ accountCommand.command("unlock").description("Unlock account by caching private key in OS keychain").option("--account <name>", "Account to unlock").option("--password <password>", "Password to unlock account (skips interactive prompt)").action(async (options) => {
50486
50510
  const unlockAction = new UnlockAccountAction();
50487
50511
  await unlockAction.execute(options);
50488
50512
  });
@@ -51321,6 +51345,7 @@ var StakingAction = class extends BaseAction {
51321
51345
  constructor() {
51322
51346
  super();
51323
51347
  __publicField(this, "_stakingClient", null);
51348
+ __publicField(this, "_passwordOverride");
51324
51349
  }
51325
51350
  getNetwork(config) {
51326
51351
  if (config.network) {
@@ -51337,6 +51362,9 @@ var StakingAction = class extends BaseAction {
51337
51362
  if (config.account) {
51338
51363
  this.accountOverride = config.account;
51339
51364
  }
51365
+ if (config.password) {
51366
+ this._passwordOverride = config.password;
51367
+ }
51340
51368
  const network = this.getNetwork(config);
51341
51369
  if (config.stakingAddress) {
51342
51370
  network.stakingContract = {
@@ -51401,8 +51429,13 @@ var StakingAction = class extends BaseAction {
51401
51429
  return cachedKey;
51402
51430
  }
51403
51431
  }
51404
- this.stopSpinner();
51405
- const password = await this.promptPassword(`Enter password to unlock account '${accountName}':`);
51432
+ let password;
51433
+ if (this._passwordOverride) {
51434
+ password = this._passwordOverride;
51435
+ } else {
51436
+ this.stopSpinner();
51437
+ password = await this.promptPassword(`Enter password to unlock account '${accountName}':`);
51438
+ }
51406
51439
  this.startSpinner("Unlocking account...");
51407
51440
  const wallet = await ethers6.Wallet.fromEncryptedJson(keystoreJson, password);
51408
51441
  return wallet.privateKey;
@@ -51431,6 +51464,9 @@ var StakingAction = class extends BaseAction {
51431
51464
  if (config.account) {
51432
51465
  this.accountOverride = config.account;
51433
51466
  }
51467
+ if (config.password) {
51468
+ this._passwordOverride = config.password;
51469
+ }
51434
51470
  const network = this.getNetwork(config);
51435
51471
  const rpcUrl = config.rpc || network.rpcUrls.default.http[0];
51436
51472
  const privateKey = await this.getPrivateKeyForStaking();
@@ -52324,7 +52360,8 @@ var SLASH_EVENT_ABI = {
52324
52360
  { name: "validator", type: "address", indexed: true },
52325
52361
  { name: "txId", type: "bytes32", indexed: false },
52326
52362
  { name: "epoch", type: "uint256", indexed: false },
52327
- { name: "percentage", type: "uint256", indexed: false }
52363
+ { name: "percentage", type: "uint256", indexed: false },
52364
+ { name: "txStatus", type: "uint8", indexed: false }
52328
52365
  ]
52329
52366
  };
52330
52367
  var REWARD_EVENT_ABI = {
@@ -53162,11 +53199,11 @@ function initializeStakingCommands(program2) {
53162
53199
  const wizard = new ValidatorWizardAction();
53163
53200
  await wizard.execute(options);
53164
53201
  });
53165
- staking.command("validator-join").description("Join as a validator by staking tokens").requiredOption("--amount <amount>", "Amount to stake (in wei or with 'eth'/'gen' suffix, e.g., '42000gen')").option("--operator <address>", "Operator address (defaults to signer)").option("--account <name>", "Account to use").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (options) => {
53202
+ staking.command("validator-join").description("Join as a validator by staking tokens").requiredOption("--amount <amount>", "Amount to stake (in wei or with 'eth'/'gen' suffix, e.g., '42000gen')").option("--operator <address>", "Operator address (defaults to signer)").option("--account <name>", "Account to use").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (options) => {
53166
53203
  const action = new ValidatorJoinAction();
53167
53204
  await action.execute(options);
53168
53205
  });
53169
- staking.command("validator-deposit [validator]").description("Make an additional deposit to a validator wallet").option("--validator <address>", "Validator wallet contract address (deprecated, use positional arg)").requiredOption("--amount <amount>", "Amount to deposit (in wei or with 'eth'/'gen' suffix)").option("--account <name>", "Account to use (must be validator owner)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").action(async (validatorArg, options) => {
53206
+ staking.command("validator-deposit [validator]").description("Make an additional deposit to a validator wallet").option("--validator <address>", "Validator wallet contract address (deprecated, use positional arg)").requiredOption("--amount <amount>", "Amount to deposit (in wei or with 'eth'/'gen' suffix)").option("--account <name>", "Account to use (must be validator owner)").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").action(async (validatorArg, options) => {
53170
53207
  const validator = validatorArg || options.validator;
53171
53208
  if (!validator) {
53172
53209
  console.error("Error: validator address is required");
@@ -53175,7 +53212,7 @@ function initializeStakingCommands(program2) {
53175
53212
  const action = new ValidatorDepositAction();
53176
53213
  await action.execute({ ...options, validator });
53177
53214
  });
53178
- staking.command("validator-exit [validator]").description("Exit as a validator by withdrawing shares").option("--validator <address>", "Validator wallet contract address (deprecated, use positional arg)").requiredOption("--shares <shares>", "Number of shares to withdraw").option("--account <name>", "Account to use (must be validator owner)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").action(async (validatorArg, options) => {
53215
+ staking.command("validator-exit [validator]").description("Exit as a validator by withdrawing shares").option("--validator <address>", "Validator wallet contract address (deprecated, use positional arg)").requiredOption("--shares <shares>", "Number of shares to withdraw").option("--account <name>", "Account to use (must be validator owner)").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").action(async (validatorArg, options) => {
53179
53216
  const validator = validatorArg || options.validator;
53180
53217
  if (!validator) {
53181
53218
  console.error("Error: validator address is required");
@@ -53184,7 +53221,7 @@ function initializeStakingCommands(program2) {
53184
53221
  const action = new ValidatorExitAction();
53185
53222
  await action.execute({ ...options, validator });
53186
53223
  });
53187
- staking.command("validator-claim [validator]").description("Claim validator withdrawals after unbonding period").option("--validator <address>", "Validator wallet contract address (deprecated, use positional arg)").option("--account <name>", "Account to use").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").action(async (validatorArg, options) => {
53224
+ staking.command("validator-claim [validator]").description("Claim validator withdrawals after unbonding period").option("--validator <address>", "Validator wallet contract address (deprecated, use positional arg)").option("--account <name>", "Account to use").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").action(async (validatorArg, options) => {
53188
53225
  const validator = validatorArg || options.validator;
53189
53226
  if (!validator) {
53190
53227
  console.error("Error: validator address is required");
@@ -53193,7 +53230,7 @@ function initializeStakingCommands(program2) {
53193
53230
  const action = new ValidatorClaimAction();
53194
53231
  await action.execute({ ...options, validator });
53195
53232
  });
53196
- staking.command("validator-prime [validator]").description("Prime a validator to prepare their stake record for the next epoch").option("--validator <address>", "Validator address to prime (deprecated, use positional arg)").option("--account <name>", "Account to use").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (validatorArg, options) => {
53233
+ staking.command("validator-prime [validator]").description("Prime a validator to prepare their stake record for the next epoch").option("--validator <address>", "Validator address to prime (deprecated, use positional arg)").option("--account <name>", "Account to use").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (validatorArg, options) => {
53197
53234
  const validator = validatorArg || options.validator;
53198
53235
  if (!validator) {
53199
53236
  console.error("Error: validator address is required");
@@ -53202,11 +53239,11 @@ function initializeStakingCommands(program2) {
53202
53239
  const action = new ValidatorPrimeAction();
53203
53240
  await action.execute({ ...options, validator });
53204
53241
  });
53205
- staking.command("prime-all").description("Prime all validators that need priming").option("--account <name>", "Account to use (pays gas)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (options) => {
53242
+ staking.command("prime-all").description("Prime all validators that need priming").option("--account <name>", "Account to use (pays gas)").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (options) => {
53206
53243
  const action = new ValidatorPrimeAction();
53207
53244
  await action.primeAll(options);
53208
53245
  });
53209
- staking.command("set-operator [validator] [operator]").description("Change the operator address for a validator wallet").option("--validator <address>", "Validator wallet address (deprecated, use positional arg)").option("--operator <address>", "New operator address (deprecated, use positional arg)").option("--account <name>", "Account to use (must be validator owner)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").action(async (validatorArg, operatorArg, options) => {
53246
+ staking.command("set-operator [validator] [operator]").description("Change the operator address for a validator wallet").option("--validator <address>", "Validator wallet address (deprecated, use positional arg)").option("--operator <address>", "New operator address (deprecated, use positional arg)").option("--account <name>", "Account to use (must be validator owner)").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").action(async (validatorArg, operatorArg, options) => {
53210
53247
  const validator = validatorArg || options.validator;
53211
53248
  const operator = operatorArg || options.operator;
53212
53249
  if (!validator || !operator) {
@@ -53216,7 +53253,7 @@ function initializeStakingCommands(program2) {
53216
53253
  const action = new SetOperatorAction();
53217
53254
  await action.execute({ ...options, validator, operator });
53218
53255
  });
53219
- staking.command("set-identity [validator]").description("Set validator identity metadata (moniker, website, socials, etc.)").option("--validator <address>", "Validator wallet address (deprecated, use positional arg)").requiredOption("--moniker <name>", "Validator display name").option("--logo-uri <uri>", "Logo URI").option("--website <url>", "Website URL").option("--description <text>", "Description").option("--email <email>", "Contact email").option("--twitter <handle>", "Twitter handle").option("--telegram <handle>", "Telegram handle").option("--github <handle>", "GitHub handle").option("--extra-cid <cid>", "Extra data as IPFS CID or hex bytes (0x...)").option("--account <name>", "Account to use (must be validator operator)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").action(async (validatorArg, options) => {
53256
+ staking.command("set-identity [validator]").description("Set validator identity metadata (moniker, website, socials, etc.)").option("--validator <address>", "Validator wallet address (deprecated, use positional arg)").requiredOption("--moniker <name>", "Validator display name").option("--logo-uri <uri>", "Logo URI").option("--website <url>", "Website URL").option("--description <text>", "Description").option("--email <email>", "Contact email").option("--twitter <handle>", "Twitter handle").option("--telegram <handle>", "Telegram handle").option("--github <handle>", "GitHub handle").option("--extra-cid <cid>", "Extra data as IPFS CID or hex bytes (0x...)").option("--account <name>", "Account to use (must be validator operator)").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").action(async (validatorArg, options) => {
53220
53257
  const validator = validatorArg || options.validator;
53221
53258
  if (!validator) {
53222
53259
  console.error("Error: validator address is required");
@@ -53225,7 +53262,7 @@ function initializeStakingCommands(program2) {
53225
53262
  const action = new SetIdentityAction();
53226
53263
  await action.execute({ ...options, validator });
53227
53264
  });
53228
- staking.command("delegator-join [validator]").description("Join as a delegator by staking with a validator").option("--validator <address>", "Validator address to delegate to (deprecated, use positional arg)").requiredOption("--amount <amount>", "Amount to stake (in wei or with 'eth'/'gen' suffix)").option("--account <name>", "Account to use").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (validatorArg, options) => {
53265
+ staking.command("delegator-join [validator]").description("Join as a delegator by staking with a validator").option("--validator <address>", "Validator address to delegate to (deprecated, use positional arg)").requiredOption("--amount <amount>", "Amount to stake (in wei or with 'eth'/'gen' suffix)").option("--account <name>", "Account to use").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (validatorArg, options) => {
53229
53266
  const validator = validatorArg || options.validator;
53230
53267
  if (!validator) {
53231
53268
  console.error("Error: validator address is required");
@@ -53234,7 +53271,7 @@ function initializeStakingCommands(program2) {
53234
53271
  const action = new DelegatorJoinAction();
53235
53272
  await action.execute({ ...options, validator });
53236
53273
  });
53237
- staking.command("delegator-exit [validator]").description("Exit as a delegator by withdrawing shares from a validator").option("--validator <address>", "Validator address to exit from (deprecated, use positional arg)").requiredOption("--shares <shares>", "Number of shares to withdraw").option("--account <name>", "Account to use").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (validatorArg, options) => {
53274
+ staking.command("delegator-exit [validator]").description("Exit as a delegator by withdrawing shares from a validator").option("--validator <address>", "Validator address to exit from (deprecated, use positional arg)").requiredOption("--shares <shares>", "Number of shares to withdraw").option("--account <name>", "Account to use").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (validatorArg, options) => {
53238
53275
  const validator = validatorArg || options.validator;
53239
53276
  if (!validator) {
53240
53277
  console.error("Error: validator address is required");
@@ -53243,7 +53280,7 @@ function initializeStakingCommands(program2) {
53243
53280
  const action = new DelegatorExitAction();
53244
53281
  await action.execute({ ...options, validator });
53245
53282
  });
53246
- staking.command("delegator-claim [validator]").description("Claim delegator withdrawals after unbonding period").option("--validator <address>", "Validator address (deprecated, use positional arg)").option("--delegator <address>", "Delegator address (defaults to signer)").option("--account <name>", "Account to use").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (validatorArg, options) => {
53283
+ staking.command("delegator-claim [validator]").description("Claim delegator withdrawals after unbonding period").option("--validator <address>", "Validator address (deprecated, use positional arg)").option("--delegator <address>", "Delegator address (defaults to signer)").option("--account <name>", "Account to use").option("--password <password>", "Password to unlock account (skips interactive prompt)").option("--network <network>", "Network to use (localnet, testnet-asimov)").option("--rpc <rpcUrl>", "RPC URL for the network").option("--staking-address <address>", "Staking contract address (overrides chain config)").action(async (validatorArg, options) => {
53247
53284
  const validator = validatorArg || options.validator;
53248
53285
  if (!validator) {
53249
53286
  console.error("Error: validator address is required");
package/package.json CHANGED
@@ -1,16 +1,25 @@
1
1
  {
2
2
  "name": "genlayer",
3
- "version": "0.33.1",
3
+ "version": "0.34.1",
4
4
  "description": "GenLayer Command Line Tool",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
7
7
  "bin": {
8
8
  "genlayer": "./dist/index.js"
9
9
  },
10
+ "files": [
11
+ "dist",
12
+ "scripts",
13
+ "templates",
14
+ ".env.example",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
10
18
  "scripts": {
11
19
  "test": "vitest",
12
20
  "test:watch": "vitest --watch",
13
21
  "test:coverage": "vitest run --coverage",
22
+ "test:smoke": "vitest run --config vitest.smoke.config.ts",
14
23
  "dev": "cross-env NODE_ENV=development node esbuild.config.js",
15
24
  "build": "cross-env NODE_ENV=production node esbuild.config.js",
16
25
  "release": "release-it --ci",
@@ -20,7 +29,7 @@
20
29
  },
21
30
  "repository": {
22
31
  "type": "git",
23
- "url": "git+https://github.com/yeagerai/genlayer-cli.git"
32
+ "url": "git+https://github.com/genlayerlabs/genlayer-cli.git"
24
33
  },
25
34
  "keywords": [
26
35
  "genlayer",
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules
2
- dist
@@ -1,121 +0,0 @@
1
- name: Generate CLI Docs and PR to genlayer-docs
2
-
3
- on:
4
- workflow_dispatch:
5
- release:
6
- types: [published]
7
-
8
- jobs:
9
- generate-and-sync:
10
- # Skip for pre-releases (tags containing '-') unless manually dispatched
11
- if: github.event_name != 'release' || !contains(github.event.release.tag_name, '-')
12
- runs-on: ubuntu-latest
13
- permissions:
14
- contents: read
15
- steps:
16
- - name: Checkout CLI repo
17
- uses: actions/checkout@v4
18
-
19
- - name: Setup Node.js
20
- uses: actions/setup-node@v4
21
- with:
22
- node-version: '20'
23
- cache: 'npm'
24
-
25
- - name: Install dependencies
26
- run: npm ci
27
-
28
- - name: Build
29
- run: npm run build
30
-
31
- - name: Determine version for docs
32
- id: version
33
- run: |
34
- if [ "${{ github.event_name }}" = "release" ]; then
35
- echo "value=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
36
- else
37
- # Prefer package.json version when not a release event
38
- echo "value=$(node -p \"require('./package.json').version\")" >> $GITHUB_OUTPUT
39
- fi
40
-
41
- - name: Generate CLI docs (MDX)
42
- env:
43
- DOCS_CLEAN: 'true'
44
- DOCS_VERSION: ${{ steps.version.outputs.value }}
45
- run: node scripts/generate-cli-docs.mjs | cat
46
-
47
- - name: Set up Git (for committing to CLI repo)
48
- run: |
49
- git config user.name "github-actions[bot]"
50
- git config user.email "github-actions[bot]@users.noreply.github.com"
51
-
52
- - name: Commit and push docs back to CLI repo (non-beta releases)
53
- if: github.event_name == 'release' && !contains(github.event.release.tag_name, '-')
54
- run: |
55
- set -euo pipefail
56
- if [ -n "$(git status --porcelain docs/api-references || true)" ]; then
57
- git add docs/api-references
58
- VERSION=${{ steps.version.outputs.value }}
59
- git commit -m "docs(cli): update API reference for ${VERSION}"
60
- git push
61
- else
62
- echo "No docs changes to commit"
63
- fi
64
-
65
- - name: Checkout docs repo
66
- uses: actions/checkout@v4
67
- with:
68
- repository: genlayerlabs/genlayer-docs
69
- token: ${{ secrets.DOCS_REPO_TOKEN || secrets.GITHUB_TOKEN }}
70
- path: docs-repo
71
- fetch-depth: 0
72
-
73
- - name: Prepare branch
74
- working-directory: docs-repo
75
- run: |
76
- set -euo pipefail
77
- git config user.name "github-actions[bot]"
78
- git config user.email "github-actions[bot]@users.noreply.github.com"
79
- BRANCH="docs/cli/${{ github.repository }}-${{ github.ref_name }}-${{ github.run_id }}"
80
- git switch -c "$BRANCH" || git switch "$BRANCH"
81
- echo "BRANCH=$BRANCH" >> $GITHUB_ENV
82
-
83
- - name: Sync CLI docs into docs repo
84
- run: |
85
- set -euo pipefail
86
- mkdir -p docs-repo/pages/api-references/genlayer-cli
87
- rsync -a --delete "${{ github.workspace }}/docs/api-references/" docs-repo/pages/api-references/genlayer-cli/
88
- echo "Synced files:" && ls -la docs-repo/pages/api-references/genlayer-cli | cat
89
-
90
- - name: Commit changes
91
- working-directory: docs-repo
92
- run: |
93
- set -euo pipefail
94
- if [ -n "$(git status --porcelain)" ]; then
95
- git add pages/api-references/genlayer-cli
96
- git commit -m "docs(cli): sync API reference ${VERSION:-${{ env.VERSION }}}"
97
- git push --set-upstream origin "$BRANCH"
98
- echo "HAS_CHANGES=true" >> $GITHUB_ENV
99
- else
100
- echo "No changes to commit"
101
- echo "HAS_CHANGES=false" >> $GITHUB_ENV
102
- fi
103
-
104
- - name: Create PR in docs repo
105
- if: env.HAS_CHANGES == 'true'
106
- uses: peter-evans/create-pull-request@v6
107
- with:
108
- token: ${{ secrets.DOCS_REPO_TOKEN || secrets.GITHUB_TOKEN }}
109
- path: docs-repo
110
- commit-message: "docs(cli): sync API reference ${{ steps.version.outputs.value }}"
111
- branch: ${{ env.BRANCH }}
112
- title: "docs(cli): sync CLI API reference ${{ steps.version.outputs.value }}"
113
- body: |
114
- This PR updates the GenlayerCLI API Reference generated automatically from `${{ github.repository }}`.
115
-
116
- - Version: `${{ steps.version.outputs.value }}`
117
- - Source commit: `${{ github.sha }}`
118
- - Trigger: `${{ github.event_name }}`
119
- labels: documentation, cli
120
-
121
-
@@ -1,41 +0,0 @@
1
- name: Release & Publish Beta version of the Package to NPM with @beta tag
2
-
3
- on:
4
- workflow_dispatch:
5
- push:
6
- branches:
7
- - staging
8
-
9
- jobs:
10
- release:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - name: Get CI Bot Token
14
- uses: tibdex/github-app-token@v2
15
- id: ci_bot_token
16
- with:
17
- app_id: ${{ secrets.CI_BOT_APP_ID }}
18
- private_key: ${{ secrets.CI_BOT_SECRET }}
19
-
20
- - name: Checkout source code
21
- uses: actions/checkout@v4
22
- with:
23
- token: ${{ steps.ci_bot_token.outputs.token }}
24
- - name: Setup Node.js
25
- uses: actions/setup-node@v4
26
- with:
27
- node-version: "22"
28
- - name: Install the dependencies
29
- run: npm ci
30
- - name: Initialize Git User
31
- run: |
32
- git config --global user.email "github-actions[bot]@genlayer.com"
33
- git config --global user.name "github-actions[bot]"
34
- - name: Initialize the NPM configuration
35
- run: npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
36
- env:
37
- NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
38
- - run: npm run release-beta
39
- env:
40
- GITHUB_TOKEN: ${{ steps.ci_bot_token.outputs.token }}
41
- NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -1,43 +0,0 @@
1
- name: Release & Publish Package to NPM
2
-
3
- on:
4
- workflow_dispatch:
5
- push:
6
- branches:
7
- - main
8
- paths-ignore:
9
- - 'docs/**'
10
-
11
- jobs:
12
- release:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - name: Get CI Bot Token
16
- uses: tibdex/github-app-token@v2
17
- id: ci_bot_token
18
- with:
19
- app_id: ${{ secrets.CI_BOT_APP_ID }}
20
- private_key: ${{ secrets.CI_BOT_SECRET }}
21
-
22
- - name: Checkout source code
23
- uses: actions/checkout@v4
24
- with:
25
- token: ${{ steps.ci_bot_token.outputs.token }}
26
- - name: Setup Node.js
27
- uses: actions/setup-node@v4
28
- with:
29
- node-version: "22"
30
- - name: Install the dependencies
31
- run: npm ci
32
- - name: Initialize Git User
33
- run: |
34
- git config --global user.email "github-actions[bot]@genlayer.com"
35
- git config --global user.name "github-actions[bot]"
36
- - name: Initialize the NPM configuration
37
- run: npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
38
- env:
39
- NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
40
- - run: npm run release
41
- env:
42
- GITHUB_TOKEN: ${{ steps.ci_bot_token.outputs.token }}
43
- NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -1,47 +0,0 @@
1
- name: CI Workflow
2
-
3
- on:
4
- pull_request:
5
- types:
6
- - opened
7
- - synchronize
8
- - reopened
9
- push:
10
- branches:
11
- - main
12
-
13
- jobs:
14
- build-and-test:
15
- name: Build and Test
16
- runs-on: ubuntu-latest
17
-
18
- steps:
19
- - name: Checkout code
20
- uses: actions/checkout@v4
21
-
22
- - name: Install libsecret runtime
23
- run: sudo apt-get update && sudo apt-get install -y libsecret-1-0
24
-
25
- - name: Set up Node.js
26
- uses: actions/setup-node@v4
27
- with:
28
- node-version: 18
29
- cache: "npm"
30
-
31
- - name: Install dependencies
32
- run: npm ci
33
-
34
- - name: Build the project
35
- run: npm run build
36
-
37
- - name: Run tests
38
- run: npm run test:coverage
39
-
40
- - name: Upload coverage report
41
- if: success()
42
- uses: codecov/codecov-action@v5.4.3
43
- with:
44
- verbose: true
45
- token: ${{ secrets.CODECOV_TOKEN }}
46
- fail_ci_if_error: true
47
- directory: coverage
package/.prettierignore DELETED
@@ -1,19 +0,0 @@
1
- # Node artifact files
2
- node_modules/
3
- dist/
4
- package-lock.json
5
- yarn.lock
6
- pnpm-lock.yaml
7
-
8
- # Log files
9
- *.log
10
-
11
- # Generated by MacOS
12
- .DS_Store
13
-
14
- # Generated by Windows
15
- Thumbs.db
16
-
17
- # aws
18
- .aws-sam
19
- .sam
package/.prettierrc DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "tabWidth": 2,
3
- "useTabs": false,
4
- "semi": true,
5
- "singleQuote": false,
6
- "jsxSingleQuote": false,
7
- "trailingComma": "all",
8
- "bracketSpacing": false,
9
- "bracketSameLine": false,
10
- "arrowParens": "avoid",
11
- "printWidth": 110
12
- }