@0xsequence/catapult 1.4.0 → 1.5.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.
Files changed (163) hide show
  1. package/README.md +27 -0
  2. package/dist/lib/__tests__/network-loader.spec.js.map +1 -1
  3. package/dist/lib/core/__tests__/resolver.spec.js +22 -0
  4. package/dist/lib/core/__tests__/resolver.spec.js.map +1 -1
  5. package/dist/lib/core/__tests__/sign-actions.spec.d.ts +2 -0
  6. package/dist/lib/core/__tests__/sign-actions.spec.d.ts.map +1 -0
  7. package/dist/lib/core/__tests__/sign-actions.spec.js +128 -0
  8. package/dist/lib/core/__tests__/sign-actions.spec.js.map +1 -0
  9. package/dist/lib/core/__tests__/signer.spec.d.ts +2 -0
  10. package/dist/lib/core/__tests__/signer.spec.d.ts.map +1 -0
  11. package/dist/lib/core/__tests__/signer.spec.js +40 -0
  12. package/dist/lib/core/__tests__/signer.spec.js.map +1 -0
  13. package/dist/lib/core/context.d.ts +3 -2
  14. package/dist/lib/core/context.d.ts.map +1 -1
  15. package/dist/lib/core/context.js +3 -2
  16. package/dist/lib/core/context.js.map +1 -1
  17. package/dist/lib/core/engine.d.ts +4 -0
  18. package/dist/lib/core/engine.d.ts.map +1 -1
  19. package/dist/lib/core/engine.js +173 -0
  20. package/dist/lib/core/engine.js.map +1 -1
  21. package/dist/lib/core/signer.d.ts +7 -0
  22. package/dist/lib/core/signer.d.ts.map +1 -0
  23. package/dist/lib/core/signer.js +60 -0
  24. package/dist/lib/core/signer.js.map +1 -0
  25. package/dist/lib/parsers/__tests__/source.spec.js +37 -0
  26. package/dist/lib/parsers/__tests__/source.spec.js.map +1 -1
  27. package/dist/lib/parsers/source.js +1 -1
  28. package/dist/lib/parsers/source.js.map +1 -1
  29. package/dist/lib/provenance.js +51 -2
  30. package/dist/lib/provenance.js.map +1 -1
  31. package/dist/lib/types/actions.d.ts +26 -2
  32. package/dist/lib/types/actions.d.ts.map +1 -1
  33. package/dist/lib/types/actions.js +3 -0
  34. package/dist/lib/types/actions.js.map +1 -1
  35. package/dist/lib/types/source.d.ts +2 -0
  36. package/dist/lib/types/source.d.ts.map +1 -1
  37. package/package.json +4 -1
  38. package/.eslintrc.json +0 -29
  39. package/.github/workflows/ci.yml +0 -181
  40. package/CONCEPT.md +0 -24
  41. package/contracts/checked-call.huff +0 -65
  42. package/eslint.config.js +0 -48
  43. package/examples/jobs/guards-v1.yaml +0 -17
  44. package/examples/jobs/sequence-seq-0001-patch.yaml +0 -59
  45. package/examples/jobs/sequence-v1.yaml +0 -59
  46. package/examples/templates/sequence-factory-v1.yaml +0 -56
  47. package/jest.config.js +0 -25
  48. package/src/cli.ts +0 -18
  49. package/src/commands/common.ts +0 -61
  50. package/src/commands/dry.ts +0 -209
  51. package/src/commands/etherscan.ts +0 -360
  52. package/src/commands/index.ts +0 -6
  53. package/src/commands/list.ts +0 -262
  54. package/src/commands/provenance.ts +0 -120
  55. package/src/commands/run.ts +0 -146
  56. package/src/commands/utils.ts +0 -215
  57. package/src/index.ts +0 -67
  58. package/src/lib/__tests__/deployer-events.spec.ts +0 -338
  59. package/src/lib/__tests__/deployer.spec.ts +0 -2269
  60. package/src/lib/__tests__/network-loader.spec.ts +0 -150
  61. package/src/lib/__tests__/network-selection.spec.ts +0 -41
  62. package/src/lib/__tests__/network-utils.spec.ts +0 -230
  63. package/src/lib/__tests__/provenance.spec.ts +0 -208
  64. package/src/lib/artifacts/__tests__/fixtures/contract1.json +0 -19
  65. package/src/lib/artifacts/__tests__/fixtures/contract2.json +0 -19
  66. package/src/lib/artifacts/__tests__/fixtures/duplicate-name.json +0 -19
  67. package/src/lib/artifacts/__tests__/fixtures/nested/nested-contract.json +0 -18
  68. package/src/lib/artifacts/__tests__/fixtures/not-an-artifact.json +0 -8
  69. package/src/lib/artifacts/__tests__/fixtures/readme.txt +0 -2
  70. package/src/lib/contracts/__tests__/repository.spec.ts +0 -612
  71. package/src/lib/contracts/repository.ts +0 -411
  72. package/src/lib/core/__tests__/assert-action.spec.ts +0 -474
  73. package/src/lib/core/__tests__/context.spec.ts +0 -37
  74. package/src/lib/core/__tests__/engine.spec.ts +0 -2005
  75. package/src/lib/core/__tests__/graph.spec.ts +0 -125
  76. package/src/lib/core/__tests__/json-integration.spec.ts +0 -425
  77. package/src/lib/core/__tests__/loader.spec.ts +0 -367
  78. package/src/lib/core/__tests__/multi-platform-verification.spec.ts +0 -406
  79. package/src/lib/core/__tests__/resolver.spec.ts +0 -2496
  80. package/src/lib/core/__tests__/static-action.spec.ts +0 -172
  81. package/src/lib/core/context.ts +0 -127
  82. package/src/lib/core/engine.ts +0 -1834
  83. package/src/lib/core/graph.ts +0 -252
  84. package/src/lib/core/loader.ts +0 -253
  85. package/src/lib/core/resolver.ts +0 -873
  86. package/src/lib/deployer.ts +0 -1005
  87. package/src/lib/events/__tests__/event-system.spec.ts +0 -392
  88. package/src/lib/events/cli-adapter.ts +0 -369
  89. package/src/lib/events/emitter.ts +0 -62
  90. package/src/lib/events/index.ts +0 -3
  91. package/src/lib/events/types.ts +0 -520
  92. package/src/lib/index.ts +0 -17
  93. package/src/lib/network-loader.ts +0 -90
  94. package/src/lib/network-selection.ts +0 -73
  95. package/src/lib/network-utils.ts +0 -64
  96. package/src/lib/parsers/__tests__/buildinfo.spec.ts +0 -122
  97. package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-bytecode-buildinfo.json +0 -62
  98. package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-json.txt +0 -2
  99. package/src/lib/parsers/__tests__/fixtures/buildinfo/multi-contract-buildinfo.json +0 -89
  100. package/src/lib/parsers/__tests__/fixtures/buildinfo/no-contracts-buildinfo.json +0 -17
  101. package/src/lib/parsers/__tests__/fixtures/buildinfo/simple-buildinfo.json +0 -63
  102. package/src/lib/parsers/__tests__/fixtures/buildinfo/wrong-format.json +0 -4
  103. package/src/lib/parsers/__tests__/job.spec.ts +0 -439
  104. package/src/lib/parsers/__tests__/source.spec.ts +0 -134
  105. package/src/lib/parsers/__tests__/template.spec.ts +0 -111
  106. package/src/lib/parsers/artifact/__tests__/artifact.spec.ts +0 -117
  107. package/src/lib/parsers/artifact/__tests__/fixtures/empty-bytecode.json +0 -5
  108. package/src/lib/parsers/artifact/__tests__/fixtures/hardhat-artifact.json +0 -67
  109. package/src/lib/parsers/artifact/__tests__/fixtures/invalid-bytecode.json +0 -5
  110. package/src/lib/parsers/artifact/__tests__/fixtures/invalid-json.txt +0 -11
  111. package/src/lib/parsers/artifact/__tests__/fixtures/minimal-artifact.json +0 -5
  112. package/src/lib/parsers/artifact/__tests__/fixtures/missing-abi.json +0 -4
  113. package/src/lib/parsers/artifact/__tests__/fixtures/missing-bytecode.json +0 -11
  114. package/src/lib/parsers/artifact/__tests__/fixtures/missing-contract-name.json +0 -11
  115. package/src/lib/parsers/artifact/__tests__/fixtures/simple-artifact.json +0 -40
  116. package/src/lib/parsers/artifact/__tests__/fixtures/wrong-types.json +0 -7
  117. package/src/lib/parsers/artifact/foundry-1.2.ts +0 -72
  118. package/src/lib/parsers/artifact/index.ts +0 -27
  119. package/src/lib/parsers/artifact/types.ts +0 -9
  120. package/src/lib/parsers/buildinfo.ts +0 -127
  121. package/src/lib/parsers/constants.ts +0 -56
  122. package/src/lib/parsers/index.ts +0 -6
  123. package/src/lib/parsers/job.ts +0 -160
  124. package/src/lib/parsers/source.ts +0 -129
  125. package/src/lib/parsers/template.ts +0 -135
  126. package/src/lib/provenance.ts +0 -785
  127. package/src/lib/std/templates/arachnid-deterministic-deployment-proxy.yaml +0 -68
  128. package/src/lib/std/templates/assured-deployment.yaml +0 -46
  129. package/src/lib/std/templates/era-evm-predeploy.yaml +0 -35
  130. package/src/lib/std/templates/erc-2470.yaml +0 -70
  131. package/src/lib/std/templates/min-balance.yaml +0 -35
  132. package/src/lib/std/templates/nano-universal-deployer.yaml +0 -61
  133. package/src/lib/std/templates/raw-erc-2470.yaml +0 -62
  134. package/src/lib/std/templates/raw-nano-universal-deployer.yaml +0 -54
  135. package/src/lib/std/templates/raw-sequence-universal-deployer-2.yaml +0 -52
  136. package/src/lib/std/templates/sequence-universal-deployer-2.yaml +0 -61
  137. package/src/lib/types/__tests__/json-request-action.spec.ts +0 -243
  138. package/src/lib/types/__tests__/read-json-value.spec.ts +0 -278
  139. package/src/lib/types/__tests__/resolve-json-value.spec.ts +0 -769
  140. package/src/lib/types/actions.ts +0 -148
  141. package/src/lib/types/artifacts.ts +0 -21
  142. package/src/lib/types/buildinfo.ts +0 -116
  143. package/src/lib/types/conditions.ts +0 -50
  144. package/src/lib/types/contracts.ts +0 -26
  145. package/src/lib/types/definitions.ts +0 -77
  146. package/src/lib/types/index.ts +0 -9
  147. package/src/lib/types/network.ts +0 -33
  148. package/src/lib/types/project.ts +0 -9
  149. package/src/lib/types/source.ts +0 -26
  150. package/src/lib/types/task.ts +0 -9
  151. package/src/lib/types/values.ts +0 -221
  152. package/src/lib/utils/assertion.ts +0 -24
  153. package/src/lib/utils/validation.ts +0 -116
  154. package/src/lib/validation/contract-references.ts +0 -210
  155. package/src/lib/validation/index.ts +0 -1
  156. package/src/lib/verification/__tests__/etherscan.spec.ts +0 -710
  157. package/src/lib/verification/__tests__/sourcify.spec.ts +0 -288
  158. package/src/lib/verification/etherscan.ts +0 -547
  159. package/src/lib/verification/sourcify.ts +0 -248
  160. package/test_validation/artifacts/TestContract.json +0 -9
  161. package/test_validation/jobs/test-missing.yaml +0 -16
  162. package/test_validation/networks.yaml +0 -3
  163. package/tsconfig.json +0 -36
@@ -1,520 +0,0 @@
1
- /**
2
- * Event system for structured logging throughout the deployment process.
3
- * Replaces direct console.log calls with rich, structured events.
4
- */
5
-
6
- export interface BaseEvent {
7
- type: string
8
- timestamp: Date
9
- level: 'info' | 'warn' | 'error' | 'debug'
10
- }
11
-
12
- // Deployment lifecycle events
13
- export interface DeploymentStartedEvent extends BaseEvent {
14
- type: 'deployment_started'
15
- level: 'info'
16
- data: {
17
- projectRoot: string
18
- }
19
- }
20
-
21
- export interface DeploymentCompletedEvent extends BaseEvent {
22
- type: 'deployment_completed'
23
- level: 'info'
24
- }
25
-
26
- export interface DeploymentFailedEvent extends BaseEvent {
27
- type: 'deployment_failed'
28
- level: 'error'
29
- data: {
30
- error: string
31
- stack?: string
32
- failedJobs?: Array<{
33
- jobName: string
34
- networkName: string
35
- chainId: number
36
- error: string
37
- }>
38
- }
39
- }
40
-
41
- // Project loading events
42
- export interface ProjectLoadingStartedEvent extends BaseEvent {
43
- type: 'project_loading_started'
44
- level: 'info'
45
- data: {
46
- projectRoot: string
47
- }
48
- }
49
-
50
- export interface ProjectLoadedEvent extends BaseEvent {
51
- type: 'project_loaded'
52
- level: 'info'
53
- data: {
54
- jobCount: number
55
- templateCount: number
56
- }
57
- }
58
-
59
- // Execution plan events
60
- export interface ExecutionPlanEvent extends BaseEvent {
61
- type: 'execution_plan'
62
- level: 'info'
63
- data: {
64
- targetNetworks: Array<{
65
- name: string
66
- chainId: number
67
- }>
68
- jobExecutionOrder: string[]
69
- }
70
- }
71
-
72
- // Job execution events
73
- export interface JobStartedEvent extends BaseEvent {
74
- type: 'job_started'
75
- level: 'info'
76
- data: {
77
- jobName: string
78
- jobVersion: string
79
- networkName: string
80
- chainId: number
81
- }
82
- }
83
-
84
- export interface JobCompletedEvent extends BaseEvent {
85
- type: 'job_completed'
86
- level: 'info'
87
- data: {
88
- jobName: string
89
- networkName: string
90
- chainId: number
91
- }
92
- }
93
-
94
- export interface JobSkippedEvent extends BaseEvent {
95
- type: 'job_skipped'
96
- level: 'warn'
97
- data: {
98
- jobName: string
99
- networkName: string
100
- reason: string
101
- }
102
- }
103
-
104
- // Action execution events
105
- export interface ActionStartedEvent extends BaseEvent {
106
- type: 'action_started'
107
- level: 'info'
108
- data: {
109
- actionName: string
110
- jobName: string
111
- }
112
- }
113
-
114
- export interface ActionSkippedEvent extends BaseEvent {
115
- type: 'action_skipped'
116
- level: 'info'
117
- data: {
118
- actionName: string
119
- reason: string
120
- }
121
- }
122
-
123
- export interface ActionCompletedEvent extends BaseEvent {
124
- type: 'action_completed'
125
- level: 'info'
126
- data: {
127
- actionName: string
128
- result: string
129
- }
130
- }
131
-
132
- export interface ActionFailedEvent extends BaseEvent {
133
- type: 'action_failed'
134
- level: 'error'
135
- data: {
136
- message: string
137
- }
138
- }
139
-
140
- export interface ActionInfoEvent extends BaseEvent {
141
- type: 'action_info'
142
- level: 'debug'
143
- data: {
144
- message: string
145
- }
146
- }
147
-
148
- export interface DebugInfoEvent extends BaseEvent {
149
- type: 'debug_info'
150
- level: 'debug' | 'info' | 'warn'
151
- data: {
152
- message: string
153
- }
154
- }
155
-
156
- // Template execution events
157
- export interface TemplateEnteredEvent extends BaseEvent {
158
- type: 'template_entered'
159
- level: 'debug'
160
- data: {
161
- templateName: string
162
- }
163
- }
164
-
165
- export interface TemplateExitedEvent extends BaseEvent {
166
- type: 'template_exited'
167
- level: 'debug'
168
- data: {
169
- templateName: string
170
- }
171
- }
172
-
173
- export interface TemplateSetupStartedEvent extends BaseEvent {
174
- type: 'template_setup_started'
175
- level: 'debug'
176
- data: {
177
- templateName: string
178
- }
179
- }
180
-
181
- export interface TemplateSetupCompletedEvent extends BaseEvent {
182
- type: 'template_setup_completed'
183
- level: 'debug'
184
- data: {
185
- templateName: string
186
- }
187
- }
188
-
189
- export interface TemplateSetupSkippedEvent extends BaseEvent {
190
- type: 'template_setup_skipped'
191
- level: 'info'
192
- data: {
193
- templateName: string
194
- reason: string
195
- }
196
- }
197
-
198
- export interface TemplateSkippedEvent extends BaseEvent {
199
- type: 'template_skipped'
200
- level: 'info'
201
- data: {
202
- templateName: string
203
- reason: string
204
- }
205
- }
206
-
207
- // Transaction events
208
- export interface PrimitiveActionEvent extends BaseEvent {
209
- type: 'primitive_action'
210
- level: 'debug'
211
- data: {
212
- actionType: string
213
- }
214
- }
215
-
216
- export interface TransactionSentEvent extends BaseEvent {
217
- type: 'transaction_sent'
218
- level: 'info'
219
- data: {
220
- to: string
221
- value: string
222
- dataPreview: string
223
- txHash: string
224
- }
225
- }
226
-
227
- export interface TransactionConfirmedEvent extends BaseEvent {
228
- type: 'transaction_confirmed'
229
- level: 'info'
230
- data: {
231
- txHash: string
232
- blockNumber: number
233
- }
234
- }
235
-
236
- // Contract lifecycle events
237
- export interface ContractCreatedEvent extends BaseEvent {
238
- type: 'contract_created'
239
- level: 'info'
240
- data: {
241
- contractAddress: string
242
- txHash: string
243
- blockNumber: number
244
- }
245
- }
246
-
247
- // Output events
248
- export interface OutputStoredEvent extends BaseEvent {
249
- type: 'output_stored'
250
- level: 'debug'
251
- data: {
252
- outputKey: string
253
- value: any
254
- }
255
- }
256
-
257
- export interface OutputFileWrittenEvent extends BaseEvent {
258
- type: 'output_file_written'
259
- level: 'info'
260
- data: {
261
- relativePath: string
262
- }
263
- }
264
-
265
- export interface NoOutputsEvent extends BaseEvent {
266
- type: 'no_outputs'
267
- level: 'warn'
268
- }
269
-
270
- export interface OutputWritingStartedEvent extends BaseEvent {
271
- type: 'output_writing_started'
272
- level: 'info'
273
- }
274
-
275
- // Warning events
276
- export interface DuplicateArtifactWarningEvent extends BaseEvent {
277
- type: 'duplicate_artifact_warning'
278
- level: 'warn'
279
- data: {
280
- contractName: string
281
- path: string
282
- }
283
- }
284
-
285
- export interface MissingNetworkConfigWarningEvent extends BaseEvent {
286
- type: 'missing_network_config_warning'
287
- level: 'warn'
288
- data: {
289
- missingChainIds: number[]
290
- }
291
- }
292
-
293
- export interface ContextDisposalWarningEvent extends BaseEvent {
294
- type: 'context_disposal_warning'
295
- level: 'warn'
296
- data: {
297
- jobName: string
298
- networkName: string
299
- error: string
300
- }
301
- }
302
-
303
- export interface DeprecatedJobsSkippedEvent extends BaseEvent {
304
- type: 'deprecated_jobs_skipped'
305
- level: 'warn'
306
- data: {
307
- jobs: string[] | { name: string }[]
308
- }
309
- }
310
-
311
- // Network events
312
- export interface NetworkStartedEvent extends BaseEvent {
313
- type: 'network_started'
314
- level: 'info'
315
- data: {
316
- networkName: string
317
- chainId: number
318
- }
319
- }
320
-
321
- /**
322
- * Emitted right after a network run starts to inform which address will be used
323
- * to send transactions and its current balance.
324
- */
325
- export interface NetworkSignerInfoEvent extends BaseEvent {
326
- type: 'network_signer_info'
327
- level: 'info'
328
- data: {
329
- networkName: string
330
- chainId: number
331
- address: string
332
- balanceWei: string
333
- balance: string // formatted in ETH
334
- }
335
- }
336
-
337
- // Process error events
338
- export interface UnhandledRejectionEvent extends BaseEvent {
339
- type: 'unhandled_rejection'
340
- level: 'error'
341
- data: {
342
- error: string
343
- origin: string
344
- }
345
- }
346
-
347
- export interface UncaughtExceptionEvent extends BaseEvent {
348
- type: 'uncaught_exception'
349
- level: 'error'
350
- data: {
351
- error: Error
352
- }
353
- }
354
-
355
- export interface CLIErrorEvent extends BaseEvent {
356
- type: 'cli_error'
357
- level: 'error'
358
- data: {
359
- message: string
360
- }
361
- }
362
-
363
- export interface JobExecutionFailedEvent extends BaseEvent {
364
- type: 'job_execution_failed'
365
- level: 'error'
366
- data: {
367
- jobName: string
368
- networkName: string
369
- chainId: number
370
- error: string
371
- }
372
- }
373
-
374
- export interface VerificationStartedEvent extends BaseEvent {
375
- type: 'verification_started'
376
- level: 'info'
377
- data: {
378
- actionName: string
379
- address: string
380
- contractName: string
381
- platform: string
382
- networkName: string
383
- }
384
- }
385
-
386
- export interface VerificationSubmittedEvent extends BaseEvent {
387
- type: 'verification_submitted'
388
- level: 'info'
389
- data: {
390
- actionName: string
391
- platform: string
392
- guid: string
393
- message: string
394
- }
395
- }
396
-
397
- export interface VerificationCompletedEvent extends BaseEvent {
398
- type: 'verification_completed'
399
- level: 'info'
400
- data: {
401
- actionName: string
402
- address: string
403
- contractName: string
404
- platform: string
405
- message: string
406
- }
407
- }
408
-
409
- export interface VerificationFailedEvent extends BaseEvent {
410
- type: 'verification_failed'
411
- level: 'error'
412
- data: {
413
- actionName: string
414
- address: string
415
- contractName: string
416
- platform: string
417
- error: string
418
- }
419
- }
420
-
421
- export interface VerificationRetryEvent extends BaseEvent {
422
- type: 'verification_retry'
423
- level: 'info'
424
- data: {
425
- platform: string
426
- attempt: number
427
- maxRetries: number
428
- error: string
429
- }
430
- }
431
-
432
- export interface VerificationSkippedEvent extends BaseEvent {
433
- type: 'verification_skipped'
434
- level: 'warn'
435
- data: {
436
- actionName: string
437
- reason: string
438
- }
439
- }
440
-
441
- export interface VerificationWarningsReportEvent extends BaseEvent {
442
- type: 'verification_warnings_report'
443
- level: 'warn'
444
- data: {
445
- totalWarnings: number
446
- warnings: Array<{
447
- actionName: string
448
- address: string
449
- contractName: string
450
- platform: string
451
- error: string
452
- jobName?: string
453
- networkName?: string
454
- }>
455
- }
456
- }
457
-
458
- // End-of-run summary
459
- export interface RunSummaryEvent extends BaseEvent {
460
- type: 'run_summary'
461
- level: 'info' | 'warn'
462
- data: {
463
- networkCount: number
464
- jobCount: number
465
- successCount: number
466
- failedCount: number
467
- skippedCount: number
468
- keyContracts: Array<{ job: string; action: string; address: string }>
469
- }
470
- }
471
-
472
- // Union type of all events
473
- export type DeploymentEvent =
474
- | DeploymentStartedEvent
475
- | DeploymentCompletedEvent
476
- | DeploymentFailedEvent
477
- | ProjectLoadingStartedEvent
478
- | ProjectLoadedEvent
479
- | ExecutionPlanEvent
480
- | JobStartedEvent
481
- | JobCompletedEvent
482
- | JobSkippedEvent
483
- | ActionStartedEvent
484
- | ActionSkippedEvent
485
- | ActionCompletedEvent
486
- | ActionFailedEvent
487
- | ActionInfoEvent
488
- | DebugInfoEvent
489
- | TemplateEnteredEvent
490
- | TemplateExitedEvent
491
- | TemplateSetupStartedEvent
492
- | TemplateSetupCompletedEvent
493
- | TemplateSetupSkippedEvent
494
- | TemplateSkippedEvent
495
- | PrimitiveActionEvent
496
- | TransactionSentEvent
497
- | TransactionConfirmedEvent
498
- | ContractCreatedEvent
499
- | OutputStoredEvent
500
- | OutputFileWrittenEvent
501
- | NoOutputsEvent
502
- | OutputWritingStartedEvent
503
- | DuplicateArtifactWarningEvent
504
- | MissingNetworkConfigWarningEvent
505
- | ContextDisposalWarningEvent
506
- | DeprecatedJobsSkippedEvent
507
- | NetworkStartedEvent
508
- | NetworkSignerInfoEvent
509
- | UnhandledRejectionEvent
510
- | UncaughtExceptionEvent
511
- | CLIErrorEvent
512
- | JobExecutionFailedEvent
513
- | VerificationStartedEvent
514
- | VerificationSubmittedEvent
515
- | VerificationCompletedEvent
516
- | VerificationFailedEvent
517
- | VerificationRetryEvent
518
- | VerificationSkippedEvent
519
- | VerificationWarningsReportEvent
520
- | RunSummaryEvent
package/src/lib/index.ts DELETED
@@ -1,17 +0,0 @@
1
- // Export all types
2
- export * from './types'
3
-
4
- // Export core classes
5
- export * from './contracts/repository'
6
-
7
- // Export all parsers
8
- export * as parsers from './parsers'
9
-
10
- // Export the deployer
11
- export * from './deployer'
12
-
13
- // Export provenance helpers
14
- export * from './provenance'
15
-
16
- // This will be the main entry point for the lib
17
- // Additional functionality will be added here as the lib grows
@@ -1,90 +0,0 @@
1
- import * as fs from 'fs/promises'
2
- import * as path from 'path'
3
- import { parse as parseYaml } from 'yaml'
4
- import { Network } from './types'
5
-
6
- function isValidNetwork(obj: unknown): obj is Network {
7
- return (
8
- typeof obj === 'object' &&
9
- obj !== null &&
10
- 'name' in obj &&
11
- 'chainId' in obj &&
12
- 'rpcUrl' in obj &&
13
- typeof (obj as Record<string, unknown>).name === 'string' &&
14
- typeof (obj as Record<string, unknown>).chainId === 'number' &&
15
- typeof (obj as Record<string, unknown>).rpcUrl === 'string' &&
16
- // supports field is optional and should be an array of strings if present
17
- (!('supports' in obj) ||
18
- (Array.isArray((obj as Record<string, unknown>).supports) &&
19
- ((obj as Record<string, unknown>).supports as unknown[]).every((item: unknown) => typeof item === 'string'))) &&
20
- // gasLimit field is optional and should be a number if present
21
- (!('gasLimit' in obj) || typeof (obj as Record<string, unknown>).gasLimit === 'number') &&
22
- // testnet field is optional and should be a boolean if present
23
- (!('testnet' in obj) || typeof (obj as Record<string, unknown>).testnet === 'boolean') &&
24
- // evmVersion field is optional and should be a string if present
25
- (!('evmVersion' in obj) || typeof (obj as Record<string, unknown>).evmVersion === 'string') &&
26
- // params field is optional and must be a plain object if present
27
- (!('params' in obj) || (
28
- typeof (obj as Record<string, unknown>).params === 'object' &&
29
- (obj as Record<string, unknown>).params !== null &&
30
- !Array.isArray((obj as Record<string, unknown>).params)
31
- ))
32
- )
33
- }
34
-
35
- function resolveRpcUrlTokens(rpcUrl: string): string {
36
- // Replace placeholders like {{RPC_SOMETHING}} with process.env.RPC_SOMETHING
37
- // Only tokens starting with "RPC" are considered. Others are left as-is.
38
- const TOKEN_REGEX = /\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g
39
- return rpcUrl.replace(TOKEN_REGEX, (match: string, varName: string) => {
40
- if (!varName.startsWith('RPC')) {
41
- // Leave non-RPC tokens intact
42
- return match
43
- }
44
- const value = process.env[varName]
45
- if (typeof value === 'undefined') {
46
- // Default to empty string if missing
47
- return ''
48
- }
49
- return value
50
- })
51
- }
52
-
53
- /**
54
- * Loads and validates network configurations from a `networks.yaml` file in the project root.
55
- * @param projectRoot The root directory of the project.
56
- * @returns A promise that resolves to an array of Network objects.
57
- * @throws An error if the file exists but is malformed or contains invalid network data.
58
- */
59
- export async function loadNetworks(projectRoot: string): Promise<Network[]> {
60
- const filePath = path.join(projectRoot, 'networks.yaml')
61
- try {
62
- const content = await fs.readFile(filePath, 'utf-8')
63
- const parsed = parseYaml(content)
64
-
65
- if (!Array.isArray(parsed)) {
66
- throw new Error('networks.yaml must contain an array of network configurations.')
67
- }
68
-
69
- const networks: Network[] = []
70
- for (const item of parsed) {
71
- if (!isValidNetwork(item)) {
72
- throw new Error(`Invalid network configuration found in networks.yaml: ${JSON.stringify(item)}`)
73
- }
74
- // Resolve RPC URL tokens using environment variables
75
- const resolvedRpcUrl = resolveRpcUrlTokens(item.rpcUrl)
76
- networks.push({ ...item, rpcUrl: resolvedRpcUrl })
77
- }
78
- return networks
79
- } catch (error: unknown) {
80
- if (error && typeof error === 'object' && 'code' in error) {
81
- const errWithCode = error as { code?: unknown }
82
- if (errWithCode.code === 'ENOENT') {
83
- // It's okay if the file doesn't exist, just return an empty array.
84
- return []
85
- }
86
- }
87
- const message = error instanceof Error ? error.message : String(error)
88
- throw new Error(`Failed to load or parse networks.yaml: ${message}`)
89
- }
90
- }
@@ -1,73 +0,0 @@
1
- import { Network } from './types'
2
-
3
- /**
4
- * Parses a comma-separated selector string into chain IDs, supporting numeric IDs and network names.
5
- * - Numeric tokens (e.g., "1") are treated as chain IDs
6
- * - String tokens (e.g., "mainnet") are matched against Network.name case-insensitively
7
- * - When a name matches multiple networks, all of them are included
8
- * - Order is preserved by token then by appearance order in `networks`
9
- * - Duplicates are removed
10
- *
11
- * Throws if any token cannot be resolved to at least one chain ID.
12
- */
13
- export function resolveSelectedChainIds(
14
- selectors: string | undefined,
15
- networks: Network[]
16
- ): number[] | undefined {
17
- if (selectors == null) return undefined
18
- const normalized = String(selectors).trim()
19
- if (normalized.length === 0) return undefined
20
-
21
- const tokens = normalized
22
- .split(',')
23
- .map(t => t.trim())
24
- .filter(t => t.length > 0)
25
-
26
- if (tokens.length === 0) return undefined
27
-
28
- const result: number[] = []
29
- const seen = new Set<number>()
30
-
31
- for (const token of tokens) {
32
- if (/^\d+$/.test(token)) {
33
- const id = Number(token)
34
- if (!seen.has(id)) {
35
- seen.add(id)
36
- result.push(id)
37
- }
38
- continue
39
- }
40
-
41
- const tokenLc = token.toLowerCase()
42
- const matches = networks.filter(n => n.name.toLowerCase() === tokenLc)
43
- if (matches.length === 0) {
44
- const available = Array.from(new Set(networks.map(n => n.name))).sort()
45
- throw new Error(
46
- `Unknown network selector "${token}". Use a chain ID (e.g., 1) or a network name. Available names: ${available.join(', ')}`
47
- )
48
- }
49
- for (const net of matches) {
50
- if (!seen.has(net.chainId)) {
51
- seen.add(net.chainId)
52
- result.push(net.chainId)
53
- }
54
- }
55
- }
56
-
57
- return result
58
- }
59
-
60
- /**
61
- * Resolves a single selector into one chain ID. If a name maps to multiple networks,
62
- * returns the first matching network in the order provided.
63
- */
64
- export function resolveSingleChainId(
65
- selector: string | undefined,
66
- networks: Network[]
67
- ): number | undefined {
68
- const ids = resolveSelectedChainIds(selector, networks)
69
- if (!ids || ids.length === 0) return undefined
70
- return ids[0]
71
- }
72
-
73
-