movehat 0.2.4 → 0.2.5
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 +1 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -1
- package/dist/commands/compile.d.ts +0 -1
- package/dist/commands/compile.js +0 -1
- package/dist/commands/fork/create.d.ts +1 -1
- package/dist/commands/fork/create.js +18 -3
- package/dist/commands/fork/fund.d.ts +0 -1
- package/dist/commands/fork/fund.js +0 -1
- package/dist/commands/fork/list.d.ts +0 -1
- package/dist/commands/fork/list.js +0 -1
- package/dist/commands/fork/serve.d.ts +0 -1
- package/dist/commands/fork/serve.js +0 -1
- package/dist/commands/fork/view-resource.d.ts +0 -1
- package/dist/commands/fork/view-resource.js +0 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +0 -1
- package/dist/commands/run.d.ts +0 -1
- package/dist/commands/run.js +0 -1
- package/dist/commands/test-move.d.ts +0 -1
- package/dist/commands/test-move.js +0 -1
- package/dist/commands/test.d.ts +0 -1
- package/dist/commands/test.js +8 -1
- package/dist/commands/update.d.ts +0 -1
- package/dist/commands/update.js +0 -1
- package/dist/core/AccountManager.d.ts +15 -2
- package/dist/core/AccountManager.js +32 -20
- package/dist/core/Publisher.d.ts +0 -1
- package/dist/core/Publisher.js +0 -1
- package/dist/core/config.d.ts +0 -1
- package/dist/core/config.js +0 -1
- package/dist/core/contract.d.ts +0 -1
- package/dist/core/contract.js +0 -1
- package/dist/core/deployments.d.ts +0 -1
- package/dist/core/deployments.js +0 -1
- package/dist/core/movementProfile.d.ts +0 -1
- package/dist/core/movementProfile.js +0 -1
- package/dist/core/shell.d.ts +0 -1
- package/dist/core/shell.js +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/fork/api.d.ts +24 -1
- package/dist/fork/api.js +95 -1
- package/dist/fork/manager.d.ts +14 -1
- package/dist/fork/manager.js +19 -1
- package/dist/fork/server.d.ts +19 -1
- package/dist/fork/server.js +188 -8
- package/dist/fork/storage.d.ts +0 -1
- package/dist/fork/storage.js +50 -32
- package/dist/fork/test.d.ts +0 -1
- package/dist/fork/test.js +0 -1
- package/dist/harness/Harness.d.ts +0 -1
- package/dist/harness/Harness.js +6 -2
- package/dist/harness/codeObject.d.ts +0 -1
- package/dist/harness/codeObject.js +0 -1
- package/dist/harness/errors.d.ts +0 -1
- package/dist/harness/errors.js +0 -1
- package/dist/harness/index.d.ts +0 -1
- package/dist/harness/index.js +0 -1
- package/dist/harness/proxy.d.ts +12 -1
- package/dist/harness/proxy.js +23 -1
- package/dist/harness/script.d.ts +0 -1
- package/dist/harness/script.js +0 -1
- package/dist/harness/view.d.ts +0 -1
- package/dist/harness/view.js +0 -1
- package/dist/helpers/assertions.d.ts +0 -1
- package/dist/helpers/assertions.js +0 -1
- package/dist/helpers/banner.d.ts +0 -1
- package/dist/helpers/banner.js +0 -1
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/index.js +0 -1
- package/dist/helpers/move-tests.d.ts +0 -1
- package/dist/helpers/move-tests.js +0 -1
- package/dist/helpers/npm-registry.d.ts +0 -1
- package/dist/helpers/npm-registry.js +0 -1
- package/dist/helpers/semver-utils.d.ts +0 -1
- package/dist/helpers/semver-utils.js +0 -1
- package/dist/helpers/setup.d.ts +0 -1
- package/dist/helpers/setup.js +0 -1
- package/dist/helpers/setupLocalTesting.d.ts +2 -5
- package/dist/helpers/setupLocalTesting.js +0 -1
- package/dist/helpers/testFixtures.d.ts +0 -1
- package/dist/helpers/testFixtures.js +0 -1
- package/dist/helpers/version-check.d.ts +0 -1
- package/dist/helpers/version-check.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/node/LocalNodeManager.d.ts +0 -1
- package/dist/node/LocalNodeManager.js +4 -2
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.js +0 -1
- package/dist/types/config.d.ts +0 -1
- package/dist/types/config.js +0 -1
- package/dist/types/fork.d.ts +0 -1
- package/dist/types/fork.js +0 -1
- package/dist/types/harness.d.ts +0 -1
- package/dist/types/harness.js +0 -1
- package/dist/types/runtime.d.ts +0 -1
- package/dist/types/runtime.js +0 -1
- package/dist/ui/colors.d.ts +0 -1
- package/dist/ui/colors.js +0 -1
- package/dist/ui/formatters.d.ts +0 -1
- package/dist/ui/formatters.js +0 -1
- package/dist/ui/index.d.ts +0 -1
- package/dist/ui/index.js +0 -1
- package/dist/ui/logger.d.ts +0 -1
- package/dist/ui/logger.js +0 -1
- package/dist/ui/spinner.d.ts +0 -1
- package/dist/ui/spinner.js +0 -1
- package/dist/ui/symbols.d.ts +0 -1
- package/dist/ui/symbols.js +0 -1
- package/dist/ui/table.d.ts +0 -1
- package/dist/ui/table.js +0 -1
- package/dist/utils/address.d.ts +0 -1
- package/dist/utils/address.js +0 -1
- package/dist/utils/childProcessAdapter.d.ts +0 -1
- package/dist/utils/childProcessAdapter.js +46 -20
- package/dist/utils/movementCli.d.ts +5 -0
- package/dist/utils/movementCli.js +91 -0
- package/dist/utils/parseCliOutput.d.ts +0 -1
- package/dist/utils/parseCliOutput.js +0 -1
- package/dist/utils/redact.d.ts +3 -3
- package/dist/utils/redact.js +6 -5
- package/dist/utils/runCli.d.ts +0 -1
- package/dist/utils/runCli.js +10 -2
- package/package.json +4 -4
- package/dist/__tests__/deployContract.test.d.ts +0 -2
- package/dist/__tests__/deployContract.test.d.ts.map +0 -1
- package/dist/__tests__/deployContract.test.js +0 -377
- package/dist/__tests__/deployContract.test.js.map +0 -1
- package/dist/__tests__/errors.test.d.ts +0 -2
- package/dist/__tests__/errors.test.d.ts.map +0 -1
- package/dist/__tests__/errors.test.js +0 -46
- package/dist/__tests__/errors.test.js.map +0 -1
- package/dist/__tests__/exports.test.d.ts +0 -2
- package/dist/__tests__/exports.test.d.ts.map +0 -1
- package/dist/__tests__/exports.test.js +0 -30
- package/dist/__tests__/exports.test.js.map +0 -1
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts +0 -25
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts.map +0 -1
- package/dist/__tests__/fixtures/sigint-deploy-harness.js +0 -83
- package/dist/__tests__/fixtures/sigint-deploy-harness.js.map +0 -1
- package/dist/__tests__/fork/api.test.d.ts +0 -2
- package/dist/__tests__/fork/api.test.d.ts.map +0 -1
- package/dist/__tests__/fork/api.test.js +0 -115
- package/dist/__tests__/fork/api.test.js.map +0 -1
- package/dist/__tests__/fork/api.timeout.test.d.ts +0 -2
- package/dist/__tests__/fork/api.timeout.test.d.ts.map +0 -1
- package/dist/__tests__/fork/api.timeout.test.js +0 -98
- package/dist/__tests__/fork/api.timeout.test.js.map +0 -1
- package/dist/__tests__/harness/Harness.createLive.test.d.ts +0 -2
- package/dist/__tests__/harness/Harness.createLive.test.d.ts.map +0 -1
- package/dist/__tests__/harness/Harness.createLive.test.js +0 -53
- package/dist/__tests__/harness/Harness.createLive.test.js.map +0 -1
- package/dist/__tests__/harness/Harness.proxy.test.d.ts +0 -2
- package/dist/__tests__/harness/Harness.proxy.test.d.ts.map +0 -1
- package/dist/__tests__/harness/Harness.proxy.test.js +0 -89
- package/dist/__tests__/harness/Harness.proxy.test.js.map +0 -1
- package/dist/__tests__/harness/_fixture.d.ts +0 -54
- package/dist/__tests__/harness/_fixture.d.ts.map +0 -1
- package/dist/__tests__/harness/_fixture.js +0 -69
- package/dist/__tests__/harness/_fixture.js.map +0 -1
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts +0 -2
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts.map +0 -1
- package/dist/__tests__/harness/codeObject.deploy.test.js +0 -288
- package/dist/__tests__/harness/codeObject.deploy.test.js.map +0 -1
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts +0 -2
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts.map +0 -1
- package/dist/__tests__/harness/codeObject.upgrade.test.js +0 -138
- package/dist/__tests__/harness/codeObject.upgrade.test.js.map +0 -1
- package/dist/__tests__/harness/script.test.d.ts +0 -2
- package/dist/__tests__/harness/script.test.d.ts.map +0 -1
- package/dist/__tests__/harness/script.test.js +0 -219
- package/dist/__tests__/harness/script.test.js.map +0 -1
- package/dist/__tests__/harness/view.test.d.ts +0 -2
- package/dist/__tests__/harness/view.test.d.ts.map +0 -1
- package/dist/__tests__/harness/view.test.js +0 -92
- package/dist/__tests__/harness/view.test.js.map +0 -1
- package/dist/__tests__/runtime.test.d.ts +0 -2
- package/dist/__tests__/runtime.test.d.ts.map +0 -1
- package/dist/__tests__/runtime.test.js +0 -141
- package/dist/__tests__/runtime.test.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/__tests__/compile.test.d.ts +0 -2
- package/dist/commands/__tests__/compile.test.d.ts.map +0 -1
- package/dist/commands/__tests__/compile.test.js +0 -351
- package/dist/commands/__tests__/compile.test.js.map +0 -1
- package/dist/commands/__tests__/compile.toml-mutation.test.d.ts +0 -2
- package/dist/commands/__tests__/compile.toml-mutation.test.d.ts.map +0 -1
- package/dist/commands/__tests__/compile.toml-mutation.test.js +0 -69
- package/dist/commands/__tests__/compile.toml-mutation.test.js.map +0 -1
- package/dist/commands/__tests__/init.test.d.ts +0 -2
- package/dist/commands/__tests__/init.test.d.ts.map +0 -1
- package/dist/commands/__tests__/init.test.js +0 -163
- package/dist/commands/__tests__/init.test.js.map +0 -1
- package/dist/commands/__tests__/run.test.d.ts +0 -2
- package/dist/commands/__tests__/run.test.d.ts.map +0 -1
- package/dist/commands/__tests__/run.test.js +0 -166
- package/dist/commands/__tests__/run.test.js.map +0 -1
- package/dist/commands/__tests__/test-move.test.d.ts +0 -2
- package/dist/commands/__tests__/test-move.test.d.ts.map +0 -1
- package/dist/commands/__tests__/test-move.test.js +0 -59
- package/dist/commands/__tests__/test-move.test.js.map +0 -1
- package/dist/commands/__tests__/test.test.d.ts +0 -2
- package/dist/commands/__tests__/test.test.d.ts.map +0 -1
- package/dist/commands/__tests__/test.test.js +0 -168
- package/dist/commands/__tests__/test.test.js.map +0 -1
- package/dist/commands/__tests__/update.test.d.ts +0 -2
- package/dist/commands/__tests__/update.test.d.ts.map +0 -1
- package/dist/commands/__tests__/update.test.js +0 -176
- package/dist/commands/__tests__/update.test.js.map +0 -1
- package/dist/commands/compile.d.ts.map +0 -1
- package/dist/commands/compile.js.map +0 -1
- package/dist/commands/fork/__tests__/create.test.d.ts +0 -2
- package/dist/commands/fork/__tests__/create.test.d.ts.map +0 -1
- package/dist/commands/fork/__tests__/create.test.js +0 -108
- package/dist/commands/fork/__tests__/create.test.js.map +0 -1
- package/dist/commands/fork/__tests__/fund.test.d.ts +0 -2
- package/dist/commands/fork/__tests__/fund.test.d.ts.map +0 -1
- package/dist/commands/fork/__tests__/fund.test.js +0 -72
- package/dist/commands/fork/__tests__/fund.test.js.map +0 -1
- package/dist/commands/fork/__tests__/list.test.d.ts +0 -2
- package/dist/commands/fork/__tests__/list.test.d.ts.map +0 -1
- package/dist/commands/fork/__tests__/list.test.js +0 -119
- package/dist/commands/fork/__tests__/list.test.js.map +0 -1
- package/dist/commands/fork/__tests__/serve.test.d.ts +0 -2
- package/dist/commands/fork/__tests__/serve.test.d.ts.map +0 -1
- package/dist/commands/fork/__tests__/serve.test.js +0 -97
- package/dist/commands/fork/__tests__/serve.test.js.map +0 -1
- package/dist/commands/fork/__tests__/view-resource.test.d.ts +0 -2
- package/dist/commands/fork/__tests__/view-resource.test.d.ts.map +0 -1
- package/dist/commands/fork/__tests__/view-resource.test.js +0 -77
- package/dist/commands/fork/__tests__/view-resource.test.js.map +0 -1
- package/dist/commands/fork/create.d.ts.map +0 -1
- package/dist/commands/fork/create.js.map +0 -1
- package/dist/commands/fork/fund.d.ts.map +0 -1
- package/dist/commands/fork/fund.js.map +0 -1
- package/dist/commands/fork/list.d.ts.map +0 -1
- package/dist/commands/fork/list.js.map +0 -1
- package/dist/commands/fork/serve.d.ts.map +0 -1
- package/dist/commands/fork/serve.js.map +0 -1
- package/dist/commands/fork/view-resource.d.ts.map +0 -1
- package/dist/commands/fork/view-resource.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/test-move.d.ts.map +0 -1
- package/dist/commands/test-move.js.map +0 -1
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/update.d.ts.map +0 -1
- package/dist/commands/update.js.map +0 -1
- package/dist/core/AccountManager.d.ts.map +0 -1
- package/dist/core/AccountManager.js.map +0 -1
- package/dist/core/Publisher.d.ts.map +0 -1
- package/dist/core/Publisher.js.map +0 -1
- package/dist/core/__tests__/AccountManager.global-state.test.d.ts +0 -2
- package/dist/core/__tests__/AccountManager.global-state.test.d.ts.map +0 -1
- package/dist/core/__tests__/AccountManager.global-state.test.js +0 -69
- package/dist/core/__tests__/AccountManager.global-state.test.js.map +0 -1
- package/dist/core/__tests__/AccountManager.test.d.ts +0 -2
- package/dist/core/__tests__/AccountManager.test.d.ts.map +0 -1
- package/dist/core/__tests__/AccountManager.test.js +0 -239
- package/dist/core/__tests__/AccountManager.test.js.map +0 -1
- package/dist/core/__tests__/config.test.d.ts +0 -2
- package/dist/core/__tests__/config.test.d.ts.map +0 -1
- package/dist/core/__tests__/config.test.js +0 -311
- package/dist/core/__tests__/config.test.js.map +0 -1
- package/dist/core/__tests__/deployments.test.d.ts +0 -2
- package/dist/core/__tests__/deployments.test.d.ts.map +0 -1
- package/dist/core/__tests__/deployments.test.js +0 -201
- package/dist/core/__tests__/deployments.test.js.map +0 -1
- package/dist/core/__tests__/movementProfile.test.d.ts +0 -2
- package/dist/core/__tests__/movementProfile.test.d.ts.map +0 -1
- package/dist/core/__tests__/movementProfile.test.js +0 -112
- package/dist/core/__tests__/movementProfile.test.js.map +0 -1
- package/dist/core/__tests__/shell.test.d.ts +0 -2
- package/dist/core/__tests__/shell.test.d.ts.map +0 -1
- package/dist/core/__tests__/shell.test.js +0 -107
- package/dist/core/__tests__/shell.test.js.map +0 -1
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js.map +0 -1
- package/dist/core/contract.d.ts.map +0 -1
- package/dist/core/contract.js.map +0 -1
- package/dist/core/deployments.d.ts.map +0 -1
- package/dist/core/deployments.js.map +0 -1
- package/dist/core/movementProfile.d.ts.map +0 -1
- package/dist/core/movementProfile.js.map +0 -1
- package/dist/core/shell.d.ts.map +0 -1
- package/dist/core/shell.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/fork/__tests__/manager.test.d.ts +0 -2
- package/dist/fork/__tests__/manager.test.d.ts.map +0 -1
- package/dist/fork/__tests__/manager.test.js +0 -309
- package/dist/fork/__tests__/manager.test.js.map +0 -1
- package/dist/fork/__tests__/server.cors.test.d.ts +0 -2
- package/dist/fork/__tests__/server.cors.test.d.ts.map +0 -1
- package/dist/fork/__tests__/server.cors.test.js +0 -79
- package/dist/fork/__tests__/server.cors.test.js.map +0 -1
- package/dist/fork/__tests__/server.test.d.ts +0 -2
- package/dist/fork/__tests__/server.test.d.ts.map +0 -1
- package/dist/fork/__tests__/server.test.js +0 -54
- package/dist/fork/__tests__/server.test.js.map +0 -1
- package/dist/fork/__tests__/storage.test.d.ts +0 -2
- package/dist/fork/__tests__/storage.test.d.ts.map +0 -1
- package/dist/fork/__tests__/storage.test.js +0 -222
- package/dist/fork/__tests__/storage.test.js.map +0 -1
- package/dist/fork/__tests__/test.test.d.ts +0 -2
- package/dist/fork/__tests__/test.test.d.ts.map +0 -1
- package/dist/fork/__tests__/test.test.js +0 -81
- package/dist/fork/__tests__/test.test.js.map +0 -1
- package/dist/fork/api.d.ts.map +0 -1
- package/dist/fork/api.js.map +0 -1
- package/dist/fork/manager.d.ts.map +0 -1
- package/dist/fork/manager.js.map +0 -1
- package/dist/fork/server.d.ts.map +0 -1
- package/dist/fork/server.js.map +0 -1
- package/dist/fork/storage.d.ts.map +0 -1
- package/dist/fork/storage.js.map +0 -1
- package/dist/fork/test.d.ts.map +0 -1
- package/dist/fork/test.js.map +0 -1
- package/dist/harness/Harness.d.ts.map +0 -1
- package/dist/harness/Harness.js.map +0 -1
- package/dist/harness/codeObject.d.ts.map +0 -1
- package/dist/harness/codeObject.js.map +0 -1
- package/dist/harness/errors.d.ts.map +0 -1
- package/dist/harness/errors.js.map +0 -1
- package/dist/harness/index.d.ts.map +0 -1
- package/dist/harness/index.js.map +0 -1
- package/dist/harness/proxy.d.ts.map +0 -1
- package/dist/harness/proxy.js.map +0 -1
- package/dist/harness/script.d.ts.map +0 -1
- package/dist/harness/script.js.map +0 -1
- package/dist/harness/view.d.ts.map +0 -1
- package/dist/harness/view.js.map +0 -1
- package/dist/helpers/__tests__/semver-utils.test.d.ts +0 -2
- package/dist/helpers/__tests__/semver-utils.test.d.ts.map +0 -1
- package/dist/helpers/__tests__/semver-utils.test.js +0 -103
- package/dist/helpers/__tests__/semver-utils.test.js.map +0 -1
- package/dist/helpers/__tests__/setupLocalTesting.fork-network.test.d.ts +0 -2
- package/dist/helpers/__tests__/setupLocalTesting.fork-network.test.d.ts.map +0 -1
- package/dist/helpers/__tests__/setupLocalTesting.fork-network.test.js +0 -172
- package/dist/helpers/__tests__/setupLocalTesting.fork-network.test.js.map +0 -1
- package/dist/helpers/assertions.d.ts.map +0 -1
- package/dist/helpers/assertions.js.map +0 -1
- package/dist/helpers/banner.d.ts.map +0 -1
- package/dist/helpers/banner.js.map +0 -1
- package/dist/helpers/index.d.ts.map +0 -1
- package/dist/helpers/index.js.map +0 -1
- package/dist/helpers/move-tests.d.ts.map +0 -1
- package/dist/helpers/move-tests.js.map +0 -1
- package/dist/helpers/npm-registry.d.ts.map +0 -1
- package/dist/helpers/npm-registry.js.map +0 -1
- package/dist/helpers/semver-utils.d.ts.map +0 -1
- package/dist/helpers/semver-utils.js.map +0 -1
- package/dist/helpers/setup.d.ts.map +0 -1
- package/dist/helpers/setup.js.map +0 -1
- package/dist/helpers/setupLocalTesting.d.ts.map +0 -1
- package/dist/helpers/setupLocalTesting.js.map +0 -1
- package/dist/helpers/testFixtures.d.ts.map +0 -1
- package/dist/helpers/testFixtures.js.map +0 -1
- package/dist/helpers/version-check.d.ts.map +0 -1
- package/dist/helpers/version-check.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/node/LocalNodeManager.d.ts.map +0 -1
- package/dist/node/LocalNodeManager.js.map +0 -1
- package/dist/node/__tests__/LocalNodeManager.api-port.test.d.ts +0 -2
- package/dist/node/__tests__/LocalNodeManager.api-port.test.d.ts.map +0 -1
- package/dist/node/__tests__/LocalNodeManager.api-port.test.js +0 -55
- package/dist/node/__tests__/LocalNodeManager.api-port.test.js.map +0 -1
- package/dist/node/__tests__/LocalNodeManager.test.d.ts +0 -2
- package/dist/node/__tests__/LocalNodeManager.test.d.ts.map +0 -1
- package/dist/node/__tests__/LocalNodeManager.test.js +0 -449
- package/dist/node/__tests__/LocalNodeManager.test.js.map +0 -1
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js.map +0 -1
- package/dist/types/fork.d.ts.map +0 -1
- package/dist/types/fork.js.map +0 -1
- package/dist/types/harness.d.ts.map +0 -1
- package/dist/types/harness.js.map +0 -1
- package/dist/types/runtime.d.ts.map +0 -1
- package/dist/types/runtime.js.map +0 -1
- package/dist/ui/__tests__/colors.test.d.ts +0 -2
- package/dist/ui/__tests__/colors.test.d.ts.map +0 -1
- package/dist/ui/__tests__/colors.test.js +0 -127
- package/dist/ui/__tests__/colors.test.js.map +0 -1
- package/dist/ui/__tests__/logger.test.d.ts +0 -2
- package/dist/ui/__tests__/logger.test.d.ts.map +0 -1
- package/dist/ui/__tests__/logger.test.js +0 -75
- package/dist/ui/__tests__/logger.test.js.map +0 -1
- package/dist/ui/colors.d.ts.map +0 -1
- package/dist/ui/colors.js.map +0 -1
- package/dist/ui/formatters.d.ts.map +0 -1
- package/dist/ui/formatters.js.map +0 -1
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/logger.d.ts.map +0 -1
- package/dist/ui/logger.js.map +0 -1
- package/dist/ui/spinner.d.ts.map +0 -1
- package/dist/ui/spinner.js.map +0 -1
- package/dist/ui/symbols.d.ts.map +0 -1
- package/dist/ui/symbols.js.map +0 -1
- package/dist/ui/table.d.ts.map +0 -1
- package/dist/ui/table.js.map +0 -1
- package/dist/utils/__tests__/address.test.d.ts +0 -2
- package/dist/utils/__tests__/address.test.d.ts.map +0 -1
- package/dist/utils/__tests__/address.test.js +0 -70
- package/dist/utils/__tests__/address.test.js.map +0 -1
- package/dist/utils/__tests__/childProcessAdapter.maxBuffer.test.d.ts +0 -2
- package/dist/utils/__tests__/childProcessAdapter.maxBuffer.test.d.ts.map +0 -1
- package/dist/utils/__tests__/childProcessAdapter.maxBuffer.test.js +0 -43
- package/dist/utils/__tests__/childProcessAdapter.maxBuffer.test.js.map +0 -1
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts +0 -2
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts.map +0 -1
- package/dist/utils/__tests__/childProcessAdapter.test.js +0 -217
- package/dist/utils/__tests__/childProcessAdapter.test.js.map +0 -1
- package/dist/utils/__tests__/runCli.test.d.ts +0 -2
- package/dist/utils/__tests__/runCli.test.d.ts.map +0 -1
- package/dist/utils/__tests__/runCli.test.js +0 -187
- package/dist/utils/__tests__/runCli.test.js.map +0 -1
- package/dist/utils/address.d.ts.map +0 -1
- package/dist/utils/address.js.map +0 -1
- package/dist/utils/childProcessAdapter.d.ts.map +0 -1
- package/dist/utils/childProcessAdapter.js.map +0 -1
- package/dist/utils/parseCliOutput.d.ts.map +0 -1
- package/dist/utils/parseCliOutput.js.map +0 -1
- package/dist/utils/redact.d.ts.map +0 -1
- package/dist/utils/redact.js.map +0 -1
- package/dist/utils/runCli.d.ts.map +0 -1
- package/dist/utils/runCli.js.map +0 -1
- package/src/__tests__/deployContract.test.ts +0 -438
- package/src/__tests__/errors.test.ts +0 -84
- package/src/__tests__/exports.test.ts +0 -32
- package/src/__tests__/fixtures/sigint-deploy-harness.ts +0 -96
- package/src/__tests__/fork/api.test.ts +0 -148
- package/src/__tests__/fork/api.timeout.test.ts +0 -150
- package/src/__tests__/harness/Harness.createLive.test.ts +0 -57
- package/src/__tests__/harness/Harness.proxy.test.ts +0 -111
- package/src/__tests__/harness/_fixture.ts +0 -131
- package/src/__tests__/harness/codeObject.deploy.test.ts +0 -319
- package/src/__tests__/harness/codeObject.upgrade.test.ts +0 -156
- package/src/__tests__/harness/script.test.ts +0 -245
- package/src/__tests__/harness/view.test.ts +0 -104
- package/src/__tests__/runtime.test.ts +0 -182
- package/src/cli.ts +0 -164
- package/src/commands/__tests__/compile.test.ts +0 -407
- package/src/commands/__tests__/compile.toml-mutation.test.ts +0 -77
- package/src/commands/__tests__/init.test.ts +0 -210
- package/src/commands/__tests__/run.test.ts +0 -192
- package/src/commands/__tests__/test-move.test.ts +0 -81
- package/src/commands/__tests__/test.test.ts +0 -204
- package/src/commands/__tests__/update.test.ts +0 -223
- package/src/commands/compile.ts +0 -339
- package/src/commands/fork/__tests__/create.test.ts +0 -132
- package/src/commands/fork/__tests__/fund.test.ts +0 -104
- package/src/commands/fork/__tests__/list.test.ts +0 -139
- package/src/commands/fork/__tests__/serve.test.ts +0 -121
- package/src/commands/fork/__tests__/view-resource.test.ts +0 -101
- package/src/commands/fork/create.ts +0 -110
- package/src/commands/fork/fund.ts +0 -64
- package/src/commands/fork/list.ts +0 -98
- package/src/commands/fork/serve.ts +0 -80
- package/src/commands/fork/view-resource.ts +0 -51
- package/src/commands/init.ts +0 -264
- package/src/commands/run.ts +0 -125
- package/src/commands/test-move.ts +0 -27
- package/src/commands/test.ts +0 -255
- package/src/commands/update.ts +0 -201
- package/src/core/AccountManager.ts +0 -457
- package/src/core/Publisher.ts +0 -310
- package/src/core/__tests__/AccountManager.global-state.test.ts +0 -83
- package/src/core/__tests__/AccountManager.test.ts +0 -290
- package/src/core/__tests__/config.test.ts +0 -377
- package/src/core/__tests__/deployments.test.ts +0 -247
- package/src/core/__tests__/movementProfile.test.ts +0 -131
- package/src/core/__tests__/shell.test.ts +0 -138
- package/src/core/config.ts +0 -286
- package/src/core/contract.ts +0 -103
- package/src/core/deployments.ts +0 -155
- package/src/core/movementProfile.ts +0 -127
- package/src/core/shell.ts +0 -86
- package/src/errors.ts +0 -81
- package/src/fork/__tests__/manager.test.ts +0 -385
- package/src/fork/__tests__/server.cors.test.ts +0 -101
- package/src/fork/__tests__/server.test.ts +0 -65
- package/src/fork/__tests__/storage.test.ts +0 -281
- package/src/fork/__tests__/test.test.ts +0 -97
- package/src/fork/api.ts +0 -190
- package/src/fork/manager.ts +0 -343
- package/src/fork/server.ts +0 -380
- package/src/fork/storage.ts +0 -253
- package/src/fork/test.ts +0 -221
- package/src/harness/Harness.ts +0 -231
- package/src/harness/codeObject.ts +0 -381
- package/src/harness/errors.ts +0 -22
- package/src/harness/index.ts +0 -3
- package/src/harness/proxy.ts +0 -40
- package/src/harness/script.ts +0 -200
- package/src/harness/view.ts +0 -34
- package/src/helpers/__tests__/semver-utils.test.ts +0 -121
- package/src/helpers/__tests__/setupLocalTesting.fork-network.test.ts +0 -212
- package/src/helpers/assertions.ts +0 -29
- package/src/helpers/banner.ts +0 -63
- package/src/helpers/index.ts +0 -37
- package/src/helpers/move-tests.ts +0 -72
- package/src/helpers/npm-registry.ts +0 -72
- package/src/helpers/semver-utils.ts +0 -54
- package/src/helpers/setup.ts +0 -54
- package/src/helpers/setupLocalTesting.ts +0 -387
- package/src/helpers/testFixtures.ts +0 -210
- package/src/helpers/version-check.ts +0 -114
- package/src/index.ts +0 -30
- package/src/node/LocalNodeManager.ts +0 -383
- package/src/node/__tests__/LocalNodeManager.api-port.test.ts +0 -62
- package/src/node/__tests__/LocalNodeManager.test.ts +0 -579
- package/src/runtime.ts +0 -157
- package/src/templates/.env.example +0 -9
- package/src/templates/.mocharc.json +0 -8
- package/src/templates/.vscode/settings.json +0 -11
- package/src/templates/README.md +0 -146
- package/src/templates/gitignore +0 -22
- package/src/templates/move/Move.toml +0 -19
- package/src/templates/move/sources/Counter.move +0 -96
- package/src/templates/movehat.config.ts +0 -57
- package/src/templates/package.json +0 -27
- package/src/templates/scripts/deploy-counter.ts +0 -66
- package/src/templates/tests/Counter.test.ts +0 -113
- package/src/templates/tsconfig.json +0 -15
- package/src/templates/types/movehat.d.ts +0 -101
- package/src/types/config.ts +0 -83
- package/src/types/fork.ts +0 -47
- package/src/types/harness.ts +0 -182
- package/src/types/runtime.ts +0 -57
- package/src/ui/__tests__/colors.test.ts +0 -156
- package/src/ui/__tests__/logger.test.ts +0 -89
- package/src/ui/colors.ts +0 -144
- package/src/ui/formatters.ts +0 -246
- package/src/ui/index.ts +0 -62
- package/src/ui/logger.ts +0 -310
- package/src/ui/spinner.ts +0 -218
- package/src/ui/symbols.ts +0 -80
- package/src/ui/table.ts +0 -191
- package/src/utils/__tests__/address.test.ts +0 -93
- package/src/utils/__tests__/childProcessAdapter.maxBuffer.test.ts +0 -51
- package/src/utils/__tests__/childProcessAdapter.test.ts +0 -266
- package/src/utils/__tests__/runCli.test.ts +0 -240
- package/src/utils/address.ts +0 -52
- package/src/utils/childProcessAdapter.ts +0 -244
- package/src/utils/parseCliOutput.ts +0 -27
- package/src/utils/redact.ts +0 -24
- package/src/utils/runCli.ts +0 -64
package/src/fork/test.ts
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { join } from 'path';
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import { runCli } from '../utils/runCli.js';
|
|
4
|
-
import type { ChildProcessAdapter } from '../utils/childProcessAdapter.js';
|
|
5
|
-
import { logger } from '../ui/index.js';
|
|
6
|
-
|
|
7
|
-
export interface SnapshotOptions {
|
|
8
|
-
path?: string;
|
|
9
|
-
name?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Override the child-process adapter. Test-only — production callers
|
|
12
|
-
* leave this undefined so the default spawn-based adapter is used.
|
|
13
|
-
*/
|
|
14
|
-
adapter?: ChildProcessAdapter;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ForkInfo {
|
|
18
|
-
path: string;
|
|
19
|
-
networkVersion?: number;
|
|
20
|
-
nodeUrl?: string;
|
|
21
|
-
exists: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Create a snapshot (fork) of the current network state
|
|
26
|
-
* Useful for debugging test failures or inspecting state after tests
|
|
27
|
-
*
|
|
28
|
-
* @param options - Snapshot configuration
|
|
29
|
-
* @returns Path to the created snapshot
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* // In your test
|
|
34
|
-
* after(async () => {
|
|
35
|
-
* const snapshotPath = await snapshot({ name: 'after-counter-test' });
|
|
36
|
-
* console.log(`Snapshot saved to ${snapshotPath}`);
|
|
37
|
-
* });
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export async function snapshot(options: SnapshotOptions = {}): Promise<string> {
|
|
41
|
-
const name = options.name || `snapshot-${Date.now()}`;
|
|
42
|
-
const snapshotPath = options.path || join(process.cwd(), '.movehat', 'snapshots', name);
|
|
43
|
-
|
|
44
|
-
logger.info(`Creating snapshot: ${name}...`);
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
// Initialize fork/snapshot using aptos CLI.
|
|
48
|
-
// runCli uses spawn-with-args under the hood (no shell), preventing
|
|
49
|
-
// command injection. Pass throwOnNonZeroExit:false so the exitCode is
|
|
50
|
-
// observable below — the stderr/dir defenses are belt-and-suspenders
|
|
51
|
-
// on top of the exitCode check.
|
|
52
|
-
const { stdout, stderr, exitCode } = await runCli(
|
|
53
|
-
{
|
|
54
|
-
command: 'aptos',
|
|
55
|
-
args: ['move', 'sim', 'init', '--path', snapshotPath],
|
|
56
|
-
},
|
|
57
|
-
{ throwOnNonZeroExit: false, adapter: options.adapter }
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
if (exitCode !== 0) {
|
|
61
|
-
throw new Error(stderr || `fork snapshot init failed with exit code ${exitCode}`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (stderr && !stderr.includes('Success')) {
|
|
65
|
-
throw new Error(stderr);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (!existsSync(snapshotPath)) {
|
|
69
|
-
throw new Error('Snapshot directory was not created');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
logger.success(`Snapshot created at ${snapshotPath}`, 2);
|
|
73
|
-
return snapshotPath;
|
|
74
|
-
} catch (error) {
|
|
75
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
76
|
-
throw new Error(`Failed to create snapshot: ${msg}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Get information about a fork/snapshot
|
|
82
|
-
*
|
|
83
|
-
* @param path - Path to the fork directory
|
|
84
|
-
* @returns Fork information
|
|
85
|
-
*/
|
|
86
|
-
export async function getForkInfo(path: string): Promise<ForkInfo> {
|
|
87
|
-
const configPath = join(path, 'config.json');
|
|
88
|
-
|
|
89
|
-
if (!existsSync(configPath)) {
|
|
90
|
-
return {
|
|
91
|
-
path,
|
|
92
|
-
exists: false
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
const fs = await import('fs/promises');
|
|
98
|
-
const configContent = await fs.readFile(configPath, 'utf-8');
|
|
99
|
-
const config = JSON.parse(configContent);
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
path,
|
|
103
|
-
exists: true,
|
|
104
|
-
networkVersion: config.base?.Remote?.network_version,
|
|
105
|
-
nodeUrl: config.base?.Remote?.node_url
|
|
106
|
-
};
|
|
107
|
-
} catch (error) {
|
|
108
|
-
return {
|
|
109
|
-
path,
|
|
110
|
-
exists: false
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* View a resource from a fork/snapshot
|
|
117
|
-
* Useful for inspecting state without modifying it
|
|
118
|
-
*
|
|
119
|
-
* @param sessionPath - Path to the fork session
|
|
120
|
-
* @param account - Account address
|
|
121
|
-
* @param resourceType - Full resource type (e.g., '0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>')
|
|
122
|
-
* @returns Resource data
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```typescript
|
|
126
|
-
* const balance = await viewForkResource(
|
|
127
|
-
* '.movehat/snapshots/test-snapshot',
|
|
128
|
-
* '0x123...',
|
|
129
|
-
* '0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>'
|
|
130
|
-
* );
|
|
131
|
-
* console.log(`Balance: ${balance.coin.value}`);
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
export async function viewForkResource(
|
|
135
|
-
sessionPath: string,
|
|
136
|
-
account: string,
|
|
137
|
-
resourceType: string,
|
|
138
|
-
options: { adapter?: ChildProcessAdapter } = {}
|
|
139
|
-
): Promise<any> {
|
|
140
|
-
try {
|
|
141
|
-
// runCli uses spawn-with-args (no shell) to prevent command injection.
|
|
142
|
-
const { stdout, stderr, exitCode } = await runCli(
|
|
143
|
-
{
|
|
144
|
-
command: 'aptos',
|
|
145
|
-
args: [
|
|
146
|
-
'move',
|
|
147
|
-
'sim',
|
|
148
|
-
'view-resource',
|
|
149
|
-
'--session',
|
|
150
|
-
sessionPath,
|
|
151
|
-
'--account',
|
|
152
|
-
account,
|
|
153
|
-
'--resource',
|
|
154
|
-
resourceType,
|
|
155
|
-
],
|
|
156
|
-
},
|
|
157
|
-
{ throwOnNonZeroExit: false, adapter: options.adapter }
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
if (exitCode !== 0) {
|
|
161
|
-
throw new Error(
|
|
162
|
-
stderr || `fork view-resource failed with exit code ${exitCode}`
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const result = JSON.parse(stdout);
|
|
167
|
-
|
|
168
|
-
if (result.Error) {
|
|
169
|
-
throw new Error(result.Error);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return result.Result;
|
|
173
|
-
} catch (error) {
|
|
174
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
175
|
-
throw new Error(`Failed to view resource: ${msg}`);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Compare a resource between current network state and a fork
|
|
181
|
-
* Useful for verifying state changes after tests
|
|
182
|
-
*
|
|
183
|
-
* @param forkPath - Path to the fork
|
|
184
|
-
* @param account - Account address
|
|
185
|
-
* @param resourceType - Resource type to compare
|
|
186
|
-
* @param currentValue - Current value from network (pass from your test)
|
|
187
|
-
* @returns Comparison result
|
|
188
|
-
*/
|
|
189
|
-
export async function compareForkState(
|
|
190
|
-
forkPath: string,
|
|
191
|
-
account: string,
|
|
192
|
-
resourceType: string,
|
|
193
|
-
currentValue: unknown
|
|
194
|
-
): Promise<{ fork: unknown; current: unknown; changed: boolean }> {
|
|
195
|
-
const forkValue = await viewForkResource(forkPath, account, resourceType);
|
|
196
|
-
|
|
197
|
-
return {
|
|
198
|
-
fork: forkValue,
|
|
199
|
-
current: currentValue,
|
|
200
|
-
changed: JSON.stringify(forkValue) !== JSON.stringify(currentValue)
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* List all snapshots in the project
|
|
206
|
-
* @returns Array of snapshot paths
|
|
207
|
-
*/
|
|
208
|
-
export async function listSnapshots(): Promise<string[]> {
|
|
209
|
-
const snapshotsDir = join(process.cwd(), '.movehat', 'snapshots');
|
|
210
|
-
|
|
211
|
-
if (!existsSync(snapshotsDir)) {
|
|
212
|
-
return [];
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const fs = await import('fs/promises');
|
|
216
|
-
const entries = await fs.readdir(snapshotsDir, { withFileTypes: true });
|
|
217
|
-
|
|
218
|
-
return entries
|
|
219
|
-
.filter(entry => entry.isDirectory())
|
|
220
|
-
.map(entry => join(snapshotsDir, entry.name));
|
|
221
|
-
}
|
package/src/harness/Harness.ts
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
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. Built-ins: `"testnet"`, `"mainnet"`.
|
|
96
|
-
* Any other name requires `rpcUrl`.
|
|
97
|
-
* @param apiKey - Optional Movement API key. When set, every upstream
|
|
98
|
-
* request from the fork's `MovementApiClient` carries
|
|
99
|
-
* `Authorization: Bearer <apiKey>`. Use for rate-limited public
|
|
100
|
-
* endpoints or auth-gated nodes. The key stays in process memory
|
|
101
|
-
* (not persisted to the fork's on-disk metadata).
|
|
102
|
-
* @param rpcUrl - Required when forking a non-built-in network.
|
|
103
|
-
* Ignored when a fork already exists on disk (the saved metadata's
|
|
104
|
-
* nodeUrl is reused).
|
|
105
|
-
*/
|
|
106
|
-
static async createFork(
|
|
107
|
-
network: string,
|
|
108
|
-
apiKey?: string,
|
|
109
|
-
rpcUrl?: string
|
|
110
|
-
): Promise<Harness> {
|
|
111
|
-
const setupOpts: import("../types/config.js").LocalTestOptions = {
|
|
112
|
-
mode: "fork",
|
|
113
|
-
forkNetwork: network,
|
|
114
|
-
};
|
|
115
|
-
if (apiKey !== undefined) setupOpts.forkApiKey = apiKey;
|
|
116
|
-
if (rpcUrl !== undefined) setupOpts.forkRpcUrl = rpcUrl;
|
|
117
|
-
const ctx = await setupLocalTesting(setupOpts);
|
|
118
|
-
const init: HarnessInit = {
|
|
119
|
-
mode: "fork",
|
|
120
|
-
runtime: ctx.runtime,
|
|
121
|
-
};
|
|
122
|
-
if (ctx.forkServer) init.forkServer = ctx.forkServer;
|
|
123
|
-
if (ctx.forkManager) init.forkManager = ctx.forkManager;
|
|
124
|
-
const instance = new Harness(init);
|
|
125
|
-
return createHarnessProxy(instance, () => instance._poisoned);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Bind a Harness to a real running network (testnet, mainnet, or any
|
|
130
|
-
* custom network defined in `movehat.config.ts`). No local process is
|
|
131
|
-
* spawned; transactions are submitted to the configured RPC.
|
|
132
|
-
*
|
|
133
|
-
* @param network - Named network from movehat.config.ts.
|
|
134
|
-
* @param _faucetUrl - Reserved for future auto-fund support on networks with a faucet.
|
|
135
|
-
*/
|
|
136
|
-
static async createLive(network: string, _faucetUrl?: string): Promise<Harness> {
|
|
137
|
-
const runtime = await initRuntime({ network });
|
|
138
|
-
const instance = new Harness({ mode: "live", runtime });
|
|
139
|
-
return createHarnessProxy(instance, () => instance._poisoned);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Release resources owned by this harness (local node or fork server)
|
|
144
|
-
* and poison it. Idempotent: subsequent calls are no-ops.
|
|
145
|
-
*
|
|
146
|
-
* After `cleanup()` resolves, any call to `deployCodeObject`,
|
|
147
|
-
* `upgradeCodeObject`, `runViewFunction`, or `runMoveScript` throws
|
|
148
|
-
* `HarnessDisposedError` synchronously on property access.
|
|
149
|
-
*/
|
|
150
|
-
async cleanup(): Promise<void> {
|
|
151
|
-
if (this._poisoned) return;
|
|
152
|
-
this._poisoned = true;
|
|
153
|
-
if (this.localNode) {
|
|
154
|
-
await this.localNode.stop().catch(() => {});
|
|
155
|
-
}
|
|
156
|
-
if (this.forkServer) {
|
|
157
|
-
await this.forkServer.stop().catch(() => {});
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Deploy a Move package as a code object via `movement move deploy-object`.
|
|
163
|
-
*
|
|
164
|
-
* The derived object address is bound to `options.moduleName` as a
|
|
165
|
-
* named address at compile time, then captured into the returned
|
|
166
|
-
* {@link CodeObjectInfo.address} for later use with
|
|
167
|
-
* `harness.runtime.getContract(address, moduleName)`.
|
|
168
|
-
*
|
|
169
|
-
* Not available on fork-mode harnesses (forks are read-only). Calling
|
|
170
|
-
* this on a `Harness.createFork(...)` instance throws synchronously.
|
|
171
|
-
*/
|
|
172
|
-
async deployCodeObject(options: DeployCodeObjectOptions): Promise<CodeObjectInfo> {
|
|
173
|
-
if (this.mode === "fork") {
|
|
174
|
-
throw new Error(
|
|
175
|
-
"Harness.createFork is read-only; code-object deployment requires Harness.createLocal or createLive."
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
return deployCodeObject(this.runtime, options);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Upgrade an existing code object via `movement move upgrade-object`.
|
|
183
|
-
*
|
|
184
|
-
* Requires {@link UpgradeCodeObjectOptions.objectAddress} (the existing
|
|
185
|
-
* on-chain object). Overwrites the local deployment record's timestamp
|
|
186
|
-
* + txHash; address stays the same.
|
|
187
|
-
*
|
|
188
|
-
* Not available on fork-mode harnesses (forks are read-only).
|
|
189
|
-
*/
|
|
190
|
-
async upgradeCodeObject(
|
|
191
|
-
options: UpgradeCodeObjectOptions
|
|
192
|
-
): Promise<CodeObjectInfo> {
|
|
193
|
-
if (this.mode === "fork") {
|
|
194
|
-
throw new Error(
|
|
195
|
-
"Harness.createFork is read-only; code-object upgrade requires Harness.createLocal or createLive."
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
return upgradeCodeObject(this.runtime, options);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Execute a Move view function via the Aptos SDK.
|
|
203
|
-
*
|
|
204
|
-
* Returns the raw view-function result array. For single-value
|
|
205
|
-
* returns, destructure: `const [count] = await harness.runViewFunction(...)`.
|
|
206
|
-
*
|
|
207
|
-
* Works on all 3 harness modes (createLocal, createFork, createLive)
|
|
208
|
-
* — view functions are read-only.
|
|
209
|
-
*/
|
|
210
|
-
async runViewFunction(options: RunViewFunctionOptions): Promise<unknown[]> {
|
|
211
|
-
return runViewFunction(this.runtime, options);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Execute a Move script via `movement move run-script`.
|
|
216
|
-
*
|
|
217
|
-
* Accepts either a `.move` source path (CLI auto-compiles) or a
|
|
218
|
-
* pre-compiled `.mv` bytecode path. Other extensions throw
|
|
219
|
-
* synchronously.
|
|
220
|
-
*
|
|
221
|
-
* Not available on fork-mode harnesses (forks are read-only).
|
|
222
|
-
*/
|
|
223
|
-
async runMoveScript(options: RunMoveScriptOptions): Promise<MoveScriptResult> {
|
|
224
|
-
if (this.mode === "fork") {
|
|
225
|
-
throw new Error(
|
|
226
|
-
"Harness.createFork is read-only; script execution requires Harness.createLocal or createLive."
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
return runMoveScript(this.runtime, options);
|
|
230
|
-
}
|
|
231
|
-
}
|