movehat 0.1.9 → 0.2.1
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/README.md +132 -279
- package/dist/__tests__/deployContract.test.d.ts +2 -0
- package/dist/__tests__/deployContract.test.d.ts.map +1 -0
- package/dist/__tests__/deployContract.test.js +368 -0
- package/dist/__tests__/deployContract.test.js.map +1 -0
- package/dist/__tests__/errors.test.d.ts +2 -0
- package/dist/__tests__/errors.test.d.ts.map +1 -0
- package/dist/__tests__/errors.test.js +46 -0
- package/dist/__tests__/errors.test.js.map +1 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts +24 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts.map +1 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.js +82 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.js.map +1 -0
- package/dist/__tests__/fork/api.test.d.ts +2 -0
- package/dist/__tests__/fork/api.test.d.ts.map +1 -0
- package/dist/__tests__/fork/api.test.js +110 -0
- package/dist/__tests__/fork/api.test.js.map +1 -0
- package/dist/__tests__/harness/Harness.createLive.test.d.ts +2 -0
- package/dist/__tests__/harness/Harness.createLive.test.d.ts.map +1 -0
- package/dist/__tests__/harness/Harness.createLive.test.js +53 -0
- package/dist/__tests__/harness/Harness.createLive.test.js.map +1 -0
- package/dist/__tests__/harness/Harness.proxy.test.d.ts +2 -0
- package/dist/__tests__/harness/Harness.proxy.test.d.ts.map +1 -0
- package/dist/__tests__/harness/Harness.proxy.test.js +89 -0
- package/dist/__tests__/harness/Harness.proxy.test.js.map +1 -0
- package/dist/__tests__/harness/_fixture.d.ts +54 -0
- package/dist/__tests__/harness/_fixture.d.ts.map +1 -0
- package/dist/__tests__/harness/_fixture.js +69 -0
- package/dist/__tests__/harness/_fixture.js.map +1 -0
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts +2 -0
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts.map +1 -0
- package/dist/__tests__/harness/codeObject.deploy.test.js +288 -0
- package/dist/__tests__/harness/codeObject.deploy.test.js.map +1 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts +2 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts.map +1 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.js +138 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.js.map +1 -0
- package/dist/__tests__/harness/script.test.d.ts +2 -0
- package/dist/__tests__/harness/script.test.d.ts.map +1 -0
- package/dist/__tests__/harness/script.test.js +219 -0
- package/dist/__tests__/harness/script.test.js.map +1 -0
- package/dist/__tests__/harness/view.test.d.ts +2 -0
- package/dist/__tests__/harness/view.test.d.ts.map +1 -0
- package/dist/__tests__/harness/view.test.js +92 -0
- package/dist/__tests__/harness/view.test.js.map +1 -0
- package/dist/__tests__/runtime.test.d.ts +2 -0
- package/dist/__tests__/runtime.test.d.ts.map +1 -0
- package/dist/__tests__/runtime.test.js +141 -0
- package/dist/__tests__/runtime.test.js.map +1 -0
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/__tests__/compile.test.d.ts +2 -0
- package/dist/commands/__tests__/compile.test.d.ts.map +1 -0
- package/dist/commands/__tests__/compile.test.js +351 -0
- package/dist/commands/__tests__/compile.test.js.map +1 -0
- package/dist/commands/__tests__/init.test.d.ts +2 -0
- package/dist/commands/__tests__/init.test.d.ts.map +1 -0
- package/dist/commands/__tests__/init.test.js +101 -0
- package/dist/commands/__tests__/init.test.js.map +1 -0
- package/dist/commands/__tests__/run.test.d.ts +2 -0
- package/dist/commands/__tests__/run.test.d.ts.map +1 -0
- package/dist/commands/__tests__/run.test.js +166 -0
- package/dist/commands/__tests__/run.test.js.map +1 -0
- package/dist/commands/__tests__/test-move.test.d.ts +2 -0
- package/dist/commands/__tests__/test-move.test.d.ts.map +1 -0
- package/dist/commands/__tests__/test-move.test.js +59 -0
- package/dist/commands/__tests__/test-move.test.js.map +1 -0
- package/dist/commands/__tests__/test.test.d.ts +2 -0
- package/dist/commands/__tests__/test.test.d.ts.map +1 -0
- package/dist/commands/__tests__/test.test.js +168 -0
- package/dist/commands/__tests__/test.test.js.map +1 -0
- package/dist/commands/__tests__/update.test.d.ts +2 -0
- package/dist/commands/__tests__/update.test.d.ts.map +1 -0
- package/dist/commands/__tests__/update.test.js +176 -0
- package/dist/commands/__tests__/update.test.js.map +1 -0
- package/dist/commands/compile.d.ts +7 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +150 -33
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/fork/__tests__/create.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/create.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/create.test.js +108 -0
- package/dist/commands/fork/__tests__/create.test.js.map +1 -0
- package/dist/commands/fork/__tests__/fund.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/fund.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/fund.test.js +72 -0
- package/dist/commands/fork/__tests__/fund.test.js.map +1 -0
- package/dist/commands/fork/__tests__/list.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/list.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/list.test.js +119 -0
- package/dist/commands/fork/__tests__/list.test.js.map +1 -0
- package/dist/commands/fork/__tests__/serve.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/serve.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/serve.test.js +97 -0
- package/dist/commands/fork/__tests__/serve.test.js.map +1 -0
- package/dist/commands/fork/__tests__/view-resource.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/view-resource.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/view-resource.test.js +77 -0
- package/dist/commands/fork/__tests__/view-resource.test.js.map +1 -0
- package/dist/commands/fork/create.d.ts +1 -1
- package/dist/commands/fork/create.d.ts.map +1 -1
- package/dist/commands/fork/create.js +3 -2
- package/dist/commands/fork/create.js.map +1 -1
- package/dist/commands/fork/fund.d.ts.map +1 -1
- package/dist/commands/fork/fund.js +15 -8
- package/dist/commands/fork/fund.js.map +1 -1
- package/dist/commands/fork/list.d.ts.map +1 -1
- package/dist/commands/fork/list.js +2 -1
- package/dist/commands/fork/list.js.map +1 -1
- package/dist/commands/fork/serve.d.ts +1 -0
- package/dist/commands/fork/serve.d.ts.map +1 -1
- package/dist/commands/fork/serve.js +4 -2
- package/dist/commands/fork/serve.js.map +1 -1
- package/dist/commands/fork/view-resource.d.ts.map +1 -1
- package/dist/commands/fork/view-resource.js +10 -5
- package/dist/commands/fork/view-resource.js.map +1 -1
- package/dist/commands/run.d.ts +15 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +50 -27
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/test-move.d.ts.map +1 -1
- package/dist/commands/test-move.js +3 -2
- package/dist/commands/test-move.js.map +1 -1
- package/dist/commands/test.js +52 -46
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +15 -13
- package/dist/commands/update.js.map +1 -1
- package/dist/core/AccountManager.d.ts +1 -4
- package/dist/core/AccountManager.d.ts.map +1 -1
- package/dist/core/AccountManager.js +20 -12
- package/dist/core/AccountManager.js.map +1 -1
- package/dist/core/Publisher.d.ts +26 -0
- package/dist/core/Publisher.d.ts.map +1 -0
- package/dist/core/Publisher.js +240 -0
- package/dist/core/Publisher.js.map +1 -0
- package/dist/core/__tests__/AccountManager.test.d.ts +2 -0
- package/dist/core/__tests__/AccountManager.test.d.ts.map +1 -0
- package/dist/core/__tests__/AccountManager.test.js +239 -0
- package/dist/core/__tests__/AccountManager.test.js.map +1 -0
- package/dist/core/__tests__/config.test.d.ts +2 -0
- package/dist/core/__tests__/config.test.d.ts.map +1 -0
- package/dist/core/__tests__/config.test.js +311 -0
- package/dist/core/__tests__/config.test.js.map +1 -0
- package/dist/core/__tests__/deployments.test.d.ts +2 -0
- package/dist/core/__tests__/deployments.test.d.ts.map +1 -0
- package/dist/core/__tests__/deployments.test.js +201 -0
- package/dist/core/__tests__/deployments.test.js.map +1 -0
- package/dist/core/__tests__/shell.test.d.ts +2 -0
- package/dist/core/__tests__/shell.test.d.ts.map +1 -0
- package/dist/core/__tests__/shell.test.js +107 -0
- package/dist/core/__tests__/shell.test.js.map +1 -0
- package/dist/core/config.d.ts +13 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +80 -11
- package/dist/core/config.js.map +1 -1
- package/dist/core/contract.d.ts +1 -4
- package/dist/core/contract.d.ts.map +1 -1
- package/dist/core/contract.js +15 -7
- package/dist/core/contract.js.map +1 -1
- package/dist/core/deployments.d.ts +2 -8
- package/dist/core/deployments.d.ts.map +1 -1
- package/dist/core/deployments.js +8 -18
- package/dist/core/deployments.js.map +1 -1
- package/dist/core/movementProfile.d.ts +34 -0
- package/dist/core/movementProfile.d.ts.map +1 -0
- package/dist/core/movementProfile.js +150 -0
- package/dist/core/movementProfile.js.map +1 -0
- package/dist/core/shell.d.ts +23 -7
- package/dist/core/shell.d.ts.map +1 -1
- package/dist/core/shell.js +32 -14
- package/dist/core/shell.js.map +1 -1
- package/dist/errors.d.ts +35 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +54 -0
- package/dist/errors.js.map +1 -1
- package/dist/fork/__tests__/manager.test.d.ts +2 -0
- package/dist/fork/__tests__/manager.test.d.ts.map +1 -0
- package/dist/fork/__tests__/manager.test.js +309 -0
- package/dist/fork/__tests__/manager.test.js.map +1 -0
- package/dist/fork/__tests__/server.test.d.ts +2 -0
- package/dist/fork/__tests__/server.test.d.ts.map +1 -0
- package/dist/fork/__tests__/server.test.js +54 -0
- package/dist/fork/__tests__/server.test.js.map +1 -0
- package/dist/fork/__tests__/storage.test.d.ts +2 -0
- package/dist/fork/__tests__/storage.test.d.ts.map +1 -0
- package/dist/fork/__tests__/storage.test.js +222 -0
- package/dist/fork/__tests__/storage.test.js.map +1 -0
- package/dist/fork/__tests__/test.test.d.ts +2 -0
- package/dist/fork/__tests__/test.test.d.ts.map +1 -0
- package/dist/fork/__tests__/test.test.js +81 -0
- package/dist/fork/__tests__/test.test.js.map +1 -0
- package/dist/fork/api.d.ts +14 -3
- package/dist/fork/api.d.ts.map +1 -1
- package/dist/fork/api.js +25 -14
- package/dist/fork/api.js.map +1 -1
- package/dist/fork/manager.d.ts +23 -29
- package/dist/fork/manager.d.ts.map +1 -1
- package/dist/fork/manager.js +79 -76
- package/dist/fork/manager.js.map +1 -1
- package/dist/fork/server.d.ts +11 -3
- package/dist/fork/server.d.ts.map +1 -1
- package/dist/fork/server.js +45 -13
- package/dist/fork/server.js.map +1 -1
- package/dist/fork/storage.d.ts +4 -4
- package/dist/fork/storage.d.ts.map +1 -1
- package/dist/fork/storage.js +7 -9
- package/dist/fork/storage.js.map +1 -1
- package/dist/fork/test.d.ts +12 -4
- package/dist/fork/test.d.ts.map +1 -1
- package/dist/fork/test.js +36 -27
- package/dist/fork/test.js.map +1 -1
- package/dist/harness/Harness.d.ts +118 -0
- package/dist/harness/Harness.d.ts.map +1 -0
- package/dist/harness/Harness.js +187 -0
- package/dist/harness/Harness.js.map +1 -0
- package/dist/harness/codeObject.d.ts +31 -0
- package/dist/harness/codeObject.d.ts.map +1 -0
- package/dist/harness/codeObject.js +267 -0
- package/dist/harness/codeObject.js.map +1 -0
- package/dist/harness/errors.d.ts +14 -0
- package/dist/harness/errors.d.ts.map +1 -0
- package/dist/harness/errors.js +22 -0
- package/dist/harness/errors.js.map +1 -0
- package/dist/harness/index.d.ts +4 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +3 -0
- package/dist/harness/index.js.map +1 -0
- package/dist/harness/proxy.d.ts +7 -0
- package/dist/harness/proxy.d.ts.map +1 -0
- package/dist/harness/proxy.js +36 -0
- package/dist/harness/proxy.js.map +1 -0
- package/dist/harness/script.d.ts +21 -0
- package/dist/harness/script.d.ts.map +1 -0
- package/dist/harness/script.js +155 -0
- package/dist/harness/script.js.map +1 -0
- package/dist/harness/view.d.ts +22 -0
- package/dist/harness/view.d.ts.map +1 -0
- package/dist/harness/view.js +28 -0
- package/dist/harness/view.js.map +1 -0
- package/dist/helpers/__tests__/semver-utils.test.d.ts +2 -0
- package/dist/helpers/__tests__/semver-utils.test.d.ts.map +1 -0
- package/dist/helpers/__tests__/semver-utils.test.js +103 -0
- package/dist/helpers/__tests__/semver-utils.test.js.map +1 -0
- package/dist/helpers/index.d.ts +3 -2
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +2 -2
- package/dist/helpers/index.js.map +1 -1
- package/dist/helpers/move-tests.d.ts +3 -3
- package/dist/helpers/move-tests.d.ts.map +1 -1
- package/dist/helpers/move-tests.js +21 -20
- package/dist/helpers/move-tests.js.map +1 -1
- package/dist/helpers/npm-registry.d.ts.map +1 -1
- package/dist/helpers/npm-registry.js +1 -3
- package/dist/helpers/npm-registry.js.map +1 -1
- package/dist/helpers/semver-utils.d.ts.map +1 -1
- package/dist/helpers/semver-utils.js +4 -3
- package/dist/helpers/semver-utils.js.map +1 -1
- package/dist/helpers/setup.d.ts.map +1 -1
- package/dist/helpers/setup.js +6 -4
- package/dist/helpers/setup.js.map +1 -1
- package/dist/helpers/setupLocalTesting.d.ts +31 -27
- package/dist/helpers/setupLocalTesting.d.ts.map +1 -1
- package/dist/helpers/setupLocalTesting.js +179 -180
- package/dist/helpers/setupLocalTesting.js.map +1 -1
- package/dist/helpers/testFixtures.d.ts +19 -53
- package/dist/helpers/testFixtures.d.ts.map +1 -1
- package/dist/helpers/testFixtures.js +89 -107
- package/dist/helpers/testFixtures.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/node/LocalNodeManager.d.ts +9 -1
- package/dist/node/LocalNodeManager.d.ts.map +1 -1
- package/dist/node/LocalNodeManager.js +75 -58
- package/dist/node/LocalNodeManager.js.map +1 -1
- package/dist/node/__tests__/LocalNodeManager.test.d.ts +2 -0
- package/dist/node/__tests__/LocalNodeManager.test.d.ts.map +1 -0
- package/dist/node/__tests__/LocalNodeManager.test.js +349 -0
- package/dist/node/__tests__/LocalNodeManager.test.js.map +1 -0
- package/dist/runtime.d.ts +12 -15
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +26 -239
- package/dist/runtime.js.map +1 -1
- package/dist/templates/README.md +1 -1
- package/dist/templates/movehat.config.ts +10 -0
- package/dist/templates/package.json +2 -1
- package/dist/templates/scripts/deploy-counter.ts +46 -38
- package/dist/templates/tests/Counter.test.ts +39 -51
- package/dist/templates/types/movehat.d.ts +6 -9
- package/dist/types/config.d.ts +8 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/fork.d.ts +7 -1
- package/dist/types/fork.d.ts.map +1 -1
- package/dist/types/harness.d.ts +166 -0
- package/dist/types/harness.d.ts.map +1 -0
- package/dist/types/harness.js +2 -0
- package/dist/types/harness.js.map +1 -0
- package/dist/types/runtime.d.ts +7 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/ui/__tests__/colors.test.d.ts +2 -0
- package/dist/ui/__tests__/colors.test.d.ts.map +1 -0
- package/dist/ui/__tests__/colors.test.js +127 -0
- package/dist/ui/__tests__/colors.test.js.map +1 -0
- package/dist/ui/colors.d.ts.map +1 -1
- package/dist/ui/colors.js +6 -2
- package/dist/ui/colors.js.map +1 -1
- package/dist/ui/logger.d.ts +17 -0
- package/dist/ui/logger.d.ts.map +1 -1
- package/dist/ui/logger.js +22 -0
- package/dist/ui/logger.js.map +1 -1
- package/dist/ui/symbols.d.ts +1 -0
- package/dist/ui/symbols.d.ts.map +1 -1
- package/dist/ui/symbols.js +7 -1
- package/dist/ui/symbols.js.map +1 -1
- package/dist/utils/__tests__/address.test.d.ts +2 -0
- package/dist/utils/__tests__/address.test.d.ts.map +1 -0
- package/dist/utils/__tests__/address.test.js +70 -0
- package/dist/utils/__tests__/address.test.js.map +1 -0
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts +2 -0
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts.map +1 -0
- package/dist/utils/__tests__/childProcessAdapter.test.js +217 -0
- package/dist/utils/__tests__/childProcessAdapter.test.js.map +1 -0
- package/dist/utils/__tests__/runCli.test.d.ts +2 -0
- package/dist/utils/__tests__/runCli.test.d.ts.map +1 -0
- package/dist/utils/__tests__/runCli.test.js +187 -0
- package/dist/utils/__tests__/runCli.test.js.map +1 -0
- package/dist/utils/address.d.ts +29 -0
- package/dist/utils/address.d.ts.map +1 -0
- package/dist/utils/address.js +48 -0
- package/dist/utils/address.js.map +1 -0
- package/dist/utils/childProcessAdapter.d.ts +93 -0
- package/dist/utils/childProcessAdapter.d.ts.map +1 -0
- package/dist/utils/childProcessAdapter.js +108 -0
- package/dist/utils/childProcessAdapter.js.map +1 -0
- package/dist/utils/parseCliOutput.d.ts +20 -0
- package/dist/utils/parseCliOutput.d.ts.map +1 -0
- package/dist/utils/parseCliOutput.js +26 -0
- package/dist/utils/parseCliOutput.js.map +1 -0
- package/dist/utils/redact.d.ts +15 -0
- package/dist/utils/redact.d.ts.map +1 -0
- package/dist/utils/redact.js +24 -0
- package/dist/utils/redact.js.map +1 -0
- package/dist/utils/runCli.d.ts +24 -0
- package/dist/utils/runCli.d.ts.map +1 -0
- package/dist/utils/runCli.js +37 -0
- package/dist/utils/runCli.js.map +1 -0
- package/package.json +15 -4
- package/src/__tests__/deployContract.test.ts +429 -0
- package/src/__tests__/errors.test.ts +84 -0
- package/src/__tests__/fixtures/sigint-deploy-harness.ts +95 -0
- package/src/__tests__/fork/api.test.ts +143 -0
- package/src/__tests__/harness/Harness.createLive.test.ts +57 -0
- package/src/__tests__/harness/Harness.proxy.test.ts +111 -0
- package/src/__tests__/harness/_fixture.ts +131 -0
- package/src/__tests__/harness/codeObject.deploy.test.ts +319 -0
- package/src/__tests__/harness/codeObject.upgrade.test.ts +156 -0
- package/src/__tests__/harness/script.test.ts +245 -0
- package/src/__tests__/harness/view.test.ts +104 -0
- package/src/__tests__/runtime.test.ts +182 -0
- package/src/cli.ts +2 -1
- package/src/commands/__tests__/compile.test.ts +407 -0
- package/src/commands/__tests__/init.test.ts +125 -0
- package/src/commands/__tests__/run.test.ts +192 -0
- package/src/commands/__tests__/test-move.test.ts +81 -0
- package/src/commands/__tests__/test.test.ts +204 -0
- package/src/commands/__tests__/update.test.ts +223 -0
- package/src/commands/compile.ts +168 -32
- package/src/commands/fork/__tests__/create.test.ts +132 -0
- package/src/commands/fork/__tests__/fund.test.ts +104 -0
- package/src/commands/fork/__tests__/list.test.ts +139 -0
- package/src/commands/fork/__tests__/serve.test.ts +121 -0
- package/src/commands/fork/__tests__/view-resource.test.ts +101 -0
- package/src/commands/fork/create.ts +4 -3
- package/src/commands/fork/fund.ts +16 -9
- package/src/commands/fork/list.ts +3 -2
- package/src/commands/fork/serve.ts +6 -3
- package/src/commands/fork/view-resource.ts +11 -6
- package/src/commands/run.ts +54 -28
- package/src/commands/test-move.ts +4 -3
- package/src/commands/test.ts +56 -44
- package/src/commands/update.ts +19 -16
- package/src/core/AccountManager.ts +23 -22
- package/src/core/Publisher.ts +314 -0
- package/src/core/__tests__/AccountManager.test.ts +290 -0
- package/src/core/__tests__/config.test.ts +377 -0
- package/src/core/__tests__/deployments.test.ts +247 -0
- package/src/core/__tests__/shell.test.ts +138 -0
- package/src/core/config.ts +96 -12
- package/src/core/contract.ts +13 -7
- package/src/core/deployments.ts +13 -23
- package/src/core/movementProfile.ts +179 -0
- package/src/core/shell.ts +34 -14
- package/src/errors.ts +60 -0
- package/src/fork/__tests__/manager.test.ts +385 -0
- package/src/fork/__tests__/server.test.ts +65 -0
- package/src/fork/__tests__/storage.test.ts +281 -0
- package/src/fork/__tests__/test.test.ts +97 -0
- package/src/fork/api.ts +28 -14
- package/src/fork/manager.ts +88 -83
- package/src/fork/server.ts +53 -19
- package/src/fork/storage.ts +12 -15
- package/src/fork/test.ts +57 -32
- package/src/harness/Harness.ts +222 -0
- package/src/harness/codeObject.ts +384 -0
- package/src/harness/errors.ts +22 -0
- package/src/harness/index.ts +3 -0
- package/src/harness/proxy.ts +40 -0
- package/src/harness/script.ts +196 -0
- package/src/harness/view.ts +34 -0
- package/src/helpers/__tests__/semver-utils.test.ts +121 -0
- package/src/helpers/index.ts +2 -8
- package/src/helpers/move-tests.ts +27 -23
- package/src/helpers/npm-registry.ts +4 -3
- package/src/helpers/semver-utils.ts +4 -3
- package/src/helpers/setup.ts +6 -4
- package/src/helpers/setupLocalTesting.ts +218 -200
- package/src/helpers/testFixtures.ts +106 -118
- package/src/index.ts +8 -3
- package/src/node/LocalNodeManager.ts +87 -62
- package/src/node/__tests__/LocalNodeManager.test.ts +452 -0
- package/src/runtime.ts +28 -288
- package/src/templates/README.md +1 -1
- package/src/templates/movehat.config.ts +10 -0
- package/src/templates/package.json +2 -1
- package/src/templates/scripts/deploy-counter.ts +46 -38
- package/src/templates/tests/Counter.test.ts +39 -51
- package/src/templates/types/movehat.d.ts +6 -9
- package/src/types/config.ts +8 -0
- package/src/types/fork.ts +7 -1
- package/src/types/harness.ts +182 -0
- package/src/types/runtime.ts +11 -3
- package/src/ui/__tests__/colors.test.ts +156 -0
- package/src/ui/colors.ts +5 -2
- package/src/ui/logger.ts +22 -0
- package/src/ui/symbols.ts +7 -1
- package/src/utils/__tests__/address.test.ts +93 -0
- package/src/utils/__tests__/childProcessAdapter.test.ts +266 -0
- package/src/utils/__tests__/runCli.test.ts +240 -0
- package/src/utils/address.ts +52 -0
- package/src/utils/childProcessAdapter.ts +214 -0
- package/src/utils/parseCliOutput.ts +27 -0
- package/src/utils/redact.ts +24 -0
- package/src/utils/runCli.ts +64 -0
package/src/fork/test.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { execFile } from 'child_process';
|
|
2
|
-
import { promisify } from 'util';
|
|
3
1
|
import { join } from 'path';
|
|
4
2
|
import { existsSync } from 'fs';
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { runCli } from '../utils/runCli.js';
|
|
4
|
+
import type { ChildProcessAdapter } from '../utils/childProcessAdapter.js';
|
|
7
5
|
|
|
8
6
|
export interface SnapshotOptions {
|
|
9
7
|
path?: string;
|
|
10
8
|
name?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Override the child-process adapter. Test-only — production callers
|
|
11
|
+
* leave this undefined so the default spawn-based adapter is used.
|
|
12
|
+
*/
|
|
13
|
+
adapter?: ChildProcessAdapter;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export interface ForkInfo {
|
|
@@ -40,15 +43,22 @@ export async function snapshot(options: SnapshotOptions = {}): Promise<string> {
|
|
|
40
43
|
console.log(`📸 Creating snapshot: ${name}...`);
|
|
41
44
|
|
|
42
45
|
try {
|
|
43
|
-
// Initialize fork/snapshot using aptos CLI
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
// Initialize fork/snapshot using aptos CLI.
|
|
47
|
+
// runCli uses spawn-with-args under the hood (no shell), preventing
|
|
48
|
+
// command injection. Pass throwOnNonZeroExit:false so the exitCode is
|
|
49
|
+
// observable below — the stderr/dir defenses are belt-and-suspenders
|
|
50
|
+
// on top of the exitCode check.
|
|
51
|
+
const { stdout, stderr, exitCode } = await runCli(
|
|
52
|
+
{
|
|
53
|
+
command: 'aptos',
|
|
54
|
+
args: ['move', 'sim', 'init', '--path', snapshotPath],
|
|
55
|
+
},
|
|
56
|
+
{ throwOnNonZeroExit: false, adapter: options.adapter }
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (exitCode !== 0) {
|
|
60
|
+
throw new Error(stderr || `fork snapshot init failed with exit code ${exitCode}`);
|
|
61
|
+
}
|
|
52
62
|
|
|
53
63
|
if (stderr && !stderr.includes('Success')) {
|
|
54
64
|
throw new Error(stderr);
|
|
@@ -60,8 +70,9 @@ export async function snapshot(options: SnapshotOptions = {}): Promise<string> {
|
|
|
60
70
|
|
|
61
71
|
console.log(` ✓ Snapshot created at ${snapshotPath}`);
|
|
62
72
|
return snapshotPath;
|
|
63
|
-
} catch (error
|
|
64
|
-
|
|
73
|
+
} catch (error) {
|
|
74
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
75
|
+
throw new Error(`Failed to create snapshot: ${msg}`);
|
|
65
76
|
}
|
|
66
77
|
}
|
|
67
78
|
|
|
@@ -122,21 +133,34 @@ export async function getForkInfo(path: string): Promise<ForkInfo> {
|
|
|
122
133
|
export async function viewForkResource(
|
|
123
134
|
sessionPath: string,
|
|
124
135
|
account: string,
|
|
125
|
-
resourceType: string
|
|
136
|
+
resourceType: string,
|
|
137
|
+
options: { adapter?: ChildProcessAdapter } = {}
|
|
126
138
|
): Promise<any> {
|
|
127
139
|
try {
|
|
128
|
-
//
|
|
129
|
-
const { stdout } = await
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
// runCli uses spawn-with-args (no shell) to prevent command injection.
|
|
141
|
+
const { stdout, stderr, exitCode } = await runCli(
|
|
142
|
+
{
|
|
143
|
+
command: 'aptos',
|
|
144
|
+
args: [
|
|
145
|
+
'move',
|
|
146
|
+
'sim',
|
|
147
|
+
'view-resource',
|
|
148
|
+
'--session',
|
|
149
|
+
sessionPath,
|
|
150
|
+
'--account',
|
|
151
|
+
account,
|
|
152
|
+
'--resource',
|
|
153
|
+
resourceType,
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
{ throwOnNonZeroExit: false, adapter: options.adapter }
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
if (exitCode !== 0) {
|
|
160
|
+
throw new Error(
|
|
161
|
+
stderr || `fork view-resource failed with exit code ${exitCode}`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
140
164
|
|
|
141
165
|
const result = JSON.parse(stdout);
|
|
142
166
|
|
|
@@ -145,8 +169,9 @@ export async function viewForkResource(
|
|
|
145
169
|
}
|
|
146
170
|
|
|
147
171
|
return result.Result;
|
|
148
|
-
} catch (error
|
|
149
|
-
|
|
172
|
+
} catch (error) {
|
|
173
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
174
|
+
throw new Error(`Failed to view resource: ${msg}`);
|
|
150
175
|
}
|
|
151
176
|
}
|
|
152
177
|
|
|
@@ -164,8 +189,8 @@ export async function compareForkState(
|
|
|
164
189
|
forkPath: string,
|
|
165
190
|
account: string,
|
|
166
191
|
resourceType: string,
|
|
167
|
-
currentValue:
|
|
168
|
-
): Promise<{ fork:
|
|
192
|
+
currentValue: unknown
|
|
193
|
+
): Promise<{ fork: unknown; current: unknown; changed: boolean }> {
|
|
169
194
|
const forkValue = await viewForkResource(forkPath, account, resourceType);
|
|
170
195
|
|
|
171
196
|
return {
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { MovehatRuntime } from "../types/runtime.js";
|
|
2
|
+
import type { LocalNodeManager } from "../node/LocalNodeManager.js";
|
|
3
|
+
import type { ForkServer } from "../fork/server.js";
|
|
4
|
+
import type { ForkManager } from "../fork/manager.js";
|
|
5
|
+
import type { LocalTestOptions } from "../types/config.js";
|
|
6
|
+
import type {
|
|
7
|
+
DeployCodeObjectOptions,
|
|
8
|
+
UpgradeCodeObjectOptions,
|
|
9
|
+
CodeObjectInfo,
|
|
10
|
+
RunViewFunctionOptions,
|
|
11
|
+
RunMoveScriptOptions,
|
|
12
|
+
MoveScriptResult,
|
|
13
|
+
} from "../types/harness.js";
|
|
14
|
+
import { setupLocalTesting } from "../helpers/setupLocalTesting.js";
|
|
15
|
+
import { initRuntime } from "../runtime.js";
|
|
16
|
+
import { createHarnessProxy } from "./proxy.js";
|
|
17
|
+
import { deployCodeObject, upgradeCodeObject } from "./codeObject.js";
|
|
18
|
+
import { runViewFunction } from "./view.js";
|
|
19
|
+
import { runMoveScript } from "./script.js";
|
|
20
|
+
|
|
21
|
+
export type HarnessMode = "local" | "fork" | "live";
|
|
22
|
+
|
|
23
|
+
interface HarnessInit {
|
|
24
|
+
mode: HarnessMode;
|
|
25
|
+
runtime: MovehatRuntime;
|
|
26
|
+
localNode?: LocalNodeManager;
|
|
27
|
+
forkServer?: ForkServer;
|
|
28
|
+
forkManager?: ForkManager;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Hardhat-style testing harness for Movehat.
|
|
33
|
+
*
|
|
34
|
+
* Construct via the static factories — `createLocal`, `createFork`,
|
|
35
|
+
* `createLive` — never via `new Harness(...)`. The returned instance is
|
|
36
|
+
* a Proxy that synchronously throws {@link HarnessDisposedError} on any
|
|
37
|
+
* post-`cleanup()` call to one of the deployment / script / view methods.
|
|
38
|
+
*
|
|
39
|
+
* AccountManager note: the underlying account pool is a process-wide
|
|
40
|
+
* static (see `core/AccountManager.ts`). Two Harness instances in the
|
|
41
|
+
* same process share account labels; this is the same constraint that
|
|
42
|
+
* already governs `setupTestFixture`.
|
|
43
|
+
*/
|
|
44
|
+
export class Harness {
|
|
45
|
+
public readonly mode: HarnessMode;
|
|
46
|
+
public readonly runtime: MovehatRuntime;
|
|
47
|
+
|
|
48
|
+
/** @internal */
|
|
49
|
+
public readonly localNode?: LocalNodeManager;
|
|
50
|
+
/** @internal */
|
|
51
|
+
public readonly forkServer?: ForkServer;
|
|
52
|
+
/** @internal */
|
|
53
|
+
public readonly forkManager?: ForkManager;
|
|
54
|
+
|
|
55
|
+
private _poisoned = false;
|
|
56
|
+
|
|
57
|
+
private constructor(init: HarnessInit) {
|
|
58
|
+
this.mode = init.mode;
|
|
59
|
+
this.runtime = init.runtime;
|
|
60
|
+
if (init.localNode) this.localNode = init.localNode;
|
|
61
|
+
if (init.forkServer) this.forkServer = init.forkServer;
|
|
62
|
+
if (init.forkManager) this.forkManager = init.forkManager;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** True once `cleanup()` has been awaited at least once. */
|
|
66
|
+
public get poisoned(): boolean {
|
|
67
|
+
return this._poisoned;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Spin up a local Movement node and return a Harness bound to it.
|
|
72
|
+
*
|
|
73
|
+
* Forwards to `setupLocalTesting({ mode: 'local-node', ... })` so all
|
|
74
|
+
* existing options (`nodeApiPort`, `accountLabels`, `autoDeploy`, ...)
|
|
75
|
+
* apply unchanged.
|
|
76
|
+
*/
|
|
77
|
+
static async createLocal(options: LocalTestOptions = {}): Promise<Harness> {
|
|
78
|
+
const ctx = await setupLocalTesting({ ...options, mode: "local-node" });
|
|
79
|
+
const init: HarnessInit = {
|
|
80
|
+
mode: "local",
|
|
81
|
+
runtime: ctx.runtime,
|
|
82
|
+
};
|
|
83
|
+
if (ctx.localNode) init.localNode = ctx.localNode;
|
|
84
|
+
const instance = new Harness(init);
|
|
85
|
+
return createHarnessProxy(instance, () => instance._poisoned);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Create a fork-mode Harness reading from a snapshot of `network`.
|
|
90
|
+
*
|
|
91
|
+
* Fork mode is read-only: `deployCodeObject`, `upgradeCodeObject`,
|
|
92
|
+
* and `runMoveScript` throw with a message pointing at `createLocal`.
|
|
93
|
+
* `runViewFunction` works (read-only path).
|
|
94
|
+
*
|
|
95
|
+
* @param network - Network to fork (e.g. `"testnet"`).
|
|
96
|
+
* @param apiKey - Optional Movement API key. When set, every upstream
|
|
97
|
+
* request from the fork's `MovementApiClient` carries
|
|
98
|
+
* `Authorization: Bearer <apiKey>`. Use for rate-limited public
|
|
99
|
+
* endpoints or auth-gated nodes. The key stays in process memory
|
|
100
|
+
* (not persisted to the fork's on-disk metadata).
|
|
101
|
+
*/
|
|
102
|
+
static async createFork(network: string, apiKey?: string): Promise<Harness> {
|
|
103
|
+
const setupOpts: import("../types/config.js").LocalTestOptions = {
|
|
104
|
+
mode: "fork",
|
|
105
|
+
forkNetwork: network,
|
|
106
|
+
};
|
|
107
|
+
if (apiKey !== undefined) setupOpts.forkApiKey = apiKey;
|
|
108
|
+
const ctx = await setupLocalTesting(setupOpts);
|
|
109
|
+
const init: HarnessInit = {
|
|
110
|
+
mode: "fork",
|
|
111
|
+
runtime: ctx.runtime,
|
|
112
|
+
};
|
|
113
|
+
if (ctx.forkServer) init.forkServer = ctx.forkServer;
|
|
114
|
+
if (ctx.forkManager) init.forkManager = ctx.forkManager;
|
|
115
|
+
const instance = new Harness(init);
|
|
116
|
+
return createHarnessProxy(instance, () => instance._poisoned);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Bind a Harness to a real running network (testnet, mainnet, or any
|
|
121
|
+
* custom network defined in `movehat.config.ts`). No local process is
|
|
122
|
+
* spawned; transactions are submitted to the configured RPC.
|
|
123
|
+
*
|
|
124
|
+
* @param network - Named network from movehat.config.ts.
|
|
125
|
+
* @param _faucetUrl - Reserved for future auto-fund support on networks with a faucet.
|
|
126
|
+
*/
|
|
127
|
+
static async createLive(network: string, _faucetUrl?: string): Promise<Harness> {
|
|
128
|
+
const runtime = await initRuntime({ network });
|
|
129
|
+
const instance = new Harness({ mode: "live", runtime });
|
|
130
|
+
return createHarnessProxy(instance, () => instance._poisoned);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Release resources owned by this harness (local node or fork server)
|
|
135
|
+
* and poison it. Idempotent: subsequent calls are no-ops.
|
|
136
|
+
*
|
|
137
|
+
* After `cleanup()` resolves, any call to `deployCodeObject`,
|
|
138
|
+
* `upgradeCodeObject`, `runViewFunction`, or `runMoveScript` throws
|
|
139
|
+
* `HarnessDisposedError` synchronously on property access.
|
|
140
|
+
*/
|
|
141
|
+
async cleanup(): Promise<void> {
|
|
142
|
+
if (this._poisoned) return;
|
|
143
|
+
this._poisoned = true;
|
|
144
|
+
if (this.localNode) {
|
|
145
|
+
await this.localNode.stop().catch(() => {});
|
|
146
|
+
}
|
|
147
|
+
if (this.forkServer) {
|
|
148
|
+
await this.forkServer.stop().catch(() => {});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Deploy a Move package as a code object via `movement move deploy-object`.
|
|
154
|
+
*
|
|
155
|
+
* The derived object address is bound to `options.moduleName` as a
|
|
156
|
+
* named address at compile time, then captured into the returned
|
|
157
|
+
* {@link CodeObjectInfo.address} for later use with
|
|
158
|
+
* `harness.runtime.getContract(address, moduleName)`.
|
|
159
|
+
*
|
|
160
|
+
* Not available on fork-mode harnesses (forks are read-only). Calling
|
|
161
|
+
* this on a `Harness.createFork(...)` instance throws synchronously.
|
|
162
|
+
*/
|
|
163
|
+
async deployCodeObject(options: DeployCodeObjectOptions): Promise<CodeObjectInfo> {
|
|
164
|
+
if (this.mode === "fork") {
|
|
165
|
+
throw new Error(
|
|
166
|
+
"Harness.createFork is read-only; code-object deployment requires Harness.createLocal or createLive."
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
return deployCodeObject(this.runtime, options);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Upgrade an existing code object via `movement move upgrade-object`.
|
|
174
|
+
*
|
|
175
|
+
* Requires {@link UpgradeCodeObjectOptions.objectAddress} (the existing
|
|
176
|
+
* on-chain object). Overwrites the local deployment record's timestamp
|
|
177
|
+
* + txHash; address stays the same.
|
|
178
|
+
*
|
|
179
|
+
* Not available on fork-mode harnesses (forks are read-only).
|
|
180
|
+
*/
|
|
181
|
+
async upgradeCodeObject(
|
|
182
|
+
options: UpgradeCodeObjectOptions
|
|
183
|
+
): Promise<CodeObjectInfo> {
|
|
184
|
+
if (this.mode === "fork") {
|
|
185
|
+
throw new Error(
|
|
186
|
+
"Harness.createFork is read-only; code-object upgrade requires Harness.createLocal or createLive."
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return upgradeCodeObject(this.runtime, options);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Execute a Move view function via the Aptos SDK.
|
|
194
|
+
*
|
|
195
|
+
* Returns the raw view-function result array. For single-value
|
|
196
|
+
* returns, destructure: `const [count] = await harness.runViewFunction(...)`.
|
|
197
|
+
*
|
|
198
|
+
* Works on all 3 harness modes (createLocal, createFork, createLive)
|
|
199
|
+
* — view functions are read-only.
|
|
200
|
+
*/
|
|
201
|
+
async runViewFunction(options: RunViewFunctionOptions): Promise<unknown[]> {
|
|
202
|
+
return runViewFunction(this.runtime, options);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Execute a Move script via `movement move run-script`.
|
|
207
|
+
*
|
|
208
|
+
* Accepts either a `.move` source path (CLI auto-compiles) or a
|
|
209
|
+
* pre-compiled `.mv` bytecode path. Other extensions throw
|
|
210
|
+
* synchronously.
|
|
211
|
+
*
|
|
212
|
+
* Not available on fork-mode harnesses (forks are read-only).
|
|
213
|
+
*/
|
|
214
|
+
async runMoveScript(options: RunMoveScriptOptions): Promise<MoveScriptResult> {
|
|
215
|
+
if (this.mode === "fork") {
|
|
216
|
+
throw new Error(
|
|
217
|
+
"Harness.createFork is read-only; script execution requires Harness.createLocal or createLive."
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
return runMoveScript(this.runtime, options);
|
|
221
|
+
}
|
|
222
|
+
}
|