movehat 0.2.4 → 0.2.6
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 +17 -1
- package/dist/commands/run.js +46 -33
- 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 +109 -28
- 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 +6 -4
- package/dist/utils/parseCliOutput.js +10 -6
- 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
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { existsSync, mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
|
|
6
|
-
const storageExists = vi.fn();
|
|
7
|
-
const storageLoadMetadata = vi.fn();
|
|
8
|
-
const storageListAccounts = vi.fn();
|
|
9
|
-
|
|
10
|
-
vi.mock("../../../fork/storage.js", () => ({
|
|
11
|
-
ForkStorage: class {
|
|
12
|
-
exists = storageExists;
|
|
13
|
-
loadMetadata = storageLoadMetadata;
|
|
14
|
-
listAccounts = storageListAccounts;
|
|
15
|
-
},
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
const { default: forkListCommand } = await import("../list.js");
|
|
19
|
-
|
|
20
|
-
describe("forkListCommand", () => {
|
|
21
|
-
let tmpCwd: string;
|
|
22
|
-
let origCwd: string;
|
|
23
|
-
let exitSpy: ReturnType<typeof vi.spyOn>;
|
|
24
|
-
let logSpy: ReturnType<typeof vi.spyOn>;
|
|
25
|
-
|
|
26
|
-
beforeEach(() => {
|
|
27
|
-
storageExists.mockReset();
|
|
28
|
-
storageLoadMetadata.mockReset();
|
|
29
|
-
storageListAccounts.mockReset();
|
|
30
|
-
origCwd = process.cwd();
|
|
31
|
-
tmpCwd = mkdtempSync(join(tmpdir(), "movehat-forklist-"));
|
|
32
|
-
process.chdir(tmpCwd);
|
|
33
|
-
exitSpy = vi
|
|
34
|
-
.spyOn(process, "exit")
|
|
35
|
-
.mockImplementation(((code?: number) => {
|
|
36
|
-
throw new Error(`__test_exit_${code ?? 0}__`);
|
|
37
|
-
}) as never);
|
|
38
|
-
logSpy = vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
39
|
-
vi.spyOn(console, "error").mockImplementation(() => undefined);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
afterEach(() => {
|
|
43
|
-
process.chdir(origCwd);
|
|
44
|
-
if (existsSync(tmpCwd)) rmSync(tmpCwd, { recursive: true, force: true });
|
|
45
|
-
vi.restoreAllMocks();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("prints 'no forks found' when the forks dir doesn't exist", async () => {
|
|
49
|
-
await forkListCommand();
|
|
50
|
-
|
|
51
|
-
const printed = logSpy.mock.calls.flat().join(" ");
|
|
52
|
-
expect(printed).toMatch(/No forks found/i);
|
|
53
|
-
expect(storageExists).not.toHaveBeenCalled();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("prints 'no forks found' when the forks dir is empty", async () => {
|
|
57
|
-
mkdirSync(join(tmpCwd, ".movehat", "forks"), { recursive: true });
|
|
58
|
-
await forkListCommand();
|
|
59
|
-
|
|
60
|
-
const printed = logSpy.mock.calls.flat().join(" ");
|
|
61
|
-
expect(printed).toMatch(/No forks found/i);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("lists a single valid fork in a table", async () => {
|
|
65
|
-
mkdirSync(join(tmpCwd, ".movehat", "forks", "testnet-fork"), { recursive: true });
|
|
66
|
-
storageExists.mockReturnValue(true);
|
|
67
|
-
storageLoadMetadata.mockReturnValue({
|
|
68
|
-
network: "testnet",
|
|
69
|
-
nodeUrl: "https://testnet.movementnetwork.xyz/v1",
|
|
70
|
-
chainId: 27,
|
|
71
|
-
ledgerVersion: "100",
|
|
72
|
-
timestamp: "12345",
|
|
73
|
-
epoch: "5",
|
|
74
|
-
blockHeight: "42",
|
|
75
|
-
createdAt: new Date(1700000000000).toISOString(),
|
|
76
|
-
});
|
|
77
|
-
storageListAccounts.mockReturnValue(["0xabc", "0xdef"]);
|
|
78
|
-
|
|
79
|
-
await forkListCommand();
|
|
80
|
-
|
|
81
|
-
const printed = logSpy.mock.calls.flat().join(" ");
|
|
82
|
-
expect(printed).toMatch(/testnet-fork/);
|
|
83
|
-
expect(printed).toMatch(/testnet/);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it("flags forks with invalid/missing metadata gracefully", async () => {
|
|
87
|
-
mkdirSync(join(tmpCwd, ".movehat", "forks", "broken-fork"), { recursive: true });
|
|
88
|
-
storageExists.mockReturnValue(false);
|
|
89
|
-
|
|
90
|
-
await forkListCommand();
|
|
91
|
-
|
|
92
|
-
const printed = logSpy.mock.calls.flat().join(" ");
|
|
93
|
-
expect(printed).toMatch(/broken-fork/);
|
|
94
|
-
expect(printed).toMatch(/invalid/);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("handles metadata-load errors per-fork without aborting the list", async () => {
|
|
98
|
-
mkdirSync(join(tmpCwd, ".movehat", "forks", "fork-a"), { recursive: true });
|
|
99
|
-
mkdirSync(join(tmpCwd, ".movehat", "forks", "fork-b"), { recursive: true });
|
|
100
|
-
|
|
101
|
-
// First fork: exists() throws on metadata load; second: ok.
|
|
102
|
-
let call = 0;
|
|
103
|
-
storageExists.mockImplementation(() => {
|
|
104
|
-
call++;
|
|
105
|
-
if (call === 1) throw new Error("metadata corrupt");
|
|
106
|
-
return true;
|
|
107
|
-
});
|
|
108
|
-
storageLoadMetadata.mockReturnValue({
|
|
109
|
-
network: "testnet",
|
|
110
|
-
nodeUrl: "url",
|
|
111
|
-
chainId: 27,
|
|
112
|
-
ledgerVersion: "100",
|
|
113
|
-
timestamp: "0",
|
|
114
|
-
epoch: "0",
|
|
115
|
-
blockHeight: "0",
|
|
116
|
-
createdAt: new Date(0).toISOString(),
|
|
117
|
-
});
|
|
118
|
-
storageListAccounts.mockReturnValue([]);
|
|
119
|
-
|
|
120
|
-
await forkListCommand();
|
|
121
|
-
|
|
122
|
-
const printed = logSpy.mock.calls.flat().join(" ");
|
|
123
|
-
expect(printed).toMatch(/fork-a/);
|
|
124
|
-
expect(printed).toMatch(/error/);
|
|
125
|
-
expect(printed).toMatch(/fork-b/);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it("skips non-directory entries in the forks dir", async () => {
|
|
129
|
-
mkdirSync(join(tmpCwd, ".movehat", "forks"), { recursive: true });
|
|
130
|
-
// Plant a stray file at the forks-dir level.
|
|
131
|
-
writeFileSync(join(tmpCwd, ".movehat", "forks", "not-a-fork.txt"), "x");
|
|
132
|
-
|
|
133
|
-
// No actual fork subdirs — should still hit the "0 forks" branch.
|
|
134
|
-
await forkListCommand();
|
|
135
|
-
|
|
136
|
-
const printed = logSpy.mock.calls.flat().join(" ");
|
|
137
|
-
expect(printed).toMatch(/No forks found/i);
|
|
138
|
-
});
|
|
139
|
-
});
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { existsSync, mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
|
|
6
|
-
const serverStart = vi.fn();
|
|
7
|
-
const serverStop = vi.fn();
|
|
8
|
-
const ForkServerCtor = vi.fn();
|
|
9
|
-
const loadUserConfigMock = vi.fn();
|
|
10
|
-
|
|
11
|
-
vi.mock("../../../fork/server.js", () => ({
|
|
12
|
-
ForkServer: class {
|
|
13
|
-
constructor(forkPath: string, port: number, host: string) {
|
|
14
|
-
ForkServerCtor(forkPath, port, host);
|
|
15
|
-
}
|
|
16
|
-
start = serverStart;
|
|
17
|
-
stop = serverStop;
|
|
18
|
-
},
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
vi.mock("../../../core/config.js", () => ({
|
|
22
|
-
loadUserConfig: loadUserConfigMock,
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
const { default: forkServeCommand } = await import("../serve.js");
|
|
26
|
-
|
|
27
|
-
describe("forkServeCommand", () => {
|
|
28
|
-
let tmpCwd: string;
|
|
29
|
-
let origCwd: string;
|
|
30
|
-
let exitSpy: ReturnType<typeof vi.spyOn>;
|
|
31
|
-
|
|
32
|
-
beforeEach(() => {
|
|
33
|
-
serverStart.mockReset().mockResolvedValue(undefined);
|
|
34
|
-
serverStop.mockReset().mockResolvedValue(undefined);
|
|
35
|
-
ForkServerCtor.mockReset();
|
|
36
|
-
loadUserConfigMock.mockReset();
|
|
37
|
-
origCwd = process.cwd();
|
|
38
|
-
tmpCwd = mkdtempSync(join(tmpdir(), "movehat-forkserve-"));
|
|
39
|
-
process.chdir(tmpCwd);
|
|
40
|
-
exitSpy = vi
|
|
41
|
-
.spyOn(process, "exit")
|
|
42
|
-
.mockImplementation(((code?: number) => {
|
|
43
|
-
throw new Error(`__test_exit_${code ?? 0}__`);
|
|
44
|
-
}) as never);
|
|
45
|
-
vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
46
|
-
vi.spyOn(console, "error").mockImplementation(() => undefined);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
afterEach(() => {
|
|
50
|
-
process.chdir(origCwd);
|
|
51
|
-
if (existsSync(tmpCwd)) rmSync(tmpCwd, { recursive: true, force: true });
|
|
52
|
-
vi.restoreAllMocks();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("happy path: starts server with explicit fork path + default port/host", async () => {
|
|
56
|
-
const forkPath = join(tmpCwd, "myfork");
|
|
57
|
-
mkdirSync(forkPath, { recursive: true });
|
|
58
|
-
writeFileSync(join(forkPath, "metadata.json"), "{}");
|
|
59
|
-
|
|
60
|
-
await forkServeCommand({ fork: forkPath });
|
|
61
|
-
|
|
62
|
-
expect(ForkServerCtor).toHaveBeenCalledWith(forkPath, 8080, "127.0.0.1");
|
|
63
|
-
expect(serverStart).toHaveBeenCalledTimes(1);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it("respects --port and --host overrides", async () => {
|
|
67
|
-
const forkPath = join(tmpCwd, "myfork");
|
|
68
|
-
mkdirSync(forkPath, { recursive: true });
|
|
69
|
-
writeFileSync(join(forkPath, "metadata.json"), "{}");
|
|
70
|
-
|
|
71
|
-
await forkServeCommand({ fork: forkPath, port: 9999, host: "0.0.0.0" });
|
|
72
|
-
|
|
73
|
-
expect(ForkServerCtor).toHaveBeenCalledWith(forkPath, 9999, "0.0.0.0");
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("resolves fork path from defaultNetwork when --fork is omitted", async () => {
|
|
77
|
-
loadUserConfigMock.mockResolvedValueOnce({
|
|
78
|
-
defaultNetwork: "testnet",
|
|
79
|
-
networks: { testnet: { url: "x", chainId: "testnet" } },
|
|
80
|
-
});
|
|
81
|
-
const expectedPath = join(tmpCwd, ".movehat", "forks", "testnet-fork");
|
|
82
|
-
mkdirSync(expectedPath, { recursive: true });
|
|
83
|
-
writeFileSync(join(expectedPath, "metadata.json"), "{}");
|
|
84
|
-
|
|
85
|
-
await forkServeCommand({});
|
|
86
|
-
|
|
87
|
-
// macOS /var → /private/var symlink — match by suffix.
|
|
88
|
-
const passedPath = ForkServerCtor.mock.calls[0]![0] as string;
|
|
89
|
-
expect(passedPath).toMatch(/\.movehat\/forks\/testnet-fork$/);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("exits 1 when the fork's metadata.json is missing", async () => {
|
|
93
|
-
const forkPath = join(tmpCwd, "missing-fork");
|
|
94
|
-
|
|
95
|
-
await expect(forkServeCommand({ fork: forkPath })).rejects.toThrow(
|
|
96
|
-
"__test_exit_1__"
|
|
97
|
-
);
|
|
98
|
-
expect(serverStart).not.toHaveBeenCalled();
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it("exits 1 when the configured network is unknown", async () => {
|
|
102
|
-
loadUserConfigMock.mockResolvedValueOnce({
|
|
103
|
-
defaultNetwork: "ghost",
|
|
104
|
-
networks: {},
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
await expect(forkServeCommand({})).rejects.toThrow("__test_exit_1__");
|
|
108
|
-
expect(serverStart).not.toHaveBeenCalled();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it("exits 1 when server.start throws", async () => {
|
|
112
|
-
const forkPath = join(tmpCwd, "myfork");
|
|
113
|
-
mkdirSync(forkPath, { recursive: true });
|
|
114
|
-
writeFileSync(join(forkPath, "metadata.json"), "{}");
|
|
115
|
-
serverStart.mockRejectedValueOnce(new Error("EADDRINUSE"));
|
|
116
|
-
|
|
117
|
-
await expect(forkServeCommand({ fork: forkPath })).rejects.toThrow(
|
|
118
|
-
"__test_exit_1__"
|
|
119
|
-
);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
|
|
3
|
-
const forkManagerLoad = vi.fn();
|
|
4
|
-
const forkManagerGetResource = vi.fn();
|
|
5
|
-
const ForkManagerCtor = vi.fn();
|
|
6
|
-
|
|
7
|
-
vi.mock("../../../fork/manager.js", () => ({
|
|
8
|
-
ForkManager: class {
|
|
9
|
-
constructor(forkPath: string) {
|
|
10
|
-
ForkManagerCtor(forkPath);
|
|
11
|
-
}
|
|
12
|
-
load = forkManagerLoad;
|
|
13
|
-
getResource = forkManagerGetResource;
|
|
14
|
-
},
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
const { default: forkViewResourceCommand } = await import("../view-resource.js");
|
|
18
|
-
|
|
19
|
-
describe("forkViewResourceCommand", () => {
|
|
20
|
-
let exitSpy: ReturnType<typeof vi.spyOn>;
|
|
21
|
-
let logSpy: ReturnType<typeof vi.spyOn>;
|
|
22
|
-
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
forkManagerLoad.mockReset();
|
|
25
|
-
forkManagerGetResource.mockReset();
|
|
26
|
-
ForkManagerCtor.mockReset();
|
|
27
|
-
exitSpy = vi
|
|
28
|
-
.spyOn(process, "exit")
|
|
29
|
-
.mockImplementation(((code?: number) => {
|
|
30
|
-
throw new Error(`__test_exit_${code ?? 0}__`);
|
|
31
|
-
}) as never);
|
|
32
|
-
logSpy = vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
33
|
-
vi.spyOn(console, "error").mockImplementation(() => undefined);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
afterEach(() => {
|
|
37
|
-
vi.restoreAllMocks();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("exits 1 when --account is missing", async () => {
|
|
41
|
-
await expect(
|
|
42
|
-
forkViewResourceCommand({
|
|
43
|
-
account: "",
|
|
44
|
-
resource: "0x1::aptos_coin::AptosCoin",
|
|
45
|
-
} as never)
|
|
46
|
-
).rejects.toThrow("__test_exit_1__");
|
|
47
|
-
expect(forkManagerLoad).not.toHaveBeenCalled();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("exits 1 when --resource is missing", async () => {
|
|
51
|
-
await expect(
|
|
52
|
-
forkViewResourceCommand({
|
|
53
|
-
account: "0xabc",
|
|
54
|
-
resource: "",
|
|
55
|
-
} as never)
|
|
56
|
-
).rejects.toThrow("__test_exit_1__");
|
|
57
|
-
expect(forkManagerLoad).not.toHaveBeenCalled();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it("happy path: loads the fork, fetches the resource, JSON-pretty-prints it", async () => {
|
|
61
|
-
forkManagerGetResource.mockResolvedValueOnce({ coin: { value: "1000" } });
|
|
62
|
-
|
|
63
|
-
await forkViewResourceCommand({
|
|
64
|
-
account: "0xabc",
|
|
65
|
-
resource: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
|
|
66
|
-
fork: "/tmp/fork",
|
|
67
|
-
} as never);
|
|
68
|
-
|
|
69
|
-
expect(forkManagerLoad).toHaveBeenCalledTimes(1);
|
|
70
|
-
expect(forkManagerGetResource).toHaveBeenCalledWith(
|
|
71
|
-
"0xabc",
|
|
72
|
-
"0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>"
|
|
73
|
-
);
|
|
74
|
-
// Pretty-printed JSON appears in stdout.
|
|
75
|
-
const printed = logSpy.mock.calls.flat().join(" ");
|
|
76
|
-
expect(printed).toContain("1000");
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("defaults forkPath to <cwd>/.movehat/forks/testnet-fork when --fork is omitted", async () => {
|
|
80
|
-
forkManagerGetResource.mockResolvedValueOnce({});
|
|
81
|
-
|
|
82
|
-
await forkViewResourceCommand({
|
|
83
|
-
account: "0xabc",
|
|
84
|
-
resource: "0x1::a::B",
|
|
85
|
-
} as never);
|
|
86
|
-
|
|
87
|
-
const passed = ForkManagerCtor.mock.calls[0]![0] as string;
|
|
88
|
-
expect(passed).toMatch(/\.movehat\/forks\/testnet-fork$/);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it("exits 1 when getResource throws (resource not found)", async () => {
|
|
92
|
-
forkManagerGetResource.mockRejectedValueOnce(new Error("not found"));
|
|
93
|
-
|
|
94
|
-
await expect(
|
|
95
|
-
forkViewResourceCommand({
|
|
96
|
-
account: "0xabc",
|
|
97
|
-
resource: "0x1::missing::X",
|
|
98
|
-
} as never)
|
|
99
|
-
).rejects.toThrow("__test_exit_1__");
|
|
100
|
-
});
|
|
101
|
-
});
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { join } from 'path';
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import prompts from 'prompts';
|
|
4
|
-
import { loadUserConfig, resolveNetworkConfig } from '../../core/config.js';
|
|
5
|
-
import { ForkManager } from '../../fork/manager.js';
|
|
6
|
-
import { logger, withSpinner, createKVTable, formatCommand } from '../../ui/index.js';
|
|
7
|
-
|
|
8
|
-
interface ForkCreateOptions {
|
|
9
|
-
network?: string;
|
|
10
|
-
path?: string;
|
|
11
|
-
name?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Create a local fork of a Movement network
|
|
16
|
-
*
|
|
17
|
-
* This command:
|
|
18
|
-
* - Connects to the specified network RPC endpoint
|
|
19
|
-
* - Downloads blockchain state (accounts, modules, resources)
|
|
20
|
-
* - Creates a local fork database for testing
|
|
21
|
-
* - Displays fork metadata (chain ID, ledger version, block height, epoch)
|
|
22
|
-
*
|
|
23
|
-
* @param options - Fork creation options
|
|
24
|
-
* @param options.network - Network to fork from (e.g., 'testnet', 'mainnet')
|
|
25
|
-
* @param options.path - Custom path to store fork data
|
|
26
|
-
* @param options.name - Custom name for the fork
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* // Fork testnet
|
|
30
|
-
* await forkCreateCommand({ network: 'testnet' });
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* // Fork with custom name
|
|
34
|
-
* await forkCreateCommand({ network: 'testnet', name: 'my-fork' });
|
|
35
|
-
*/
|
|
36
|
-
export default async function forkCreateCommand(options: ForkCreateOptions = {}) {
|
|
37
|
-
try {
|
|
38
|
-
// Load MoveHat config
|
|
39
|
-
const userConfig = await loadUserConfig();
|
|
40
|
-
const networkName = options.network || process.env.MH_CLI_NETWORK || userConfig.defaultNetwork || 'testnet';
|
|
41
|
-
const networkConfig = await resolveNetworkConfig(userConfig, networkName);
|
|
42
|
-
|
|
43
|
-
// Determine fork name and path
|
|
44
|
-
const forkName = options.name || `${networkName}-fork`;
|
|
45
|
-
const forkPath = options.path || join(process.cwd(), '.movehat', 'forks', forkName);
|
|
46
|
-
|
|
47
|
-
logger.newline();
|
|
48
|
-
logger.info(`Creating fork of ${networkName}`);
|
|
49
|
-
logger.kv('Network', networkConfig.rpc, 2);
|
|
50
|
-
logger.kv('Fork path', forkPath, 2);
|
|
51
|
-
logger.newline();
|
|
52
|
-
|
|
53
|
-
// Check if fork already exists
|
|
54
|
-
if (existsSync(forkPath)) {
|
|
55
|
-
const { overwrite } = await prompts({
|
|
56
|
-
type: 'confirm',
|
|
57
|
-
name: 'overwrite',
|
|
58
|
-
message: `Fork already exists at ${forkPath}. Overwrite?`,
|
|
59
|
-
initial: false,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
if (!overwrite) {
|
|
63
|
-
logger.warning('Fork creation cancelled');
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Create fork manager
|
|
69
|
-
const forkManager = new ForkManager(forkPath);
|
|
70
|
-
|
|
71
|
-
// Initialize fork with spinner
|
|
72
|
-
const metadata = await withSpinner(
|
|
73
|
-
'Initializing fork...',
|
|
74
|
-
async () => {
|
|
75
|
-
await forkManager.initialize(networkConfig.rpc, networkName);
|
|
76
|
-
return forkManager.getMetadata();
|
|
77
|
-
},
|
|
78
|
-
'Fork initialized successfully!'
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
// Show fork details
|
|
82
|
-
logger.newline();
|
|
83
|
-
logger.success('Fork created successfully!');
|
|
84
|
-
logger.newline();
|
|
85
|
-
|
|
86
|
-
logger.section('Fork Details');
|
|
87
|
-
const detailsTable = createKVTable({
|
|
88
|
-
'Chain ID': metadata.chainId.toString(),
|
|
89
|
-
'Ledger Version': metadata.ledgerVersion,
|
|
90
|
-
'Block Height': metadata.blockHeight,
|
|
91
|
-
'Epoch': metadata.epoch
|
|
92
|
-
});
|
|
93
|
-
console.log(detailsTable.toString());
|
|
94
|
-
logger.newline();
|
|
95
|
-
|
|
96
|
-
// Usage examples
|
|
97
|
-
logger.section('Usage');
|
|
98
|
-
logger.item(formatCommand(`movehat fork view-resource --fork ${forkPath} --account <ADDRESS> --resource <TYPE>`), 2);
|
|
99
|
-
logger.item(formatCommand(`movehat fork fund --fork ${forkPath} --account <ADDRESS> --amount <AMOUNT>`), 2);
|
|
100
|
-
logger.item(formatCommand('movehat fork list'), 2);
|
|
101
|
-
logger.newline();
|
|
102
|
-
|
|
103
|
-
} catch (error) {
|
|
104
|
-
logger.newline();
|
|
105
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
106
|
-
logger.error(`Error: ${msg}`);
|
|
107
|
-
logger.newline();
|
|
108
|
-
process.exit(1);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { join } from 'path';
|
|
2
|
-
import { ForkManager } from '../../fork/manager.js';
|
|
3
|
-
import { logger } from '../../ui/index.js';
|
|
4
|
-
|
|
5
|
-
interface ForkFundOptions {
|
|
6
|
-
fork?: string;
|
|
7
|
-
account: string;
|
|
8
|
-
amount: string;
|
|
9
|
-
coinType?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Fork fund command: Fund an account in the fork
|
|
14
|
-
*/
|
|
15
|
-
export default async function forkFundCommand(options: ForkFundOptions) {
|
|
16
|
-
try {
|
|
17
|
-
if (!options.account) {
|
|
18
|
-
throw new Error('--account is required');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!options.amount) {
|
|
22
|
-
throw new Error('--amount is required');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const amount = parseInt(options.amount, 10);
|
|
26
|
-
if (isNaN(amount) || amount <= 0) {
|
|
27
|
-
throw new Error('--amount must be a positive number');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Determine fork path
|
|
31
|
-
const forkPath = options.fork || join(process.cwd(), '.movehat', 'forks', 'testnet-fork');
|
|
32
|
-
const coinType = options.coinType || '0x1::aptos_coin::AptosCoin';
|
|
33
|
-
|
|
34
|
-
logger.newline();
|
|
35
|
-
logger.step("Funding account in fork");
|
|
36
|
-
logger.plain(` Fork: ${forkPath}`);
|
|
37
|
-
logger.plain(` Account: ${options.account}`);
|
|
38
|
-
logger.plain(` Amount: ${amount}`);
|
|
39
|
-
logger.plain(` Coin Type: ${coinType}`);
|
|
40
|
-
logger.newline();
|
|
41
|
-
|
|
42
|
-
// Load fork
|
|
43
|
-
const forkManager = new ForkManager(forkPath);
|
|
44
|
-
forkManager.load();
|
|
45
|
-
|
|
46
|
-
// Fund account
|
|
47
|
-
await forkManager.fundAccount(options.account, amount, coinType);
|
|
48
|
-
|
|
49
|
-
// Verify
|
|
50
|
-
const resourceType = `0x1::coin::CoinStore<${coinType}>`;
|
|
51
|
-
const coinStore = await forkManager.getResource(options.account, resourceType);
|
|
52
|
-
|
|
53
|
-
logger.newline();
|
|
54
|
-
logger.success("Account funded successfully!");
|
|
55
|
-
logger.plain(` New balance: ${coinStore.coin.value}`);
|
|
56
|
-
logger.newline();
|
|
57
|
-
|
|
58
|
-
} catch (error) {
|
|
59
|
-
logger.newline();
|
|
60
|
-
logger.error(error instanceof Error ? error.message : String(error));
|
|
61
|
-
logger.newline();
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { join } from 'path';
|
|
2
|
-
import { existsSync, readdirSync, statSync } from 'fs';
|
|
3
|
-
import { ForkStorage } from '../../fork/storage.js';
|
|
4
|
-
import { logger, createTable, formatCommand } from '../../ui/index.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* List all available local forks
|
|
8
|
-
*
|
|
9
|
-
* Displays forks in a formatted table showing:
|
|
10
|
-
* - Fork name
|
|
11
|
-
* - Network (testnet, mainnet, etc.)
|
|
12
|
-
* - Chain ID
|
|
13
|
-
* - Number of accounts
|
|
14
|
-
* - Creation timestamp
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* // List all forks
|
|
18
|
-
* await forkListCommand();
|
|
19
|
-
*/
|
|
20
|
-
export default async function forkListCommand() {
|
|
21
|
-
try {
|
|
22
|
-
const forksDir = join(process.cwd(), '.movehat', 'forks');
|
|
23
|
-
|
|
24
|
-
if (!existsSync(forksDir)) {
|
|
25
|
-
logger.newline();
|
|
26
|
-
logger.info('No forks found');
|
|
27
|
-
logger.newline();
|
|
28
|
-
logger.plain('Create a fork with:');
|
|
29
|
-
logger.item(formatCommand('movehat fork create --network testnet'), 2);
|
|
30
|
-
logger.newline();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const entries = readdirSync(forksDir);
|
|
35
|
-
const forkDirs = entries.filter((entry) => {
|
|
36
|
-
const fullPath = join(forksDir, entry);
|
|
37
|
-
return statSync(fullPath).isDirectory();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
if (forkDirs.length === 0) {
|
|
41
|
-
logger.newline();
|
|
42
|
-
logger.info('No forks found');
|
|
43
|
-
logger.newline();
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
logger.newline();
|
|
48
|
-
logger.info(`Found ${forkDirs.length} fork(s)`);
|
|
49
|
-
logger.newline();
|
|
50
|
-
|
|
51
|
-
// Create table for forks
|
|
52
|
-
const table = createTable({
|
|
53
|
-
head: ['Name', 'Network', 'Chain ID', 'Accounts', 'Created'],
|
|
54
|
-
preset: 'default',
|
|
55
|
-
colWidths: [20, 15, 12, 12, 25]
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
for (const forkDir of forkDirs) {
|
|
59
|
-
const forkPath = join(forksDir, forkDir);
|
|
60
|
-
const storage = new ForkStorage(forkPath);
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
if (storage.exists()) {
|
|
64
|
-
const metadata = storage.loadMetadata();
|
|
65
|
-
const accounts = storage.listAccounts();
|
|
66
|
-
|
|
67
|
-
table.push([
|
|
68
|
-
forkDir,
|
|
69
|
-
metadata.network,
|
|
70
|
-
metadata.chainId.toString(),
|
|
71
|
-
accounts.length.toString(),
|
|
72
|
-
new Date(metadata.createdAt).toLocaleString()
|
|
73
|
-
]);
|
|
74
|
-
} else {
|
|
75
|
-
table.push([forkDir, 'invalid', '-', '-', 'missing metadata']);
|
|
76
|
-
}
|
|
77
|
-
} catch (error) {
|
|
78
|
-
table.push([forkDir, 'error', '-', '-', 'error reading']);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
console.log(table.toString());
|
|
83
|
-
logger.newline();
|
|
84
|
-
|
|
85
|
-
// Usage examples
|
|
86
|
-
logger.section('Usage');
|
|
87
|
-
logger.item(formatCommand('movehat fork view-resource --fork <PATH> --account <ADDR> --resource <TYPE>'), 2);
|
|
88
|
-
logger.item(formatCommand('movehat fork fund --fork <PATH> --account <ADDR> --amount <AMOUNT>'), 2);
|
|
89
|
-
logger.newline();
|
|
90
|
-
|
|
91
|
-
} catch (error) {
|
|
92
|
-
logger.newline();
|
|
93
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
94
|
-
logger.error(`Error: ${msg}`);
|
|
95
|
-
logger.newline();
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
98
|
-
}
|