rocketh 0.10.8 → 0.10.9
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 +6 -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-BJlVmvtt.cjs +1306 -0
- package/dist/index-BJlVmvtt.cjs.map +1 -0
- package/dist/{chunk-LUXDAM6F.js → index-DOSnToHV.mjs} +82 -240
- package/dist/index-DOSnToHV.mjs.map +1 -0
- package/dist/index.cjs +33 -1484
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +923 -7
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +26 -17
- package/src/environment/utils/chains.ts +0 -12
- 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);
|
|
@@ -714,11 +577,11 @@ async function createEnvironment(config, providedContext) {
|
|
|
714
577
|
}
|
|
715
578
|
};
|
|
716
579
|
function ensureDeploymentFolder() {
|
|
717
|
-
const folderPath =
|
|
718
|
-
|
|
719
|
-
const chainFilepath =
|
|
720
|
-
if (!
|
|
721
|
-
|
|
580
|
+
const folderPath = path.join(config.deployments, context.network.name);
|
|
581
|
+
fs.mkdirSync(folderPath, { recursive: true });
|
|
582
|
+
const chainFilepath = path.join(folderPath, ".chain");
|
|
583
|
+
if (!fs.existsSync(chainFilepath)) {
|
|
584
|
+
fs.writeFileSync(chainFilepath, JSON.stringify({ chainId, genesisHash }));
|
|
722
585
|
}
|
|
723
586
|
return folderPath;
|
|
724
587
|
}
|
|
@@ -760,7 +623,7 @@ async function createEnvironment(config, providedContext) {
|
|
|
760
623
|
deployments[name] = deployment;
|
|
761
624
|
if (context.network.saveDeployments) {
|
|
762
625
|
const folderPath = ensureDeploymentFolder();
|
|
763
|
-
|
|
626
|
+
fs.writeFileSync(`${folderPath}/${name}.json`, JSONToString(deployment, 2));
|
|
764
627
|
}
|
|
765
628
|
return deployment;
|
|
766
629
|
}
|
|
@@ -769,10 +632,10 @@ async function createEnvironment(config, providedContext) {
|
|
|
769
632
|
return;
|
|
770
633
|
}
|
|
771
634
|
const folderPath = ensureDeploymentFolder();
|
|
772
|
-
const filepath =
|
|
635
|
+
const filepath = path.join(folderPath, ".pending_transactions.json");
|
|
773
636
|
let existingPendingTansactions;
|
|
774
637
|
try {
|
|
775
|
-
existingPendingTansactions = stringToJSON(
|
|
638
|
+
existingPendingTansactions = stringToJSON(fs.readFileSync(filepath, "utf-8"));
|
|
776
639
|
} catch {
|
|
777
640
|
existingPendingTansactions = [];
|
|
778
641
|
}
|
|
@@ -786,7 +649,7 @@ async function createEnvironment(config, providedContext) {
|
|
|
786
649
|
);
|
|
787
650
|
try {
|
|
788
651
|
await waitForDeploymentTransactionAndSave(pendingTransaction);
|
|
789
|
-
|
|
652
|
+
fs.writeFileSync(filepath, JSONToString(existingPendingTansactions, 2));
|
|
790
653
|
spinner.succeed();
|
|
791
654
|
} catch (e) {
|
|
792
655
|
spinner.fail();
|
|
@@ -796,7 +659,7 @@ async function createEnvironment(config, providedContext) {
|
|
|
796
659
|
const spinner = spin(`recovering execution's transaction ${pendingTransaction.transaction.hash}`);
|
|
797
660
|
try {
|
|
798
661
|
await waitForTransaction(pendingTransaction.transaction.hash);
|
|
799
|
-
|
|
662
|
+
fs.writeFileSync(filepath, JSONToString(existingPendingTansactions, 2));
|
|
800
663
|
spinner.succeed();
|
|
801
664
|
} catch (e) {
|
|
802
665
|
spinner.fail();
|
|
@@ -805,21 +668,21 @@ async function createEnvironment(config, providedContext) {
|
|
|
805
668
|
}
|
|
806
669
|
}
|
|
807
670
|
}
|
|
808
|
-
|
|
671
|
+
fs.rmSync(filepath);
|
|
809
672
|
}
|
|
810
673
|
}
|
|
811
674
|
async function savePendingTransaction(pendingTransaction) {
|
|
812
675
|
if (context.network.saveDeployments) {
|
|
813
676
|
const folderPath = ensureDeploymentFolder();
|
|
814
|
-
const filepath =
|
|
677
|
+
const filepath = path.join(folderPath, ".pending_transactions.json");
|
|
815
678
|
let existingPendinTransactions;
|
|
816
679
|
try {
|
|
817
|
-
existingPendinTransactions = stringToJSON(
|
|
680
|
+
existingPendinTransactions = stringToJSON(fs.readFileSync(filepath, "utf-8"));
|
|
818
681
|
} catch {
|
|
819
682
|
existingPendinTransactions = [];
|
|
820
683
|
}
|
|
821
684
|
existingPendinTransactions.push(pendingTransaction);
|
|
822
|
-
|
|
685
|
+
fs.writeFileSync(filepath, JSONToString(existingPendinTransactions, 2));
|
|
823
686
|
}
|
|
824
687
|
return deployments;
|
|
825
688
|
}
|
|
@@ -841,25 +704,25 @@ async function createEnvironment(config, providedContext) {
|
|
|
841
704
|
async function deleteTransaction(hash) {
|
|
842
705
|
if (context.network.saveDeployments) {
|
|
843
706
|
const folderPath = ensureDeploymentFolder();
|
|
844
|
-
const filepath =
|
|
707
|
+
const filepath = path.join(folderPath, ".pending_transactions.json");
|
|
845
708
|
let existingPendinTransactions;
|
|
846
709
|
try {
|
|
847
|
-
existingPendinTransactions = stringToJSON(
|
|
710
|
+
existingPendinTransactions = stringToJSON(fs.readFileSync(filepath, "utf-8"));
|
|
848
711
|
} catch {
|
|
849
712
|
existingPendinTransactions = [];
|
|
850
713
|
}
|
|
851
714
|
existingPendinTransactions = existingPendinTransactions.filter((v) => v.transaction.hash !== hash);
|
|
852
715
|
if (existingPendinTransactions.length === 0) {
|
|
853
|
-
|
|
716
|
+
fs.rmSync(filepath);
|
|
854
717
|
} else {
|
|
855
|
-
|
|
718
|
+
fs.writeFileSync(filepath, JSONToString(existingPendinTransactions, 2));
|
|
856
719
|
}
|
|
857
720
|
}
|
|
858
721
|
}
|
|
859
722
|
async function exportDeploymentsAsTypes() {
|
|
860
723
|
const folderPath = "./generated";
|
|
861
|
-
|
|
862
|
-
|
|
724
|
+
fs.mkdirSync(folderPath, { recursive: true });
|
|
725
|
+
fs.writeFileSync(`${folderPath}/deployments.ts`, `export default ${JSONToString(deployments, 2)} as const;`);
|
|
863
726
|
}
|
|
864
727
|
async function waitForTransaction(hash, info) {
|
|
865
728
|
const spinner = spin(
|
|
@@ -1040,7 +903,6 @@ async function createEnvironment(config, providedContext) {
|
|
|
1040
903
|
};
|
|
1041
904
|
}
|
|
1042
905
|
|
|
1043
|
-
// src/utils/eth.ts
|
|
1044
906
|
function avg(arr) {
|
|
1045
907
|
const sum = arr.reduce((a, v) => a + v);
|
|
1046
908
|
return sum / BigInt(arr.length);
|
|
@@ -1103,11 +965,8 @@ async function getRoughGasPriceEstimate(provider, options) {
|
|
|
1103
965
|
};
|
|
1104
966
|
}
|
|
1105
967
|
|
|
1106
|
-
// src/executor/index.ts
|
|
1107
|
-
import prompts from "prompts";
|
|
1108
|
-
import { formatEther } from "viem";
|
|
1109
968
|
if (!process.env["ROCKETH_SKIP_ESBUILD"]) {
|
|
1110
|
-
|
|
969
|
+
require$1("esbuild-register/dist/node").register();
|
|
1111
970
|
}
|
|
1112
971
|
function execute(context, callback, options) {
|
|
1113
972
|
const scriptModule = (env, args) => callback(env, args);
|
|
@@ -1119,7 +978,7 @@ function execute(context, callback, options) {
|
|
|
1119
978
|
function readConfig(options) {
|
|
1120
979
|
let configFile;
|
|
1121
980
|
try {
|
|
1122
|
-
const configString =
|
|
981
|
+
const configString = fs.readFileSync("./rocketh.json", "utf-8");
|
|
1123
982
|
configFile = JSON.parse(configString);
|
|
1124
983
|
} catch {
|
|
1125
984
|
}
|
|
@@ -1238,7 +1097,7 @@ async function executeDeployScripts(config, args) {
|
|
|
1238
1097
|
setLogLevel(typeof config.logLevel === "undefined" ? 0 : config.logLevel);
|
|
1239
1098
|
let filepaths;
|
|
1240
1099
|
filepaths = traverseMultipleDirectory([config.scripts]);
|
|
1241
|
-
filepaths = filepaths.filter((v) => !
|
|
1100
|
+
filepaths = filepaths.filter((v) => !path.basename(v).startsWith("_")).sort((a, b) => {
|
|
1242
1101
|
if (a < b) {
|
|
1243
1102
|
return -1;
|
|
1244
1103
|
}
|
|
@@ -1252,13 +1111,13 @@ async function executeDeployScripts(config, args) {
|
|
|
1252
1111
|
const scriptPathBags = {};
|
|
1253
1112
|
const scriptFilePaths = [];
|
|
1254
1113
|
for (const filepath of filepaths) {
|
|
1255
|
-
const scriptFilePath =
|
|
1114
|
+
const scriptFilePath = path.resolve(filepath);
|
|
1256
1115
|
let scriptModule;
|
|
1257
1116
|
try {
|
|
1258
|
-
if (
|
|
1259
|
-
delete
|
|
1117
|
+
if (require$1.cache) {
|
|
1118
|
+
delete require$1.cache[scriptFilePath];
|
|
1260
1119
|
}
|
|
1261
|
-
scriptModule =
|
|
1120
|
+
scriptModule = require$1(scriptFilePath);
|
|
1262
1121
|
if (scriptModule.default) {
|
|
1263
1122
|
scriptModule = scriptModule.default;
|
|
1264
1123
|
if (scriptModule.default) {
|
|
@@ -1380,8 +1239,8 @@ Do you want to proceed (note that gas price can change for each tx)`
|
|
|
1380
1239
|
}
|
|
1381
1240
|
}
|
|
1382
1241
|
for (const deployScript of scriptsToRun.concat(scriptsToRunAtTheEnd)) {
|
|
1383
|
-
const filename =
|
|
1384
|
-
|
|
1242
|
+
const filename = path.basename(deployScript.filePath);
|
|
1243
|
+
path.relative(".", deployScript.filePath);
|
|
1385
1244
|
let skip = false;
|
|
1386
1245
|
const spinner = spin(`- Executing ${filename}`);
|
|
1387
1246
|
if (deployScript.func.skip) {
|
|
@@ -1405,7 +1264,7 @@ Do you want to proceed (note that gas price can change for each tx)`
|
|
|
1405
1264
|
throw e;
|
|
1406
1265
|
}
|
|
1407
1266
|
if (result && typeof result === "boolean") {
|
|
1408
|
-
|
|
1267
|
+
config.deployments;
|
|
1409
1268
|
}
|
|
1410
1269
|
}
|
|
1411
1270
|
}
|
|
@@ -1425,22 +1284,5 @@ Do you want to proceed (note that gas price can change for each tx)`
|
|
|
1425
1284
|
return external;
|
|
1426
1285
|
}
|
|
1427
1286
|
|
|
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
|
|
1287
|
+
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 };
|
|
1288
|
+
//# sourceMappingURL=index-DOSnToHV.mjs.map
|