movehat 0.2.3 → 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 +15 -2
- package/dist/fork/manager.js +20 -2
- 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 +2 -3
- 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 +1 -2
- package/dist/node/LocalNodeManager.js +6 -4
- 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
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
mkdtempSync,
|
|
4
|
-
readFileSync,
|
|
5
|
-
rmSync,
|
|
6
|
-
utimesSync,
|
|
7
|
-
writeFileSync,
|
|
8
|
-
} from "node:fs";
|
|
9
|
-
import { tmpdir } from "node:os";
|
|
10
|
-
import { dirname, join } from "node:path";
|
|
11
|
-
import { fileURLToPath } from "node:url";
|
|
12
|
-
import { loadUserConfig, resolveNetworkConfig, _resetConfigCache } from "../config.js";
|
|
13
|
-
import type { MovehatUserConfig } from "../../types/config.js";
|
|
14
|
-
|
|
15
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
-
|
|
17
|
-
const CONFIG_A = `export default {
|
|
18
|
-
defaultNetwork: "testnet",
|
|
19
|
-
networks: {
|
|
20
|
-
testnet: { url: "https://testnet.movementnetwork.xyz/v1", chainId: "testnet" }
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
const CONFIG_B = `export default {
|
|
26
|
-
defaultNetwork: "mainnet",
|
|
27
|
-
networks: {
|
|
28
|
-
mainnet: { url: "https://mainnet.movementnetwork.xyz/v1", chainId: "mainnet" }
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
describe("loadUserConfig — mtime cache (#81, #62)", () => {
|
|
34
|
-
let tmpCwd: string;
|
|
35
|
-
let origCwd: string;
|
|
36
|
-
|
|
37
|
-
beforeEach(() => {
|
|
38
|
-
_resetConfigCache();
|
|
39
|
-
origCwd = process.cwd();
|
|
40
|
-
tmpCwd = mkdtempSync(join(tmpdir(), "movehat-config-test-"));
|
|
41
|
-
process.chdir(tmpCwd);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
afterEach(() => {
|
|
45
|
-
process.chdir(origCwd);
|
|
46
|
-
rmSync(tmpCwd, { recursive: true, force: true });
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("first call reads from disk", async () => {
|
|
50
|
-
writeFileSync(join(tmpCwd, "movehat.config.js"), CONFIG_A);
|
|
51
|
-
|
|
52
|
-
const config = await loadUserConfig();
|
|
53
|
-
|
|
54
|
-
expect(config.defaultNetwork).toBe("testnet");
|
|
55
|
-
expect(config.networks).toHaveProperty("testnet");
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("second call returns the same parsed object (cache hit)", async () => {
|
|
59
|
-
writeFileSync(join(tmpCwd, "movehat.config.js"), CONFIG_A);
|
|
60
|
-
|
|
61
|
-
const first = await loadUserConfig();
|
|
62
|
-
const second = await loadUserConfig();
|
|
63
|
-
|
|
64
|
-
// Reference equality proves we returned the cached object rather
|
|
65
|
-
// than re-importing and getting a structurally-equal copy.
|
|
66
|
-
expect(second).toBe(first);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("mtime change invalidates the cache", async () => {
|
|
70
|
-
const path = join(tmpCwd, "movehat.config.js");
|
|
71
|
-
writeFileSync(path, CONFIG_A);
|
|
72
|
-
|
|
73
|
-
const first = await loadUserConfig();
|
|
74
|
-
expect(first.defaultNetwork).toBe("testnet");
|
|
75
|
-
|
|
76
|
-
// Rewrite + force an mtime far in the future so we don't depend on
|
|
77
|
-
// filesystem mtime resolution.
|
|
78
|
-
writeFileSync(path, CONFIG_B);
|
|
79
|
-
const future = new Date(Date.now() + 60_000);
|
|
80
|
-
utimesSync(path, future, future);
|
|
81
|
-
|
|
82
|
-
const second = await loadUserConfig();
|
|
83
|
-
|
|
84
|
-
expect(second).not.toBe(first);
|
|
85
|
-
expect(second.defaultNetwork).toBe("mainnet");
|
|
86
|
-
expect(second.networks).toHaveProperty("mainnet");
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it("different cwds keep separate cache entries", async () => {
|
|
90
|
-
writeFileSync(join(tmpCwd, "movehat.config.js"), CONFIG_A);
|
|
91
|
-
const fromA = await loadUserConfig();
|
|
92
|
-
expect(fromA.defaultNetwork).toBe("testnet");
|
|
93
|
-
|
|
94
|
-
const tmpCwdB = mkdtempSync(join(tmpdir(), "movehat-config-test-b-"));
|
|
95
|
-
try {
|
|
96
|
-
process.chdir(tmpCwdB);
|
|
97
|
-
writeFileSync(join(tmpCwdB, "movehat.config.js"), CONFIG_B);
|
|
98
|
-
const fromB = await loadUserConfig();
|
|
99
|
-
expect(fromB.defaultNetwork).toBe("mainnet");
|
|
100
|
-
|
|
101
|
-
// Switching back to A returns A's cached entry, not B's — proves
|
|
102
|
-
// the cache is keyed by absolute path, not by something process-
|
|
103
|
-
// scoped like "the last value loaded".
|
|
104
|
-
process.chdir(tmpCwd);
|
|
105
|
-
const fromAagain = await loadUserConfig();
|
|
106
|
-
expect(fromAagain).toBe(fromA);
|
|
107
|
-
expect(fromAagain.defaultNetwork).toBe("testnet");
|
|
108
|
-
} finally {
|
|
109
|
-
process.chdir(tmpCwd);
|
|
110
|
-
rmSync(tmpCwdB, { recursive: true, force: true });
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it("source file no longer contains the `?t=` cache-bust (#62 regression guard)", () => {
|
|
115
|
-
const configSrc = readFileSync(join(__dirname, "..", "config.ts"), "utf-8");
|
|
116
|
-
|
|
117
|
-
expect(configSrc).not.toMatch(/\?t=['"]\s*\+\s*Date\.now/);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
// Note: there's no direct behavioral test for `_resetConfigCache()`.
|
|
121
|
-
// The function is exercised in `beforeEach` above — if it didn't
|
|
122
|
-
// actually clear the in-memory map, tests 3 and 4 would leak state
|
|
123
|
-
// between each other and start failing. Its "test" is therefore the
|
|
124
|
-
// rest of this suite continuing to pass.
|
|
125
|
-
|
|
126
|
-
it("throws when no movehat.config.{ts,js} is present", async () => {
|
|
127
|
-
// tmpCwd is empty (no config written) — should reject with the
|
|
128
|
-
// 'Configuration file not found' message.
|
|
129
|
-
await expect(loadUserConfig()).rejects.toThrow(/Configuration file not found/);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("rejects a config with empty `networks`", async () => {
|
|
133
|
-
writeFileSync(
|
|
134
|
-
join(tmpCwd, "movehat.config.js"),
|
|
135
|
-
`export default { networks: {} };
|
|
136
|
-
`
|
|
137
|
-
);
|
|
138
|
-
await expect(loadUserConfig()).rejects.toThrow(/No networks defined/);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
const TEST_KEY =
|
|
143
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001";
|
|
144
|
-
|
|
145
|
-
const baseUserConfig = (networks: MovehatUserConfig["networks"]): MovehatUserConfig => ({
|
|
146
|
-
networks,
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
describe("resolveNetworkConfig", () => {
|
|
150
|
-
const envSnapshot: Record<string, string | undefined> = {};
|
|
151
|
-
|
|
152
|
-
beforeEach(() => {
|
|
153
|
-
envSnapshot.PRIVATE_KEY = process.env.PRIVATE_KEY;
|
|
154
|
-
envSnapshot.MH_CLI_NETWORK = process.env.MH_CLI_NETWORK;
|
|
155
|
-
envSnapshot.MH_DEFAULT_NETWORK = process.env.MH_DEFAULT_NETWORK;
|
|
156
|
-
delete process.env.PRIVATE_KEY;
|
|
157
|
-
delete process.env.MH_CLI_NETWORK;
|
|
158
|
-
delete process.env.MH_DEFAULT_NETWORK;
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
afterEach(() => {
|
|
162
|
-
for (const [key, value] of Object.entries(envSnapshot)) {
|
|
163
|
-
if (value === undefined) {
|
|
164
|
-
delete process.env[key];
|
|
165
|
-
} else {
|
|
166
|
-
process.env[key] = value;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it("uses the network passed as the argument over defaultNetwork", async () => {
|
|
172
|
-
const user = baseUserConfig({
|
|
173
|
-
a: { url: "https://a.example.com/v1", chainId: "a", accounts: [TEST_KEY] },
|
|
174
|
-
b: { url: "https://b.example.com/v1", chainId: "b", accounts: [TEST_KEY] },
|
|
175
|
-
});
|
|
176
|
-
user.defaultNetwork = "a";
|
|
177
|
-
const resolved = await resolveNetworkConfig(user, "b");
|
|
178
|
-
expect(resolved.network).toBe("b");
|
|
179
|
-
expect(resolved.rpc).toBe("https://b.example.com/v1");
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it("MH_CLI_NETWORK env var overrides defaultNetwork when no arg is passed", async () => {
|
|
183
|
-
process.env.MH_CLI_NETWORK = "b";
|
|
184
|
-
const user = baseUserConfig({
|
|
185
|
-
a: { url: "https://a.example.com/v1", chainId: "a", accounts: [TEST_KEY] },
|
|
186
|
-
b: { url: "https://b.example.com/v1", chainId: "b", accounts: [TEST_KEY] },
|
|
187
|
-
});
|
|
188
|
-
user.defaultNetwork = "a";
|
|
189
|
-
const resolved = await resolveNetworkConfig(user);
|
|
190
|
-
expect(resolved.network).toBe("b");
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it("MH_DEFAULT_NETWORK env var is the next-lower priority after MH_CLI_NETWORK", async () => {
|
|
194
|
-
process.env.MH_DEFAULT_NETWORK = "b";
|
|
195
|
-
const user = baseUserConfig({
|
|
196
|
-
a: { url: "https://a.example.com/v1", chainId: "a", accounts: [TEST_KEY] },
|
|
197
|
-
b: { url: "https://b.example.com/v1", chainId: "b", accounts: [TEST_KEY] },
|
|
198
|
-
});
|
|
199
|
-
user.defaultNetwork = "a";
|
|
200
|
-
const resolved = await resolveNetworkConfig(user);
|
|
201
|
-
expect(resolved.network).toBe("b");
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
it("auto-generates a testnet config when 'testnet' is missing from user networks", async () => {
|
|
205
|
-
const logSpy = vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
206
|
-
const user = baseUserConfig({
|
|
207
|
-
a: { url: "https://a.example.com/v1", chainId: "a", accounts: [TEST_KEY] },
|
|
208
|
-
});
|
|
209
|
-
const resolved = await resolveNetworkConfig(user, "testnet");
|
|
210
|
-
expect(resolved.network).toBe("testnet");
|
|
211
|
-
expect(resolved.rpc).toBe("https://testnet.movementnetwork.xyz/v1");
|
|
212
|
-
logSpy.mockRestore();
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
it("auto-generates a local config when 'local' is missing from user networks", async () => {
|
|
216
|
-
const logSpy = vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
217
|
-
const user = baseUserConfig({
|
|
218
|
-
a: { url: "https://a.example.com/v1", chainId: "a", accounts: [TEST_KEY] },
|
|
219
|
-
});
|
|
220
|
-
const resolved = await resolveNetworkConfig(user, "local");
|
|
221
|
-
expect(resolved.network).toBe("local");
|
|
222
|
-
expect(resolved.rpc).toBe("http://localhost:8080/v1");
|
|
223
|
-
logSpy.mockRestore();
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
it("throws on a completely unknown network with a clear list of available ones", async () => {
|
|
227
|
-
const user = baseUserConfig({
|
|
228
|
-
a: { url: "https://a.example.com/v1", chainId: "a", accounts: [TEST_KEY] },
|
|
229
|
-
});
|
|
230
|
-
await expect(resolveNetworkConfig(user, "nonexistent")).rejects.toThrow(
|
|
231
|
-
/Network 'nonexistent' not found/
|
|
232
|
-
);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it("falls back to PRIVATE_KEY env var when no accounts are configured anywhere", async () => {
|
|
236
|
-
process.env.PRIVATE_KEY = TEST_KEY;
|
|
237
|
-
const user = baseUserConfig({
|
|
238
|
-
a: { url: "https://a.example.com/v1", chainId: "a" },
|
|
239
|
-
});
|
|
240
|
-
const resolved = await resolveNetworkConfig(user, "a");
|
|
241
|
-
expect(resolved.privateKey).toBe(TEST_KEY);
|
|
242
|
-
expect(resolved.allAccounts).toEqual([TEST_KEY]);
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
it("auto-generates a deterministic test key for testnet when no accounts are anywhere", async () => {
|
|
246
|
-
const logSpy = vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
247
|
-
const user = baseUserConfig({
|
|
248
|
-
testnet: { url: "https://testnet.movementnetwork.xyz/v1", chainId: "testnet" },
|
|
249
|
-
});
|
|
250
|
-
const resolved = await resolveNetworkConfig(user, "testnet");
|
|
251
|
-
// The auto-generated key is the canonical Hardhat-style test key.
|
|
252
|
-
expect(resolved.privateKey).toBe(
|
|
253
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001"
|
|
254
|
-
);
|
|
255
|
-
logSpy.mockRestore();
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
it("rejects a non-testnet/local network with no accounts (security gate)", async () => {
|
|
259
|
-
const user = baseUserConfig({
|
|
260
|
-
mainnet: { url: "https://mainnet.movementnetwork.xyz/v1", chainId: "mainnet" },
|
|
261
|
-
});
|
|
262
|
-
await expect(resolveNetworkConfig(user, "mainnet")).rejects.toThrow(
|
|
263
|
-
/requires explicit account configuration/
|
|
264
|
-
);
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
it("prefers network-specific accounts over global ones", async () => {
|
|
268
|
-
const user: MovehatUserConfig = {
|
|
269
|
-
accounts: ["0xglobal"],
|
|
270
|
-
networks: {
|
|
271
|
-
a: {
|
|
272
|
-
url: "https://a.example.com/v1",
|
|
273
|
-
chainId: "a",
|
|
274
|
-
accounts: [TEST_KEY],
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
};
|
|
278
|
-
const resolved = await resolveNetworkConfig(user, "a");
|
|
279
|
-
expect(resolved.privateKey).toBe(TEST_KEY);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
it("falls back to global accounts when network has none", async () => {
|
|
283
|
-
const user: MovehatUserConfig = {
|
|
284
|
-
accounts: [TEST_KEY],
|
|
285
|
-
networks: {
|
|
286
|
-
a: { url: "https://a.example.com/v1", chainId: "a" },
|
|
287
|
-
},
|
|
288
|
-
};
|
|
289
|
-
const resolved = await resolveNetworkConfig(user, "a");
|
|
290
|
-
expect(resolved.privateKey).toBe(TEST_KEY);
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
it("merges named addresses, with network-specific overriding global", async () => {
|
|
294
|
-
const user: MovehatUserConfig = {
|
|
295
|
-
namedAddresses: { foo: "0xglobal", shared: "0xglobal" },
|
|
296
|
-
networks: {
|
|
297
|
-
a: {
|
|
298
|
-
url: "https://a.example.com/v1",
|
|
299
|
-
chainId: "a",
|
|
300
|
-
accounts: [TEST_KEY],
|
|
301
|
-
namedAddresses: { bar: "0xnet", shared: "0xnet" },
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
};
|
|
305
|
-
const resolved = await resolveNetworkConfig(user, "a");
|
|
306
|
-
expect(resolved.namedAddresses).toEqual({
|
|
307
|
-
foo: "0xglobal",
|
|
308
|
-
bar: "0xnet",
|
|
309
|
-
shared: "0xnet",
|
|
310
|
-
});
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
it("derives the on-chain account address from the resolved key", async () => {
|
|
314
|
-
const user = baseUserConfig({
|
|
315
|
-
a: { url: "https://a.example.com/v1", chainId: "a", accounts: [TEST_KEY] },
|
|
316
|
-
});
|
|
317
|
-
const resolved = await resolveNetworkConfig(user, "a");
|
|
318
|
-
// The canonical Hardhat-style 0x...01 key derives to a well-known address.
|
|
319
|
-
expect(resolved.account).toMatch(/^0x[a-f0-9]+$/i);
|
|
320
|
-
expect(resolved.account.length).toBeGreaterThan(2);
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
it("returns account='' and warns when the configured key is malformed", async () => {
|
|
324
|
-
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => undefined);
|
|
325
|
-
const user = baseUserConfig({
|
|
326
|
-
a: { url: "https://a.example.com/v1", chainId: "a", accounts: ["not-a-real-key"] },
|
|
327
|
-
});
|
|
328
|
-
const resolved = await resolveNetworkConfig(user, "a");
|
|
329
|
-
expect(resolved.account).toBe("");
|
|
330
|
-
expect(warnSpy).toHaveBeenCalledWith(
|
|
331
|
-
expect.stringMatching(/Could not derive account address/)
|
|
332
|
-
);
|
|
333
|
-
warnSpy.mockRestore();
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
it("strips the 'ed25519-priv-' prefix when deriving the account address", async () => {
|
|
337
|
-
const user = baseUserConfig({
|
|
338
|
-
a: {
|
|
339
|
-
url: "https://a.example.com/v1",
|
|
340
|
-
chainId: "a",
|
|
341
|
-
accounts: [`ed25519-priv-${TEST_KEY}`],
|
|
342
|
-
},
|
|
343
|
-
});
|
|
344
|
-
const resolved = await resolveNetworkConfig(user, "a");
|
|
345
|
-
// Same key, prefixed and unprefixed, should derive the same address.
|
|
346
|
-
const bareResolved = await resolveNetworkConfig(
|
|
347
|
-
baseUserConfig({
|
|
348
|
-
a: { url: "https://a.example.com/v1", chainId: "a", accounts: [TEST_KEY] },
|
|
349
|
-
}),
|
|
350
|
-
"a"
|
|
351
|
-
);
|
|
352
|
-
expect(resolved.account).toBe(bareResolved.account);
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
it("uses profile='default' when networkConfig has no profile", async () => {
|
|
356
|
-
const user = baseUserConfig({
|
|
357
|
-
a: { url: "https://a.example.com/v1", chainId: "a", accounts: [TEST_KEY] },
|
|
358
|
-
});
|
|
359
|
-
const resolved = await resolveNetworkConfig(user, "a");
|
|
360
|
-
expect(resolved.profile).toBe("default");
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
it("respects networkConfig.profile when set", async () => {
|
|
364
|
-
const user: MovehatUserConfig = {
|
|
365
|
-
networks: {
|
|
366
|
-
a: {
|
|
367
|
-
url: "https://a.example.com/v1",
|
|
368
|
-
chainId: "a",
|
|
369
|
-
accounts: [TEST_KEY],
|
|
370
|
-
profile: "custom-profile",
|
|
371
|
-
},
|
|
372
|
-
},
|
|
373
|
-
};
|
|
374
|
-
const resolved = await resolveNetworkConfig(user, "a");
|
|
375
|
-
expect(resolved.profile).toBe("custom-profile");
|
|
376
|
-
});
|
|
377
|
-
});
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
|
-
import { vol, fs as memfsFs } from 'memfs';
|
|
3
|
-
|
|
4
|
-
// Mock fs module
|
|
5
|
-
vi.mock('fs', () => ({
|
|
6
|
-
default: memfsFs,
|
|
7
|
-
...memfsFs,
|
|
8
|
-
}));
|
|
9
|
-
|
|
10
|
-
// Import after mock
|
|
11
|
-
const {
|
|
12
|
-
validateSafeName,
|
|
13
|
-
saveDeployment,
|
|
14
|
-
loadDeployment,
|
|
15
|
-
getAllDeployments,
|
|
16
|
-
getDeployedAddress,
|
|
17
|
-
} = await import('../deployments.js');
|
|
18
|
-
|
|
19
|
-
describe('validateSafeName', () => {
|
|
20
|
-
it('should accept valid names', () => {
|
|
21
|
-
expect(() => validateSafeName('testnet', 'network')).not.toThrow();
|
|
22
|
-
expect(() => validateSafeName('counter', 'module')).not.toThrow();
|
|
23
|
-
expect(() => validateSafeName('my-module', 'module')).not.toThrow();
|
|
24
|
-
expect(() => validateSafeName('module_v2', 'module')).not.toThrow();
|
|
25
|
-
expect(() => validateSafeName('Module123', 'module')).not.toThrow();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should reject path traversal attempts', () => {
|
|
29
|
-
expect(() => validateSafeName('../etc/passwd', 'network')).toThrow('Path traversal');
|
|
30
|
-
expect(() => validateSafeName('..\\windows', 'network')).toThrow('Path traversal');
|
|
31
|
-
expect(() => validateSafeName('foo/../bar', 'module')).toThrow('Path traversal');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should reject slashes', () => {
|
|
35
|
-
expect(() => validateSafeName('path/to/file', 'network')).toThrow('Path traversal');
|
|
36
|
-
expect(() => validateSafeName('path\\to\\file', 'network')).toThrow('Path traversal');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should reject special characters', () => {
|
|
40
|
-
expect(() => validateSafeName('test;rm', 'module')).toThrow('Only alphanumeric');
|
|
41
|
-
expect(() => validateSafeName('test$var', 'module')).toThrow('Only alphanumeric');
|
|
42
|
-
expect(() => validateSafeName('test space', 'module')).toThrow('Only alphanumeric');
|
|
43
|
-
expect(() => validateSafeName('test.module', 'module')).toThrow('Only alphanumeric');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should reject hidden files (starting with dot)', () => {
|
|
47
|
-
expect(() => validateSafeName('.hidden', 'network')).toThrow('cannot start with a dot');
|
|
48
|
-
expect(() => validateSafeName('.gitignore', 'module')).toThrow('cannot start with a dot');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should reject empty strings', () => {
|
|
52
|
-
expect(() => validateSafeName('', 'network')).toThrow('must be a non-empty string');
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should reject non-string input', () => {
|
|
56
|
-
expect(() => validateSafeName(null as any, 'network')).toThrow('must be a non-empty string');
|
|
57
|
-
expect(() => validateSafeName(undefined as any, 'module')).toThrow('must be a non-empty string');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should use correct type in error messages', () => {
|
|
61
|
-
expect(() => validateSafeName('bad name', 'network')).toThrow('Invalid network name');
|
|
62
|
-
expect(() => validateSafeName('bad name', 'module')).toThrow('Invalid module name');
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('saveDeployment and loadDeployment', () => {
|
|
67
|
-
beforeEach(() => {
|
|
68
|
-
vol.reset();
|
|
69
|
-
// Create initial directory structure
|
|
70
|
-
vol.fromJSON({
|
|
71
|
-
'/project/.gitkeep': '',
|
|
72
|
-
});
|
|
73
|
-
// Mock process.cwd
|
|
74
|
-
vi.spyOn(process, 'cwd').mockReturnValue('/project');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
afterEach(() => {
|
|
78
|
-
vol.reset();
|
|
79
|
-
vi.restoreAllMocks();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('should save and load deployment', () => {
|
|
83
|
-
const deployment = {
|
|
84
|
-
address: '0x1234',
|
|
85
|
-
moduleName: 'counter',
|
|
86
|
-
network: 'testnet',
|
|
87
|
-
deployer: '0xabcd',
|
|
88
|
-
timestamp: 1704985623564,
|
|
89
|
-
txHash: '0x5678',
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// Mock console.log to suppress output
|
|
93
|
-
vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
94
|
-
|
|
95
|
-
saveDeployment(deployment);
|
|
96
|
-
|
|
97
|
-
const loaded = loadDeployment('testnet', 'counter');
|
|
98
|
-
expect(loaded).toEqual(deployment);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should return null for non-existent deployment', () => {
|
|
102
|
-
const loaded = loadDeployment('testnet', 'nonexistent');
|
|
103
|
-
expect(loaded).toBeNull();
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('should create directories if they do not exist', () => {
|
|
107
|
-
const deployment = {
|
|
108
|
-
address: '0x1234',
|
|
109
|
-
moduleName: 'token',
|
|
110
|
-
network: 'mainnet',
|
|
111
|
-
deployer: '0xabcd',
|
|
112
|
-
timestamp: Date.now(),
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
116
|
-
|
|
117
|
-
saveDeployment(deployment);
|
|
118
|
-
|
|
119
|
-
expect(vol.existsSync('/project/deployments')).toBe(true);
|
|
120
|
-
expect(vol.existsSync('/project/deployments/mainnet')).toBe(true);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('should reject invalid network names when saving', () => {
|
|
124
|
-
const deployment = {
|
|
125
|
-
address: '0x1234',
|
|
126
|
-
moduleName: 'counter',
|
|
127
|
-
network: '../etc',
|
|
128
|
-
deployer: '0xabcd',
|
|
129
|
-
timestamp: Date.now(),
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
expect(() => saveDeployment(deployment)).toThrow('Path traversal');
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('should reject invalid module names when saving', () => {
|
|
136
|
-
const deployment = {
|
|
137
|
-
address: '0x1234',
|
|
138
|
-
moduleName: 'counter;rm -rf',
|
|
139
|
-
network: 'testnet',
|
|
140
|
-
deployer: '0xabcd',
|
|
141
|
-
timestamp: Date.now(),
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
expect(() => saveDeployment(deployment)).toThrow('Only alphanumeric');
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
describe('getAllDeployments', () => {
|
|
149
|
-
beforeEach(() => {
|
|
150
|
-
vol.reset();
|
|
151
|
-
vi.spyOn(process, 'cwd').mockReturnValue('/project');
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
afterEach(() => {
|
|
155
|
-
vol.reset();
|
|
156
|
-
vi.restoreAllMocks();
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('should return empty object for non-existent network', () => {
|
|
160
|
-
vol.fromJSON({
|
|
161
|
-
'/project/.gitkeep': '',
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
const deployments = getAllDeployments('nonexistent');
|
|
165
|
-
expect(deployments).toEqual({});
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('should return all deployments for a network', () => {
|
|
169
|
-
vol.fromJSON({
|
|
170
|
-
'/project/deployments/testnet/counter.json': JSON.stringify({
|
|
171
|
-
address: '0x1',
|
|
172
|
-
moduleName: 'counter',
|
|
173
|
-
network: 'testnet',
|
|
174
|
-
deployer: '0xd1',
|
|
175
|
-
timestamp: 1000,
|
|
176
|
-
}),
|
|
177
|
-
'/project/deployments/testnet/token.json': JSON.stringify({
|
|
178
|
-
address: '0x2',
|
|
179
|
-
moduleName: 'token',
|
|
180
|
-
network: 'testnet',
|
|
181
|
-
deployer: '0xd2',
|
|
182
|
-
timestamp: 2000,
|
|
183
|
-
}),
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
const deployments = getAllDeployments('testnet');
|
|
187
|
-
|
|
188
|
-
expect(Object.keys(deployments)).toHaveLength(2);
|
|
189
|
-
expect(deployments['counter']?.address).toBe('0x1');
|
|
190
|
-
expect(deployments['token']?.address).toBe('0x2');
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it('should ignore non-JSON files', () => {
|
|
194
|
-
vol.fromJSON({
|
|
195
|
-
'/project/deployments/testnet/counter.json': JSON.stringify({
|
|
196
|
-
address: '0x1',
|
|
197
|
-
moduleName: 'counter',
|
|
198
|
-
network: 'testnet',
|
|
199
|
-
deployer: '0xd1',
|
|
200
|
-
timestamp: 1000,
|
|
201
|
-
}),
|
|
202
|
-
'/project/deployments/testnet/README.md': '# Readme',
|
|
203
|
-
'/project/deployments/testnet/.gitkeep': '',
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
const deployments = getAllDeployments('testnet');
|
|
207
|
-
|
|
208
|
-
expect(Object.keys(deployments)).toHaveLength(1);
|
|
209
|
-
expect(deployments['counter']).toBeDefined();
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
describe('getDeployedAddress', () => {
|
|
214
|
-
beforeEach(() => {
|
|
215
|
-
vol.reset();
|
|
216
|
-
vi.spyOn(process, 'cwd').mockReturnValue('/project');
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
afterEach(() => {
|
|
220
|
-
vol.reset();
|
|
221
|
-
vi.restoreAllMocks();
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it('should return address for existing deployment', () => {
|
|
225
|
-
vol.fromJSON({
|
|
226
|
-
'/project/deployments/testnet/counter.json': JSON.stringify({
|
|
227
|
-
address: '0x1234abcd',
|
|
228
|
-
moduleName: 'counter',
|
|
229
|
-
network: 'testnet',
|
|
230
|
-
deployer: '0xd1',
|
|
231
|
-
timestamp: 1000,
|
|
232
|
-
}),
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
const address = getDeployedAddress('testnet', 'counter');
|
|
236
|
-
expect(address).toBe('0x1234abcd');
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
it('should return null for non-existent deployment', () => {
|
|
240
|
-
vol.fromJSON({
|
|
241
|
-
'/project/.gitkeep': '',
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
const address = getDeployedAddress('testnet', 'nonexistent');
|
|
245
|
-
expect(address).toBeNull();
|
|
246
|
-
});
|
|
247
|
-
});
|