jaelis-node 1.5.0 → 1.8.0

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.
@@ -28,6 +28,9 @@ const {
28
28
  CROSS_CHAIN_OPCODES
29
29
  } = require('./cross-chain-state');
30
30
 
31
+ // Cross-Chain Deployment Manager (OUTBOUND propagation!)
32
+ const { CrossChainDeployManager } = require('./cross-chain-deploy');
33
+
31
34
  /**
32
35
  * Unified JAELIS VM
33
36
  *
@@ -57,6 +60,13 @@ class UnifiedJaelisVM {
57
60
  autoRegisterLightClients: config.autoRegisterLightClients !== false
58
61
  });
59
62
 
63
+ // Cross-chain deployment manager (OUTBOUND propagation!)
64
+ // When you deploy on JAELIS, contracts appear on ETH/SOL/etc explorers!
65
+ this.deployManager = new CrossChainDeployManager({
66
+ nativeChainId: config.chainId || CHAIN_REGISTRY.JAELIS_TESTNET.id,
67
+ lightClients: this.crossChainManager.stateStore.lightClients
68
+ });
69
+
60
70
  // JAELIS ABI (ONE ABI for all!)
61
71
  this.abi = JaelisABI;
62
72
 
@@ -85,6 +95,7 @@ class UnifiedJaelisVM {
85
95
  console.log(' ✓ CHAIN-ID NAMESPACED STORAGE - Universal settlement');
86
96
  console.log(' ✓ LIGHT CLIENT VERIFICATION - Trustless external state');
87
97
  console.log(' ✓ ZERO FEES - Always free execution');
98
+ console.log(' ✓ CROSS-CHAIN DEPLOY - Contracts appear on ALL explorers!');
88
99
  console.log('═══════════════════════════════════════════════════════════════');
89
100
  }
90
101
 
@@ -114,6 +125,70 @@ class UnifiedJaelisVM {
114
125
  return this.compiler.compile(sources);
115
126
  }
116
127
 
128
+ /**
129
+ * Deploy unified contract with cross-chain propagation
130
+ *
131
+ * THE FULL FLOW:
132
+ * 1. Compile all sources into unified JIR bytecode
133
+ * 2. Deploy to JAELIS (native)
134
+ * 3. Propagate to target chains (ETH, SOL, etc.)
135
+ * 4. Return deployment info with explorer URLs
136
+ *
137
+ * @param {Object} params - Deployment parameters
138
+ * @param {string} params.from - Deployer address
139
+ * @param {Array} params.sources - [{ code, language, name }...]
140
+ * @param {Array<number>} params.targetChains - Chain IDs to deploy to
141
+ */
142
+ async deployUnifiedWithPropagation(params) {
143
+ const { from, sources, targetChains } = params;
144
+
145
+ console.log(`[UnifiedVM] Deploying unified bundle with propagation...`);
146
+ console.log(`[UnifiedVM] Sources: ${sources.length} contracts`);
147
+ console.log(`[UnifiedVM] Languages: ${[...new Set(sources.map(s => s.language))].join(', ')}`);
148
+ console.log(`[UnifiedVM] Target chains: ${targetChains?.length || 0}`);
149
+
150
+ // Step 1: Compile all sources
151
+ const compiled = await this.compileBundle(sources);
152
+
153
+ // Step 2: Deploy with cross-chain propagation
154
+ const deployment = await this.deployManager.deployToChains({
155
+ from,
156
+ bytecode: compiled.bytecode,
157
+ abi: compiled.abi || [],
158
+ targetChains: targetChains || [],
159
+ metadata: {
160
+ sources: sources.map(s => ({ name: s.name, language: s.language })),
161
+ compiledAt: Date.now(),
162
+ version: '1.0.0'
163
+ }
164
+ });
165
+
166
+ this.stats.contractsDeployed++;
167
+
168
+ // Build explorer URLs for each chain
169
+ const explorerUrls = {};
170
+ for (const chainDeploy of deployment.deployments) {
171
+ const url = this.deployManager.getExplorerUrl(chainDeploy.chainId, chainDeploy.address);
172
+ if (url) {
173
+ explorerUrls[chainDeploy.chainId] = url;
174
+ }
175
+ }
176
+
177
+ console.log(`[UnifiedVM] Deployment complete!`);
178
+ console.log(`[UnifiedVM] JAELIS address: ${deployment.jaelisAddress}`);
179
+ console.log(`[UnifiedVM] Chain deployments: ${deployment.deployments.length}`);
180
+
181
+ return {
182
+ address: deployment.jaelisAddress,
183
+ bytecode: compiled.bytecode?.toString('hex'),
184
+ abi: compiled.abi || [],
185
+ deployments: deployment.deployments,
186
+ explorerUrls,
187
+ metadata: deployment.metadata,
188
+ gasUsed: 0 // ZERO FEES!
189
+ };
190
+ }
191
+
117
192
  /**
118
193
  * Execute a function on ANY contract
119
194
  */
@@ -361,7 +436,7 @@ module.exports = {
361
436
  JaelisABIDecoder,
362
437
  ABIConverter,
363
438
 
364
- // Cross-Chain Settlement (THE KEY INNOVATION!)
439
+ // Cross-Chain Settlement (INBOUND - reading external state)
365
440
  CrossChainStateStore,
366
441
  CrossChainSettlementManager,
367
442
  CrossChainExecutor,
@@ -371,6 +446,9 @@ module.exports = {
371
446
  CHAIN_REGISTRY,
372
447
  CROSS_CHAIN_OPCODES,
373
448
 
449
+ // Cross-Chain Deployment (OUTBOUND - propagating to external chains!)
450
+ CrossChainDeployManager,
451
+
374
452
  // Types
375
453
  UNIFIED_TYPES,
376
454
  JAELIS_TYPES,