@moltium/world-cli 0.1.9 → 0.1.10

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/index.js +37 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -41,13 +41,10 @@ function generateWorldConfig(options) {
41
41
  }
42
42
  },
43
43
  blockchain: {
44
- rpcUrl: process.env.MONAD_RPC_URL || "https://rpc-testnet.monadinfra.com",
44
+ rpcUrl: "https://rpc-testnet.monadinfra.com",
45
45
  chainId: 10143,
46
46
  requireMembership: true,
47
- enforceOnChainValidation: false,
48
- ...options.tokenType === "custom" && {
49
- useCustomToken: true
50
- }
47
+ enforceOnChainValidation: false
51
48
  },
52
49
  logging: {
53
50
  level: "info",
@@ -78,6 +75,9 @@ MONAD_RPC_URL=https://rpc-testnet.monadinfra.com
78
75
  # IMPORTANT: Keep this secret! Never commit to version control
79
76
  DEPLOYER_PRIVATE_KEY=
80
77
 
78
+ # World Entry Fee in MON (e.g. 0.01)
79
+ ENTRY_FEE_MON=0.01
80
+
81
81
  # Deployed Contract Addresses (populated after deployment)
82
82
  AGENT_REGISTRY_ADDRESS=
83
83
  WORLD_MEMBERSHIP_ADDRESS=
@@ -90,7 +90,7 @@ ${options.tokenType === "custom" ? "WORLD_TOKEN_ADDRESS=\n" : ""}
90
90
  // src/templates/world-template.ts
91
91
  function generateWorldTemplate(config3) {
92
92
  const files = {};
93
- files["src/index.ts"] = `import { World, startWorldServer, validateWorldConfig } from '@moltium/world-core';
93
+ files["src/index.ts"] = `import { World, startWorldServer } from '@moltium/world-core';
94
94
  import type { WorldConfig } from '@moltium/world-core';
95
95
  import dotenv from 'dotenv';
96
96
  import fs from 'fs';
@@ -98,23 +98,44 @@ import fs from 'fs';
98
98
  dotenv.config();
99
99
 
100
100
  async function main() {
101
- // Load configuration
102
- const raw = JSON.parse(fs.readFileSync('./world.config.json', 'utf-8'));
103
- const config = raw as WorldConfig;
104
-
101
+ // Load base configuration from JSON
102
+ const config = JSON.parse(fs.readFileSync('./world.config.json', 'utf-8')) as WorldConfig;
103
+
104
+ // Merge blockchain settings from environment variables
105
+ if (config.blockchain) {
106
+ if (process.env.MONAD_RPC_URL) {
107
+ config.blockchain.rpcUrl = process.env.MONAD_RPC_URL;
108
+ }
109
+ if (process.env.DEPLOYER_PRIVATE_KEY) {
110
+ config.blockchain.privateKey = process.env.DEPLOYER_PRIVATE_KEY;
111
+ }
112
+ if (process.env.ENTRY_FEE_MON) {
113
+ config.blockchain.entryFee = parseFloat(process.env.ENTRY_FEE_MON);
114
+ }
115
+ if (process.env.AGENT_REGISTRY_ADDRESS) {
116
+ config.blockchain.agentRegistryAddress = process.env.AGENT_REGISTRY_ADDRESS;
117
+ }
118
+ if (process.env.WORLD_MEMBERSHIP_ADDRESS) {
119
+ config.blockchain.membershipContractAddress = process.env.WORLD_MEMBERSHIP_ADDRESS;
120
+ }
121
+ if (process.env.WORLD_TOKEN_ADDRESS) {
122
+ config.blockchain.worldTokenAddress = process.env.WORLD_TOKEN_ADDRESS;
123
+ }
124
+ }
125
+
105
126
  // Create world instance
106
127
  const world = new World(config);
107
-
128
+
108
129
  // Initialize world (restore state, discover agents)
109
130
  await world.init();
110
-
131
+
111
132
  // Start HTTP server
112
133
  await startWorldServer(world);
113
-
134
+
114
135
  console.log(\`\u{1F30D} \${config.name} is running!\`);
115
136
  console.log(\` Server: http://\${config.server?.host ?? 'localhost'}:\${config.server?.port ?? 3000}\`);
116
137
  console.log(\` Agents: \${world.getAgents().length}/\${config.admission?.maxAgents ?? 10}\`);
117
-
138
+
118
139
  // Graceful shutdown
119
140
  process.on('SIGINT', async () => {
120
141
  console.log('\\n\\n\u{1F6D1} Shutting down...');
@@ -396,7 +417,7 @@ var initCommand = new Command("init").description("Initialize a new world projec
396
417
  "deploy:contracts": "moltium-world deploy"
397
418
  },
398
419
  dependencies: {
399
- "@moltium/world-core": "^0.1.9",
420
+ "@moltium/world-core": "^0.1.10",
400
421
  dotenv: "^16.4.0",
401
422
  ...persistenceAnswers.persistenceType === "sqlite" ? { "better-sqlite3": "^11.0.0" } : {},
402
423
  ...persistenceAnswers.persistenceType === "redis" ? { "ioredis": "^5.3.0" } : {},
@@ -815,7 +836,7 @@ var deployCommand = new Command4("deploy").description("Deploy smart contracts t
815
836
 
816
837
  // src/index.ts
817
838
  var program = new Command5();
818
- program.name("moltium-world").description("CLI tool for creating and managing Moltium World SDK projects").version("0.1.9");
839
+ program.name("moltium-world").description("CLI tool for creating and managing Moltium World SDK projects").version("0.1.10");
819
840
  program.addCommand(initCommand);
820
841
  program.addCommand(tokenCommand);
821
842
  program.addCommand(startCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moltium/world-cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "CLI tool for creating and managing Moltium World SDK projects",
5
5
  "license": "MIT",
6
6
  "keywords": [