genlayer 0.38.0 → 0.38.2

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.
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.38.0";
20081
+ var version = "0.38.2";
20082
20082
  var package_default = {
20083
20083
  name: "genlayer",
20084
20084
  version,
@@ -20093,6 +20093,7 @@ var package_default = {
20093
20093
  "scripts",
20094
20094
  "templates",
20095
20095
  ".env.example",
20096
+ "docker-compose.yml",
20096
20097
  "README.md",
20097
20098
  "LICENSE"
20098
20099
  ],
@@ -20186,9 +20187,9 @@ var DEFAULT_JSON_RPC_URL = "http://localhost:4000/api";
20186
20187
  var CONTAINERS_NAME_PREFIX = "/genlayer-";
20187
20188
  var IMAGES_NAME_PREFIX = "yeagerai";
20188
20189
  var DEFAULT_RUN_SIMULATOR_COMMAND = (location, profiles) => ({
20189
- darwin: `osascript -e 'tell application "Terminal" to do script "cd ${location} && docker compose build && docker compose -p genlayer ${profiles} up"'`,
20190
- win32: `start cmd.exe /c "cd /d ${location} && docker compose build && docker compose -p genlayer ${profiles} up && pause"`,
20191
- linux: `nohup bash -c 'cd ${location} && docker compose build && docker compose -p genlayer ${profiles} up -d '`
20190
+ darwin: `osascript -e 'tell application "Terminal" to do script "cd \\"${location}\\" && docker compose build && docker compose -p genlayer ${profiles} up"'`,
20191
+ win32: `cd /d "${location}" && docker compose build && docker compose -p genlayer ${profiles} up -d`,
20192
+ linux: `nohup bash -c 'cd "${location}" && docker compose build && docker compose -p genlayer ${profiles} up -d'`
20192
20193
  });
20193
20194
  var DEFAULT_RUN_DOCKER_COMMAND = {
20194
20195
  darwin: "open -a Docker",
@@ -54084,6 +54085,33 @@ Run npm install -g genlayer to update
54084
54085
  }
54085
54086
  return 0;
54086
54087
  }
54088
+ setupLocalhostAccess() {
54089
+ const overridePath = path3.join(this.location, "docker-compose.override.yml");
54090
+ const overrideContent = `# Auto-generated by genlayer CLI \u2014 enables localhost access for local development
54091
+ services:
54092
+ jsonrpc:
54093
+ volumes:
54094
+ - ./config-overrides/genvm-module-web.yaml:/genvm/config/genvm-module-web.yaml:ro
54095
+ extra_hosts:
54096
+ - "host.docker.internal:host-gateway"
54097
+ - "anvil-local:host-gateway"
54098
+ `;
54099
+ fs8.writeFileSync(overridePath, overrideContent);
54100
+ const configDir = path3.join(this.location, "config-overrides");
54101
+ if (!fs8.existsSync(configDir)) {
54102
+ fs8.mkdirSync(configDir, { recursive: true });
54103
+ }
54104
+ const genvmConfigPath = path3.join(configDir, "genvm-module-web.yaml");
54105
+ const genvmConfigContent = `# Auto-generated by genlayer CLI \u2014 allows GenVM to reach localhost services
54106
+ always_allow_hosts:
54107
+ - "localhost"
54108
+ - "127.0.0.1"
54109
+ - "host.docker.internal"
54110
+ - "anvil-local"
54111
+ `;
54112
+ fs8.writeFileSync(genvmConfigPath, genvmConfigContent);
54113
+ console.warn("\x1B[33m\u26A0 Localhost access enabled \u2014 GenVM can reach host services (Anvil, local APIs). Not for production use.\x1B[0m");
54114
+ }
54087
54115
  async isLocalnetRunning() {
54088
54116
  const genlayerContainers = await this.getGenlayerContainers();
54089
54117
  const runningContainers = genlayerContainers.filter((container) => container.State === "running");
@@ -54191,6 +54219,7 @@ var InitAction = class extends BaseAction {
54191
54219
  this.simulatorService.addConfigToEnvFile(aiProvidersEnvVars);
54192
54220
  this.simulatorService.addConfigToEnvFile({ LOCALNETVERSION: localnetVersion });
54193
54221
  this.setSpinnerText("Running GenLayer Localnet...");
54222
+ this.simulatorService.setupLocalhostAccess();
54194
54223
  await this.simulatorService.runSimulator();
54195
54224
  this.setSpinnerText("Waiting for localnet to be ready...");
54196
54225
  const { initialized, errorCode, errorMessage } = await this.simulatorService.waitForSimulatorToBeReady();
@@ -54259,6 +54288,7 @@ var StartAction = class extends BaseAction {
54259
54288
  const restartValidatorsHintText = resetValidators ? `creating new ${numValidators} random validators` : "keeping the existing validators";
54260
54289
  this.setSpinnerText(`Starting GenLayer Localnet (${restartValidatorsHintText})...`);
54261
54290
  try {
54291
+ this.simulatorService.setupLocalhostAccess();
54262
54292
  await this.simulatorService.runSimulator();
54263
54293
  } catch (error) {
54264
54294
  this.failSpinner("Error starting the simulator", error);
@@ -54362,7 +54392,7 @@ function initializeGeneralCommands(program2) {
54362
54392
  }
54363
54393
 
54364
54394
  // src/commands/account/show.ts
54365
- import { readFileSync as readFileSync3, existsSync as existsSync2 } from "fs";
54395
+ import { readFileSync as readFileSync3, existsSync as existsSync3 } from "fs";
54366
54396
  var ShowAccountAction = class extends BaseAction {
54367
54397
  constructor() {
54368
54398
  super();
@@ -54378,7 +54408,7 @@ var ShowAccountAction = class extends BaseAction {
54378
54408
  }
54379
54409
  const accountName = this.resolveAccountName();
54380
54410
  const keystorePath = this.getKeystorePath(accountName);
54381
- if (!existsSync2(keystorePath)) {
54411
+ if (!existsSync3(keystorePath)) {
54382
54412
  this.failSpinner(`Account '${accountName}' not found. Run 'genlayer account create --name ${accountName}' first.`);
54383
54413
  return;
54384
54414
  }
@@ -54436,7 +54466,7 @@ var CreateAccountAction = class extends BaseAction {
54436
54466
 
54437
54467
  // src/commands/account/import.ts
54438
54468
  import { ethers as ethers2 } from "ethers";
54439
- import { writeFileSync as writeFileSync3, existsSync as existsSync3, readFileSync as readFileSync4 } from "fs";
54469
+ import { writeFileSync as writeFileSync3, existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
54440
54470
  var ImportAccountAction = class extends BaseAction {
54441
54471
  constructor() {
54442
54472
  super();
@@ -54444,7 +54474,7 @@ var ImportAccountAction = class extends BaseAction {
54444
54474
  async execute(options) {
54445
54475
  try {
54446
54476
  const keystorePath = this.getKeystorePath(options.name);
54447
- if (existsSync3(keystorePath) && !options.overwrite) {
54477
+ if (existsSync4(keystorePath) && !options.overwrite) {
54448
54478
  this.failSpinner(`Account '${options.name}' already exists. Use '--overwrite' to replace.`);
54449
54479
  }
54450
54480
  let privateKey;
@@ -54488,7 +54518,7 @@ var ImportAccountAction = class extends BaseAction {
54488
54518
  }
54489
54519
  }
54490
54520
  async importFromKeystore(keystorePath, sourcePassword) {
54491
- if (!existsSync3(keystorePath)) {
54521
+ if (!existsSync4(keystorePath)) {
54492
54522
  this.failSpinner(`Keystore file not found: ${keystorePath}`);
54493
54523
  }
54494
54524
  const fileContent = readFileSync4(keystorePath, "utf-8");
@@ -54532,7 +54562,7 @@ var ImportAccountAction = class extends BaseAction {
54532
54562
 
54533
54563
  // src/commands/account/export.ts
54534
54564
  import { ethers as ethers3 } from "ethers";
54535
- import { writeFileSync as writeFileSync4, existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
54565
+ import { writeFileSync as writeFileSync4, existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
54536
54566
  import path4 from "path";
54537
54567
  var ExportAccountAction = class extends BaseAction {
54538
54568
  constructor() {
@@ -54545,11 +54575,11 @@ var ExportAccountAction = class extends BaseAction {
54545
54575
  }
54546
54576
  const accountName = this.resolveAccountName();
54547
54577
  const keystorePath = this.getKeystorePath(accountName);
54548
- if (!existsSync4(keystorePath)) {
54578
+ if (!existsSync5(keystorePath)) {
54549
54579
  this.failSpinner(`Account '${accountName}' not found.`);
54550
54580
  }
54551
54581
  const outputPath = path4.resolve(options.output);
54552
- if (existsSync4(outputPath) && !options.overwrite) {
54582
+ if (existsSync5(outputPath) && !options.overwrite) {
54553
54583
  this.failSpinner(`Output file already exists: ${outputPath}`);
54554
54584
  }
54555
54585
  const privateKey = await this.getPrivateKeyForExport(accountName, keystorePath, options.sourcePassword);
@@ -54601,7 +54631,7 @@ var ExportAccountAction = class extends BaseAction {
54601
54631
  };
54602
54632
 
54603
54633
  // src/commands/account/unlock.ts
54604
- import { readFileSync as readFileSync6, existsSync as existsSync5 } from "fs";
54634
+ import { readFileSync as readFileSync6, existsSync as existsSync6 } from "fs";
54605
54635
  import { ethers as ethers4 } from "ethers";
54606
54636
  var UnlockAccountAction = class extends BaseAction {
54607
54637
  async execute(options) {
@@ -54617,7 +54647,7 @@ var UnlockAccountAction = class extends BaseAction {
54617
54647
  const accountName = this.resolveAccountName();
54618
54648
  this.setSpinnerText(`Checking for account '${accountName}'...`);
54619
54649
  const keystorePath = this.getKeystorePath(accountName);
54620
- if (!existsSync5(keystorePath)) {
54650
+ if (!existsSync6(keystorePath)) {
54621
54651
  this.failSpinner(`Account '${accountName}' not found. Run 'genlayer account create --name ${accountName}' first.`);
54622
54652
  return;
54623
54653
  }
@@ -54674,7 +54704,7 @@ var LockAccountAction = class extends BaseAction {
54674
54704
  };
54675
54705
 
54676
54706
  // src/commands/account/send.ts
54677
- import { readFileSync as readFileSync7, existsSync as existsSync6 } from "fs";
54707
+ import { readFileSync as readFileSync7, existsSync as existsSync7 } from "fs";
54678
54708
  import { ethers as ethers5 } from "ethers";
54679
54709
  var SendAction = class extends BaseAction {
54680
54710
  constructor() {
@@ -54709,7 +54739,7 @@ var SendAction = class extends BaseAction {
54709
54739
  }
54710
54740
  const accountName = this.resolveAccountName();
54711
54741
  const keystorePath = this.getKeystorePath(accountName);
54712
- if (!existsSync6(keystorePath)) {
54742
+ if (!existsSync7(keystorePath)) {
54713
54743
  this.failSpinner(`Account '${accountName}' not found. Run 'genlayer account create --name ${accountName}' first.`);
54714
54744
  return;
54715
54745
  }
@@ -55849,7 +55879,7 @@ function initializeTransactionsCommands(program2) {
55849
55879
  }
55850
55880
 
55851
55881
  // src/commands/staking/StakingAction.ts
55852
- import { readFileSync as readFileSync8, existsSync as existsSync7 } from "fs";
55882
+ import { readFileSync as readFileSync8, existsSync as existsSync8 } from "fs";
55853
55883
  import { ethers as ethers6, ZeroAddress } from "ethers";
55854
55884
  var STAKING_TREE_ABI = [
55855
55885
  {
@@ -55914,7 +55944,7 @@ var StakingAction = class extends BaseAction {
55914
55944
  }
55915
55945
  const accountName = this.resolveAccountName();
55916
55946
  const keystorePath = this.getKeystorePath(accountName);
55917
- if (!existsSync7(keystorePath)) {
55947
+ if (!existsSync8(keystorePath)) {
55918
55948
  throw new Error(`Account '${accountName}' not found. Run 'genlayer account create --name ${accountName}' first.`);
55919
55949
  }
55920
55950
  const keystoreData = JSON.parse(readFileSync8(keystorePath, "utf-8"));
@@ -55929,7 +55959,7 @@ var StakingAction = class extends BaseAction {
55929
55959
  async getPrivateKeyForStaking() {
55930
55960
  const accountName = this.resolveAccountName();
55931
55961
  const keystorePath = this.getKeystorePath(accountName);
55932
- if (!existsSync7(keystorePath)) {
55962
+ if (!existsSync8(keystorePath)) {
55933
55963
  throw new Error(`Account '${accountName}' not found. Run 'genlayer account create --name ${accountName}' first.`);
55934
55964
  }
55935
55965
  const keystoreJson = readFileSync8(keystorePath, "utf-8");
@@ -55968,7 +55998,7 @@ var StakingAction = class extends BaseAction {
55968
55998
  async getSignerAddress() {
55969
55999
  const accountName = this.resolveAccountName();
55970
56000
  const keystorePath = this.getKeystorePath(accountName);
55971
- if (!existsSync7(keystorePath)) {
56001
+ if (!existsSync8(keystorePath)) {
55972
56002
  throw new Error(`Account '${accountName}' not found.`);
55973
56003
  }
55974
56004
  const keystoreData = JSON.parse(readFileSync8(keystorePath, "utf-8"));
@@ -57075,7 +57105,7 @@ var ValidatorHistoryAction = class extends StakingAction {
57075
57105
 
57076
57106
  // src/commands/staking/wizard.ts
57077
57107
  import inquirer6 from "inquirer";
57078
- import { readFileSync as readFileSync9, existsSync as existsSync8 } from "fs";
57108
+ import { readFileSync as readFileSync9, existsSync as existsSync9 } from "fs";
57079
57109
  import path7 from "path";
57080
57110
  function ensureHexPrefix(address) {
57081
57111
  if (!address) return address;
@@ -57344,7 +57374,7 @@ Fund your account (${state.accountAddress}) and run the wizard again.`
57344
57374
  }
57345
57375
  ]);
57346
57376
  let outputPath2 = path7.resolve(`./${outputFilename2}`);
57347
- if (existsSync8(outputPath2)) {
57377
+ if (existsSync9(outputPath2)) {
57348
57378
  const { overwrite } = await inquirer6.prompt([
57349
57379
  {
57350
57380
  type: "confirm",
@@ -57431,7 +57461,7 @@ Fund your account (${state.accountAddress}) and run the wizard again.`
57431
57461
  }
57432
57462
  ]);
57433
57463
  let outputPath = path7.resolve(`./${outputFilename}`);
57434
- if (existsSync8(outputPath)) {
57464
+ if (existsSync9(outputPath)) {
57435
57465
  const { overwrite } = await inquirer6.prompt([
57436
57466
  {
57437
57467
  type: "confirm",
@@ -0,0 +1,154 @@
1
+ version: "3.8"
2
+
3
+ services:
4
+ frontend:
5
+ image: yeagerai/simulator-frontend:${LOCALNETVERSION:-latest}
6
+ ports:
7
+ - "${FRONTEND_PORT:-8080}:8080"
8
+ environment:
9
+ - VITE_*
10
+ env_file:
11
+ - ./.env
12
+ depends_on:
13
+ jsonrpc:
14
+ condition: service_healthy
15
+ expose:
16
+ - "${FRONTEND_PORT:-8080}"
17
+ restart: always
18
+ security_opt:
19
+ - "no-new-privileges=true"
20
+ logging:
21
+ driver: "json-file"
22
+ options:
23
+ max-size: "10m"
24
+ max-file: "3"
25
+ profiles:
26
+ - frontend
27
+
28
+
29
+ jsonrpc:
30
+ image: yeagerai/simulator-jsonrpc:${LOCALNETVERSION:-latest}
31
+ environment:
32
+ - FLASK_SERVER_PORT=${RPCPORT:-5000}
33
+ - PYTHONUNBUFFERED=1
34
+ - RPCDEBUGPORT=${RPCDEBUGPORT:-5001}
35
+ - WEBDRIVERHOST=${WEBDRIVERHOST:-webdriver}
36
+ - WEBDRIVERPORT=${WEBDRIVERPORT:-4444}
37
+ ports:
38
+ - "${RPCPORT:-5000}:${RPCPORT:-5000}"
39
+ - "${RPCDEBUGPORT:-5001}:${RPCDEBUGPORT:-5001}"
40
+ env_file:
41
+ - ./.env
42
+ healthcheck:
43
+ test: [ "CMD", "python3", "backend/healthcheck.py", "--port", "${RPCPORT}" ]
44
+ interval: 30s
45
+ timeout: 10s
46
+ retries: 3
47
+ start_period: 30s
48
+ depends_on:
49
+ database-migration:
50
+ condition: service_completed_successfully
51
+ webdriver:
52
+ condition: service_healthy
53
+ expose:
54
+ - "${RPCPORT:-5000}"
55
+ restart: always
56
+ security_opt:
57
+ - "no-new-privileges=true"
58
+ logging:
59
+ driver: "json-file"
60
+ options:
61
+ max-size: "10m"
62
+ max-file: "3"
63
+ deploy:
64
+ replicas: ${JSONRPC_REPLICAS:-1}
65
+ volumes:
66
+ - hardhat_artifacts:/app/hardhat/artifacts
67
+ - hardhat_deployments:/app/hardhat/deployments
68
+
69
+
70
+ webdriver:
71
+ image: yeagerai/genlayer-genvm-webdriver:0.0.3
72
+ shm_size: 2gb
73
+ environment:
74
+ - PORT=${WEBDRIVERPORT:-4444}
75
+ expose:
76
+ - "${WEBDRIVERPORT:-4444}"
77
+ restart: always
78
+ security_opt:
79
+ - "no-new-privileges=true"
80
+ logging:
81
+ driver: "json-file"
82
+ options:
83
+ max-size: "10m"
84
+ max-file: "3"
85
+
86
+ ollama:
87
+ image: ollama/ollama:0.9.6
88
+ ports:
89
+ - 11434:11434
90
+ container_name: genlayer-ollama
91
+ tty: true
92
+ restart: always
93
+ security_opt:
94
+ - "no-new-privileges=true"
95
+ logging:
96
+ driver: "json-file"
97
+ options:
98
+ max-size: "10m"
99
+ max-file: "3"
100
+ profiles:
101
+ - ollama
102
+
103
+ postgres:
104
+ image: postgres:17-alpine
105
+ ports:
106
+ - "${DBPORT:-5432}:5432"
107
+ environment:
108
+ - POSTGRES_USER=${DBUSER:-postgres}
109
+ - POSTGRES_PASSWORD=${DBPASSWORD:-postgres}
110
+ - POSTGRES_DB=${DBNAME:-simulator_db}
111
+ healthcheck:
112
+ test: pg_isready -U ${DBUSER:-postgres} -d ${DBNAME:-simulator_db}
113
+ interval: 10s
114
+ timeout: 3s
115
+ retries: 3
116
+ restart: always
117
+ security_opt:
118
+ - "no-new-privileges=true"
119
+ logging:
120
+ driver: "json-file"
121
+ options:
122
+ max-size: "10m"
123
+ max-file: "3"
124
+
125
+ # Uncomment the following lines if you want your DB to persist
126
+ # volumes:
127
+ # - "./data/postgres:/var/lib/postgresql/data"
128
+
129
+ database-migration:
130
+ image: yeagerai/simulator-database-migration:${LOCALNETVERSION:-latest}
131
+ environment:
132
+ - DB_URL=postgresql://${DBUSER:-postgres}:${DBPASSWORD:-postgres}@postgres/${DBNAME:-simulator_db}
133
+ depends_on:
134
+ postgres:
135
+ condition: service_healthy
136
+
137
+ hardhat:
138
+ image: yeagerai/simulator-hardhat:${LOCALNETVERSION:-latest}
139
+ ports:
140
+ - "${HARDHAT_PORT:-8545}:8545"
141
+ environment:
142
+ - HARDHAT_NETWORK=hardhat
143
+ volumes:
144
+ - hardhat_artifacts:/app/artifacts
145
+ - hardhat_deployments:/app/deployments
146
+ - hardhat_cache:/app/cache
147
+ - hardhat_snapshots:/app/snapshots
148
+
149
+ volumes:
150
+ hardhat_artifacts:
151
+ hardhat_deployments:
152
+ hardhat_cache:
153
+ hardhat_snapshots:
154
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genlayer",
3
- "version": "0.38.0",
3
+ "version": "0.38.2",
4
4
  "description": "GenLayer Command Line Tool",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -12,6 +12,7 @@
12
12
  "scripts",
13
13
  "templates",
14
14
  ".env.example",
15
+ "docker-compose.yml",
15
16
  "README.md",
16
17
  "LICENSE"
17
18
  ],