@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,67 @@
|
|
|
1
|
+
# Similar to "raw-erc-2470" but it
|
|
2
|
+
# uses some extra logic, delivered as a create-contract action, that ensures that the top level call fails if the contract
|
|
3
|
+
# fails to deploy. This ensures that the gas estimation is accurate and the transaction won't silently fail with out of gas.
|
|
4
|
+
name: "erc-2470"
|
|
5
|
+
type: "template"
|
|
6
|
+
|
|
7
|
+
arguments:
|
|
8
|
+
creationCode:
|
|
9
|
+
type: "bytes"
|
|
10
|
+
salt:
|
|
11
|
+
type: "bytes32"
|
|
12
|
+
|
|
13
|
+
returns:
|
|
14
|
+
address:
|
|
15
|
+
type: "address"
|
|
16
|
+
|
|
17
|
+
setup:
|
|
18
|
+
skip_condition:
|
|
19
|
+
- type: "contract-exists"
|
|
20
|
+
arguments:
|
|
21
|
+
address: "0xce0042B868300000d44A59004Da54A005ffdcf9f"
|
|
22
|
+
actions:
|
|
23
|
+
- type: "test-nicks-method"
|
|
24
|
+
- type: "min-balance"
|
|
25
|
+
arguments:
|
|
26
|
+
address: "0xBb6e024b9cFFACB947A71991E386681B1Cd1477D"
|
|
27
|
+
balance: "24700000000000000"
|
|
28
|
+
- type: "send-signed-transaction"
|
|
29
|
+
arguments:
|
|
30
|
+
transaction: |
|
|
31
|
+
0xf9016c8085174876e8008303c4d88080b90154608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212206b44f8a82cb6b156bfcc3dc6aadd6df4eefd204bc928a4397fd15dacf6d5320564736f6c634300060200331b83247000822470
|
|
32
|
+
|
|
33
|
+
actions:
|
|
34
|
+
- type: "assured-deployment"
|
|
35
|
+
arguments:
|
|
36
|
+
targetAddress:
|
|
37
|
+
type: "compute-create2"
|
|
38
|
+
arguments:
|
|
39
|
+
deployerAddress: "0xce0042B868300000d44A59004Da54A005ffdcf9f"
|
|
40
|
+
salt: "{{salt}}"
|
|
41
|
+
initCode: "{{creationCode}}"
|
|
42
|
+
factoryAddress: "0xce0042B868300000d44A59004Da54A005ffdcf9f"
|
|
43
|
+
callData:
|
|
44
|
+
type: "abi-encode"
|
|
45
|
+
arguments:
|
|
46
|
+
signature: "deploy(bytes,bytes32)"
|
|
47
|
+
values:
|
|
48
|
+
- "{{creationCode}}"
|
|
49
|
+
- "{{salt}}"
|
|
50
|
+
|
|
51
|
+
skip_condition:
|
|
52
|
+
- type: "contract-exists"
|
|
53
|
+
arguments:
|
|
54
|
+
address:
|
|
55
|
+
type: "compute-create2"
|
|
56
|
+
arguments:
|
|
57
|
+
deployerAddress: "0xce0042B868300000d44A59004Da54A005ffdcf9f"
|
|
58
|
+
salt: "{{salt}}"
|
|
59
|
+
initCode: "{{creationCode}}"
|
|
60
|
+
|
|
61
|
+
outputs:
|
|
62
|
+
address:
|
|
63
|
+
type: "compute-create2"
|
|
64
|
+
arguments:
|
|
65
|
+
deployerAddress: "0xce0042B868300000d44A59004Da54A005ffdcf9f"
|
|
66
|
+
salt: "{{salt}}"
|
|
67
|
+
initCode: "{{creationCode}}"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: "min-balance"
|
|
2
|
+
type: "template"
|
|
3
|
+
|
|
4
|
+
arguments:
|
|
5
|
+
address:
|
|
6
|
+
type: "address"
|
|
7
|
+
balance:
|
|
8
|
+
type: "uint256"
|
|
9
|
+
|
|
10
|
+
actions:
|
|
11
|
+
- type: "send-transaction"
|
|
12
|
+
arguments:
|
|
13
|
+
to: "{{address}}"
|
|
14
|
+
value:
|
|
15
|
+
type: "basic-arithmetic"
|
|
16
|
+
arguments:
|
|
17
|
+
operation: "sub"
|
|
18
|
+
values:
|
|
19
|
+
- "{{balance}}"
|
|
20
|
+
- type: "read-balance"
|
|
21
|
+
arguments:
|
|
22
|
+
address: "{{address}}"
|
|
23
|
+
|
|
24
|
+
skip_condition:
|
|
25
|
+
- type: "basic-arithmetic"
|
|
26
|
+
arguments:
|
|
27
|
+
operation: "gte"
|
|
28
|
+
values:
|
|
29
|
+
- type: "read-balance"
|
|
30
|
+
arguments:
|
|
31
|
+
address: "{{address}}"
|
|
32
|
+
- "{{balance}}"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Similar to "raw-nano-universal-deployer" but it
|
|
2
|
+
# uses some extra logic, delivered as a create-contract action, that ensures that the top level call fails if the contract
|
|
3
|
+
# fails to deploy. This ensures that the gas estimation is accurate and the transaction won't silently fail with out of gas.
|
|
4
|
+
name: "nano-universal-deployer"
|
|
5
|
+
type: "template"
|
|
6
|
+
|
|
7
|
+
arguments:
|
|
8
|
+
creationCode:
|
|
9
|
+
type: "bytes"
|
|
10
|
+
|
|
11
|
+
returns:
|
|
12
|
+
address:
|
|
13
|
+
type: "address"
|
|
14
|
+
|
|
15
|
+
setup:
|
|
16
|
+
skip_condition:
|
|
17
|
+
- type: "contract-exists"
|
|
18
|
+
arguments:
|
|
19
|
+
address: "0x1B926fBB24A9F78DCDd3272f2d86F5D0660E59c0"
|
|
20
|
+
actions:
|
|
21
|
+
- type: "test-nicks-method"
|
|
22
|
+
- type: "min-balance"
|
|
23
|
+
arguments:
|
|
24
|
+
address: "0x9c5a87452d4FAC0cbd53BDCA580b20A45526B3AB"
|
|
25
|
+
balance: "21700000000140000"
|
|
26
|
+
- type: "send-signed-transaction"
|
|
27
|
+
arguments:
|
|
28
|
+
transaction: |
|
|
29
|
+
0xf9010880852416b84e01830222e08080b8b66080604052348015600f57600080fd5b50609980601d6000396000f3fe60a06020601f369081018290049091028201604052608081815260009260609284918190838280828437600092018290525084519495509392505060208401905034f5604080516001600160a01b0383168152905191935081900360200190a0505000fea26469706673582212205a310755225e3c740b2f013fb6343f4c205e7141fcdf15947f5f0e0e818727fb64736f6c634300060a00331ca01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820
|
|
30
|
+
|
|
31
|
+
actions:
|
|
32
|
+
- type: "assured-deployment"
|
|
33
|
+
arguments:
|
|
34
|
+
targetAddress:
|
|
35
|
+
type: "compute-create2"
|
|
36
|
+
arguments:
|
|
37
|
+
deployerAddress: "0x1B926fBB24A9F78DCDd3272f2d86F5D0660E59c0"
|
|
38
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
39
|
+
initCode: "{{creationCode}}"
|
|
40
|
+
factoryAddress: "0x1B926fBB24A9F78DCDd3272f2d86F5D0660E59c0"
|
|
41
|
+
callData: "{{creationCode}}"
|
|
42
|
+
|
|
43
|
+
skip_condition:
|
|
44
|
+
- type: "contract-exists"
|
|
45
|
+
arguments:
|
|
46
|
+
address:
|
|
47
|
+
type: "compute-create2"
|
|
48
|
+
arguments:
|
|
49
|
+
deployerAddress: "0x1B926fBB24A9F78DCDd3272f2d86F5D0660E59c0"
|
|
50
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
51
|
+
initCode: "{{creationCode}}"
|
|
52
|
+
|
|
53
|
+
outputs:
|
|
54
|
+
address:
|
|
55
|
+
type: "compute-create2"
|
|
56
|
+
arguments:
|
|
57
|
+
deployerAddress: "0x1B926fBB24A9F78DCDd3272f2d86F5D0660E59c0"
|
|
58
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
59
|
+
initCode: "{{creationCode}}"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: "raw-erc-2470"
|
|
2
|
+
type: "template"
|
|
3
|
+
|
|
4
|
+
arguments:
|
|
5
|
+
creationCode:
|
|
6
|
+
type: "bytes"
|
|
7
|
+
salt:
|
|
8
|
+
type: "bytes32"
|
|
9
|
+
|
|
10
|
+
returns:
|
|
11
|
+
address:
|
|
12
|
+
type: "address"
|
|
13
|
+
|
|
14
|
+
setup:
|
|
15
|
+
skip_condition:
|
|
16
|
+
- type: "contract-exists"
|
|
17
|
+
arguments:
|
|
18
|
+
address: "0xce0042B868300000d44A59004Da54A005ffdcf9f"
|
|
19
|
+
actions:
|
|
20
|
+
- type: "test-nicks-method"
|
|
21
|
+
- type: "min-balance"
|
|
22
|
+
arguments:
|
|
23
|
+
address: "0xBb6e024b9cFFACB947A71991E386681B1Cd1477D"
|
|
24
|
+
balance: "24700000000000000"
|
|
25
|
+
- type: "send-signed-transaction"
|
|
26
|
+
arguments:
|
|
27
|
+
transaction: |
|
|
28
|
+
0xf9016c8085174876e8008303c4d88080b90154608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212206b44f8a82cb6b156bfcc3dc6aadd6df4eefd204bc928a4397fd15dacf6d5320564736f6c634300060200331b83247000822470
|
|
29
|
+
|
|
30
|
+
actions:
|
|
31
|
+
- type: "send-transaction"
|
|
32
|
+
arguments:
|
|
33
|
+
to: "0xce0042B868300000d44A59004Da54A005ffdcf9f"
|
|
34
|
+
data:
|
|
35
|
+
type: "abi-encode"
|
|
36
|
+
arguments:
|
|
37
|
+
signature: "deploy(bytes,bytes32)"
|
|
38
|
+
values:
|
|
39
|
+
- "{{creationCode}}"
|
|
40
|
+
- "{{salt}}"
|
|
41
|
+
gasMultiplier: 1.6
|
|
42
|
+
|
|
43
|
+
skip_condition:
|
|
44
|
+
- type: "contract-exists"
|
|
45
|
+
arguments:
|
|
46
|
+
address:
|
|
47
|
+
type: "compute-create2"
|
|
48
|
+
arguments:
|
|
49
|
+
deployerAddress: "0xce0042B868300000d44A59004Da54A005ffdcf9f"
|
|
50
|
+
salt: "{{salt}}"
|
|
51
|
+
initCode: "{{creationCode}}"
|
|
52
|
+
|
|
53
|
+
outputs:
|
|
54
|
+
address:
|
|
55
|
+
type: "compute-create2"
|
|
56
|
+
arguments:
|
|
57
|
+
deployerAddress: "0xce0042B868300000d44A59004Da54A005ffdcf9f"
|
|
58
|
+
salt: "{{salt}}"
|
|
59
|
+
initCode: "{{creationCode}}"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: "raw-nano-universal-deployer"
|
|
2
|
+
type: "template"
|
|
3
|
+
|
|
4
|
+
arguments:
|
|
5
|
+
creationCode:
|
|
6
|
+
type: "bytes"
|
|
7
|
+
|
|
8
|
+
returns:
|
|
9
|
+
address:
|
|
10
|
+
type: "address"
|
|
11
|
+
|
|
12
|
+
setup:
|
|
13
|
+
skip_condition:
|
|
14
|
+
- type: "contract-exists"
|
|
15
|
+
arguments:
|
|
16
|
+
address: "0x1B926fBB24A9F78DCDd3272f2d86F5D0660E59c0"
|
|
17
|
+
actions:
|
|
18
|
+
- type: "test-nicks-method"
|
|
19
|
+
- type: "min-balance"
|
|
20
|
+
arguments:
|
|
21
|
+
address: "0x9c5a87452d4FAC0cbd53BDCA580b20A45526B3AB"
|
|
22
|
+
balance: "21700000000140000"
|
|
23
|
+
- type: "send-signed-transaction"
|
|
24
|
+
arguments:
|
|
25
|
+
transaction: |
|
|
26
|
+
0xf9010880852416b84e01830222e08080b8b66080604052348015600f57600080fd5b50609980601d6000396000f3fe60a06020601f369081018290049091028201604052608081815260009260609284918190838280828437600092018290525084519495509392505060208401905034f5604080516001600160a01b0383168152905191935081900360200190a0505000fea26469706673582212205a310755225e3c740b2f013fb6343f4c205e7141fcdf15947f5f0e0e818727fb64736f6c634300060a00331ca01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820
|
|
27
|
+
|
|
28
|
+
actions:
|
|
29
|
+
- type: "send-transaction"
|
|
30
|
+
arguments:
|
|
31
|
+
to: "0x1B926fBB24A9F78DCDd3272f2d86F5D0660E59c0"
|
|
32
|
+
data: "{{creationCode}}"
|
|
33
|
+
gasMultiplier: 1.6
|
|
34
|
+
|
|
35
|
+
skip_condition:
|
|
36
|
+
- type: "contract-exists"
|
|
37
|
+
arguments:
|
|
38
|
+
address:
|
|
39
|
+
type: "compute-create2"
|
|
40
|
+
arguments:
|
|
41
|
+
deployerAddress: "0x1B926fBB24A9F78DCDd3272f2d86F5D0660E59c0"
|
|
42
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
43
|
+
initCode: "{{creationCode}}"
|
|
44
|
+
|
|
45
|
+
outputs:
|
|
46
|
+
address:
|
|
47
|
+
type: "compute-create2"
|
|
48
|
+
arguments:
|
|
49
|
+
deployerAddress: "0x1B926fBB24A9F78DCDd3272f2d86F5D0660E59c0"
|
|
50
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
51
|
+
initCode: "{{creationCode}}"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: "raw-sequence-universal-deployer-2"
|
|
2
|
+
type: "template"
|
|
3
|
+
|
|
4
|
+
arguments:
|
|
5
|
+
creationCode:
|
|
6
|
+
type: "bytes"
|
|
7
|
+
salt:
|
|
8
|
+
type: "bytes32"
|
|
9
|
+
|
|
10
|
+
returns:
|
|
11
|
+
address:
|
|
12
|
+
type: "address"
|
|
13
|
+
|
|
14
|
+
setup:
|
|
15
|
+
- type: "nano-universal-deployer"
|
|
16
|
+
arguments:
|
|
17
|
+
creationCode: "0x608060405234801561001057600080fd5b5061013d806100206000396000f3fe60806040526004361061001e5760003560e01c80639c4ae2d014610023575b600080fd5b6100cb6004803603604081101561003957600080fd5b81019060208101813564010000000081111561005457600080fd5b82018360208201111561006657600080fd5b8035906020019184600183028401116401000000008311171561008857600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506100cd915050565b005b60008183516020850134f56040805173ffffffffffffffffffffffffffffffffffffffff83168152905191925081900360200190a050505056fea264697066735822122033609f614f03931b92d88c309d698449bb77efcd517328d341fa4f923c5d8c7964736f6c63430007060033"
|
|
18
|
+
|
|
19
|
+
actions:
|
|
20
|
+
- type: "send-transaction"
|
|
21
|
+
arguments:
|
|
22
|
+
to: "0x8A5Bc19e22D6aD55a2c763B93A75d09F321fe764"
|
|
23
|
+
data:
|
|
24
|
+
type: "abi-encode"
|
|
25
|
+
arguments:
|
|
26
|
+
signature: "deploy(bytes,uint256)"
|
|
27
|
+
values:
|
|
28
|
+
- "{{creationCode}}"
|
|
29
|
+
- "{{salt}}"
|
|
30
|
+
gasMultiplier: 1.6
|
|
31
|
+
|
|
32
|
+
skip_condition:
|
|
33
|
+
- type: "contract-exists"
|
|
34
|
+
arguments:
|
|
35
|
+
address:
|
|
36
|
+
type: "compute-create2"
|
|
37
|
+
arguments:
|
|
38
|
+
deployerAddress: "0x8A5Bc19e22D6aD55a2c763B93A75d09F321fe764"
|
|
39
|
+
salt: "{{salt}}"
|
|
40
|
+
initCode: "{{creationCode}}"
|
|
41
|
+
|
|
42
|
+
outputs:
|
|
43
|
+
address:
|
|
44
|
+
type: "compute-create2"
|
|
45
|
+
arguments:
|
|
46
|
+
deployerAddress: "0x8A5Bc19e22D6aD55a2c763B93A75d09F321fe764"
|
|
47
|
+
salt: "{{salt}}"
|
|
48
|
+
initCode: "{{creationCode}}"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Similar to "raw-sequence-universal-deployer-2" but it
|
|
2
|
+
# uses some extra logic, delivered as a create-contract action, that ensures that the top level call fails if the contract
|
|
3
|
+
# fails to deploy. This ensures that the gas estimation is accurate and the transaction won't silently fail with out of gas.
|
|
4
|
+
name: "sequence-universal-deployer-2"
|
|
5
|
+
type: "template"
|
|
6
|
+
|
|
7
|
+
arguments:
|
|
8
|
+
creationCode:
|
|
9
|
+
type: "bytes"
|
|
10
|
+
salt:
|
|
11
|
+
type: "bytes32"
|
|
12
|
+
|
|
13
|
+
returns:
|
|
14
|
+
address:
|
|
15
|
+
type: "address"
|
|
16
|
+
|
|
17
|
+
setup:
|
|
18
|
+
- type: "nano-universal-deployer"
|
|
19
|
+
arguments:
|
|
20
|
+
creationCode: "0x608060405234801561001057600080fd5b5061013d806100206000396000f3fe60806040526004361061001e5760003560e01c80639c4ae2d014610023575b600080fd5b6100cb6004803603604081101561003957600080fd5b81019060208101813564010000000081111561005457600080fd5b82018360208201111561006657600080fd5b8035906020019184600183028401116401000000008311171561008857600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506100cd915050565b005b60008183516020850134f56040805173ffffffffffffffffffffffffffffffffffffffff83168152905191925081900360200190a050505056fea264697066735822122033609f614f03931b92d88c309d698449bb77efcd517328d341fa4f923c5d8c7964736f6c63430007060033"
|
|
21
|
+
|
|
22
|
+
actions:
|
|
23
|
+
- type: "assured-deployment"
|
|
24
|
+
arguments:
|
|
25
|
+
targetAddress:
|
|
26
|
+
type: "compute-create2"
|
|
27
|
+
arguments:
|
|
28
|
+
deployerAddress: "0x8A5Bc19e22D6aD55a2c763B93A75d09F321fe764"
|
|
29
|
+
salt: "{{salt}}"
|
|
30
|
+
initCode: "{{creationCode}}"
|
|
31
|
+
factoryAddress: "0x8A5Bc19e22D6aD55a2c763B93A75d09F321fe764"
|
|
32
|
+
callData:
|
|
33
|
+
type: "abi-encode"
|
|
34
|
+
arguments:
|
|
35
|
+
signature: "deploy(bytes,uint256)"
|
|
36
|
+
values:
|
|
37
|
+
- "{{creationCode}}"
|
|
38
|
+
- "{{salt}}"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
skip_condition:
|
|
42
|
+
- type: "contract-exists"
|
|
43
|
+
arguments:
|
|
44
|
+
address:
|
|
45
|
+
type: "compute-create2"
|
|
46
|
+
arguments:
|
|
47
|
+
deployerAddress: "0x8A5Bc19e22D6aD55a2c763B93A75d09F321fe764"
|
|
48
|
+
salt: "{{salt}}"
|
|
49
|
+
initCode: "{{creationCode}}"
|
|
50
|
+
|
|
51
|
+
outputs:
|
|
52
|
+
address:
|
|
53
|
+
type: "compute-create2"
|
|
54
|
+
arguments:
|
|
55
|
+
deployerAddress: "0x8A5Bc19e22D6aD55a2c763B93A75d09F321fe764"
|
|
56
|
+
salt: "{{salt}}"
|
|
57
|
+
initCode: "{{creationCode}}"
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { JsonRequestAction } from '../actions'
|
|
2
|
+
|
|
3
|
+
describe('JsonRequestAction', () => {
|
|
4
|
+
describe('type definition', () => {
|
|
5
|
+
it('should have correct type structure for basic GET request', () => {
|
|
6
|
+
const action: JsonRequestAction = {
|
|
7
|
+
type: 'json-request',
|
|
8
|
+
arguments: {
|
|
9
|
+
url: 'https://api.example.com/data'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
expect(action.type).toBe('json-request')
|
|
14
|
+
expect(action.arguments.url).toBe('https://api.example.com/data')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('should support optional method parameter', () => {
|
|
18
|
+
const action: JsonRequestAction = {
|
|
19
|
+
type: 'json-request',
|
|
20
|
+
arguments: {
|
|
21
|
+
url: 'https://api.example.com/data',
|
|
22
|
+
method: 'POST'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
expect(action.arguments.method).toBe('POST')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('should support optional headers parameter', () => {
|
|
30
|
+
const action: JsonRequestAction = {
|
|
31
|
+
type: 'json-request',
|
|
32
|
+
arguments: {
|
|
33
|
+
url: 'https://api.example.com/data',
|
|
34
|
+
headers: {
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
'Authorization': 'Bearer token123'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
expect(action.arguments.headers).toEqual({
|
|
42
|
+
'Content-Type': 'application/json',
|
|
43
|
+
'Authorization': 'Bearer token123'
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('should support optional body parameter', () => {
|
|
48
|
+
const requestBody = {
|
|
49
|
+
name: 'John Doe',
|
|
50
|
+
email: 'john@example.com'
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const action: JsonRequestAction = {
|
|
54
|
+
type: 'json-request',
|
|
55
|
+
arguments: {
|
|
56
|
+
url: 'https://api.example.com/users',
|
|
57
|
+
method: 'POST',
|
|
58
|
+
body: requestBody
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
expect(action.arguments.body).toEqual(requestBody)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('should support template variables in url', () => {
|
|
66
|
+
const action: JsonRequestAction = {
|
|
67
|
+
type: 'json-request',
|
|
68
|
+
arguments: {
|
|
69
|
+
url: '{{apiBaseUrl}}/users/{{userId}}'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
expect(action.arguments.url).toBe('{{apiBaseUrl}}/users/{{userId}}')
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('should support template variables in method', () => {
|
|
77
|
+
const action: JsonRequestAction = {
|
|
78
|
+
type: 'json-request',
|
|
79
|
+
arguments: {
|
|
80
|
+
url: 'https://api.example.com/data',
|
|
81
|
+
method: '{{httpMethod}}'
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
expect(action.arguments.method).toBe('{{httpMethod}}')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it('should support template variables in headers', () => {
|
|
89
|
+
const action: JsonRequestAction = {
|
|
90
|
+
type: 'json-request',
|
|
91
|
+
arguments: {
|
|
92
|
+
url: 'https://api.example.com/data',
|
|
93
|
+
headers: {
|
|
94
|
+
'Authorization': '{{authToken}}',
|
|
95
|
+
'X-API-Key': '{{apiKey}}'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
expect(action.arguments.headers).toEqual({
|
|
101
|
+
'Authorization': '{{authToken}}',
|
|
102
|
+
'X-API-Key': '{{apiKey}}'
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it('should support template variables in body', () => {
|
|
107
|
+
const action: JsonRequestAction = {
|
|
108
|
+
type: 'json-request',
|
|
109
|
+
arguments: {
|
|
110
|
+
url: 'https://api.example.com/users',
|
|
111
|
+
method: 'POST',
|
|
112
|
+
body: {
|
|
113
|
+
name: '{{userName}}',
|
|
114
|
+
email: '{{userEmail}}',
|
|
115
|
+
data: '{{userData}}'
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
expect(action.arguments.body).toEqual({
|
|
121
|
+
name: '{{userName}}',
|
|
122
|
+
email: '{{userEmail}}',
|
|
123
|
+
data: '{{userData}}'
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it('should support complex nested body structures', () => {
|
|
128
|
+
const action: JsonRequestAction = {
|
|
129
|
+
type: 'json-request',
|
|
130
|
+
arguments: {
|
|
131
|
+
url: 'https://api.example.com/transactions',
|
|
132
|
+
method: 'POST',
|
|
133
|
+
body: {
|
|
134
|
+
transaction: {
|
|
135
|
+
to: '{{recipientAddress}}',
|
|
136
|
+
value: '{{amount}}',
|
|
137
|
+
data: '{{calldata}}'
|
|
138
|
+
},
|
|
139
|
+
metadata: {
|
|
140
|
+
timestamp: '{{currentTime}}',
|
|
141
|
+
source: 'live-contracts'
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
expect(action.arguments.body).toEqual({
|
|
148
|
+
transaction: {
|
|
149
|
+
to: '{{recipientAddress}}',
|
|
150
|
+
value: '{{amount}}',
|
|
151
|
+
data: '{{calldata}}'
|
|
152
|
+
},
|
|
153
|
+
metadata: {
|
|
154
|
+
timestamp: '{{currentTime}}',
|
|
155
|
+
source: 'live-contracts'
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
it('should support all HTTP methods', () => {
|
|
161
|
+
const methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS']
|
|
162
|
+
|
|
163
|
+
methods.forEach(method => {
|
|
164
|
+
const action: JsonRequestAction = {
|
|
165
|
+
type: 'json-request',
|
|
166
|
+
arguments: {
|
|
167
|
+
url: 'https://api.example.com/data',
|
|
168
|
+
method: method
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
expect(action.arguments.method).toBe(method)
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
it('should work with minimal configuration (only url)', () => {
|
|
177
|
+
const action: JsonRequestAction = {
|
|
178
|
+
type: 'json-request',
|
|
179
|
+
arguments: {
|
|
180
|
+
url: 'https://api.example.com/status'
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
expect(action.type).toBe('json-request')
|
|
185
|
+
expect(action.arguments.url).toBe('https://api.example.com/status')
|
|
186
|
+
expect(action.arguments.method).toBeUndefined()
|
|
187
|
+
expect(action.arguments.headers).toBeUndefined()
|
|
188
|
+
expect(action.arguments.body).toBeUndefined()
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
it('should work with full configuration', () => {
|
|
192
|
+
const action: JsonRequestAction = {
|
|
193
|
+
type: 'json-request',
|
|
194
|
+
arguments: {
|
|
195
|
+
url: 'https://api.example.com/users',
|
|
196
|
+
method: 'POST',
|
|
197
|
+
headers: {
|
|
198
|
+
'Content-Type': 'application/json',
|
|
199
|
+
'Authorization': 'Bearer token123',
|
|
200
|
+
'X-Custom-Header': 'custom-value'
|
|
201
|
+
},
|
|
202
|
+
body: {
|
|
203
|
+
user: {
|
|
204
|
+
name: 'Alice',
|
|
205
|
+
email: 'alice@example.com',
|
|
206
|
+
preferences: {
|
|
207
|
+
theme: 'dark',
|
|
208
|
+
notifications: true
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
metadata: {
|
|
212
|
+
source: 'api',
|
|
213
|
+
version: '1.0'
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
expect(action.type).toBe('json-request')
|
|
220
|
+
expect(action.arguments.url).toBe('https://api.example.com/users')
|
|
221
|
+
expect(action.arguments.method).toBe('POST')
|
|
222
|
+
expect(action.arguments.headers).toEqual({
|
|
223
|
+
'Content-Type': 'application/json',
|
|
224
|
+
'Authorization': 'Bearer token123',
|
|
225
|
+
'X-Custom-Header': 'custom-value'
|
|
226
|
+
})
|
|
227
|
+
expect(action.arguments.body).toEqual({
|
|
228
|
+
user: {
|
|
229
|
+
name: 'Alice',
|
|
230
|
+
email: 'alice@example.com',
|
|
231
|
+
preferences: {
|
|
232
|
+
theme: 'dark',
|
|
233
|
+
notifications: true
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
metadata: {
|
|
237
|
+
source: 'api',
|
|
238
|
+
version: '1.0'
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
})
|
|
242
|
+
})
|
|
243
|
+
})
|