@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.
- package/.eslintrc.json +29 -0
- package/.github/workflows/ci.yml +181 -0
- package/CONCEPT.md +24 -0
- package/README.md +772 -0
- package/contracts/checked-call.huff +65 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +16 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/common.d.ts +11 -0
- package/dist/commands/common.d.ts.map +1 -0
- package/dist/commands/common.js +73 -0
- package/dist/commands/common.js.map +1 -0
- package/dist/commands/dry.d.ts +3 -0
- package/dist/commands/dry.d.ts.map +1 -0
- package/dist/commands/dry.js +171 -0
- package/dist/commands/dry.js.map +1 -0
- package/dist/commands/etherscan.d.ts +3 -0
- package/dist/commands/etherscan.d.ts.map +1 -0
- package/dist/commands/etherscan.js +323 -0
- package/dist/commands/etherscan.js.map +1 -0
- package/dist/commands/index.d.ts +6 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +22 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +259 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/run.d.ts +3 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +96 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/utils.d.ts +3 -0
- package/dist/commands/utils.d.ts.map +1 -0
- package/dist/commands/utils.js +46 -0
- package/dist/commands/utils.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/__tests__/deployer-events.spec.d.ts +2 -0
- package/dist/lib/__tests__/deployer-events.spec.d.ts.map +1 -0
- package/dist/lib/__tests__/deployer-events.spec.js +260 -0
- package/dist/lib/__tests__/deployer-events.spec.js.map +1 -0
- package/dist/lib/__tests__/deployer.spec.d.ts +2 -0
- package/dist/lib/__tests__/deployer.spec.d.ts.map +1 -0
- package/dist/lib/__tests__/deployer.spec.js +884 -0
- package/dist/lib/__tests__/deployer.spec.js.map +1 -0
- package/dist/lib/__tests__/network-utils.spec.d.ts +2 -0
- package/dist/lib/__tests__/network-utils.spec.d.ts.map +1 -0
- package/dist/lib/__tests__/network-utils.spec.js +140 -0
- package/dist/lib/__tests__/network-utils.spec.js.map +1 -0
- package/dist/lib/contracts/__tests__/repository.spec.d.ts +2 -0
- package/dist/lib/contracts/__tests__/repository.spec.d.ts.map +1 -0
- package/dist/lib/contracts/__tests__/repository.spec.js +321 -0
- package/dist/lib/contracts/__tests__/repository.spec.js.map +1 -0
- package/dist/lib/contracts/repository.d.ts +27 -0
- package/dist/lib/contracts/repository.d.ts.map +1 -0
- package/dist/lib/contracts/repository.js +241 -0
- package/dist/lib/contracts/repository.js.map +1 -0
- package/dist/lib/core/__tests__/engine.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/engine.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/engine.spec.js +1212 -0
- package/dist/lib/core/__tests__/engine.spec.js.map +1 -0
- package/dist/lib/core/__tests__/graph.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/graph.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/graph.spec.js +116 -0
- package/dist/lib/core/__tests__/graph.spec.js.map +1 -0
- package/dist/lib/core/__tests__/json-integration.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/json-integration.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/json-integration.spec.js +300 -0
- package/dist/lib/core/__tests__/json-integration.spec.js.map +1 -0
- package/dist/lib/core/__tests__/loader.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/loader.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/loader.spec.js +288 -0
- package/dist/lib/core/__tests__/loader.spec.js.map +1 -0
- package/dist/lib/core/__tests__/multi-platform-verification.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/multi-platform-verification.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/multi-platform-verification.spec.js +342 -0
- package/dist/lib/core/__tests__/multi-platform-verification.spec.js.map +1 -0
- package/dist/lib/core/__tests__/resolver.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/resolver.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/resolver.spec.js +1367 -0
- package/dist/lib/core/__tests__/resolver.spec.js.map +1 -0
- package/dist/lib/core/__tests__/static-action.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/static-action.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/static-action.spec.js +136 -0
- package/dist/lib/core/__tests__/static-action.spec.js.map +1 -0
- package/dist/lib/core/context.d.ts +29 -0
- package/dist/lib/core/context.d.ts.map +1 -0
- package/dist/lib/core/context.js +88 -0
- package/dist/lib/core/context.js.map +1 -0
- package/dist/lib/core/engine.d.ts +25 -0
- package/dist/lib/core/engine.d.ts.map +1 -0
- package/dist/lib/core/engine.js +1191 -0
- package/dist/lib/core/engine.js.map +1 -0
- package/dist/lib/core/graph.d.ts +18 -0
- package/dist/lib/core/graph.d.ts.map +1 -0
- package/dist/lib/core/graph.js +158 -0
- package/dist/lib/core/graph.js.map +1 -0
- package/dist/lib/core/loader.d.ts +25 -0
- package/dist/lib/core/loader.d.ts.map +1 -0
- package/dist/lib/core/loader.js +248 -0
- package/dist/lib/core/loader.js.map +1 -0
- package/dist/lib/core/resolver.d.ts +20 -0
- package/dist/lib/core/resolver.d.ts.map +1 -0
- package/dist/lib/core/resolver.js +307 -0
- package/dist/lib/core/resolver.js.map +1 -0
- package/dist/lib/deployer.d.ts +39 -0
- package/dist/lib/deployer.d.ts.map +1 -0
- package/dist/lib/deployer.js +533 -0
- package/dist/lib/deployer.js.map +1 -0
- package/dist/lib/events/__tests__/event-system.spec.d.ts +2 -0
- package/dist/lib/events/__tests__/event-system.spec.d.ts.map +1 -0
- package/dist/lib/events/__tests__/event-system.spec.js +256 -0
- package/dist/lib/events/__tests__/event-system.spec.js.map +1 -0
- package/dist/lib/events/cli-adapter.d.ts +13 -0
- package/dist/lib/events/cli-adapter.d.ts.map +1 -0
- package/dist/lib/events/cli-adapter.js +244 -0
- package/dist/lib/events/cli-adapter.js.map +1 -0
- package/dist/lib/events/emitter.d.ts +11 -0
- package/dist/lib/events/emitter.d.ts.map +1 -0
- package/dist/lib/events/emitter.js +29 -0
- package/dist/lib/events/emitter.js.map +1 -0
- package/dist/lib/events/index.d.ts +4 -0
- package/dist/lib/events/index.d.ts.map +1 -0
- package/dist/lib/events/index.js +20 -0
- package/dist/lib/events/index.js.map +1 -0
- package/dist/lib/events/types.d.ts +368 -0
- package/dist/lib/events/types.d.ts.map +1 -0
- package/dist/lib/events/types.js +3 -0
- package/dist/lib/events/types.js.map +1 -0
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +44 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/network-loader.d.ts +3 -0
- package/dist/lib/network-loader.d.ts.map +1 -0
- package/dist/lib/network-loader.js +80 -0
- package/dist/lib/network-loader.js.map +1 -0
- package/dist/lib/network-match.d.ts +3 -0
- package/dist/lib/network-match.d.ts.map +1 -0
- package/dist/lib/network-match.js +62 -0
- package/dist/lib/network-match.js.map +1 -0
- package/dist/lib/network-utils.d.ts +4 -0
- package/dist/lib/network-utils.d.ts.map +1 -0
- package/dist/lib/network-utils.js +39 -0
- package/dist/lib/network-utils.js.map +1 -0
- package/dist/lib/parsers/__tests__/buildinfo.spec.d.ts +2 -0
- package/dist/lib/parsers/__tests__/buildinfo.spec.d.ts.map +1 -0
- package/dist/lib/parsers/__tests__/buildinfo.spec.js +132 -0
- package/dist/lib/parsers/__tests__/buildinfo.spec.js.map +1 -0
- package/dist/lib/parsers/__tests__/job.spec.d.ts +2 -0
- package/dist/lib/parsers/__tests__/job.spec.d.ts.map +1 -0
- package/dist/lib/parsers/__tests__/job.spec.js +318 -0
- package/dist/lib/parsers/__tests__/job.spec.js.map +1 -0
- package/dist/lib/parsers/__tests__/template.spec.d.ts +2 -0
- package/dist/lib/parsers/__tests__/template.spec.d.ts.map +1 -0
- package/dist/lib/parsers/__tests__/template.spec.js +126 -0
- package/dist/lib/parsers/__tests__/template.spec.js.map +1 -0
- package/dist/lib/parsers/artifact/__tests__/artifact.spec.d.ts +2 -0
- package/dist/lib/parsers/artifact/__tests__/artifact.spec.d.ts.map +1 -0
- package/dist/lib/parsers/artifact/__tests__/artifact.spec.js +128 -0
- package/dist/lib/parsers/artifact/__tests__/artifact.spec.js.map +1 -0
- package/dist/lib/parsers/artifact/foundry-1.2.d.ts +3 -0
- package/dist/lib/parsers/artifact/foundry-1.2.d.ts.map +1 -0
- package/dist/lib/parsers/artifact/foundry-1.2.js +82 -0
- package/dist/lib/parsers/artifact/foundry-1.2.js.map +1 -0
- package/dist/lib/parsers/artifact/index.d.ts +3 -0
- package/dist/lib/parsers/artifact/index.d.ts.map +1 -0
- package/dist/lib/parsers/artifact/index.js +17 -0
- package/dist/lib/parsers/artifact/index.js.map +1 -0
- package/dist/lib/parsers/artifact/types.d.ts +3 -0
- package/dist/lib/parsers/artifact/types.d.ts.map +1 -0
- package/dist/lib/parsers/artifact/types.js +3 -0
- package/dist/lib/parsers/artifact/types.js.map +1 -0
- package/dist/lib/parsers/buildinfo.d.ts +5 -0
- package/dist/lib/parsers/buildinfo.d.ts.map +1 -0
- package/dist/lib/parsers/buildinfo.js +85 -0
- package/dist/lib/parsers/buildinfo.js.map +1 -0
- package/dist/lib/parsers/constants.d.ts +4 -0
- package/dist/lib/parsers/constants.d.ts.map +1 -0
- package/dist/lib/parsers/constants.js +45 -0
- package/dist/lib/parsers/constants.js.map +1 -0
- package/dist/lib/parsers/index.d.ts +5 -0
- package/dist/lib/parsers/index.d.ts.map +1 -0
- package/dist/lib/parsers/index.js +21 -0
- package/dist/lib/parsers/index.js.map +1 -0
- package/dist/lib/parsers/job.d.ts +3 -0
- package/dist/lib/parsers/job.d.ts.map +1 -0
- package/dist/lib/parsers/job.js +74 -0
- package/dist/lib/parsers/job.js.map +1 -0
- package/dist/lib/parsers/template.d.ts +3 -0
- package/dist/lib/parsers/template.d.ts.map +1 -0
- package/dist/lib/parsers/template.js +91 -0
- package/dist/lib/parsers/template.js.map +1 -0
- package/dist/lib/std/templates/assured-deployment.yaml +45 -0
- package/dist/lib/std/templates/erc-2470.yaml +67 -0
- package/dist/lib/std/templates/min-balance.yaml +32 -0
- package/dist/lib/std/templates/nano-universal-deployer.yaml +59 -0
- package/dist/lib/std/templates/raw-erc-2470.yaml +59 -0
- package/dist/lib/std/templates/raw-nano-universal-deployer.yaml +51 -0
- package/dist/lib/std/templates/raw-sequence-universal-deployer-2.yaml +48 -0
- package/dist/lib/std/templates/sequence-universal-deployer-2.yaml +57 -0
- package/dist/lib/types/__tests__/json-request-action.spec.d.ts +2 -0
- package/dist/lib/types/__tests__/json-request-action.spec.d.ts.map +1 -0
- package/dist/lib/types/__tests__/json-request-action.spec.js +219 -0
- package/dist/lib/types/__tests__/json-request-action.spec.js.map +1 -0
- package/dist/lib/types/__tests__/read-json-value.spec.d.ts +2 -0
- package/dist/lib/types/__tests__/read-json-value.spec.d.ts.map +1 -0
- package/dist/lib/types/__tests__/read-json-value.spec.js +233 -0
- package/dist/lib/types/__tests__/read-json-value.spec.js.map +1 -0
- package/dist/lib/types/actions.d.ts +74 -0
- package/dist/lib/types/actions.d.ts.map +1 -0
- package/dist/lib/types/actions.js +18 -0
- package/dist/lib/types/actions.js.map +1 -0
- package/dist/lib/types/artifacts.d.ts +15 -0
- package/dist/lib/types/artifacts.d.ts.map +1 -0
- package/dist/lib/types/artifacts.js +3 -0
- package/dist/lib/types/artifacts.js.map +1 -0
- package/dist/lib/types/buildinfo.d.ts +112 -0
- package/dist/lib/types/buildinfo.d.ts.map +1 -0
- package/dist/lib/types/buildinfo.js +3 -0
- package/dist/lib/types/buildinfo.js.map +1 -0
- package/dist/lib/types/conditions.d.ts +17 -0
- package/dist/lib/types/conditions.d.ts.map +1 -0
- package/dist/lib/types/conditions.js +21 -0
- package/dist/lib/types/conditions.js.map +1 -0
- package/dist/lib/types/contracts.d.ts +14 -0
- package/dist/lib/types/contracts.d.ts.map +1 -0
- package/dist/lib/types/contracts.js +3 -0
- package/dist/lib/types/contracts.js.map +1 -0
- package/dist/lib/types/definitions.d.ts +51 -0
- package/dist/lib/types/definitions.d.ts.map +1 -0
- package/dist/lib/types/definitions.js +3 -0
- package/dist/lib/types/definitions.js.map +1 -0
- package/dist/lib/types/index.d.ts +9 -0
- package/dist/lib/types/index.d.ts.map +1 -0
- package/dist/lib/types/index.js +25 -0
- package/dist/lib/types/index.js.map +1 -0
- package/dist/lib/types/network.d.ts +9 -0
- package/dist/lib/types/network.d.ts.map +1 -0
- package/dist/lib/types/network.js +3 -0
- package/dist/lib/types/network.js.map +1 -0
- package/dist/lib/types/project.d.ts +5 -0
- package/dist/lib/types/project.d.ts.map +1 -0
- package/dist/lib/types/project.js +3 -0
- package/dist/lib/types/project.js.map +1 -0
- package/dist/lib/types/task.d.ts +9 -0
- package/dist/lib/types/task.d.ts.map +1 -0
- package/dist/lib/types/task.js +3 -0
- package/dist/lib/types/task.js.map +1 -0
- package/dist/lib/types/values.d.ts +78 -0
- package/dist/lib/types/values.d.ts.map +1 -0
- package/dist/lib/types/values.js +3 -0
- package/dist/lib/types/values.js.map +1 -0
- package/dist/lib/utils/validation.d.ts +5 -0
- package/dist/lib/utils/validation.d.ts.map +1 -0
- package/dist/lib/utils/validation.js +77 -0
- package/dist/lib/utils/validation.js.map +1 -0
- package/dist/lib/validation/contract-references.d.ts +12 -0
- package/dist/lib/validation/contract-references.d.ts.map +1 -0
- package/dist/lib/validation/contract-references.js +112 -0
- package/dist/lib/validation/contract-references.js.map +1 -0
- package/dist/lib/validation/index.d.ts +1 -0
- package/dist/lib/validation/index.d.ts.map +1 -0
- package/dist/lib/validation/index.js +2 -0
- package/dist/lib/validation/index.js.map +1 -0
- package/dist/lib/verification/__tests__/etherscan.spec.d.ts +2 -0
- package/dist/lib/verification/__tests__/etherscan.spec.d.ts.map +1 -0
- package/dist/lib/verification/__tests__/etherscan.spec.js +565 -0
- package/dist/lib/verification/__tests__/etherscan.spec.js.map +1 -0
- package/dist/lib/verification/__tests__/sourcify.spec.d.ts +2 -0
- package/dist/lib/verification/__tests__/sourcify.spec.d.ts.map +1 -0
- package/dist/lib/verification/__tests__/sourcify.spec.js +212 -0
- package/dist/lib/verification/__tests__/sourcify.spec.js.map +1 -0
- package/dist/lib/verification/etherscan.d.ts +56 -0
- package/dist/lib/verification/etherscan.d.ts.map +1 -0
- package/dist/lib/verification/etherscan.js +340 -0
- package/dist/lib/verification/etherscan.js.map +1 -0
- package/dist/lib/verification/sourcify.d.ts +12 -0
- package/dist/lib/verification/sourcify.d.ts.map +1 -0
- package/dist/lib/verification/sourcify.js +227 -0
- package/dist/lib/verification/sourcify.js.map +1 -0
- package/eslint.config.js +48 -0
- package/examples/jobs/guards-v1.yaml +17 -0
- package/examples/jobs/sequence-seq-0001-patch.yaml +59 -0
- package/examples/jobs/sequence-v1.yaml +59 -0
- package/examples/templates/sequence-factory-v1.yaml +56 -0
- package/jest.config.js +25 -0
- package/package.json +68 -0
- package/src/cli.ts +17 -0
- package/src/commands/common.ts +61 -0
- package/src/commands/dry.ts +208 -0
- package/src/commands/etherscan.ts +360 -0
- package/src/commands/index.ts +5 -0
- package/src/commands/list.ts +249 -0
- package/src/commands/run.ts +136 -0
- package/src/commands/utils.ts +52 -0
- package/src/index.ts +67 -0
- package/src/lib/__tests__/deployer-events.spec.ts +338 -0
- package/src/lib/__tests__/deployer.spec.ts +1204 -0
- package/src/lib/__tests__/network-utils.spec.ts +181 -0
- package/src/lib/artifacts/__tests__/fixtures/contract1.json +19 -0
- package/src/lib/artifacts/__tests__/fixtures/contract2.json +19 -0
- package/src/lib/artifacts/__tests__/fixtures/duplicate-name.json +19 -0
- package/src/lib/artifacts/__tests__/fixtures/nested/nested-contract.json +18 -0
- package/src/lib/artifacts/__tests__/fixtures/not-an-artifact.json +8 -0
- package/src/lib/artifacts/__tests__/fixtures/readme.txt +2 -0
- package/src/lib/contracts/__tests__/repository.spec.ts +344 -0
- package/src/lib/contracts/repository.ts +313 -0
- package/src/lib/core/__tests__/engine.spec.ts +1514 -0
- package/src/lib/core/__tests__/graph.spec.ts +125 -0
- package/src/lib/core/__tests__/json-integration.spec.ts +360 -0
- package/src/lib/core/__tests__/loader.spec.ts +334 -0
- package/src/lib/core/__tests__/multi-platform-verification.spec.ts +406 -0
- package/src/lib/core/__tests__/resolver.spec.ts +1693 -0
- package/src/lib/core/__tests__/static-action.spec.ts +172 -0
- package/src/lib/core/context.ts +127 -0
- package/src/lib/core/engine.ts +1531 -0
- package/src/lib/core/graph.ts +252 -0
- package/src/lib/core/loader.ts +263 -0
- package/src/lib/core/resolver.ts +498 -0
- package/src/lib/deployer.ts +768 -0
- package/src/lib/events/__tests__/event-system.spec.ts +343 -0
- package/src/lib/events/cli-adapter.ts +325 -0
- package/src/lib/events/emitter.ts +62 -0
- package/src/lib/events/index.ts +3 -0
- package/src/lib/events/types.ts +469 -0
- package/src/lib/index.ts +14 -0
- package/src/lib/network-loader.ts +59 -0
- package/src/lib/network-utils.ts +64 -0
- package/src/lib/parsers/__tests__/buildinfo.spec.ts +122 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-bytecode-buildinfo.json +62 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-json.txt +2 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/multi-contract-buildinfo.json +89 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/no-contracts-buildinfo.json +17 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/simple-buildinfo.json +63 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/wrong-format.json +4 -0
- package/src/lib/parsers/__tests__/job.spec.ts +335 -0
- package/src/lib/parsers/__tests__/template.spec.ts +111 -0
- package/src/lib/parsers/artifact/__tests__/artifact.spec.ts +117 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/empty-bytecode.json +5 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/hardhat-artifact.json +67 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/invalid-bytecode.json +5 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/invalid-json.txt +11 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/minimal-artifact.json +5 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-abi.json +4 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-bytecode.json +11 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-contract-name.json +11 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/simple-artifact.json +40 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/wrong-types.json +7 -0
- package/src/lib/parsers/artifact/foundry-1.2.ts +72 -0
- package/src/lib/parsers/artifact/index.ts +27 -0
- package/src/lib/parsers/artifact/types.ts +9 -0
- package/src/lib/parsers/buildinfo.ts +127 -0
- package/src/lib/parsers/constants.ts +56 -0
- package/src/lib/parsers/index.ts +5 -0
- package/src/lib/parsers/job.ts +101 -0
- package/src/lib/parsers/template.ts +131 -0
- package/src/lib/std/templates/assured-deployment.yaml +45 -0
- package/src/lib/std/templates/erc-2470.yaml +67 -0
- package/src/lib/std/templates/min-balance.yaml +32 -0
- package/src/lib/std/templates/nano-universal-deployer.yaml +59 -0
- package/src/lib/std/templates/raw-erc-2470.yaml +59 -0
- package/src/lib/std/templates/raw-nano-universal-deployer.yaml +51 -0
- package/src/lib/std/templates/raw-sequence-universal-deployer-2.yaml +48 -0
- package/src/lib/std/templates/sequence-universal-deployer-2.yaml +57 -0
- package/src/lib/types/__tests__/json-request-action.spec.ts +243 -0
- package/src/lib/types/__tests__/read-json-value.spec.ts +264 -0
- package/src/lib/types/actions.ts +127 -0
- package/src/lib/types/artifacts.ts +21 -0
- package/src/lib/types/buildinfo.ts +116 -0
- package/src/lib/types/conditions.ts +50 -0
- package/src/lib/types/contracts.ts +23 -0
- package/src/lib/types/definitions.ts +68 -0
- package/src/lib/types/index.ts +8 -0
- package/src/lib/types/network.ts +22 -0
- package/src/lib/types/project.ts +9 -0
- package/src/lib/types/task.ts +9 -0
- package/src/lib/types/values.ts +116 -0
- package/src/lib/utils/validation.ts +116 -0
- package/src/lib/validation/contract-references.ts +210 -0
- package/src/lib/validation/index.ts +1 -0
- package/src/lib/verification/__tests__/etherscan.spec.ts +710 -0
- package/src/lib/verification/__tests__/sourcify.spec.ts +288 -0
- package/src/lib/verification/etherscan.ts +546 -0
- package/src/lib/verification/sourcify.ts +248 -0
- package/test_validation/artifacts/TestContract.json +9 -0
- package/test_validation/jobs/test-missing.yaml +16 -0
- package/test_validation/networks.yaml +3 -0
- package/tsconfig.json +36 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { Network } from '../types/network'
|
|
2
|
+
import { VerificationPlatform, VerificationRequest, VerificationResult } from './etherscan'
|
|
3
|
+
|
|
4
|
+
export class SourcifyVerificationPlatform implements VerificationPlatform {
|
|
5
|
+
readonly name = 'sourcify'
|
|
6
|
+
|
|
7
|
+
supportsNetwork(network: Network): boolean {
|
|
8
|
+
// Sourcify supports most networks, but we can add specific logic here if needed
|
|
9
|
+
return !network.supports || network.supports.includes(this.name)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
isConfigured(): boolean {
|
|
13
|
+
// Sourcify requires no configuration
|
|
14
|
+
return true
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getConfigurationRequirements(): string {
|
|
18
|
+
return 'Sourcify requires no configuration'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async isContractAlreadyVerified(address: string, network: Network): Promise<boolean> {
|
|
22
|
+
try {
|
|
23
|
+
const response = await fetch(
|
|
24
|
+
`https://sourcify.dev/server/check-by-addresses?addresses=${address}&chainIds=${network.chainId}`,
|
|
25
|
+
{
|
|
26
|
+
method: 'GET',
|
|
27
|
+
signal: AbortSignal.timeout(15000), // 15 second timeout
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const data = await response.json()
|
|
36
|
+
|
|
37
|
+
// Check if the contract is verified (perfect or partial match)
|
|
38
|
+
return Array.isArray(data) && data.some(item =>
|
|
39
|
+
item.address?.toLowerCase() === address.toLowerCase() &&
|
|
40
|
+
item.chainId === network.chainId.toString() &&
|
|
41
|
+
(item.status === 'perfect' || item.status === 'partial')
|
|
42
|
+
)
|
|
43
|
+
} catch (error) {
|
|
44
|
+
// If we can't determine the verification status, assume it's not verified
|
|
45
|
+
console.warn(`Failed to check Sourcify verification status for ${address}: ${error instanceof Error ? error.message : String(error)}`)
|
|
46
|
+
return false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async verifyContract(request: VerificationRequest): Promise<VerificationResult> {
|
|
51
|
+
const { contract, buildInfo, address, network } = request
|
|
52
|
+
|
|
53
|
+
// First check if it's already verified
|
|
54
|
+
const alreadyVerified = await this.isContractAlreadyVerified(address, network)
|
|
55
|
+
if (alreadyVerified) {
|
|
56
|
+
return {
|
|
57
|
+
success: true,
|
|
58
|
+
message: 'Contract was already verified on Sourcify (checked before attempting verification)',
|
|
59
|
+
isAlreadyVerified: true
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
// Extract metadata and source files
|
|
65
|
+
const { metadata, sourceFiles } = await this.createVerificationData(contract, buildInfo)
|
|
66
|
+
|
|
67
|
+
// Use web standard FormData instead of node form-data package
|
|
68
|
+
const formData = new FormData()
|
|
69
|
+
|
|
70
|
+
formData.append('address', address)
|
|
71
|
+
formData.append('chain', network.chainId.toString())
|
|
72
|
+
|
|
73
|
+
// Upload files individually to Sourcify
|
|
74
|
+
// First add the metadata.json
|
|
75
|
+
const metadataJson = JSON.stringify(metadata, null, 2)
|
|
76
|
+
const metadataBlob = new Blob([metadataJson], { type: 'application/json' })
|
|
77
|
+
formData.append('files', metadataBlob, 'metadata.json')
|
|
78
|
+
|
|
79
|
+
// Add each source file individually
|
|
80
|
+
for (const [sourcePath, sourceContent] of sourceFiles) {
|
|
81
|
+
const sourceBlob = new Blob([sourceContent], { type: 'text/plain' })
|
|
82
|
+
formData.append('files', sourceBlob, sourcePath)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const response = await fetch('https://sourcify.dev/server/verify', {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
body: formData,
|
|
88
|
+
signal: AbortSignal.timeout(60000), // 60 second timeout for verification
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
if (!response.ok) {
|
|
92
|
+
let responseText = ''
|
|
93
|
+
try {
|
|
94
|
+
responseText = await response.text()
|
|
95
|
+
} catch {
|
|
96
|
+
// ignore
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Treat partial verification conflicts as a non-error notice
|
|
100
|
+
if (response.status === 409) {
|
|
101
|
+
const lower = `${response.statusText} ${responseText}`.toLowerCase()
|
|
102
|
+
if (
|
|
103
|
+
lower.includes('already partially verified') ||
|
|
104
|
+
lower.includes('partial match') ||
|
|
105
|
+
lower.includes('partial')
|
|
106
|
+
) {
|
|
107
|
+
return {
|
|
108
|
+
success: true,
|
|
109
|
+
message: 'Contract already partially verified on Sourcify (no further action needed)',
|
|
110
|
+
isAlreadyVerified: true
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
let errorDetails = `HTTP ${response.status}: ${response.statusText}`
|
|
116
|
+
if (responseText) {
|
|
117
|
+
errorDetails += ` - ${responseText}`
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
success: false,
|
|
121
|
+
message: `Sourcify API request failed: ${errorDetails}`
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const result = await response.json() as any
|
|
126
|
+
|
|
127
|
+
// Check for different response formats
|
|
128
|
+
if (result.result && Array.isArray(result.result)) {
|
|
129
|
+
// Array response format - check if any items have perfect/partial status
|
|
130
|
+
const perfectMatch = result.result.find((item: any) => item.status === 'perfect')
|
|
131
|
+
const partialMatch = result.result.find((item: any) => item.status === 'partial')
|
|
132
|
+
|
|
133
|
+
if (perfectMatch || partialMatch) {
|
|
134
|
+
const matchType = perfectMatch ? 'perfect' : 'partial'
|
|
135
|
+
return {
|
|
136
|
+
success: true,
|
|
137
|
+
message: `Contract verified successfully on Sourcify (${matchType} match)`
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
success: false,
|
|
143
|
+
message: 'Sourcify verification failed - no perfect or partial match found'
|
|
144
|
+
}
|
|
145
|
+
} else if (result.status) {
|
|
146
|
+
// Single object response format
|
|
147
|
+
if (result.status === 'perfect' || result.status === 'partial') {
|
|
148
|
+
return {
|
|
149
|
+
success: true,
|
|
150
|
+
message: `Contract verified successfully on Sourcify (status: ${result.status})`
|
|
151
|
+
}
|
|
152
|
+
} else if (result.status === 'error') {
|
|
153
|
+
return {
|
|
154
|
+
success: false,
|
|
155
|
+
message: result.message || 'Sourcify verification failed with unknown error'
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
return {
|
|
159
|
+
success: false,
|
|
160
|
+
message: `Sourcify verification failed with status: ${result.status}`
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
// Unknown response format
|
|
165
|
+
return {
|
|
166
|
+
success: false,
|
|
167
|
+
message: `Sourcify verification failed - unexpected response format: ${JSON.stringify(result)}`
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
} catch (error) {
|
|
171
|
+
return {
|
|
172
|
+
success: false,
|
|
173
|
+
message: `Sourcify verification failed: ${error instanceof Error ? error.message : String(error)}`
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private async createVerificationData(contract: any, buildInfo: any): Promise<{
|
|
179
|
+
metadata: any,
|
|
180
|
+
sourceFiles: Array<[string, string]>
|
|
181
|
+
}> {
|
|
182
|
+
// Extract source files from the build info
|
|
183
|
+
const sourceFiles: Array<[string, string]> = []
|
|
184
|
+
for (const [sourcePath, sourceInfo] of Object.entries(buildInfo.input.sources) as [string, any][]) {
|
|
185
|
+
if (sourceInfo.content) {
|
|
186
|
+
sourceFiles.push([sourcePath, sourceInfo.content])
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Try to find metadata from the contract's artifact if available
|
|
191
|
+
let metadata = null
|
|
192
|
+
|
|
193
|
+
// First, try to get metadata from the contract's artifact file
|
|
194
|
+
try {
|
|
195
|
+
// Look for artifact file in contract sources (convert Set to Array)
|
|
196
|
+
const sources = Array.from(contract._sources) as string[]
|
|
197
|
+
const artifactPath = sources.find((source) =>
|
|
198
|
+
source.includes('/artifacts/') && source.endsWith('.json') && !source.includes('/build-info/')
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
if (artifactPath) {
|
|
202
|
+
const fs = await import('fs/promises')
|
|
203
|
+
const artifactContent = await fs.readFile(artifactPath, 'utf-8')
|
|
204
|
+
const artifact = JSON.parse(artifactContent)
|
|
205
|
+
|
|
206
|
+
// Use rawMetadata if available (it's a JSON string)
|
|
207
|
+
if (artifact.rawMetadata) {
|
|
208
|
+
metadata = JSON.parse(artifact.rawMetadata)
|
|
209
|
+
} else if (artifact.metadata) {
|
|
210
|
+
metadata = artifact.metadata
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
} catch (error) {
|
|
214
|
+
console.warn(`Failed to load artifact metadata: ${error instanceof Error ? error.message : String(error)}`)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Fallback: look for metadata in the build info output
|
|
218
|
+
if (!metadata && buildInfo.output?.contracts?.[contract.sourceName]?.[contract.contractName]?.metadata) {
|
|
219
|
+
const metadataField = buildInfo.output.contracts[contract.sourceName][contract.contractName].metadata
|
|
220
|
+
metadata = typeof metadataField === 'string' ? JSON.parse(metadataField) : metadataField
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Last resort fallback: create basic metadata from the input
|
|
224
|
+
if (!metadata) {
|
|
225
|
+
metadata = {
|
|
226
|
+
compiler: {
|
|
227
|
+
version: buildInfo.solcLongVersion || buildInfo.solcVersion
|
|
228
|
+
},
|
|
229
|
+
language: buildInfo.input.language,
|
|
230
|
+
output: {
|
|
231
|
+
abi: buildInfo.output?.contracts?.[contract.sourceName]?.[contract.contractName]?.abi || [],
|
|
232
|
+
devdoc: { kind: 'dev', methods: {}, version: 1 },
|
|
233
|
+
userdoc: { kind: 'user', methods: {}, version: 1 }
|
|
234
|
+
},
|
|
235
|
+
settings: buildInfo.input.settings,
|
|
236
|
+
sources: buildInfo.input.sources,
|
|
237
|
+
version: 1
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Validation: ensure metadata has compilation target
|
|
242
|
+
if (!metadata?.settings?.compilationTarget) {
|
|
243
|
+
console.warn('Warning: Metadata missing compilation target')
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return { metadata, sourceFiles }
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"abi": [],
|
|
3
|
+
"bytecode": {
|
|
4
|
+
"object": "0x608060405234801561001057600080fd5b50600160008190555050607c8061002760003960006000f3fe"
|
|
5
|
+
},
|
|
6
|
+
"deployedBytecode": {
|
|
7
|
+
"object": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80638da5cb5b14610044575b36600b57005b600080fd5b61005c600480360381019061005791906100a1565b610062565b005b600080fd5b6000813590506100da81610099565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610128576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161011f906101c4565b60405180910390fd5b5080910390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060405190508061014e82610131565b8091505090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b82818337600083901b82529050565b600060208284031215610178576101776100c7565b5b60006101868482850161007c565b91505092915050565b7f537472696e67206d757374206265206e6f6e2d656d7074790000000000000000600082015250565b60006101c560198361021f565b91506101d08261018f565b6020820190509190565b60006020820190508181036000830152610203816101bf565b9050919050565b600082825260208201905092915050565b5050565b565b005b00fea264697066735822122013e4c7c9dd8f5cc6c8b78b5e5b5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e64736f6c634300081e0033"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: "test-missing"
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
description: "Test job that references a non-existent contract"
|
|
4
|
+
|
|
5
|
+
actions:
|
|
6
|
+
- name: "deploy-valid"
|
|
7
|
+
template: "sequence-universal-deployer-2"
|
|
8
|
+
arguments:
|
|
9
|
+
creationCode: "{{Contract(TestContract).creationCode}}"
|
|
10
|
+
salt: "0"
|
|
11
|
+
|
|
12
|
+
- name: "deploy-missing"
|
|
13
|
+
template: "sequence-universal-deployer-2"
|
|
14
|
+
arguments:
|
|
15
|
+
creationCode: "{{Contract(NonExistentContract).creationCode}}"
|
|
16
|
+
salt: "0"
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"removeComments": true,
|
|
16
|
+
"noImplicitAny": true,
|
|
17
|
+
"strictNullChecks": true,
|
|
18
|
+
"strictFunctionTypes": true,
|
|
19
|
+
"noImplicitThis": true,
|
|
20
|
+
"noImplicitReturns": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
"moduleResolution": "node",
|
|
23
|
+
"allowSyntheticDefaultImports": true,
|
|
24
|
+
"experimentalDecorators": true,
|
|
25
|
+
"emitDecoratorMetadata": true,
|
|
26
|
+
"resolveJsonModule": true
|
|
27
|
+
},
|
|
28
|
+
"include": [
|
|
29
|
+
"src/**/*"
|
|
30
|
+
],
|
|
31
|
+
"exclude": [
|
|
32
|
+
"node_modules",
|
|
33
|
+
"dist",
|
|
34
|
+
"**/*.test.ts"
|
|
35
|
+
]
|
|
36
|
+
}
|