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,385 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { mkdtempSync, rmSync } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Tests for `ForkManager`. Strategy:
|
|
8
|
-
* - `vi.mock` the upstream `MovementApiClient` (network layer) so
|
|
9
|
-
* tests stay offline and deterministic.
|
|
10
|
-
* - Use a REAL `ForkStorage` against a tmpdir (storage is already
|
|
11
|
-
* covered at ~85% by its own suite; we treat it as a trusted
|
|
12
|
-
* dependency here and assert the manager's lifecycle on top of it).
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
// Module-scoped fakes — populated per test via setMockApi() below.
|
|
16
|
-
const fakeApi = {
|
|
17
|
-
getLedgerInfo: vi.fn(),
|
|
18
|
-
getAccount: vi.fn(),
|
|
19
|
-
getAccountResource: vi.fn(),
|
|
20
|
-
getAccountResources: vi.fn(),
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// Track the (nodeUrl, apiKey) pair every constructor call sees, so we
|
|
24
|
-
// can assert setApiKey reconstructs the client.
|
|
25
|
-
const apiCtorCalls: Array<{ nodeUrl: string; apiKey?: string | undefined }> = [];
|
|
26
|
-
|
|
27
|
-
vi.mock("../api.js", () => ({
|
|
28
|
-
MovementApiClient: class {
|
|
29
|
-
constructor(nodeUrl: string, apiKey?: string) {
|
|
30
|
-
apiCtorCalls.push({ nodeUrl, apiKey });
|
|
31
|
-
}
|
|
32
|
-
getLedgerInfo = fakeApi.getLedgerInfo;
|
|
33
|
-
getAccount = fakeApi.getAccount;
|
|
34
|
-
getAccountResource = fakeApi.getAccountResource;
|
|
35
|
-
getAccountResources = fakeApi.getAccountResources;
|
|
36
|
-
},
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
// Static import after the mock declaration — vi hoists vi.mock calls.
|
|
40
|
-
import { ForkManager } from "../manager.js";
|
|
41
|
-
|
|
42
|
-
const TEST_NODE_URL = "https://testnet.movementnetwork.xyz/v1";
|
|
43
|
-
const TEST_ADDR = "0x" + "a".repeat(64);
|
|
44
|
-
const COIN_TYPE = "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>";
|
|
45
|
-
|
|
46
|
-
function ledgerInfoFixture() {
|
|
47
|
-
return {
|
|
48
|
-
chain_id: 27,
|
|
49
|
-
ledger_version: "100",
|
|
50
|
-
ledger_timestamp: "1234567890",
|
|
51
|
-
epoch: "5",
|
|
52
|
-
block_height: "42",
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
describe("ForkManager — initialize / load", () => {
|
|
57
|
-
let tmpDir: string;
|
|
58
|
-
let forkPath: string;
|
|
59
|
-
|
|
60
|
-
beforeEach(() => {
|
|
61
|
-
tmpDir = mkdtempSync(join(tmpdir(), "movehat-forkmgr-"));
|
|
62
|
-
forkPath = join(tmpDir, "fork");
|
|
63
|
-
apiCtorCalls.length = 0;
|
|
64
|
-
fakeApi.getLedgerInfo.mockReset();
|
|
65
|
-
fakeApi.getAccount.mockReset();
|
|
66
|
-
fakeApi.getAccountResource.mockReset();
|
|
67
|
-
fakeApi.getAccountResources.mockReset();
|
|
68
|
-
vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
afterEach(() => {
|
|
72
|
-
vi.restoreAllMocks();
|
|
73
|
-
rmSync(tmpDir, { recursive: true, force: true });
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("initialize writes metadata and constructs an API client without apiKey by default", async () => {
|
|
77
|
-
fakeApi.getLedgerInfo.mockResolvedValue(ledgerInfoFixture());
|
|
78
|
-
const mgr = new ForkManager(forkPath);
|
|
79
|
-
|
|
80
|
-
await mgr.initialize(TEST_NODE_URL);
|
|
81
|
-
|
|
82
|
-
expect(apiCtorCalls).toHaveLength(1);
|
|
83
|
-
expect(apiCtorCalls[0]?.nodeUrl).toBe(TEST_NODE_URL);
|
|
84
|
-
expect(apiCtorCalls[0]?.apiKey).toBeUndefined();
|
|
85
|
-
|
|
86
|
-
const meta = mgr.getMetadata();
|
|
87
|
-
expect(meta.network).toBe("custom");
|
|
88
|
-
expect(meta.nodeUrl).toBe(TEST_NODE_URL);
|
|
89
|
-
expect(meta.chainId).toBe(27);
|
|
90
|
-
expect(meta.ledgerVersion).toBe("100");
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("initialize passes apiKey through to the API client", async () => {
|
|
94
|
-
fakeApi.getLedgerInfo.mockResolvedValue(ledgerInfoFixture());
|
|
95
|
-
const mgr = new ForkManager(forkPath);
|
|
96
|
-
|
|
97
|
-
await mgr.initialize(TEST_NODE_URL, "testnet", "secret-key");
|
|
98
|
-
|
|
99
|
-
expect(apiCtorCalls).toHaveLength(1);
|
|
100
|
-
expect(apiCtorCalls[0]?.apiKey).toBe("secret-key");
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("initialize labels the fork with the provided networkName", async () => {
|
|
104
|
-
fakeApi.getLedgerInfo.mockResolvedValue(ledgerInfoFixture());
|
|
105
|
-
const mgr = new ForkManager(forkPath);
|
|
106
|
-
|
|
107
|
-
await mgr.initialize(TEST_NODE_URL, "bardock-testnet");
|
|
108
|
-
|
|
109
|
-
expect(mgr.getMetadata().network).toBe("bardock-testnet");
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it("load throws when the fork directory doesn't exist", () => {
|
|
113
|
-
const mgr = new ForkManager(forkPath);
|
|
114
|
-
expect(() => mgr.load()).toThrow(/Fork does not exist/);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it("load restores metadata from disk and reconstructs the API client", async () => {
|
|
118
|
-
fakeApi.getLedgerInfo.mockResolvedValue(ledgerInfoFixture());
|
|
119
|
-
const first = new ForkManager(forkPath);
|
|
120
|
-
await first.initialize(TEST_NODE_URL);
|
|
121
|
-
|
|
122
|
-
apiCtorCalls.length = 0;
|
|
123
|
-
|
|
124
|
-
const reloaded = new ForkManager(forkPath);
|
|
125
|
-
reloaded.load();
|
|
126
|
-
|
|
127
|
-
expect(apiCtorCalls).toHaveLength(1);
|
|
128
|
-
expect(reloaded.getMetadata().nodeUrl).toBe(TEST_NODE_URL);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it("setApiKey reconstructs the API client when one already exists", async () => {
|
|
132
|
-
fakeApi.getLedgerInfo.mockResolvedValue(ledgerInfoFixture());
|
|
133
|
-
const mgr = new ForkManager(forkPath);
|
|
134
|
-
await mgr.initialize(TEST_NODE_URL);
|
|
135
|
-
|
|
136
|
-
apiCtorCalls.length = 0;
|
|
137
|
-
mgr.setApiKey("new-key");
|
|
138
|
-
|
|
139
|
-
expect(apiCtorCalls).toHaveLength(1);
|
|
140
|
-
expect(apiCtorCalls[0]?.apiKey).toBe("new-key");
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it("setApiKey(undefined) clears the key on the next reconstruction", async () => {
|
|
144
|
-
fakeApi.getLedgerInfo.mockResolvedValue(ledgerInfoFixture());
|
|
145
|
-
const mgr = new ForkManager(forkPath);
|
|
146
|
-
await mgr.initialize(TEST_NODE_URL, "custom", "key");
|
|
147
|
-
|
|
148
|
-
apiCtorCalls.length = 0;
|
|
149
|
-
mgr.setApiKey(undefined);
|
|
150
|
-
|
|
151
|
-
expect(apiCtorCalls).toHaveLength(1);
|
|
152
|
-
expect(apiCtorCalls[0]?.apiKey).toBeUndefined();
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it("setApiKey is a no-op before initialize/load (no client yet)", () => {
|
|
156
|
-
const mgr = new ForkManager(forkPath);
|
|
157
|
-
apiCtorCalls.length = 0;
|
|
158
|
-
mgr.setApiKey("key");
|
|
159
|
-
expect(apiCtorCalls).toHaveLength(0);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
describe("ForkManager — account + resource fetch", () => {
|
|
164
|
-
let tmpDir: string;
|
|
165
|
-
let forkPath: string;
|
|
166
|
-
let mgr: ForkManager;
|
|
167
|
-
|
|
168
|
-
beforeEach(async () => {
|
|
169
|
-
tmpDir = mkdtempSync(join(tmpdir(), "movehat-forkmgr-"));
|
|
170
|
-
forkPath = join(tmpDir, "fork");
|
|
171
|
-
apiCtorCalls.length = 0;
|
|
172
|
-
fakeApi.getLedgerInfo.mockResolvedValue(ledgerInfoFixture());
|
|
173
|
-
fakeApi.getAccount.mockReset();
|
|
174
|
-
fakeApi.getAccountResource.mockReset();
|
|
175
|
-
fakeApi.getAccountResources.mockReset();
|
|
176
|
-
vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
177
|
-
|
|
178
|
-
mgr = new ForkManager(forkPath);
|
|
179
|
-
await mgr.initialize(TEST_NODE_URL);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
afterEach(() => {
|
|
183
|
-
vi.restoreAllMocks();
|
|
184
|
-
rmSync(tmpDir, { recursive: true, force: true });
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it("getAccount fetches from API and caches in storage on first call", async () => {
|
|
188
|
-
fakeApi.getAccount.mockResolvedValue({
|
|
189
|
-
sequence_number: "7",
|
|
190
|
-
authentication_key: "0xabc",
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
const state = await mgr.getAccount(TEST_ADDR);
|
|
194
|
-
expect(state.sequenceNumber).toBe("7");
|
|
195
|
-
expect(state.authenticationKey).toBe("0xabc");
|
|
196
|
-
expect(fakeApi.getAccount).toHaveBeenCalledTimes(1);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
it("getAccount returns the cached state on second call (no extra API hit)", async () => {
|
|
200
|
-
fakeApi.getAccount.mockResolvedValue({
|
|
201
|
-
sequence_number: "7",
|
|
202
|
-
authentication_key: "0xabc",
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
await mgr.getAccount(TEST_ADDR);
|
|
206
|
-
await mgr.getAccount(TEST_ADDR);
|
|
207
|
-
|
|
208
|
-
expect(fakeApi.getAccount).toHaveBeenCalledTimes(1);
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it("getAccount throws if the manager was never initialized/loaded", async () => {
|
|
212
|
-
const fresh = new ForkManager(join(tmpDir, "uninitialized"));
|
|
213
|
-
await expect(fresh.getAccount(TEST_ADDR)).rejects.toThrow(
|
|
214
|
-
/Fork not initialized/
|
|
215
|
-
);
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it("getResource fetches and caches by resource type", async () => {
|
|
219
|
-
fakeApi.getAccountResource.mockResolvedValue({
|
|
220
|
-
data: { value: "42" },
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
const r1 = await mgr.getResource(TEST_ADDR, "0x1::counter::Counter");
|
|
224
|
-
expect(r1).toEqual({ value: "42" });
|
|
225
|
-
const r2 = await mgr.getResource(TEST_ADDR, "0x1::counter::Counter");
|
|
226
|
-
expect(r2).toEqual({ value: "42" });
|
|
227
|
-
expect(fakeApi.getAccountResource).toHaveBeenCalledTimes(1);
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
it("getResource rethrows a clean 'not found' for upstream 404 errors", async () => {
|
|
231
|
-
fakeApi.getAccountResource.mockRejectedValue(new Error("HTTP 404: not found"));
|
|
232
|
-
await expect(
|
|
233
|
-
mgr.getResource(TEST_ADDR, "0x1::missing::Resource")
|
|
234
|
-
).rejects.toThrow(/Resource .* not found for account/);
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
it("getResource rethrows other errors unchanged", async () => {
|
|
238
|
-
fakeApi.getAccountResource.mockRejectedValue(new Error("connection refused"));
|
|
239
|
-
await expect(
|
|
240
|
-
mgr.getResource(TEST_ADDR, "0x1::missing::Resource")
|
|
241
|
-
).rejects.toThrow(/connection refused/);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
it("getAllResources fetches the whole list once, caches, and returns by type", async () => {
|
|
245
|
-
fakeApi.getAccountResources.mockResolvedValue([
|
|
246
|
-
{ type: "0x1::a::A", data: { x: 1 } },
|
|
247
|
-
{ type: "0x1::b::B", data: { y: 2 } },
|
|
248
|
-
]);
|
|
249
|
-
|
|
250
|
-
const first = await mgr.getAllResources(TEST_ADDR);
|
|
251
|
-
expect(Object.keys(first).sort()).toEqual(["0x1::a::A", "0x1::b::B"]);
|
|
252
|
-
expect(first["0x1::a::A"]).toEqual({ x: 1 });
|
|
253
|
-
|
|
254
|
-
// Second call should hit cache (API call count stays at 1).
|
|
255
|
-
await mgr.getAllResources(TEST_ADDR);
|
|
256
|
-
expect(fakeApi.getAccountResources).toHaveBeenCalledTimes(1);
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
describe("ForkManager — fundAccount / setResource / list / getOrCreateAccount", () => {
|
|
261
|
-
let tmpDir: string;
|
|
262
|
-
let forkPath: string;
|
|
263
|
-
let mgr: ForkManager;
|
|
264
|
-
|
|
265
|
-
beforeEach(async () => {
|
|
266
|
-
tmpDir = mkdtempSync(join(tmpdir(), "movehat-forkmgr-"));
|
|
267
|
-
forkPath = join(tmpDir, "fork");
|
|
268
|
-
apiCtorCalls.length = 0;
|
|
269
|
-
fakeApi.getLedgerInfo.mockResolvedValue(ledgerInfoFixture());
|
|
270
|
-
fakeApi.getAccount.mockReset();
|
|
271
|
-
fakeApi.getAccountResource.mockReset();
|
|
272
|
-
fakeApi.getAccountResources.mockReset();
|
|
273
|
-
vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
274
|
-
|
|
275
|
-
mgr = new ForkManager(forkPath);
|
|
276
|
-
await mgr.initialize(TEST_NODE_URL);
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
afterEach(() => {
|
|
280
|
-
vi.restoreAllMocks();
|
|
281
|
-
rmSync(tmpDir, { recursive: true, force: true });
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
it("fundAccount creates a fresh CoinStore when none exists upstream", async () => {
|
|
285
|
-
fakeApi.getAccountResource.mockRejectedValue(new Error("HTTP 404: not found"));
|
|
286
|
-
|
|
287
|
-
await mgr.fundAccount(TEST_ADDR, 1_000);
|
|
288
|
-
|
|
289
|
-
// Now the resource should be in cache — read it back without another API hit.
|
|
290
|
-
fakeApi.getAccountResource.mockClear();
|
|
291
|
-
const stored = await mgr.getResource(TEST_ADDR, COIN_TYPE);
|
|
292
|
-
expect(stored).toBeDefined();
|
|
293
|
-
expect(stored.coin.value).toBe("1000");
|
|
294
|
-
expect(fakeApi.getAccountResource).not.toHaveBeenCalled();
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
it("fundAccount adds to existing balance on a second call (accumulates)", async () => {
|
|
298
|
-
fakeApi.getAccountResource.mockRejectedValue(new Error("HTTP 404: not found"));
|
|
299
|
-
await mgr.fundAccount(TEST_ADDR, 1_000);
|
|
300
|
-
await mgr.fundAccount(TEST_ADDR, 500);
|
|
301
|
-
|
|
302
|
-
const stored = await mgr.getResource(TEST_ADDR, COIN_TYPE);
|
|
303
|
-
expect(stored.coin.value).toBe("1500");
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
it("fundAccount rethrows non-404 errors from getResource", async () => {
|
|
307
|
-
fakeApi.getAccountResource.mockRejectedValue(new Error("upstream is angry"));
|
|
308
|
-
await expect(mgr.fundAccount(TEST_ADDR, 100)).rejects.toThrow(/upstream is angry/);
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
it("fundMultipleAccounts funds every address in the list", async () => {
|
|
312
|
-
fakeApi.getAccountResource.mockRejectedValue(new Error("HTTP 404: not found"));
|
|
313
|
-
|
|
314
|
-
const addrs = [
|
|
315
|
-
"0x" + "1".repeat(64),
|
|
316
|
-
"0x" + "2".repeat(64),
|
|
317
|
-
"0x" + "3".repeat(64),
|
|
318
|
-
];
|
|
319
|
-
await mgr.fundMultipleAccounts(addrs, 500);
|
|
320
|
-
|
|
321
|
-
// Each address now has a 500-balance CoinStore in cache.
|
|
322
|
-
fakeApi.getAccountResource.mockClear();
|
|
323
|
-
for (const addr of addrs) {
|
|
324
|
-
const stored = await mgr.getResource(addr, COIN_TYPE);
|
|
325
|
-
expect(stored.coin.value).toBe("500");
|
|
326
|
-
}
|
|
327
|
-
expect(fakeApi.getAccountResource).not.toHaveBeenCalled();
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
it("setResource overwrites a cached resource", async () => {
|
|
331
|
-
await mgr.setResource(TEST_ADDR, "0x1::custom::Resource", { value: 1 });
|
|
332
|
-
await mgr.setResource(TEST_ADDR, "0x1::custom::Resource", { value: 2 });
|
|
333
|
-
const stored = await mgr.getResource(TEST_ADDR, "0x1::custom::Resource");
|
|
334
|
-
expect(stored).toEqual({ value: 2 });
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
it("listAccounts returns the cached account list", async () => {
|
|
338
|
-
fakeApi.getAccountResource.mockRejectedValue(new Error("HTTP 404: not found"));
|
|
339
|
-
await mgr.fundAccount(TEST_ADDR, 100);
|
|
340
|
-
const list = mgr.listAccounts();
|
|
341
|
-
expect(list.length).toBeGreaterThan(0);
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
it("getOrCreateAccount returns the existing account when one is cached", async () => {
|
|
345
|
-
fakeApi.getAccount.mockResolvedValue({
|
|
346
|
-
sequence_number: "0",
|
|
347
|
-
authentication_key: "0xabc",
|
|
348
|
-
});
|
|
349
|
-
await mgr.getAccount(TEST_ADDR);
|
|
350
|
-
fakeApi.getAccount.mockClear();
|
|
351
|
-
|
|
352
|
-
const result = await mgr.getOrCreateAccount(TEST_ADDR);
|
|
353
|
-
expect(result.authenticationKey).toBe("0xabc");
|
|
354
|
-
expect(fakeApi.getAccount).not.toHaveBeenCalled();
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
it("getOrCreateAccount synthesizes a minimal account when the upstream lookup fails", async () => {
|
|
358
|
-
// Force the storage cache miss AND the API throw, exercising the
|
|
359
|
-
// catch arm that creates the account locally.
|
|
360
|
-
fakeApi.getAccount.mockRejectedValue(new Error("HTTP 404: not found"));
|
|
361
|
-
|
|
362
|
-
const result = await mgr.getOrCreateAccount(TEST_ADDR);
|
|
363
|
-
expect(result.sequenceNumber).toBe("0");
|
|
364
|
-
expect(result.authenticationKey).toHaveLength(66);
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
it("resetState clears cached accounts and resources", async () => {
|
|
368
|
-
fakeApi.getAccount.mockResolvedValue({
|
|
369
|
-
sequence_number: "5",
|
|
370
|
-
authentication_key: "0xabc",
|
|
371
|
-
});
|
|
372
|
-
await mgr.getAccount(TEST_ADDR);
|
|
373
|
-
|
|
374
|
-
await mgr.resetState();
|
|
375
|
-
|
|
376
|
-
fakeApi.getAccount.mockClear();
|
|
377
|
-
fakeApi.getAccount.mockResolvedValue({
|
|
378
|
-
sequence_number: "5",
|
|
379
|
-
authentication_key: "0xabc",
|
|
380
|
-
});
|
|
381
|
-
// After reset, fetching again should hit the API (not the cache).
|
|
382
|
-
await mgr.getAccount(TEST_ADDR);
|
|
383
|
-
expect(fakeApi.getAccount).toHaveBeenCalledTimes(1);
|
|
384
|
-
});
|
|
385
|
-
});
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2
|
-
import { mkdtempSync, rmSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import type { AddressInfo } from "node:net";
|
|
6
|
-
|
|
7
|
-
import { ForkServer } from "../server.js";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* F2 — ForkServer must not advertise `Access-Control-Allow-Origin: *`
|
|
11
|
-
* by default. Cached fork state may include account resources fetched
|
|
12
|
-
* from authenticated upstream nodes; any web page open in the dev's
|
|
13
|
-
* browser should not be able to read it through the loopback listener.
|
|
14
|
-
*
|
|
15
|
-
* Default contract:
|
|
16
|
-
* - No CORS header emitted unless the caller opts in via
|
|
17
|
-
* `corsAllowOrigins`.
|
|
18
|
-
* - When opted in, only requests whose `Origin` is in the allowlist
|
|
19
|
-
* receive a matching `Access-Control-Allow-Origin` (echo of origin,
|
|
20
|
-
* not `*`).
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
function makeForkDir(): string {
|
|
24
|
-
const dir = mkdtempSync(join(tmpdir(), "movehat-fork-cors-"));
|
|
25
|
-
mkdirSync(join(dir, "resources"), { recursive: true });
|
|
26
|
-
writeFileSync(
|
|
27
|
-
join(dir, "metadata.json"),
|
|
28
|
-
JSON.stringify({
|
|
29
|
-
network: "test",
|
|
30
|
-
nodeUrl: "http://example.invalid/v1",
|
|
31
|
-
chainId: 0,
|
|
32
|
-
ledgerVersion: "0",
|
|
33
|
-
timestamp: "0",
|
|
34
|
-
epoch: "0",
|
|
35
|
-
blockHeight: "0",
|
|
36
|
-
createdAt: new Date().toISOString(),
|
|
37
|
-
}),
|
|
38
|
-
);
|
|
39
|
-
writeFileSync(join(dir, "accounts.json"), "{}");
|
|
40
|
-
return dir;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function boundPort(server: ForkServer): number {
|
|
44
|
-
const internal = (server as unknown as {
|
|
45
|
-
server: { address(): AddressInfo };
|
|
46
|
-
}).server;
|
|
47
|
-
const addr = internal.address();
|
|
48
|
-
return addr.port;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async function fetchFromServer(
|
|
52
|
-
port: number,
|
|
53
|
-
origin?: string
|
|
54
|
-
): Promise<Response> {
|
|
55
|
-
const headers: Record<string, string> = {};
|
|
56
|
-
if (origin !== undefined) headers.Origin = origin;
|
|
57
|
-
return fetch(`http://127.0.0.1:${port}/v1/`, { headers });
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
describe("F2 — ForkServer CORS is closed by default", () => {
|
|
61
|
-
let forkDir: string;
|
|
62
|
-
let server: ForkServer | null = null;
|
|
63
|
-
|
|
64
|
-
beforeEach(() => {
|
|
65
|
-
forkDir = makeForkDir();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
afterEach(async () => {
|
|
69
|
-
if (server) {
|
|
70
|
-
await server.stop();
|
|
71
|
-
server = null;
|
|
72
|
-
}
|
|
73
|
-
rmSync(forkDir, { recursive: true, force: true });
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("does not emit Access-Control-Allow-Origin by default", async () => {
|
|
77
|
-
server = new ForkServer(forkDir, 0);
|
|
78
|
-
await server.start();
|
|
79
|
-
const port = boundPort(server);
|
|
80
|
-
|
|
81
|
-
const res = await fetchFromServer(port, "https://evil.example");
|
|
82
|
-
expect(res.status).toBe(200);
|
|
83
|
-
expect(res.headers.get("access-control-allow-origin")).toBeNull();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it("echoes only allow-listed origins when corsAllowOrigins is set", async () => {
|
|
87
|
-
server = new ForkServer(forkDir, 0, "127.0.0.1", {
|
|
88
|
-
corsAllowOrigins: ["https://trusted.example"],
|
|
89
|
-
});
|
|
90
|
-
await server.start();
|
|
91
|
-
const port = boundPort(server);
|
|
92
|
-
|
|
93
|
-
const allowed = await fetchFromServer(port, "https://trusted.example");
|
|
94
|
-
expect(allowed.headers.get("access-control-allow-origin")).toBe(
|
|
95
|
-
"https://trusted.example"
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
const denied = await fetchFromServer(port, "https://evil.example");
|
|
99
|
-
expect(denied.headers.get("access-control-allow-origin")).toBeNull();
|
|
100
|
-
});
|
|
101
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import { mkdtempSync, rmSync, mkdirSync, writeFileSync } from "fs";
|
|
3
|
-
import { tmpdir } from "os";
|
|
4
|
-
import { join } from "path";
|
|
5
|
-
import { AddressInfo } from "net";
|
|
6
|
-
import { ForkServer } from "../server.js";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Helper to set up a minimal fork directory so ForkServer.start() succeeds.
|
|
10
|
-
*/
|
|
11
|
-
function makeForkDir(): string {
|
|
12
|
-
const dir = mkdtempSync(join(tmpdir(), "movehat-fork-server-"));
|
|
13
|
-
mkdirSync(join(dir, "resources"), { recursive: true });
|
|
14
|
-
writeFileSync(
|
|
15
|
-
join(dir, "metadata.json"),
|
|
16
|
-
JSON.stringify({
|
|
17
|
-
network: "test",
|
|
18
|
-
nodeUrl: "http://example.invalid/v1",
|
|
19
|
-
chainId: 0,
|
|
20
|
-
ledgerVersion: "0",
|
|
21
|
-
timestamp: "0",
|
|
22
|
-
epoch: "0",
|
|
23
|
-
blockHeight: "0",
|
|
24
|
-
createdAt: new Date().toISOString(),
|
|
25
|
-
}),
|
|
26
|
-
);
|
|
27
|
-
writeFileSync(join(dir, "accounts.json"), "{}");
|
|
28
|
-
return dir;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
describe("ForkServer", () => {
|
|
32
|
-
let forkDir: string;
|
|
33
|
-
let server: ForkServer | null = null;
|
|
34
|
-
|
|
35
|
-
beforeEach(() => {
|
|
36
|
-
forkDir = makeForkDir();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
afterEach(async () => {
|
|
40
|
-
if (server) {
|
|
41
|
-
await server.stop();
|
|
42
|
-
server = null;
|
|
43
|
-
}
|
|
44
|
-
rmSync(forkDir, { recursive: true, force: true });
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("binds to 127.0.0.1 by default", async () => {
|
|
48
|
-
// Port 0 lets the OS pick a free port.
|
|
49
|
-
server = new ForkServer(forkDir, 0);
|
|
50
|
-
await server.start();
|
|
51
|
-
|
|
52
|
-
const internal = (server as unknown as { server: { address(): AddressInfo } }).server;
|
|
53
|
-
const addr = internal.address();
|
|
54
|
-
expect(addr.address).toBe("127.0.0.1");
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("respects a custom host argument (::1)", async () => {
|
|
58
|
-
server = new ForkServer(forkDir, 0, "::1");
|
|
59
|
-
await server.start();
|
|
60
|
-
|
|
61
|
-
const internal = (server as unknown as { server: { address(): AddressInfo } }).server;
|
|
62
|
-
const addr = internal.address();
|
|
63
|
-
expect(addr.address).toBe("::1");
|
|
64
|
-
});
|
|
65
|
-
});
|