rocketh 0.10.8 → 0.10.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.
- package/CHANGELOG.md +12 -0
- package/dist/cli.cjs +86 -1479
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +96 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index-AgLCQD7y.cjs +1314 -0
- package/dist/index-AgLCQD7y.cjs.map +1 -0
- package/dist/{chunk-LUXDAM6F.js → index-DRZG9qM_.mjs} +98 -248
- package/dist/index-DRZG9qM_.mjs.map +1 -0
- package/dist/index.cjs +33 -1484
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +934 -17
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +26 -17
- package/src/environment/index.ts +18 -8
- package/src/environment/types.ts +8 -6
- package/src/environment/utils/chains.ts +0 -12
- package/src/executor/index.ts +18 -9
- package/dist/chunk-LUXDAM6F.js.map +0 -1
- package/dist/cli.d.cts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -72
- package/dist/cli.js.map +0 -1
- package/dist/index.d.cts +0 -467
- package/dist/index.js +0 -37
- package/dist/index.js.map +0 -1
- package/src/environment/utils/extra-chains/ancient8.ts +0 -44
- package/src/environment/utils/extra-chains/ancient8Sepolia.ts +0 -44
- package/src/environment/utils/extra-chains/index.ts +0 -2
- package/tsup.config.ts +0 -5
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { custom, createPublicClient, formatEther } from 'viem';
|
|
5
|
+
import { JSONRPCHTTPProvider } from 'eip-1193-jsonrpc-provider';
|
|
6
|
+
import { logs } from 'named-logs';
|
|
7
|
+
import { hookup, factory } from 'named-logs-console';
|
|
8
|
+
import chains from 'viem/chains';
|
|
9
|
+
import { FunctionFragment } from 'ethers';
|
|
10
|
+
import prompts from 'prompts';
|
|
11
|
+
|
|
12
|
+
var require$1 = (
|
|
13
|
+
true
|
|
14
|
+
? /* @__PURE__ */ createRequire(import.meta.url)
|
|
15
|
+
: require
|
|
16
|
+
);
|
|
13
17
|
|
|
14
|
-
// src/utils/fs.ts
|
|
15
|
-
import fs from "fs";
|
|
16
|
-
import path from "path";
|
|
17
18
|
function traverseMultipleDirectory(dirs) {
|
|
18
19
|
const filepaths = [];
|
|
19
20
|
for (const dir of dirs) {
|
|
@@ -25,7 +26,7 @@ function traverseMultipleDirectory(dirs) {
|
|
|
25
26
|
}
|
|
26
27
|
return filepaths;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
const traverse = function(dir, result = [], topDir, filter) {
|
|
29
30
|
fs.readdirSync(dir).forEach((name) => {
|
|
30
31
|
const fPath = path.resolve(dir, name);
|
|
31
32
|
const stats = fs.statSync(fPath);
|
|
@@ -47,17 +48,6 @@ var traverse = function(dir, result = [], topDir, filter) {
|
|
|
47
48
|
return result;
|
|
48
49
|
};
|
|
49
50
|
|
|
50
|
-
// src/executor/index.ts
|
|
51
|
-
import path4 from "path";
|
|
52
|
-
import fs4 from "fs";
|
|
53
|
-
|
|
54
|
-
// src/environment/index.ts
|
|
55
|
-
import fs3 from "fs";
|
|
56
|
-
import { createPublicClient, custom } from "viem";
|
|
57
|
-
import { JSONRPCHTTPProvider } from "eip-1193-jsonrpc-provider";
|
|
58
|
-
import path3 from "path";
|
|
59
|
-
|
|
60
|
-
// src/utils/json.ts
|
|
61
51
|
function bnReplacer(k, v) {
|
|
62
52
|
if (typeof v === "bigint") {
|
|
63
53
|
return v.toString() + "n";
|
|
@@ -77,12 +67,9 @@ function stringToJSON(str) {
|
|
|
77
67
|
return JSON.parse(str, bnReviver);
|
|
78
68
|
}
|
|
79
69
|
|
|
80
|
-
// src/environment/deployments.ts
|
|
81
|
-
import path2 from "path";
|
|
82
|
-
import fs2 from "fs";
|
|
83
70
|
function loadDeployments(deploymentsPath, networkName, onlyABIAndAddress, expectedChain) {
|
|
84
71
|
const deploymentsFound = {};
|
|
85
|
-
const deployPath =
|
|
72
|
+
const deployPath = path.join(deploymentsPath, networkName);
|
|
86
73
|
let filesStats;
|
|
87
74
|
try {
|
|
88
75
|
filesStats = traverse(deployPath, void 0, void 0, (name) => !name.startsWith(".") && name !== "solcInputs");
|
|
@@ -92,13 +79,13 @@ function loadDeployments(deploymentsPath, networkName, onlyABIAndAddress, expect
|
|
|
92
79
|
let chainId;
|
|
93
80
|
let genesisHash;
|
|
94
81
|
if (filesStats.length > 0) {
|
|
95
|
-
const chainIdFilepath =
|
|
96
|
-
if (
|
|
97
|
-
chainId =
|
|
82
|
+
const chainIdFilepath = path.join(deployPath, ".chainId");
|
|
83
|
+
if (fs.existsSync(chainIdFilepath)) {
|
|
84
|
+
chainId = fs.readFileSync(chainIdFilepath, "utf-8").trim();
|
|
98
85
|
} else {
|
|
99
|
-
const chainFilepath =
|
|
100
|
-
if (
|
|
101
|
-
const chainSTR =
|
|
86
|
+
const chainFilepath = path.join(deployPath, ".chain");
|
|
87
|
+
if (fs.existsSync(chainFilepath)) {
|
|
88
|
+
const chainSTR = fs.readFileSync(chainFilepath, "utf-8");
|
|
102
89
|
const chainData = JSON.parse(chainSTR);
|
|
103
90
|
chainId = chainData.chainId;
|
|
104
91
|
genesisHash = chainData.genesisHash;
|
|
@@ -116,7 +103,7 @@ function loadDeployments(deploymentsPath, networkName, onlyABIAndAddress, expect
|
|
|
116
103
|
}
|
|
117
104
|
if (expectedChain.genesisHash && expectedChain.genesisHash !== genesisHash) {
|
|
118
105
|
if (expectedChain.deleteDeploymentsIfDifferentGenesisHash) {
|
|
119
|
-
|
|
106
|
+
fs.rmSync(deployPath, { recursive: true, force: true });
|
|
120
107
|
return { deployments: {} };
|
|
121
108
|
} else {
|
|
122
109
|
throw new Error(
|
|
@@ -140,8 +127,8 @@ function loadDeployments(deploymentsPath, networkName, onlyABIAndAddress, expect
|
|
|
140
127
|
});
|
|
141
128
|
for (const fileName of fileNames) {
|
|
142
129
|
if (fileName.substring(fileName.length - 5) === ".json") {
|
|
143
|
-
const deploymentFileName =
|
|
144
|
-
let deployment = JSON.parse(
|
|
130
|
+
const deploymentFileName = path.join(deployPath, fileName);
|
|
131
|
+
let deployment = JSON.parse(fs.readFileSync(deploymentFileName).toString());
|
|
145
132
|
if (onlyABIAndAddress) {
|
|
146
133
|
deployment = {
|
|
147
134
|
address: deployment.address,
|
|
@@ -156,20 +143,17 @@ function loadDeployments(deploymentsPath, networkName, onlyABIAndAddress, expect
|
|
|
156
143
|
return { deployments: deploymentsFound, chainId, genesisHash };
|
|
157
144
|
}
|
|
158
145
|
|
|
159
|
-
// src/internal/logging.ts
|
|
160
|
-
import { logs } from "named-logs";
|
|
161
|
-
import { hookup, factory as Logging } from "named-logs-console";
|
|
162
146
|
hookup();
|
|
163
147
|
function setLogLevel(level) {
|
|
164
|
-
|
|
165
|
-
if (
|
|
166
|
-
|
|
148
|
+
factory.level = level;
|
|
149
|
+
if (factory.level > 0) {
|
|
150
|
+
factory.enable();
|
|
167
151
|
} else {
|
|
168
|
-
|
|
152
|
+
factory.disable();
|
|
169
153
|
}
|
|
170
154
|
}
|
|
171
|
-
|
|
172
|
-
|
|
155
|
+
const logger = logs("rocketh");
|
|
156
|
+
const loggerProgressIndicator = {
|
|
173
157
|
start(msg) {
|
|
174
158
|
if (msg) {
|
|
175
159
|
console.log(msg);
|
|
@@ -192,7 +176,7 @@ var loggerProgressIndicator = {
|
|
|
192
176
|
return this;
|
|
193
177
|
}
|
|
194
178
|
};
|
|
195
|
-
|
|
179
|
+
const voidProgressIndicator = {
|
|
196
180
|
start() {
|
|
197
181
|
return this;
|
|
198
182
|
},
|
|
@@ -206,9 +190,9 @@ var voidProgressIndicator = {
|
|
|
206
190
|
return this;
|
|
207
191
|
}
|
|
208
192
|
};
|
|
209
|
-
|
|
193
|
+
let lastSpin = loggerProgressIndicator;
|
|
210
194
|
function spin(message) {
|
|
211
|
-
if (
|
|
195
|
+
if (factory.level > 0) {
|
|
212
196
|
lastSpin = lastSpin.start(message);
|
|
213
197
|
return lastSpin;
|
|
214
198
|
} else {
|
|
@@ -216,111 +200,12 @@ function spin(message) {
|
|
|
216
200
|
}
|
|
217
201
|
}
|
|
218
202
|
function log(message) {
|
|
219
|
-
if (
|
|
203
|
+
if (factory.level > 0) {
|
|
220
204
|
console.log(message);
|
|
221
205
|
}
|
|
222
206
|
}
|
|
223
207
|
|
|
224
|
-
|
|
225
|
-
import chains from "viem/chains";
|
|
226
|
-
|
|
227
|
-
// src/environment/utils/extra-chains/index.ts
|
|
228
|
-
var extra_chains_exports = {};
|
|
229
|
-
__export(extra_chains_exports, {
|
|
230
|
-
ancient8: () => ancient8,
|
|
231
|
-
ancient8Sepolia: () => ancient8Sepolia
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
// src/environment/utils/extra-chains/ancient8.ts
|
|
235
|
-
import { defineChain } from "viem";
|
|
236
|
-
import { chainConfig } from "viem/op-stack";
|
|
237
|
-
var sourceId = 1;
|
|
238
|
-
var ancient8 = defineChain({
|
|
239
|
-
...chainConfig,
|
|
240
|
-
id: 888888888,
|
|
241
|
-
name: "Ancient8",
|
|
242
|
-
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
243
|
-
rpcUrls: {
|
|
244
|
-
default: {
|
|
245
|
-
http: ["https://rpc.ancient8.gg"]
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
blockExplorers: {
|
|
249
|
-
default: {
|
|
250
|
-
name: "Ancient8 explorer",
|
|
251
|
-
url: "https://scan.ancient8.gg",
|
|
252
|
-
apiUrl: "https://scan.ancient8.gg/api"
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
contracts: {
|
|
256
|
-
...chainConfig.contracts,
|
|
257
|
-
l2OutputOracle: {
|
|
258
|
-
[sourceId]: {
|
|
259
|
-
address: "0xB09DC08428C8b4EFB4ff9C0827386CDF34277996"
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
portal: {
|
|
263
|
-
[sourceId]: {
|
|
264
|
-
address: "0x639F2AECE398Aa76b07e59eF6abe2cFe32bacb68",
|
|
265
|
-
blockCreated: 19070571
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
l1StandardBridge: {
|
|
269
|
-
[sourceId]: {
|
|
270
|
-
address: "0xd5e3eDf5b68135D559D572E26bF863FBC1950033",
|
|
271
|
-
blockCreated: 19070571
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
sourceId
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
// src/environment/utils/extra-chains/ancient8Sepolia.ts
|
|
279
|
-
import { defineChain as defineChain2 } from "viem";
|
|
280
|
-
import { chainConfig as chainConfig2 } from "viem/op-stack";
|
|
281
|
-
var sourceId2 = 11155111;
|
|
282
|
-
var ancient8Sepolia = defineChain2({
|
|
283
|
-
...chainConfig2,
|
|
284
|
-
id: 28122024,
|
|
285
|
-
name: "Ancient8 Testnet",
|
|
286
|
-
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
287
|
-
rpcUrls: {
|
|
288
|
-
default: {
|
|
289
|
-
http: ["https://rpcv2-testnet.ancient8.gg"]
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
blockExplorers: {
|
|
293
|
-
default: {
|
|
294
|
-
name: "Ancient8 Celestia Testnet explorer",
|
|
295
|
-
url: "https://scanv2-testnet.ancient8.gg",
|
|
296
|
-
apiUrl: "https://scanv2-testnet.ancient8.gg/api"
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
contracts: {
|
|
300
|
-
...chainConfig2.contracts,
|
|
301
|
-
l2OutputOracle: {
|
|
302
|
-
[sourceId2]: {
|
|
303
|
-
address: "0x942fD5017c0F60575930D8574Eaca13BEcD6e1bB"
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
portal: {
|
|
307
|
-
[sourceId2]: {
|
|
308
|
-
address: "0xfa1d9E26A6aCD7b22115D27572c1221B9803c960",
|
|
309
|
-
blockCreated: 4972908
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
l1StandardBridge: {
|
|
313
|
-
[sourceId2]: {
|
|
314
|
-
address: "0xF6Bc0146d3c74D48306e79Ae134A260E418C9335",
|
|
315
|
-
blockCreated: 4972908
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
sourceId: sourceId2
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
// src/environment/utils/chains.ts
|
|
323
|
-
var chainTypesByNames = {
|
|
208
|
+
const chainTypesByNames = {
|
|
324
209
|
base: "op-stack",
|
|
325
210
|
baseGoerli: "op-stack",
|
|
326
211
|
baseSepolia: "op-stack",
|
|
@@ -340,9 +225,9 @@ var chainTypesByNames = {
|
|
|
340
225
|
zkSyncTestnet: "zksync",
|
|
341
226
|
zkSyncSepoliaTestnet: "zksync"
|
|
342
227
|
};
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
228
|
+
const chainTypes = {};
|
|
229
|
+
const chainById = {};
|
|
230
|
+
const allChains = chains.default || chains;
|
|
346
231
|
for (const key of Object.keys(allChains)) {
|
|
347
232
|
const chain = allChains[key];
|
|
348
233
|
const chainId = chain.id.toString();
|
|
@@ -352,16 +237,6 @@ for (const key of Object.keys(allChains)) {
|
|
|
352
237
|
}
|
|
353
238
|
chainById[chainId] = chain;
|
|
354
239
|
}
|
|
355
|
-
var moreChains = extra_chains_exports;
|
|
356
|
-
for (const key of Object.keys(moreChains)) {
|
|
357
|
-
const chain = moreChains[key];
|
|
358
|
-
const chainId = chain.id.toString();
|
|
359
|
-
const specificChainType = chainTypesByNames[key];
|
|
360
|
-
if (specificChainType) {
|
|
361
|
-
chainTypes[chainId] = specificChainType;
|
|
362
|
-
}
|
|
363
|
-
chainById[chainId] = chain;
|
|
364
|
-
}
|
|
365
240
|
function getChain(id) {
|
|
366
241
|
const chain = chainById[id];
|
|
367
242
|
if (!chain) {
|
|
@@ -384,8 +259,6 @@ function getChain(id) {
|
|
|
384
259
|
return chain;
|
|
385
260
|
}
|
|
386
261
|
|
|
387
|
-
// src/environment/utils/artifacts.ts
|
|
388
|
-
import { FunctionFragment } from "ethers";
|
|
389
262
|
function deepEqual(obj1, obj2) {
|
|
390
263
|
function isObject(obj) {
|
|
391
264
|
if (typeof obj === "object" && obj != null) {
|
|
@@ -439,30 +312,23 @@ function mergeArtifacts(list) {
|
|
|
439
312
|
}
|
|
440
313
|
sigJSMap.set(selector, { index: i, routeName: listElem.name, functionName: element.name });
|
|
441
314
|
const exists = added.has(element.name);
|
|
442
|
-
if (exists) {
|
|
443
|
-
} else {
|
|
315
|
+
if (exists) ; else {
|
|
444
316
|
added.set(element.name, element);
|
|
445
317
|
mergedABI.push(element);
|
|
446
318
|
}
|
|
447
|
-
} else if (element.type === "constructor") {
|
|
448
|
-
} else if (element.type === "error") {
|
|
319
|
+
} else if (element.type === "constructor") ; else if (element.type === "error") {
|
|
449
320
|
const exists = added.has(element.name);
|
|
450
|
-
if (exists) {
|
|
451
|
-
} else {
|
|
321
|
+
if (exists) ; else {
|
|
452
322
|
added.set(element.name, element);
|
|
453
323
|
mergedABI.push(element);
|
|
454
324
|
}
|
|
455
325
|
} else if (element.type === "event") {
|
|
456
326
|
const exists = added.has(element.name);
|
|
457
|
-
if (exists) {
|
|
458
|
-
} else {
|
|
327
|
+
if (exists) ; else {
|
|
459
328
|
added.set(element.name, element);
|
|
460
329
|
mergedABI.push(element);
|
|
461
330
|
}
|
|
462
|
-
} else if (element.type === "fallback")
|
|
463
|
-
} else if (element.type === "receive") {
|
|
464
|
-
} else {
|
|
465
|
-
}
|
|
331
|
+
} else if (element.type === "fallback") ; else if (element.type === "receive") ; else ;
|
|
466
332
|
}
|
|
467
333
|
const devdoc = listElem.artifact.devdoc;
|
|
468
334
|
if (devdoc) {
|
|
@@ -502,18 +368,16 @@ function mergeArtifacts(list) {
|
|
|
502
368
|
};
|
|
503
369
|
}
|
|
504
370
|
|
|
505
|
-
|
|
506
|
-
var BaseProvider = class {
|
|
371
|
+
class BaseProvider {
|
|
507
372
|
constructor(provider) {
|
|
508
373
|
this.provider = provider;
|
|
509
374
|
}
|
|
510
375
|
request(args) {
|
|
511
376
|
return this._request(args);
|
|
512
377
|
}
|
|
513
|
-
}
|
|
378
|
+
}
|
|
514
379
|
|
|
515
|
-
|
|
516
|
-
var TransactionHashTracker = class extends BaseProvider {
|
|
380
|
+
class TransactionHashTracker extends BaseProvider {
|
|
517
381
|
constructor(provider) {
|
|
518
382
|
super(provider);
|
|
519
383
|
this.transactionHashes = [];
|
|
@@ -531,9 +395,8 @@ var TransactionHashTracker = class extends BaseProvider {
|
|
|
531
395
|
}
|
|
532
396
|
return response;
|
|
533
397
|
}
|
|
534
|
-
}
|
|
398
|
+
}
|
|
535
399
|
|
|
536
|
-
// src/environment/index.ts
|
|
537
400
|
globalThis.extensions = [];
|
|
538
401
|
function extendEnvironment(extension) {
|
|
539
402
|
globalThis.extensions.push(extension);
|
|
@@ -596,6 +459,7 @@ async function createEnvironment(config, providedContext) {
|
|
|
596
459
|
saveDeployments = config.saveDeployments;
|
|
597
460
|
}
|
|
598
461
|
const resolvedAccounts = {};
|
|
462
|
+
const allRemoteAccounts = await provider.request({ method: "eth_accounts" });
|
|
599
463
|
const accountCache = {};
|
|
600
464
|
async function getAccount(name, accounts, accountDef) {
|
|
601
465
|
if (accountCache[name]) {
|
|
@@ -603,8 +467,7 @@ async function createEnvironment(config, providedContext) {
|
|
|
603
467
|
}
|
|
604
468
|
let account;
|
|
605
469
|
if (typeof accountDef === "number") {
|
|
606
|
-
const
|
|
607
|
-
const accountPerIndex = accounts2[accountDef];
|
|
470
|
+
const accountPerIndex = allRemoteAccounts[accountDef];
|
|
608
471
|
if (accountPerIndex) {
|
|
609
472
|
accountCache[name] = account = {
|
|
610
473
|
type: "remote",
|
|
@@ -699,11 +562,19 @@ async function createEnvironment(config, providedContext) {
|
|
|
699
562
|
addressSigners[address] = namedSigner;
|
|
700
563
|
namedSigners[name] = namedSigner;
|
|
701
564
|
}
|
|
565
|
+
const unnamedAccounts = allRemoteAccounts.filter((v) => !addressSigners[v]);
|
|
566
|
+
for (const account of unnamedAccounts) {
|
|
567
|
+
addressSigners[account] = {
|
|
568
|
+
type: "remote",
|
|
569
|
+
signer: provider
|
|
570
|
+
};
|
|
571
|
+
}
|
|
702
572
|
const perliminaryEnvironment = {
|
|
703
573
|
config,
|
|
704
574
|
deployments,
|
|
705
|
-
|
|
706
|
-
|
|
575
|
+
namedAccounts,
|
|
576
|
+
namedSigners,
|
|
577
|
+
unnamedAccounts,
|
|
707
578
|
addressSigners,
|
|
708
579
|
artifacts: context.artifacts,
|
|
709
580
|
network: {
|
|
@@ -714,11 +585,11 @@ async function createEnvironment(config, providedContext) {
|
|
|
714
585
|
}
|
|
715
586
|
};
|
|
716
587
|
function ensureDeploymentFolder() {
|
|
717
|
-
const folderPath =
|
|
718
|
-
|
|
719
|
-
const chainFilepath =
|
|
720
|
-
if (!
|
|
721
|
-
|
|
588
|
+
const folderPath = path.join(config.deployments, context.network.name);
|
|
589
|
+
fs.mkdirSync(folderPath, { recursive: true });
|
|
590
|
+
const chainFilepath = path.join(folderPath, ".chain");
|
|
591
|
+
if (!fs.existsSync(chainFilepath)) {
|
|
592
|
+
fs.writeFileSync(chainFilepath, JSON.stringify({ chainId, genesisHash }));
|
|
722
593
|
}
|
|
723
594
|
return folderPath;
|
|
724
595
|
}
|
|
@@ -760,7 +631,7 @@ async function createEnvironment(config, providedContext) {
|
|
|
760
631
|
deployments[name] = deployment;
|
|
761
632
|
if (context.network.saveDeployments) {
|
|
762
633
|
const folderPath = ensureDeploymentFolder();
|
|
763
|
-
|
|
634
|
+
fs.writeFileSync(`${folderPath}/${name}.json`, JSONToString(deployment, 2));
|
|
764
635
|
}
|
|
765
636
|
return deployment;
|
|
766
637
|
}
|
|
@@ -769,10 +640,10 @@ async function createEnvironment(config, providedContext) {
|
|
|
769
640
|
return;
|
|
770
641
|
}
|
|
771
642
|
const folderPath = ensureDeploymentFolder();
|
|
772
|
-
const filepath =
|
|
643
|
+
const filepath = path.join(folderPath, ".pending_transactions.json");
|
|
773
644
|
let existingPendingTansactions;
|
|
774
645
|
try {
|
|
775
|
-
existingPendingTansactions = stringToJSON(
|
|
646
|
+
existingPendingTansactions = stringToJSON(fs.readFileSync(filepath, "utf-8"));
|
|
776
647
|
} catch {
|
|
777
648
|
existingPendingTansactions = [];
|
|
778
649
|
}
|
|
@@ -786,7 +657,7 @@ async function createEnvironment(config, providedContext) {
|
|
|
786
657
|
);
|
|
787
658
|
try {
|
|
788
659
|
await waitForDeploymentTransactionAndSave(pendingTransaction);
|
|
789
|
-
|
|
660
|
+
fs.writeFileSync(filepath, JSONToString(existingPendingTansactions, 2));
|
|
790
661
|
spinner.succeed();
|
|
791
662
|
} catch (e) {
|
|
792
663
|
spinner.fail();
|
|
@@ -796,7 +667,7 @@ async function createEnvironment(config, providedContext) {
|
|
|
796
667
|
const spinner = spin(`recovering execution's transaction ${pendingTransaction.transaction.hash}`);
|
|
797
668
|
try {
|
|
798
669
|
await waitForTransaction(pendingTransaction.transaction.hash);
|
|
799
|
-
|
|
670
|
+
fs.writeFileSync(filepath, JSONToString(existingPendingTansactions, 2));
|
|
800
671
|
spinner.succeed();
|
|
801
672
|
} catch (e) {
|
|
802
673
|
spinner.fail();
|
|
@@ -805,21 +676,21 @@ async function createEnvironment(config, providedContext) {
|
|
|
805
676
|
}
|
|
806
677
|
}
|
|
807
678
|
}
|
|
808
|
-
|
|
679
|
+
fs.rmSync(filepath);
|
|
809
680
|
}
|
|
810
681
|
}
|
|
811
682
|
async function savePendingTransaction(pendingTransaction) {
|
|
812
683
|
if (context.network.saveDeployments) {
|
|
813
684
|
const folderPath = ensureDeploymentFolder();
|
|
814
|
-
const filepath =
|
|
685
|
+
const filepath = path.join(folderPath, ".pending_transactions.json");
|
|
815
686
|
let existingPendinTransactions;
|
|
816
687
|
try {
|
|
817
|
-
existingPendinTransactions = stringToJSON(
|
|
688
|
+
existingPendinTransactions = stringToJSON(fs.readFileSync(filepath, "utf-8"));
|
|
818
689
|
} catch {
|
|
819
690
|
existingPendinTransactions = [];
|
|
820
691
|
}
|
|
821
692
|
existingPendinTransactions.push(pendingTransaction);
|
|
822
|
-
|
|
693
|
+
fs.writeFileSync(filepath, JSONToString(existingPendinTransactions, 2));
|
|
823
694
|
}
|
|
824
695
|
return deployments;
|
|
825
696
|
}
|
|
@@ -841,25 +712,25 @@ async function createEnvironment(config, providedContext) {
|
|
|
841
712
|
async function deleteTransaction(hash) {
|
|
842
713
|
if (context.network.saveDeployments) {
|
|
843
714
|
const folderPath = ensureDeploymentFolder();
|
|
844
|
-
const filepath =
|
|
715
|
+
const filepath = path.join(folderPath, ".pending_transactions.json");
|
|
845
716
|
let existingPendinTransactions;
|
|
846
717
|
try {
|
|
847
|
-
existingPendinTransactions = stringToJSON(
|
|
718
|
+
existingPendinTransactions = stringToJSON(fs.readFileSync(filepath, "utf-8"));
|
|
848
719
|
} catch {
|
|
849
720
|
existingPendinTransactions = [];
|
|
850
721
|
}
|
|
851
722
|
existingPendinTransactions = existingPendinTransactions.filter((v) => v.transaction.hash !== hash);
|
|
852
723
|
if (existingPendinTransactions.length === 0) {
|
|
853
|
-
|
|
724
|
+
fs.rmSync(filepath);
|
|
854
725
|
} else {
|
|
855
|
-
|
|
726
|
+
fs.writeFileSync(filepath, JSONToString(existingPendinTransactions, 2));
|
|
856
727
|
}
|
|
857
728
|
}
|
|
858
729
|
}
|
|
859
730
|
async function exportDeploymentsAsTypes() {
|
|
860
731
|
const folderPath = "./generated";
|
|
861
|
-
|
|
862
|
-
|
|
732
|
+
fs.mkdirSync(folderPath, { recursive: true });
|
|
733
|
+
fs.writeFileSync(`${folderPath}/deployments.ts`, `export default ${JSONToString(deployments, 2)} as const;`);
|
|
863
734
|
}
|
|
864
735
|
async function waitForTransaction(hash, info) {
|
|
865
736
|
const spinner = spin(
|
|
@@ -1040,7 +911,6 @@ async function createEnvironment(config, providedContext) {
|
|
|
1040
911
|
};
|
|
1041
912
|
}
|
|
1042
913
|
|
|
1043
|
-
// src/utils/eth.ts
|
|
1044
914
|
function avg(arr) {
|
|
1045
915
|
const sum = arr.reduce((a, v) => a + v);
|
|
1046
916
|
return sum / BigInt(arr.length);
|
|
@@ -1103,11 +973,8 @@ async function getRoughGasPriceEstimate(provider, options) {
|
|
|
1103
973
|
};
|
|
1104
974
|
}
|
|
1105
975
|
|
|
1106
|
-
// src/executor/index.ts
|
|
1107
|
-
import prompts from "prompts";
|
|
1108
|
-
import { formatEther } from "viem";
|
|
1109
976
|
if (!process.env["ROCKETH_SKIP_ESBUILD"]) {
|
|
1110
|
-
|
|
977
|
+
require$1("esbuild-register/dist/node").register();
|
|
1111
978
|
}
|
|
1112
979
|
function execute(context, callback, options) {
|
|
1113
980
|
const scriptModule = (env, args) => callback(env, args);
|
|
@@ -1119,7 +986,7 @@ function execute(context, callback, options) {
|
|
|
1119
986
|
function readConfig(options) {
|
|
1120
987
|
let configFile;
|
|
1121
988
|
try {
|
|
1122
|
-
const configString =
|
|
989
|
+
const configString = fs.readFileSync("./rocketh.json", "utf-8");
|
|
1123
990
|
configFile = JSON.parse(configString);
|
|
1124
991
|
} catch {
|
|
1125
992
|
}
|
|
@@ -1230,15 +1097,15 @@ async function loadEnvironment(options, context) {
|
|
|
1230
1097
|
const { external, internal } = await createEnvironment(resolvedConfig, context);
|
|
1231
1098
|
return external;
|
|
1232
1099
|
}
|
|
1233
|
-
async function loadAndExecuteDeployments(options, args) {
|
|
1100
|
+
async function loadAndExecuteDeployments(options, context, args) {
|
|
1234
1101
|
const resolvedConfig = readAndResolveConfig(options);
|
|
1235
|
-
return executeDeployScripts(resolvedConfig, args);
|
|
1102
|
+
return executeDeployScripts(resolvedConfig, context, args);
|
|
1236
1103
|
}
|
|
1237
|
-
async function executeDeployScripts(config, args) {
|
|
1104
|
+
async function executeDeployScripts(config, context, args) {
|
|
1238
1105
|
setLogLevel(typeof config.logLevel === "undefined" ? 0 : config.logLevel);
|
|
1239
1106
|
let filepaths;
|
|
1240
1107
|
filepaths = traverseMultipleDirectory([config.scripts]);
|
|
1241
|
-
filepaths = filepaths.filter((v) => !
|
|
1108
|
+
filepaths = filepaths.filter((v) => !path.basename(v).startsWith("_")).sort((a, b) => {
|
|
1242
1109
|
if (a < b) {
|
|
1243
1110
|
return -1;
|
|
1244
1111
|
}
|
|
@@ -1247,18 +1114,18 @@ async function executeDeployScripts(config, args) {
|
|
|
1247
1114
|
}
|
|
1248
1115
|
return 0;
|
|
1249
1116
|
});
|
|
1250
|
-
let providedContext;
|
|
1117
|
+
let providedContext = context;
|
|
1251
1118
|
const scriptModuleByFilePath = {};
|
|
1252
1119
|
const scriptPathBags = {};
|
|
1253
1120
|
const scriptFilePaths = [];
|
|
1254
1121
|
for (const filepath of filepaths) {
|
|
1255
|
-
const scriptFilePath =
|
|
1122
|
+
const scriptFilePath = path.resolve(filepath);
|
|
1256
1123
|
let scriptModule;
|
|
1257
1124
|
try {
|
|
1258
|
-
if (
|
|
1259
|
-
delete
|
|
1125
|
+
if (require$1.cache) {
|
|
1126
|
+
delete require$1.cache[scriptFilePath];
|
|
1260
1127
|
}
|
|
1261
|
-
scriptModule =
|
|
1128
|
+
scriptModule = require$1(scriptFilePath);
|
|
1262
1129
|
if (scriptModule.default) {
|
|
1263
1130
|
scriptModule = scriptModule.default;
|
|
1264
1131
|
if (scriptModule.default) {
|
|
@@ -1380,8 +1247,8 @@ Do you want to proceed (note that gas price can change for each tx)`
|
|
|
1380
1247
|
}
|
|
1381
1248
|
}
|
|
1382
1249
|
for (const deployScript of scriptsToRun.concat(scriptsToRunAtTheEnd)) {
|
|
1383
|
-
const filename =
|
|
1384
|
-
|
|
1250
|
+
const filename = path.basename(deployScript.filePath);
|
|
1251
|
+
path.relative(".", deployScript.filePath);
|
|
1385
1252
|
let skip = false;
|
|
1386
1253
|
const spinner = spin(`- Executing ${filename}`);
|
|
1387
1254
|
if (deployScript.func.skip) {
|
|
@@ -1405,7 +1272,7 @@ Do you want to proceed (note that gas price can change for each tx)`
|
|
|
1405
1272
|
throw e;
|
|
1406
1273
|
}
|
|
1407
1274
|
if (result && typeof result === "boolean") {
|
|
1408
|
-
|
|
1275
|
+
config.deployments;
|
|
1409
1276
|
}
|
|
1410
1277
|
}
|
|
1411
1278
|
}
|
|
@@ -1425,22 +1292,5 @@ Do you want to proceed (note that gas price can change for each tx)`
|
|
|
1425
1292
|
return external;
|
|
1426
1293
|
}
|
|
1427
1294
|
|
|
1428
|
-
export {
|
|
1429
|
-
|
|
1430
|
-
chainTypes,
|
|
1431
|
-
chainById,
|
|
1432
|
-
getChain,
|
|
1433
|
-
mergeArtifacts,
|
|
1434
|
-
extendEnvironment,
|
|
1435
|
-
handleSignerProtocol,
|
|
1436
|
-
getGasPriceEstimate,
|
|
1437
|
-
getRoughGasPriceEstimate,
|
|
1438
|
-
execute,
|
|
1439
|
-
readConfig,
|
|
1440
|
-
readAndResolveConfig,
|
|
1441
|
-
resolveConfig,
|
|
1442
|
-
loadEnvironment,
|
|
1443
|
-
loadAndExecuteDeployments,
|
|
1444
|
-
executeDeployScripts
|
|
1445
|
-
};
|
|
1446
|
-
//# sourceMappingURL=chunk-LUXDAM6F.js.map
|
|
1295
|
+
export { execute as a, readAndResolveConfig as b, resolveConfig as c, loadEnvironment as d, extendEnvironment as e, loadAndExecuteDeployments as f, executeDeployScripts as g, handleSignerProtocol as h, chainTypes as i, chainById as j, getChain as k, loadDeployments as l, mergeArtifacts as m, getGasPriceEstimate as n, getRoughGasPriceEstimate as o, readConfig as r };
|
|
1296
|
+
//# sourceMappingURL=index-DRZG9qM_.mjs.map
|