@0xsequence/catapult 1.1.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 (393) hide show
  1. package/.eslintrc.json +29 -0
  2. package/.github/workflows/ci.yml +181 -0
  3. package/CONCEPT.md +24 -0
  4. package/README.md +772 -0
  5. package/contracts/checked-call.huff +65 -0
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +16 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/commands/common.d.ts +11 -0
  11. package/dist/commands/common.d.ts.map +1 -0
  12. package/dist/commands/common.js +73 -0
  13. package/dist/commands/common.js.map +1 -0
  14. package/dist/commands/dry.d.ts +3 -0
  15. package/dist/commands/dry.d.ts.map +1 -0
  16. package/dist/commands/dry.js +171 -0
  17. package/dist/commands/dry.js.map +1 -0
  18. package/dist/commands/etherscan.d.ts +3 -0
  19. package/dist/commands/etherscan.d.ts.map +1 -0
  20. package/dist/commands/etherscan.js +323 -0
  21. package/dist/commands/etherscan.js.map +1 -0
  22. package/dist/commands/index.d.ts +6 -0
  23. package/dist/commands/index.d.ts.map +1 -0
  24. package/dist/commands/index.js +22 -0
  25. package/dist/commands/index.js.map +1 -0
  26. package/dist/commands/list.d.ts +3 -0
  27. package/dist/commands/list.d.ts.map +1 -0
  28. package/dist/commands/list.js +259 -0
  29. package/dist/commands/list.js.map +1 -0
  30. package/dist/commands/run.d.ts +3 -0
  31. package/dist/commands/run.d.ts.map +1 -0
  32. package/dist/commands/run.js +96 -0
  33. package/dist/commands/run.js.map +1 -0
  34. package/dist/commands/utils.d.ts +3 -0
  35. package/dist/commands/utils.d.ts.map +1 -0
  36. package/dist/commands/utils.js +46 -0
  37. package/dist/commands/utils.js.map +1 -0
  38. package/dist/index.d.ts +4 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +58 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/lib/__tests__/deployer-events.spec.d.ts +2 -0
  43. package/dist/lib/__tests__/deployer-events.spec.d.ts.map +1 -0
  44. package/dist/lib/__tests__/deployer-events.spec.js +260 -0
  45. package/dist/lib/__tests__/deployer-events.spec.js.map +1 -0
  46. package/dist/lib/__tests__/deployer.spec.d.ts +2 -0
  47. package/dist/lib/__tests__/deployer.spec.d.ts.map +1 -0
  48. package/dist/lib/__tests__/deployer.spec.js +884 -0
  49. package/dist/lib/__tests__/deployer.spec.js.map +1 -0
  50. package/dist/lib/__tests__/network-utils.spec.d.ts +2 -0
  51. package/dist/lib/__tests__/network-utils.spec.d.ts.map +1 -0
  52. package/dist/lib/__tests__/network-utils.spec.js +140 -0
  53. package/dist/lib/__tests__/network-utils.spec.js.map +1 -0
  54. package/dist/lib/contracts/__tests__/repository.spec.d.ts +2 -0
  55. package/dist/lib/contracts/__tests__/repository.spec.d.ts.map +1 -0
  56. package/dist/lib/contracts/__tests__/repository.spec.js +321 -0
  57. package/dist/lib/contracts/__tests__/repository.spec.js.map +1 -0
  58. package/dist/lib/contracts/repository.d.ts +27 -0
  59. package/dist/lib/contracts/repository.d.ts.map +1 -0
  60. package/dist/lib/contracts/repository.js +241 -0
  61. package/dist/lib/contracts/repository.js.map +1 -0
  62. package/dist/lib/core/__tests__/engine.spec.d.ts +2 -0
  63. package/dist/lib/core/__tests__/engine.spec.d.ts.map +1 -0
  64. package/dist/lib/core/__tests__/engine.spec.js +1212 -0
  65. package/dist/lib/core/__tests__/engine.spec.js.map +1 -0
  66. package/dist/lib/core/__tests__/graph.spec.d.ts +2 -0
  67. package/dist/lib/core/__tests__/graph.spec.d.ts.map +1 -0
  68. package/dist/lib/core/__tests__/graph.spec.js +116 -0
  69. package/dist/lib/core/__tests__/graph.spec.js.map +1 -0
  70. package/dist/lib/core/__tests__/json-integration.spec.d.ts +2 -0
  71. package/dist/lib/core/__tests__/json-integration.spec.d.ts.map +1 -0
  72. package/dist/lib/core/__tests__/json-integration.spec.js +300 -0
  73. package/dist/lib/core/__tests__/json-integration.spec.js.map +1 -0
  74. package/dist/lib/core/__tests__/loader.spec.d.ts +2 -0
  75. package/dist/lib/core/__tests__/loader.spec.d.ts.map +1 -0
  76. package/dist/lib/core/__tests__/loader.spec.js +288 -0
  77. package/dist/lib/core/__tests__/loader.spec.js.map +1 -0
  78. package/dist/lib/core/__tests__/multi-platform-verification.spec.d.ts +2 -0
  79. package/dist/lib/core/__tests__/multi-platform-verification.spec.d.ts.map +1 -0
  80. package/dist/lib/core/__tests__/multi-platform-verification.spec.js +342 -0
  81. package/dist/lib/core/__tests__/multi-platform-verification.spec.js.map +1 -0
  82. package/dist/lib/core/__tests__/resolver.spec.d.ts +2 -0
  83. package/dist/lib/core/__tests__/resolver.spec.d.ts.map +1 -0
  84. package/dist/lib/core/__tests__/resolver.spec.js +1367 -0
  85. package/dist/lib/core/__tests__/resolver.spec.js.map +1 -0
  86. package/dist/lib/core/__tests__/static-action.spec.d.ts +2 -0
  87. package/dist/lib/core/__tests__/static-action.spec.d.ts.map +1 -0
  88. package/dist/lib/core/__tests__/static-action.spec.js +136 -0
  89. package/dist/lib/core/__tests__/static-action.spec.js.map +1 -0
  90. package/dist/lib/core/context.d.ts +29 -0
  91. package/dist/lib/core/context.d.ts.map +1 -0
  92. package/dist/lib/core/context.js +88 -0
  93. package/dist/lib/core/context.js.map +1 -0
  94. package/dist/lib/core/engine.d.ts +25 -0
  95. package/dist/lib/core/engine.d.ts.map +1 -0
  96. package/dist/lib/core/engine.js +1191 -0
  97. package/dist/lib/core/engine.js.map +1 -0
  98. package/dist/lib/core/graph.d.ts +18 -0
  99. package/dist/lib/core/graph.d.ts.map +1 -0
  100. package/dist/lib/core/graph.js +158 -0
  101. package/dist/lib/core/graph.js.map +1 -0
  102. package/dist/lib/core/loader.d.ts +25 -0
  103. package/dist/lib/core/loader.d.ts.map +1 -0
  104. package/dist/lib/core/loader.js +248 -0
  105. package/dist/lib/core/loader.js.map +1 -0
  106. package/dist/lib/core/resolver.d.ts +20 -0
  107. package/dist/lib/core/resolver.d.ts.map +1 -0
  108. package/dist/lib/core/resolver.js +307 -0
  109. package/dist/lib/core/resolver.js.map +1 -0
  110. package/dist/lib/deployer.d.ts +39 -0
  111. package/dist/lib/deployer.d.ts.map +1 -0
  112. package/dist/lib/deployer.js +533 -0
  113. package/dist/lib/deployer.js.map +1 -0
  114. package/dist/lib/events/__tests__/event-system.spec.d.ts +2 -0
  115. package/dist/lib/events/__tests__/event-system.spec.d.ts.map +1 -0
  116. package/dist/lib/events/__tests__/event-system.spec.js +256 -0
  117. package/dist/lib/events/__tests__/event-system.spec.js.map +1 -0
  118. package/dist/lib/events/cli-adapter.d.ts +13 -0
  119. package/dist/lib/events/cli-adapter.d.ts.map +1 -0
  120. package/dist/lib/events/cli-adapter.js +244 -0
  121. package/dist/lib/events/cli-adapter.js.map +1 -0
  122. package/dist/lib/events/emitter.d.ts +11 -0
  123. package/dist/lib/events/emitter.d.ts.map +1 -0
  124. package/dist/lib/events/emitter.js +29 -0
  125. package/dist/lib/events/emitter.js.map +1 -0
  126. package/dist/lib/events/index.d.ts +4 -0
  127. package/dist/lib/events/index.d.ts.map +1 -0
  128. package/dist/lib/events/index.js +20 -0
  129. package/dist/lib/events/index.js.map +1 -0
  130. package/dist/lib/events/types.d.ts +368 -0
  131. package/dist/lib/events/types.d.ts.map +1 -0
  132. package/dist/lib/events/types.js +3 -0
  133. package/dist/lib/events/types.js.map +1 -0
  134. package/dist/lib/index.d.ts +5 -0
  135. package/dist/lib/index.d.ts.map +1 -0
  136. package/dist/lib/index.js +44 -0
  137. package/dist/lib/index.js.map +1 -0
  138. package/dist/lib/network-loader.d.ts +3 -0
  139. package/dist/lib/network-loader.d.ts.map +1 -0
  140. package/dist/lib/network-loader.js +80 -0
  141. package/dist/lib/network-loader.js.map +1 -0
  142. package/dist/lib/network-match.d.ts +3 -0
  143. package/dist/lib/network-match.d.ts.map +1 -0
  144. package/dist/lib/network-match.js +62 -0
  145. package/dist/lib/network-match.js.map +1 -0
  146. package/dist/lib/network-utils.d.ts +4 -0
  147. package/dist/lib/network-utils.d.ts.map +1 -0
  148. package/dist/lib/network-utils.js +39 -0
  149. package/dist/lib/network-utils.js.map +1 -0
  150. package/dist/lib/parsers/__tests__/buildinfo.spec.d.ts +2 -0
  151. package/dist/lib/parsers/__tests__/buildinfo.spec.d.ts.map +1 -0
  152. package/dist/lib/parsers/__tests__/buildinfo.spec.js +132 -0
  153. package/dist/lib/parsers/__tests__/buildinfo.spec.js.map +1 -0
  154. package/dist/lib/parsers/__tests__/job.spec.d.ts +2 -0
  155. package/dist/lib/parsers/__tests__/job.spec.d.ts.map +1 -0
  156. package/dist/lib/parsers/__tests__/job.spec.js +318 -0
  157. package/dist/lib/parsers/__tests__/job.spec.js.map +1 -0
  158. package/dist/lib/parsers/__tests__/template.spec.d.ts +2 -0
  159. package/dist/lib/parsers/__tests__/template.spec.d.ts.map +1 -0
  160. package/dist/lib/parsers/__tests__/template.spec.js +126 -0
  161. package/dist/lib/parsers/__tests__/template.spec.js.map +1 -0
  162. package/dist/lib/parsers/artifact/__tests__/artifact.spec.d.ts +2 -0
  163. package/dist/lib/parsers/artifact/__tests__/artifact.spec.d.ts.map +1 -0
  164. package/dist/lib/parsers/artifact/__tests__/artifact.spec.js +128 -0
  165. package/dist/lib/parsers/artifact/__tests__/artifact.spec.js.map +1 -0
  166. package/dist/lib/parsers/artifact/foundry-1.2.d.ts +3 -0
  167. package/dist/lib/parsers/artifact/foundry-1.2.d.ts.map +1 -0
  168. package/dist/lib/parsers/artifact/foundry-1.2.js +82 -0
  169. package/dist/lib/parsers/artifact/foundry-1.2.js.map +1 -0
  170. package/dist/lib/parsers/artifact/index.d.ts +3 -0
  171. package/dist/lib/parsers/artifact/index.d.ts.map +1 -0
  172. package/dist/lib/parsers/artifact/index.js +17 -0
  173. package/dist/lib/parsers/artifact/index.js.map +1 -0
  174. package/dist/lib/parsers/artifact/types.d.ts +3 -0
  175. package/dist/lib/parsers/artifact/types.d.ts.map +1 -0
  176. package/dist/lib/parsers/artifact/types.js +3 -0
  177. package/dist/lib/parsers/artifact/types.js.map +1 -0
  178. package/dist/lib/parsers/buildinfo.d.ts +5 -0
  179. package/dist/lib/parsers/buildinfo.d.ts.map +1 -0
  180. package/dist/lib/parsers/buildinfo.js +85 -0
  181. package/dist/lib/parsers/buildinfo.js.map +1 -0
  182. package/dist/lib/parsers/constants.d.ts +4 -0
  183. package/dist/lib/parsers/constants.d.ts.map +1 -0
  184. package/dist/lib/parsers/constants.js +45 -0
  185. package/dist/lib/parsers/constants.js.map +1 -0
  186. package/dist/lib/parsers/index.d.ts +5 -0
  187. package/dist/lib/parsers/index.d.ts.map +1 -0
  188. package/dist/lib/parsers/index.js +21 -0
  189. package/dist/lib/parsers/index.js.map +1 -0
  190. package/dist/lib/parsers/job.d.ts +3 -0
  191. package/dist/lib/parsers/job.d.ts.map +1 -0
  192. package/dist/lib/parsers/job.js +74 -0
  193. package/dist/lib/parsers/job.js.map +1 -0
  194. package/dist/lib/parsers/template.d.ts +3 -0
  195. package/dist/lib/parsers/template.d.ts.map +1 -0
  196. package/dist/lib/parsers/template.js +91 -0
  197. package/dist/lib/parsers/template.js.map +1 -0
  198. package/dist/lib/std/templates/assured-deployment.yaml +45 -0
  199. package/dist/lib/std/templates/erc-2470.yaml +67 -0
  200. package/dist/lib/std/templates/min-balance.yaml +32 -0
  201. package/dist/lib/std/templates/nano-universal-deployer.yaml +59 -0
  202. package/dist/lib/std/templates/raw-erc-2470.yaml +59 -0
  203. package/dist/lib/std/templates/raw-nano-universal-deployer.yaml +51 -0
  204. package/dist/lib/std/templates/raw-sequence-universal-deployer-2.yaml +48 -0
  205. package/dist/lib/std/templates/sequence-universal-deployer-2.yaml +57 -0
  206. package/dist/lib/types/__tests__/json-request-action.spec.d.ts +2 -0
  207. package/dist/lib/types/__tests__/json-request-action.spec.d.ts.map +1 -0
  208. package/dist/lib/types/__tests__/json-request-action.spec.js +219 -0
  209. package/dist/lib/types/__tests__/json-request-action.spec.js.map +1 -0
  210. package/dist/lib/types/__tests__/read-json-value.spec.d.ts +2 -0
  211. package/dist/lib/types/__tests__/read-json-value.spec.d.ts.map +1 -0
  212. package/dist/lib/types/__tests__/read-json-value.spec.js +233 -0
  213. package/dist/lib/types/__tests__/read-json-value.spec.js.map +1 -0
  214. package/dist/lib/types/actions.d.ts +74 -0
  215. package/dist/lib/types/actions.d.ts.map +1 -0
  216. package/dist/lib/types/actions.js +18 -0
  217. package/dist/lib/types/actions.js.map +1 -0
  218. package/dist/lib/types/artifacts.d.ts +15 -0
  219. package/dist/lib/types/artifacts.d.ts.map +1 -0
  220. package/dist/lib/types/artifacts.js +3 -0
  221. package/dist/lib/types/artifacts.js.map +1 -0
  222. package/dist/lib/types/buildinfo.d.ts +112 -0
  223. package/dist/lib/types/buildinfo.d.ts.map +1 -0
  224. package/dist/lib/types/buildinfo.js +3 -0
  225. package/dist/lib/types/buildinfo.js.map +1 -0
  226. package/dist/lib/types/conditions.d.ts +17 -0
  227. package/dist/lib/types/conditions.d.ts.map +1 -0
  228. package/dist/lib/types/conditions.js +21 -0
  229. package/dist/lib/types/conditions.js.map +1 -0
  230. package/dist/lib/types/contracts.d.ts +14 -0
  231. package/dist/lib/types/contracts.d.ts.map +1 -0
  232. package/dist/lib/types/contracts.js +3 -0
  233. package/dist/lib/types/contracts.js.map +1 -0
  234. package/dist/lib/types/definitions.d.ts +51 -0
  235. package/dist/lib/types/definitions.d.ts.map +1 -0
  236. package/dist/lib/types/definitions.js +3 -0
  237. package/dist/lib/types/definitions.js.map +1 -0
  238. package/dist/lib/types/index.d.ts +9 -0
  239. package/dist/lib/types/index.d.ts.map +1 -0
  240. package/dist/lib/types/index.js +25 -0
  241. package/dist/lib/types/index.js.map +1 -0
  242. package/dist/lib/types/network.d.ts +9 -0
  243. package/dist/lib/types/network.d.ts.map +1 -0
  244. package/dist/lib/types/network.js +3 -0
  245. package/dist/lib/types/network.js.map +1 -0
  246. package/dist/lib/types/project.d.ts +5 -0
  247. package/dist/lib/types/project.d.ts.map +1 -0
  248. package/dist/lib/types/project.js +3 -0
  249. package/dist/lib/types/project.js.map +1 -0
  250. package/dist/lib/types/task.d.ts +9 -0
  251. package/dist/lib/types/task.d.ts.map +1 -0
  252. package/dist/lib/types/task.js +3 -0
  253. package/dist/lib/types/task.js.map +1 -0
  254. package/dist/lib/types/values.d.ts +78 -0
  255. package/dist/lib/types/values.d.ts.map +1 -0
  256. package/dist/lib/types/values.js +3 -0
  257. package/dist/lib/types/values.js.map +1 -0
  258. package/dist/lib/utils/validation.d.ts +5 -0
  259. package/dist/lib/utils/validation.d.ts.map +1 -0
  260. package/dist/lib/utils/validation.js +77 -0
  261. package/dist/lib/utils/validation.js.map +1 -0
  262. package/dist/lib/validation/contract-references.d.ts +12 -0
  263. package/dist/lib/validation/contract-references.d.ts.map +1 -0
  264. package/dist/lib/validation/contract-references.js +112 -0
  265. package/dist/lib/validation/contract-references.js.map +1 -0
  266. package/dist/lib/validation/index.d.ts +1 -0
  267. package/dist/lib/validation/index.d.ts.map +1 -0
  268. package/dist/lib/validation/index.js +2 -0
  269. package/dist/lib/validation/index.js.map +1 -0
  270. package/dist/lib/verification/__tests__/etherscan.spec.d.ts +2 -0
  271. package/dist/lib/verification/__tests__/etherscan.spec.d.ts.map +1 -0
  272. package/dist/lib/verification/__tests__/etherscan.spec.js +565 -0
  273. package/dist/lib/verification/__tests__/etherscan.spec.js.map +1 -0
  274. package/dist/lib/verification/__tests__/sourcify.spec.d.ts +2 -0
  275. package/dist/lib/verification/__tests__/sourcify.spec.d.ts.map +1 -0
  276. package/dist/lib/verification/__tests__/sourcify.spec.js +212 -0
  277. package/dist/lib/verification/__tests__/sourcify.spec.js.map +1 -0
  278. package/dist/lib/verification/etherscan.d.ts +56 -0
  279. package/dist/lib/verification/etherscan.d.ts.map +1 -0
  280. package/dist/lib/verification/etherscan.js +340 -0
  281. package/dist/lib/verification/etherscan.js.map +1 -0
  282. package/dist/lib/verification/sourcify.d.ts +12 -0
  283. package/dist/lib/verification/sourcify.d.ts.map +1 -0
  284. package/dist/lib/verification/sourcify.js +227 -0
  285. package/dist/lib/verification/sourcify.js.map +1 -0
  286. package/eslint.config.js +48 -0
  287. package/examples/jobs/guards-v1.yaml +17 -0
  288. package/examples/jobs/sequence-seq-0001-patch.yaml +59 -0
  289. package/examples/jobs/sequence-v1.yaml +59 -0
  290. package/examples/templates/sequence-factory-v1.yaml +56 -0
  291. package/jest.config.js +25 -0
  292. package/package.json +68 -0
  293. package/src/cli.ts +17 -0
  294. package/src/commands/common.ts +61 -0
  295. package/src/commands/dry.ts +208 -0
  296. package/src/commands/etherscan.ts +360 -0
  297. package/src/commands/index.ts +5 -0
  298. package/src/commands/list.ts +249 -0
  299. package/src/commands/run.ts +136 -0
  300. package/src/commands/utils.ts +52 -0
  301. package/src/index.ts +67 -0
  302. package/src/lib/__tests__/deployer-events.spec.ts +338 -0
  303. package/src/lib/__tests__/deployer.spec.ts +1204 -0
  304. package/src/lib/__tests__/network-utils.spec.ts +181 -0
  305. package/src/lib/artifacts/__tests__/fixtures/contract1.json +19 -0
  306. package/src/lib/artifacts/__tests__/fixtures/contract2.json +19 -0
  307. package/src/lib/artifacts/__tests__/fixtures/duplicate-name.json +19 -0
  308. package/src/lib/artifacts/__tests__/fixtures/nested/nested-contract.json +18 -0
  309. package/src/lib/artifacts/__tests__/fixtures/not-an-artifact.json +8 -0
  310. package/src/lib/artifacts/__tests__/fixtures/readme.txt +2 -0
  311. package/src/lib/contracts/__tests__/repository.spec.ts +344 -0
  312. package/src/lib/contracts/repository.ts +313 -0
  313. package/src/lib/core/__tests__/engine.spec.ts +1514 -0
  314. package/src/lib/core/__tests__/graph.spec.ts +125 -0
  315. package/src/lib/core/__tests__/json-integration.spec.ts +360 -0
  316. package/src/lib/core/__tests__/loader.spec.ts +334 -0
  317. package/src/lib/core/__tests__/multi-platform-verification.spec.ts +406 -0
  318. package/src/lib/core/__tests__/resolver.spec.ts +1693 -0
  319. package/src/lib/core/__tests__/static-action.spec.ts +172 -0
  320. package/src/lib/core/context.ts +127 -0
  321. package/src/lib/core/engine.ts +1531 -0
  322. package/src/lib/core/graph.ts +252 -0
  323. package/src/lib/core/loader.ts +263 -0
  324. package/src/lib/core/resolver.ts +498 -0
  325. package/src/lib/deployer.ts +768 -0
  326. package/src/lib/events/__tests__/event-system.spec.ts +343 -0
  327. package/src/lib/events/cli-adapter.ts +325 -0
  328. package/src/lib/events/emitter.ts +62 -0
  329. package/src/lib/events/index.ts +3 -0
  330. package/src/lib/events/types.ts +469 -0
  331. package/src/lib/index.ts +14 -0
  332. package/src/lib/network-loader.ts +59 -0
  333. package/src/lib/network-utils.ts +64 -0
  334. package/src/lib/parsers/__tests__/buildinfo.spec.ts +122 -0
  335. package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-bytecode-buildinfo.json +62 -0
  336. package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-json.txt +2 -0
  337. package/src/lib/parsers/__tests__/fixtures/buildinfo/multi-contract-buildinfo.json +89 -0
  338. package/src/lib/parsers/__tests__/fixtures/buildinfo/no-contracts-buildinfo.json +17 -0
  339. package/src/lib/parsers/__tests__/fixtures/buildinfo/simple-buildinfo.json +63 -0
  340. package/src/lib/parsers/__tests__/fixtures/buildinfo/wrong-format.json +4 -0
  341. package/src/lib/parsers/__tests__/job.spec.ts +335 -0
  342. package/src/lib/parsers/__tests__/template.spec.ts +111 -0
  343. package/src/lib/parsers/artifact/__tests__/artifact.spec.ts +117 -0
  344. package/src/lib/parsers/artifact/__tests__/fixtures/empty-bytecode.json +5 -0
  345. package/src/lib/parsers/artifact/__tests__/fixtures/hardhat-artifact.json +67 -0
  346. package/src/lib/parsers/artifact/__tests__/fixtures/invalid-bytecode.json +5 -0
  347. package/src/lib/parsers/artifact/__tests__/fixtures/invalid-json.txt +11 -0
  348. package/src/lib/parsers/artifact/__tests__/fixtures/minimal-artifact.json +5 -0
  349. package/src/lib/parsers/artifact/__tests__/fixtures/missing-abi.json +4 -0
  350. package/src/lib/parsers/artifact/__tests__/fixtures/missing-bytecode.json +11 -0
  351. package/src/lib/parsers/artifact/__tests__/fixtures/missing-contract-name.json +11 -0
  352. package/src/lib/parsers/artifact/__tests__/fixtures/simple-artifact.json +40 -0
  353. package/src/lib/parsers/artifact/__tests__/fixtures/wrong-types.json +7 -0
  354. package/src/lib/parsers/artifact/foundry-1.2.ts +72 -0
  355. package/src/lib/parsers/artifact/index.ts +27 -0
  356. package/src/lib/parsers/artifact/types.ts +9 -0
  357. package/src/lib/parsers/buildinfo.ts +127 -0
  358. package/src/lib/parsers/constants.ts +56 -0
  359. package/src/lib/parsers/index.ts +5 -0
  360. package/src/lib/parsers/job.ts +101 -0
  361. package/src/lib/parsers/template.ts +131 -0
  362. package/src/lib/std/templates/assured-deployment.yaml +45 -0
  363. package/src/lib/std/templates/erc-2470.yaml +67 -0
  364. package/src/lib/std/templates/min-balance.yaml +32 -0
  365. package/src/lib/std/templates/nano-universal-deployer.yaml +59 -0
  366. package/src/lib/std/templates/raw-erc-2470.yaml +59 -0
  367. package/src/lib/std/templates/raw-nano-universal-deployer.yaml +51 -0
  368. package/src/lib/std/templates/raw-sequence-universal-deployer-2.yaml +48 -0
  369. package/src/lib/std/templates/sequence-universal-deployer-2.yaml +57 -0
  370. package/src/lib/types/__tests__/json-request-action.spec.ts +243 -0
  371. package/src/lib/types/__tests__/read-json-value.spec.ts +264 -0
  372. package/src/lib/types/actions.ts +127 -0
  373. package/src/lib/types/artifacts.ts +21 -0
  374. package/src/lib/types/buildinfo.ts +116 -0
  375. package/src/lib/types/conditions.ts +50 -0
  376. package/src/lib/types/contracts.ts +23 -0
  377. package/src/lib/types/definitions.ts +68 -0
  378. package/src/lib/types/index.ts +8 -0
  379. package/src/lib/types/network.ts +22 -0
  380. package/src/lib/types/project.ts +9 -0
  381. package/src/lib/types/task.ts +9 -0
  382. package/src/lib/types/values.ts +116 -0
  383. package/src/lib/utils/validation.ts +116 -0
  384. package/src/lib/validation/contract-references.ts +210 -0
  385. package/src/lib/validation/index.ts +1 -0
  386. package/src/lib/verification/__tests__/etherscan.spec.ts +710 -0
  387. package/src/lib/verification/__tests__/sourcify.spec.ts +288 -0
  388. package/src/lib/verification/etherscan.ts +546 -0
  389. package/src/lib/verification/sourcify.ts +248 -0
  390. package/test_validation/artifacts/TestContract.json +9 -0
  391. package/test_validation/jobs/test-missing.yaml +16 -0
  392. package/test_validation/networks.yaml +3 -0
  393. package/tsconfig.json +36 -0
@@ -0,0 +1,9 @@
1
+ import { Network } from './network'
2
+
3
+ /**
4
+ * Represents a deployment project with its associated networks
5
+ */
6
+ export interface Project {
7
+ /** List of networks available for this project */
8
+ networks: Network[]
9
+ }
@@ -0,0 +1,9 @@
1
+ import { Action } from './actions'
2
+ import { Condition } from './conditions'
3
+
4
+ export interface Task {
5
+ name: string
6
+ description?: string
7
+ action: Action
8
+ checks: Condition[]
9
+ }
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Represents a reference to another value in the scope, e.g., "{{var.name}}".
3
+ * The parser will be responsible for resolving this string into a concrete value.
4
+ */
5
+ export type Reference = string;
6
+
7
+ // --- Value Resolver Types ---
8
+ // These are declarative objects that describe how to compute a value at runtime.
9
+
10
+ export interface AbiEncodeValue {
11
+ type: 'abi-encode';
12
+ arguments: {
13
+ signature: Value<string>;
14
+ values: Value<any>[];
15
+ };
16
+ }
17
+
18
+ export interface AbiPackValue {
19
+ type: 'abi-pack';
20
+ arguments: {
21
+ types: Value<string>[];
22
+ values: Value<any>[];
23
+ };
24
+ }
25
+
26
+ export interface ConstructorEncodeValue {
27
+ type: 'constructor-encode';
28
+ arguments: {
29
+ creationCode?: Value<string>;
30
+ types: Value<string>[];
31
+ values: Value<any>[];
32
+ };
33
+ }
34
+
35
+ export interface ComputeCreate2Value {
36
+ type: 'compute-create2';
37
+ arguments: {
38
+ deployerAddress: AddressValue;
39
+ salt: BytesValue;
40
+ initCode: BytesValue;
41
+ };
42
+ }
43
+
44
+ export interface ReadBalanceValue {
45
+ type: 'read-balance';
46
+ arguments: {
47
+ address: AddressValue;
48
+ };
49
+ }
50
+
51
+ export interface BasicArithmeticValue {
52
+ type: 'basic-arithmetic';
53
+ arguments: {
54
+ operation: 'add' | 'sub' | 'mul' | 'div' | 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte';
55
+ values: Value<any>[];
56
+ };
57
+ }
58
+
59
+ export interface CallValue {
60
+ type: 'call';
61
+ arguments: {
62
+ to?: AddressValue; // Optional, can be inferred from context by the parser
63
+ signature: Value<string>;
64
+ values: Value<any>[];
65
+ };
66
+ }
67
+
68
+ export interface ContractExistsValue {
69
+ type: 'contract-exists';
70
+ arguments: {
71
+ address: AddressValue;
72
+ };
73
+ }
74
+
75
+ export interface JobCompletedValue {
76
+ type: 'job-completed';
77
+ arguments: {
78
+ job: Value<string>;
79
+ };
80
+ }
81
+
82
+ export interface ReadJsonValue {
83
+ type: 'read-json';
84
+ arguments: {
85
+ json: Value<any>; // The JSON object to read from
86
+ path: Value<string>; // The path to the value (e.g., "txs.data" or "user.profile.name")
87
+ };
88
+ }
89
+
90
+ /**
91
+ * A union of all possible value-resolver objects.
92
+ */
93
+ export type ValueResolver =
94
+ | AbiEncodeValue
95
+ | AbiPackValue
96
+ | ConstructorEncodeValue
97
+ | ComputeCreate2Value
98
+ | ReadBalanceValue
99
+ | BasicArithmeticValue
100
+ | CallValue
101
+ | ContractExistsValue
102
+ | JobCompletedValue
103
+ | ReadJsonValue;
104
+
105
+ /**
106
+ * A generic value type that can be a primitive literal (string, number, boolean),
107
+ * a reference to another value, or a value-resolver object.
108
+ * This accurately models the flexibility of your YAML arguments.
109
+ */
110
+ export type Value<T = string | number | boolean> = T | Reference | ValueResolver;
111
+
112
+ // --- Specific Value Types for clarity and type-safety ---
113
+ export type BytesValue = Value<string>;
114
+ export type AddressValue = Value<string>;
115
+ export type Uint256Value = Value<string | number>;
116
+ export type BooleanValue = Value<boolean>;
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Validation utilities for type checking and conversion of resolved values.
3
+ * These functions provide runtime type safety for values resolved from YAML configurations.
4
+ */
5
+
6
+ /**
7
+ * Validates and converts a value to a valid Ethereum address.
8
+ */
9
+ export function validateAddress(value: unknown, actionName: string): string {
10
+ if (typeof value !== 'string') {
11
+ throw new Error(`Invalid 'to' address for action "${actionName}": expected string, got ${typeof value}`)
12
+ }
13
+
14
+ // Basic Ethereum address validation (0x followed by 40 hex characters)
15
+ if (!/^0x[a-fA-F0-9]{40}$/.test(value)) {
16
+ throw new Error(`Invalid 'to' address format for action "${actionName}": ${value}`)
17
+ }
18
+
19
+ return value
20
+ }
21
+
22
+ /**
23
+ * Validates and converts a value to hex data string.
24
+ */
25
+ export function validateHexData(value: unknown, actionName: string, fieldName: string): string {
26
+ if (value === null || value === undefined) {
27
+ return '0x'
28
+ }
29
+
30
+ if (typeof value !== 'string') {
31
+ throw new Error(`Invalid '${fieldName}' for action "${actionName}": expected string, got ${typeof value}`)
32
+ }
33
+
34
+ // Ensure it starts with 0x
35
+ if (!value.startsWith('0x')) {
36
+ throw new Error(`Invalid '${fieldName}' format for action "${actionName}": must start with '0x', got ${value}`)
37
+ }
38
+
39
+ // Validate hex characters (allow empty data as '0x')
40
+ if (value.length > 2 && !/^0x[a-fA-F0-9]*$/.test(value)) {
41
+ throw new Error(`Invalid '${fieldName}' format for action "${actionName}": contains non-hex characters: ${value}`)
42
+ }
43
+
44
+ return value
45
+ }
46
+
47
+ /**
48
+ * Validates and converts a value to a BigNumberish (number, string, or BigInt).
49
+ */
50
+ export function validateBigNumberish(value: unknown, actionName: string, fieldName: string): string | number | bigint {
51
+ if (value === null || value === undefined) {
52
+ return 0
53
+ }
54
+
55
+ // Handle different input types
56
+ if (typeof value === 'number') {
57
+ if (!Number.isInteger(value) || value < 0) {
58
+ throw new Error(`Invalid '${fieldName}' for action "${actionName}": must be a non-negative integer, got ${value}`)
59
+ }
60
+ return value
61
+ }
62
+
63
+ if (typeof value === 'string') {
64
+ // Handle hex strings
65
+ if (value.startsWith('0x')) {
66
+ if (!/^0x[a-fA-F0-9]+$/.test(value)) {
67
+ throw new Error(`Invalid '${fieldName}' hex format for action "${actionName}": ${value}`)
68
+ }
69
+ return value
70
+ }
71
+
72
+ // Handle decimal strings
73
+ if (!/^\d+$/.test(value)) {
74
+ throw new Error(`Invalid '${fieldName}' format for action "${actionName}": must be a number or hex string, got ${value}`)
75
+ }
76
+ return value
77
+ }
78
+
79
+ if (typeof value === 'bigint') {
80
+ if (value < 0n) {
81
+ throw new Error(`Invalid '${fieldName}' for action "${actionName}": must be non-negative, got ${value}`)
82
+ }
83
+ return value
84
+ }
85
+
86
+ throw new Error(`Invalid '${fieldName}' type for action "${actionName}": expected number, string, or bigint, got ${typeof value}`)
87
+ }
88
+
89
+ /**
90
+ * Validates that a value is a valid raw transaction string.
91
+ */
92
+ export function validateRawTransaction(value: unknown, actionName: string): string {
93
+ if (typeof value !== 'string') {
94
+ throw new Error(`Invalid raw transaction for action "${actionName}": expected string, got ${typeof value}`)
95
+ }
96
+
97
+ // Normalize: trim whitespace and allow with or without 0x prefix
98
+ const trimmed = value.trim()
99
+ const withoutPrefix = trimmed.startsWith('0x') ? trimmed.slice(2) : trimmed
100
+
101
+ if (withoutPrefix.length === 0) {
102
+ // Empty data is allowed as '0x'
103
+ return '0x'
104
+ }
105
+
106
+ // Validate hex characters only
107
+ if (!/^[a-fA-F0-9]+$/.test(withoutPrefix)) {
108
+ // Pinpoint first invalid character for easier debugging
109
+ const idx = withoutPrefix.search(/[^a-fA-F0-9]/)
110
+ const marker = idx >= 0 ? ` at index ${idx} ('${withoutPrefix[idx]}')` : ''
111
+ throw new Error(`Invalid raw transaction format for action "${actionName}": contains non-hex characters${marker}: ${value}`)
112
+ }
113
+
114
+ // Ensure canonical 0x-prefixed output
115
+ return '0x' + withoutPrefix
116
+ }
@@ -0,0 +1,210 @@
1
+ import { ProjectLoader } from '../core/loader'
2
+ import { Action, Template, Job, JobAction, Value } from '../types'
3
+
4
+ export interface MissingContractReference {
5
+ reference: string
6
+ location: string
7
+ }
8
+
9
+ export interface UsedContractReference {
10
+ reference: string
11
+ location: string
12
+ }
13
+
14
+ /**
15
+ * Extracts all Contract() references actually used in the project
16
+ */
17
+ export async function extractUsedContractReferences(loader: ProjectLoader): Promise<UsedContractReference[]> {
18
+ const usedRefs: UsedContractReference[] = []
19
+
20
+ // Extract from jobs
21
+ for (const [jobName, job] of loader.jobs.entries()) {
22
+ extractJobActionsContractReferences(job.actions, `job '${jobName}'`, job._path, usedRefs)
23
+ }
24
+
25
+ // Extract from templates
26
+ for (const [templateName, template] of loader.templates.entries()) {
27
+ extractActionsContractReferences(template.actions, `template '${templateName}'`, template._path, usedRefs)
28
+
29
+ // Extract from template setup actions if they exist
30
+ if (template.setup?.actions) {
31
+ extractActionsContractReferences(template.setup.actions, `template '${templateName}' setup`, template._path, usedRefs)
32
+ }
33
+
34
+ // Extract from template outputs
35
+ if (template.outputs) {
36
+ extractValueContractReferences(template.outputs, `template '${templateName}' outputs`, template._path, usedRefs)
37
+ }
38
+ }
39
+
40
+ return usedRefs
41
+ }
42
+
43
+ /**
44
+ * Validates that all Contract() references in the project point to existing contracts
45
+ */
46
+ export async function validateContractReferences(loader: ProjectLoader): Promise<MissingContractReference[]> {
47
+ const missingRefs: MissingContractReference[] = []
48
+
49
+ // Validate jobs
50
+ for (const [jobName, job] of loader.jobs.entries()) {
51
+ validateJobActionsForMissingContracts(job.actions, `job '${jobName}'`, job._path, loader, missingRefs)
52
+ }
53
+
54
+ // Validate templates
55
+ for (const [templateName, template] of loader.templates.entries()) {
56
+ validateActionsForMissingContracts(template.actions, `template '${templateName}'`, template._path, loader, missingRefs)
57
+
58
+ // Validate template setup actions if they exist
59
+ if (template.setup?.actions) {
60
+ validateActionsForMissingContracts(template.setup.actions, `template '${templateName}' setup`, template._path, loader, missingRefs)
61
+ }
62
+
63
+ // Validate template outputs
64
+ if (template.outputs) {
65
+ validateValueForMissingContracts(template.outputs, `template '${templateName}' outputs`, template._path, loader, missingRefs)
66
+ }
67
+ }
68
+
69
+ return missingRefs
70
+ }
71
+
72
+ /**
73
+ * Extracts contract references from job actions
74
+ */
75
+ function extractJobActionsContractReferences(
76
+ actions: JobAction[],
77
+ locationPrefix: string,
78
+ contextPath: string | undefined,
79
+ usedRefs: UsedContractReference[]
80
+ ): void {
81
+ for (let i = 0; i < actions.length; i++) {
82
+ const action = actions[i]
83
+ const actionLocation = `${locationPrefix}, action ${i + 1}${action.name ? ` '${action.name}'` : ''}`
84
+
85
+ extractValueContractReferences(action.arguments, actionLocation, contextPath, usedRefs)
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Extracts contract references from template actions
91
+ */
92
+ function extractActionsContractReferences(
93
+ actions: Action[],
94
+ locationPrefix: string,
95
+ contextPath: string | undefined,
96
+ usedRefs: UsedContractReference[]
97
+ ): void {
98
+ for (let i = 0; i < actions.length; i++) {
99
+ const action = actions[i]
100
+ const actionLocation = `${locationPrefix}, action ${i + 1}${action.name ? ` '${action.name}'` : ''}`
101
+
102
+ extractValueContractReferences(action.arguments, actionLocation, contextPath, usedRefs)
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Recursively extracts contract references from a value (or nested object/array)
108
+ */
109
+ function extractValueContractReferences(
110
+ value: any,
111
+ location: string,
112
+ contextPath: string | undefined,
113
+ usedRefs: UsedContractReference[]
114
+ ): void {
115
+ if (typeof value === 'string') {
116
+ // Check for Contract() expressions
117
+ const contractMatch = value.match(/^{{Contract\((.*?)\)(?:\.\w+)?}}$/)
118
+ if (contractMatch) {
119
+ const reference = contractMatch[1].trim()
120
+ usedRefs.push({
121
+ reference,
122
+ location: `${location}, Contract(${reference})`
123
+ })
124
+ }
125
+ } else if (Array.isArray(value)) {
126
+ // Recursively check array elements
127
+ for (let i = 0; i < value.length; i++) {
128
+ extractValueContractReferences(value[i], `${location}[${i}]`, contextPath, usedRefs)
129
+ }
130
+ } else if (typeof value === 'object' && value !== null) {
131
+ // Recursively check object properties
132
+ for (const [key, val] of Object.entries(value)) {
133
+ extractValueContractReferences(val, `${location}.${key}`, contextPath, usedRefs)
134
+ }
135
+ }
136
+ }
137
+
138
+ /**
139
+ * Validates a list of job actions for missing contract references
140
+ */
141
+ function validateJobActionsForMissingContracts(
142
+ actions: JobAction[],
143
+ locationPrefix: string,
144
+ contextPath: string | undefined,
145
+ loader: ProjectLoader,
146
+ missingRefs: MissingContractReference[]
147
+ ): void {
148
+ for (let i = 0; i < actions.length; i++) {
149
+ const action = actions[i]
150
+ const actionLocation = `${locationPrefix}, action ${i + 1}${action.name ? ` '${action.name}'` : ''}`
151
+
152
+ validateValueForMissingContracts(action.arguments, actionLocation, contextPath, loader, missingRefs)
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Validates a list of template actions for missing contract references
158
+ */
159
+ function validateActionsForMissingContracts(
160
+ actions: Action[],
161
+ locationPrefix: string,
162
+ contextPath: string | undefined,
163
+ loader: ProjectLoader,
164
+ missingRefs: MissingContractReference[]
165
+ ): void {
166
+ for (let i = 0; i < actions.length; i++) {
167
+ const action = actions[i]
168
+ const actionLocation = `${locationPrefix}, action ${i + 1}${action.name ? ` '${action.name}'` : ''}`
169
+
170
+ validateValueForMissingContracts(action.arguments, actionLocation, contextPath, loader, missingRefs)
171
+ }
172
+ }
173
+
174
+ /**
175
+ * Recursively validates a value (or nested object/array) for missing contract references
176
+ */
177
+ function validateValueForMissingContracts(
178
+ value: any,
179
+ location: string,
180
+ contextPath: string | undefined,
181
+ loader: ProjectLoader,
182
+ missingRefs: MissingContractReference[]
183
+ ): void {
184
+ if (typeof value === 'string') {
185
+ // Check for Contract() expressions
186
+ const contractMatch = value.match(/^{{Contract\((.*?)\)(?:\.\w+)?}}$/)
187
+ if (contractMatch) {
188
+ const reference = contractMatch[1].trim()
189
+
190
+ // Try to lookup the contract
191
+ const contract = loader.contractRepository.lookup(reference, contextPath)
192
+ if (!contract) {
193
+ missingRefs.push({
194
+ reference,
195
+ location: `${location}, Contract(${reference})`
196
+ })
197
+ }
198
+ }
199
+ } else if (Array.isArray(value)) {
200
+ // Recursively check array elements
201
+ for (let i = 0; i < value.length; i++) {
202
+ validateValueForMissingContracts(value[i], `${location}[${i}]`, contextPath, loader, missingRefs)
203
+ }
204
+ } else if (typeof value === 'object' && value !== null) {
205
+ // Recursively check object properties
206
+ for (const [key, val] of Object.entries(value)) {
207
+ validateValueForMissingContracts(val, `${location}.${key}`, contextPath, loader, missingRefs)
208
+ }
209
+ }
210
+ }
@@ -0,0 +1 @@
1
+ // No exports - validation logic is now integrated into ContractRepository