movehat 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -1
- package/dist/commands/compile.d.ts +0 -1
- package/dist/commands/compile.js +0 -1
- package/dist/commands/fork/create.d.ts +1 -1
- package/dist/commands/fork/create.js +18 -3
- package/dist/commands/fork/fund.d.ts +0 -1
- package/dist/commands/fork/fund.js +0 -1
- package/dist/commands/fork/list.d.ts +0 -1
- package/dist/commands/fork/list.js +0 -1
- package/dist/commands/fork/serve.d.ts +0 -1
- package/dist/commands/fork/serve.js +0 -1
- package/dist/commands/fork/view-resource.d.ts +0 -1
- package/dist/commands/fork/view-resource.js +0 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +0 -1
- package/dist/commands/run.d.ts +17 -1
- package/dist/commands/run.js +46 -33
- package/dist/commands/test-move.d.ts +0 -1
- package/dist/commands/test-move.js +0 -1
- package/dist/commands/test.d.ts +0 -1
- package/dist/commands/test.js +8 -1
- package/dist/commands/update.d.ts +0 -1
- package/dist/commands/update.js +0 -1
- package/dist/core/AccountManager.d.ts +15 -2
- package/dist/core/AccountManager.js +32 -20
- package/dist/core/Publisher.d.ts +0 -1
- package/dist/core/Publisher.js +0 -1
- package/dist/core/config.d.ts +0 -1
- package/dist/core/config.js +109 -28
- package/dist/core/contract.d.ts +0 -1
- package/dist/core/contract.js +0 -1
- package/dist/core/deployments.d.ts +0 -1
- package/dist/core/deployments.js +0 -1
- package/dist/core/movementProfile.d.ts +0 -1
- package/dist/core/movementProfile.js +0 -1
- package/dist/core/shell.d.ts +0 -1
- package/dist/core/shell.js +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/fork/api.d.ts +24 -1
- package/dist/fork/api.js +95 -1
- package/dist/fork/manager.d.ts +14 -1
- package/dist/fork/manager.js +19 -1
- package/dist/fork/server.d.ts +19 -1
- package/dist/fork/server.js +188 -8
- package/dist/fork/storage.d.ts +0 -1
- package/dist/fork/storage.js +50 -32
- package/dist/fork/test.d.ts +0 -1
- package/dist/fork/test.js +0 -1
- package/dist/harness/Harness.d.ts +0 -1
- package/dist/harness/Harness.js +6 -2
- package/dist/harness/codeObject.d.ts +0 -1
- package/dist/harness/codeObject.js +0 -1
- package/dist/harness/errors.d.ts +0 -1
- package/dist/harness/errors.js +0 -1
- package/dist/harness/index.d.ts +0 -1
- package/dist/harness/index.js +0 -1
- package/dist/harness/proxy.d.ts +12 -1
- package/dist/harness/proxy.js +23 -1
- package/dist/harness/script.d.ts +0 -1
- package/dist/harness/script.js +0 -1
- package/dist/harness/view.d.ts +0 -1
- package/dist/harness/view.js +0 -1
- package/dist/helpers/assertions.d.ts +0 -1
- package/dist/helpers/assertions.js +0 -1
- package/dist/helpers/banner.d.ts +0 -1
- package/dist/helpers/banner.js +0 -1
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/index.js +0 -1
- package/dist/helpers/move-tests.d.ts +0 -1
- package/dist/helpers/move-tests.js +0 -1
- package/dist/helpers/npm-registry.d.ts +0 -1
- package/dist/helpers/npm-registry.js +0 -1
- package/dist/helpers/semver-utils.d.ts +0 -1
- package/dist/helpers/semver-utils.js +0 -1
- package/dist/helpers/setup.d.ts +0 -1
- package/dist/helpers/setup.js +0 -1
- package/dist/helpers/setupLocalTesting.d.ts +2 -5
- package/dist/helpers/setupLocalTesting.js +0 -1
- package/dist/helpers/testFixtures.d.ts +0 -1
- package/dist/helpers/testFixtures.js +0 -1
- package/dist/helpers/version-check.d.ts +0 -1
- package/dist/helpers/version-check.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/node/LocalNodeManager.d.ts +0 -1
- package/dist/node/LocalNodeManager.js +4 -2
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.js +0 -1
- package/dist/types/config.d.ts +0 -1
- package/dist/types/config.js +0 -1
- package/dist/types/fork.d.ts +0 -1
- package/dist/types/fork.js +0 -1
- package/dist/types/harness.d.ts +0 -1
- package/dist/types/harness.js +0 -1
- package/dist/types/runtime.d.ts +0 -1
- package/dist/types/runtime.js +0 -1
- package/dist/ui/colors.d.ts +0 -1
- package/dist/ui/colors.js +0 -1
- package/dist/ui/formatters.d.ts +0 -1
- package/dist/ui/formatters.js +0 -1
- package/dist/ui/index.d.ts +0 -1
- package/dist/ui/index.js +0 -1
- package/dist/ui/logger.d.ts +0 -1
- package/dist/ui/logger.js +0 -1
- package/dist/ui/spinner.d.ts +0 -1
- package/dist/ui/spinner.js +0 -1
- package/dist/ui/symbols.d.ts +0 -1
- package/dist/ui/symbols.js +0 -1
- package/dist/ui/table.d.ts +0 -1
- package/dist/ui/table.js +0 -1
- package/dist/utils/address.d.ts +0 -1
- package/dist/utils/address.js +0 -1
- package/dist/utils/childProcessAdapter.d.ts +0 -1
- package/dist/utils/childProcessAdapter.js +46 -20
- package/dist/utils/movementCli.d.ts +5 -0
- package/dist/utils/movementCli.js +91 -0
- package/dist/utils/parseCliOutput.d.ts +6 -4
- package/dist/utils/parseCliOutput.js +10 -6
- package/dist/utils/redact.d.ts +3 -3
- package/dist/utils/redact.js +6 -5
- package/dist/utils/runCli.d.ts +0 -1
- package/dist/utils/runCli.js +10 -2
- package/package.json +4 -4
- package/dist/__tests__/deployContract.test.d.ts +0 -2
- package/dist/__tests__/deployContract.test.d.ts.map +0 -1
- package/dist/__tests__/deployContract.test.js +0 -377
- package/dist/__tests__/deployContract.test.js.map +0 -1
- package/dist/__tests__/errors.test.d.ts +0 -2
- package/dist/__tests__/errors.test.d.ts.map +0 -1
- package/dist/__tests__/errors.test.js +0 -46
- package/dist/__tests__/errors.test.js.map +0 -1
- package/dist/__tests__/exports.test.d.ts +0 -2
- package/dist/__tests__/exports.test.d.ts.map +0 -1
- package/dist/__tests__/exports.test.js +0 -30
- package/dist/__tests__/exports.test.js.map +0 -1
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts +0 -25
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts.map +0 -1
- package/dist/__tests__/fixtures/sigint-deploy-harness.js +0 -83
- package/dist/__tests__/fixtures/sigint-deploy-harness.js.map +0 -1
- package/dist/__tests__/fork/api.test.d.ts +0 -2
- package/dist/__tests__/fork/api.test.d.ts.map +0 -1
- package/dist/__tests__/fork/api.test.js +0 -115
- package/dist/__tests__/fork/api.test.js.map +0 -1
- package/dist/__tests__/fork/api.timeout.test.d.ts +0 -2
- package/dist/__tests__/fork/api.timeout.test.d.ts.map +0 -1
- package/dist/__tests__/fork/api.timeout.test.js +0 -98
- package/dist/__tests__/fork/api.timeout.test.js.map +0 -1
- package/dist/__tests__/harness/Harness.createLive.test.d.ts +0 -2
- package/dist/__tests__/harness/Harness.createLive.test.d.ts.map +0 -1
- package/dist/__tests__/harness/Harness.createLive.test.js +0 -53
- package/dist/__tests__/harness/Harness.createLive.test.js.map +0 -1
- package/dist/__tests__/harness/Harness.proxy.test.d.ts +0 -2
- package/dist/__tests__/harness/Harness.proxy.test.d.ts.map +0 -1
- package/dist/__tests__/harness/Harness.proxy.test.js +0 -89
- package/dist/__tests__/harness/Harness.proxy.test.js.map +0 -1
- package/dist/__tests__/harness/_fixture.d.ts +0 -54
- package/dist/__tests__/harness/_fixture.d.ts.map +0 -1
- package/dist/__tests__/harness/_fixture.js +0 -69
- package/dist/__tests__/harness/_fixture.js.map +0 -1
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts +0 -2
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts.map +0 -1
- package/dist/__tests__/harness/codeObject.deploy.test.js +0 -288
- package/dist/__tests__/harness/codeObject.deploy.test.js.map +0 -1
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts +0 -2
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts.map +0 -1
- package/dist/__tests__/harness/codeObject.upgrade.test.js +0 -138
- package/dist/__tests__/harness/codeObject.upgrade.test.js.map +0 -1
- package/dist/__tests__/harness/script.test.d.ts +0 -2
- package/dist/__tests__/harness/script.test.d.ts.map +0 -1
- package/dist/__tests__/harness/script.test.js +0 -219
- package/dist/__tests__/harness/script.test.js.map +0 -1
- package/dist/__tests__/harness/view.test.d.ts +0 -2
- package/dist/__tests__/harness/view.test.d.ts.map +0 -1
- package/dist/__tests__/harness/view.test.js +0 -92
- package/dist/__tests__/harness/view.test.js.map +0 -1
- package/dist/__tests__/runtime.test.d.ts +0 -2
- package/dist/__tests__/runtime.test.d.ts.map +0 -1
- package/dist/__tests__/runtime.test.js +0 -141
- package/dist/__tests__/runtime.test.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/__tests__/compile.test.d.ts +0 -2
- package/dist/commands/__tests__/compile.test.d.ts.map +0 -1
- package/dist/commands/__tests__/compile.test.js +0 -351
- package/dist/commands/__tests__/compile.test.js.map +0 -1
- package/dist/commands/__tests__/compile.toml-mutation.test.d.ts +0 -2
- package/dist/commands/__tests__/compile.toml-mutation.test.d.ts.map +0 -1
- package/dist/commands/__tests__/compile.toml-mutation.test.js +0 -69
- package/dist/commands/__tests__/compile.toml-mutation.test.js.map +0 -1
- package/dist/commands/__tests__/init.test.d.ts +0 -2
- package/dist/commands/__tests__/init.test.d.ts.map +0 -1
- package/dist/commands/__tests__/init.test.js +0 -163
- package/dist/commands/__tests__/init.test.js.map +0 -1
- package/dist/commands/__tests__/run.test.d.ts +0 -2
- package/dist/commands/__tests__/run.test.d.ts.map +0 -1
- package/dist/commands/__tests__/run.test.js +0 -166
- package/dist/commands/__tests__/run.test.js.map +0 -1
- package/dist/commands/__tests__/test-move.test.d.ts +0 -2
- package/dist/commands/__tests__/test-move.test.d.ts.map +0 -1
- package/dist/commands/__tests__/test-move.test.js +0 -59
- package/dist/commands/__tests__/test-move.test.js.map +0 -1
- package/dist/commands/__tests__/test.test.d.ts +0 -2
- package/dist/commands/__tests__/test.test.d.ts.map +0 -1
- package/dist/commands/__tests__/test.test.js +0 -168
- package/dist/commands/__tests__/test.test.js.map +0 -1
- package/dist/commands/__tests__/update.test.d.ts +0 -2
- package/dist/commands/__tests__/update.test.d.ts.map +0 -1
- package/dist/commands/__tests__/update.test.js +0 -176
- package/dist/commands/__tests__/update.test.js.map +0 -1
- package/dist/commands/compile.d.ts.map +0 -1
- package/dist/commands/compile.js.map +0 -1
- package/dist/commands/fork/__tests__/create.test.d.ts +0 -2
- package/dist/commands/fork/__tests__/create.test.d.ts.map +0 -1
- package/dist/commands/fork/__tests__/create.test.js +0 -108
- package/dist/commands/fork/__tests__/create.test.js.map +0 -1
- package/dist/commands/fork/__tests__/fund.test.d.ts +0 -2
- package/dist/commands/fork/__tests__/fund.test.d.ts.map +0 -1
- package/dist/commands/fork/__tests__/fund.test.js +0 -72
- package/dist/commands/fork/__tests__/fund.test.js.map +0 -1
- package/dist/commands/fork/__tests__/list.test.d.ts +0 -2
- package/dist/commands/fork/__tests__/list.test.d.ts.map +0 -1
- package/dist/commands/fork/__tests__/list.test.js +0 -119
- package/dist/commands/fork/__tests__/list.test.js.map +0 -1
- package/dist/commands/fork/__tests__/serve.test.d.ts +0 -2
- package/dist/commands/fork/__tests__/serve.test.d.ts.map +0 -1
- package/dist/commands/fork/__tests__/serve.test.js +0 -97
- package/dist/commands/fork/__tests__/serve.test.js.map +0 -1
- package/dist/commands/fork/__tests__/view-resource.test.d.ts +0 -2
- package/dist/commands/fork/__tests__/view-resource.test.d.ts.map +0 -1
- package/dist/commands/fork/__tests__/view-resource.test.js +0 -77
- package/dist/commands/fork/__tests__/view-resource.test.js.map +0 -1
- package/dist/commands/fork/create.d.ts.map +0 -1
- package/dist/commands/fork/create.js.map +0 -1
- package/dist/commands/fork/fund.d.ts.map +0 -1
- package/dist/commands/fork/fund.js.map +0 -1
- package/dist/commands/fork/list.d.ts.map +0 -1
- package/dist/commands/fork/list.js.map +0 -1
- package/dist/commands/fork/serve.d.ts.map +0 -1
- package/dist/commands/fork/serve.js.map +0 -1
- package/dist/commands/fork/view-resource.d.ts.map +0 -1
- package/dist/commands/fork/view-resource.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/test-move.d.ts.map +0 -1
- package/dist/commands/test-move.js.map +0 -1
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/update.d.ts.map +0 -1
- package/dist/commands/update.js.map +0 -1
- package/dist/core/AccountManager.d.ts.map +0 -1
- package/dist/core/AccountManager.js.map +0 -1
- package/dist/core/Publisher.d.ts.map +0 -1
- package/dist/core/Publisher.js.map +0 -1
- package/dist/core/__tests__/AccountManager.global-state.test.d.ts +0 -2
- package/dist/core/__tests__/AccountManager.global-state.test.d.ts.map +0 -1
- package/dist/core/__tests__/AccountManager.global-state.test.js +0 -69
- package/dist/core/__tests__/AccountManager.global-state.test.js.map +0 -1
- package/dist/core/__tests__/AccountManager.test.d.ts +0 -2
- package/dist/core/__tests__/AccountManager.test.d.ts.map +0 -1
- package/dist/core/__tests__/AccountManager.test.js +0 -239
- package/dist/core/__tests__/AccountManager.test.js.map +0 -1
- package/dist/core/__tests__/config.test.d.ts +0 -2
- package/dist/core/__tests__/config.test.d.ts.map +0 -1
- package/dist/core/__tests__/config.test.js +0 -311
- package/dist/core/__tests__/config.test.js.map +0 -1
- package/dist/core/__tests__/deployments.test.d.ts +0 -2
- package/dist/core/__tests__/deployments.test.d.ts.map +0 -1
- package/dist/core/__tests__/deployments.test.js +0 -201
- package/dist/core/__tests__/deployments.test.js.map +0 -1
- package/dist/core/__tests__/movementProfile.test.d.ts +0 -2
- package/dist/core/__tests__/movementProfile.test.d.ts.map +0 -1
- package/dist/core/__tests__/movementProfile.test.js +0 -112
- package/dist/core/__tests__/movementProfile.test.js.map +0 -1
- package/dist/core/__tests__/shell.test.d.ts +0 -2
- package/dist/core/__tests__/shell.test.d.ts.map +0 -1
- package/dist/core/__tests__/shell.test.js +0 -107
- package/dist/core/__tests__/shell.test.js.map +0 -1
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js.map +0 -1
- package/dist/core/contract.d.ts.map +0 -1
- package/dist/core/contract.js.map +0 -1
- package/dist/core/deployments.d.ts.map +0 -1
- package/dist/core/deployments.js.map +0 -1
- package/dist/core/movementProfile.d.ts.map +0 -1
- package/dist/core/movementProfile.js.map +0 -1
- package/dist/core/shell.d.ts.map +0 -1
- package/dist/core/shell.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/fork/__tests__/manager.test.d.ts +0 -2
- package/dist/fork/__tests__/manager.test.d.ts.map +0 -1
- package/dist/fork/__tests__/manager.test.js +0 -309
- package/dist/fork/__tests__/manager.test.js.map +0 -1
- package/dist/fork/__tests__/server.cors.test.d.ts +0 -2
- package/dist/fork/__tests__/server.cors.test.d.ts.map +0 -1
- package/dist/fork/__tests__/server.cors.test.js +0 -79
- package/dist/fork/__tests__/server.cors.test.js.map +0 -1
- package/dist/fork/__tests__/server.test.d.ts +0 -2
- package/dist/fork/__tests__/server.test.d.ts.map +0 -1
- package/dist/fork/__tests__/server.test.js +0 -54
- package/dist/fork/__tests__/server.test.js.map +0 -1
- package/dist/fork/__tests__/storage.test.d.ts +0 -2
- package/dist/fork/__tests__/storage.test.d.ts.map +0 -1
- package/dist/fork/__tests__/storage.test.js +0 -222
- package/dist/fork/__tests__/storage.test.js.map +0 -1
- package/dist/fork/__tests__/test.test.d.ts +0 -2
- package/dist/fork/__tests__/test.test.d.ts.map +0 -1
- package/dist/fork/__tests__/test.test.js +0 -81
- package/dist/fork/__tests__/test.test.js.map +0 -1
- package/dist/fork/api.d.ts.map +0 -1
- package/dist/fork/api.js.map +0 -1
- package/dist/fork/manager.d.ts.map +0 -1
- package/dist/fork/manager.js.map +0 -1
- package/dist/fork/server.d.ts.map +0 -1
- package/dist/fork/server.js.map +0 -1
- package/dist/fork/storage.d.ts.map +0 -1
- package/dist/fork/storage.js.map +0 -1
- package/dist/fork/test.d.ts.map +0 -1
- package/dist/fork/test.js.map +0 -1
- package/dist/harness/Harness.d.ts.map +0 -1
- package/dist/harness/Harness.js.map +0 -1
- package/dist/harness/codeObject.d.ts.map +0 -1
- package/dist/harness/codeObject.js.map +0 -1
- package/dist/harness/errors.d.ts.map +0 -1
- package/dist/harness/errors.js.map +0 -1
- package/dist/harness/index.d.ts.map +0 -1
- package/dist/harness/index.js.map +0 -1
- package/dist/harness/proxy.d.ts.map +0 -1
- package/dist/harness/proxy.js.map +0 -1
- package/dist/harness/script.d.ts.map +0 -1
- package/dist/harness/script.js.map +0 -1
- package/dist/harness/view.d.ts.map +0 -1
- package/dist/harness/view.js.map +0 -1
- package/dist/helpers/__tests__/semver-utils.test.d.ts +0 -2
- package/dist/helpers/__tests__/semver-utils.test.d.ts.map +0 -1
- package/dist/helpers/__tests__/semver-utils.test.js +0 -103
- package/dist/helpers/__tests__/semver-utils.test.js.map +0 -1
- package/dist/helpers/__tests__/setupLocalTesting.fork-network.test.d.ts +0 -2
- package/dist/helpers/__tests__/setupLocalTesting.fork-network.test.d.ts.map +0 -1
- package/dist/helpers/__tests__/setupLocalTesting.fork-network.test.js +0 -172
- package/dist/helpers/__tests__/setupLocalTesting.fork-network.test.js.map +0 -1
- package/dist/helpers/assertions.d.ts.map +0 -1
- package/dist/helpers/assertions.js.map +0 -1
- package/dist/helpers/banner.d.ts.map +0 -1
- package/dist/helpers/banner.js.map +0 -1
- package/dist/helpers/index.d.ts.map +0 -1
- package/dist/helpers/index.js.map +0 -1
- package/dist/helpers/move-tests.d.ts.map +0 -1
- package/dist/helpers/move-tests.js.map +0 -1
- package/dist/helpers/npm-registry.d.ts.map +0 -1
- package/dist/helpers/npm-registry.js.map +0 -1
- package/dist/helpers/semver-utils.d.ts.map +0 -1
- package/dist/helpers/semver-utils.js.map +0 -1
- package/dist/helpers/setup.d.ts.map +0 -1
- package/dist/helpers/setup.js.map +0 -1
- package/dist/helpers/setupLocalTesting.d.ts.map +0 -1
- package/dist/helpers/setupLocalTesting.js.map +0 -1
- package/dist/helpers/testFixtures.d.ts.map +0 -1
- package/dist/helpers/testFixtures.js.map +0 -1
- package/dist/helpers/version-check.d.ts.map +0 -1
- package/dist/helpers/version-check.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/node/LocalNodeManager.d.ts.map +0 -1
- package/dist/node/LocalNodeManager.js.map +0 -1
- package/dist/node/__tests__/LocalNodeManager.api-port.test.d.ts +0 -2
- package/dist/node/__tests__/LocalNodeManager.api-port.test.d.ts.map +0 -1
- package/dist/node/__tests__/LocalNodeManager.api-port.test.js +0 -55
- package/dist/node/__tests__/LocalNodeManager.api-port.test.js.map +0 -1
- package/dist/node/__tests__/LocalNodeManager.test.d.ts +0 -2
- package/dist/node/__tests__/LocalNodeManager.test.d.ts.map +0 -1
- package/dist/node/__tests__/LocalNodeManager.test.js +0 -449
- package/dist/node/__tests__/LocalNodeManager.test.js.map +0 -1
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js.map +0 -1
- package/dist/types/fork.d.ts.map +0 -1
- package/dist/types/fork.js.map +0 -1
- package/dist/types/harness.d.ts.map +0 -1
- package/dist/types/harness.js.map +0 -1
- package/dist/types/runtime.d.ts.map +0 -1
- package/dist/types/runtime.js.map +0 -1
- package/dist/ui/__tests__/colors.test.d.ts +0 -2
- package/dist/ui/__tests__/colors.test.d.ts.map +0 -1
- package/dist/ui/__tests__/colors.test.js +0 -127
- package/dist/ui/__tests__/colors.test.js.map +0 -1
- package/dist/ui/__tests__/logger.test.d.ts +0 -2
- package/dist/ui/__tests__/logger.test.d.ts.map +0 -1
- package/dist/ui/__tests__/logger.test.js +0 -75
- package/dist/ui/__tests__/logger.test.js.map +0 -1
- package/dist/ui/colors.d.ts.map +0 -1
- package/dist/ui/colors.js.map +0 -1
- package/dist/ui/formatters.d.ts.map +0 -1
- package/dist/ui/formatters.js.map +0 -1
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/logger.d.ts.map +0 -1
- package/dist/ui/logger.js.map +0 -1
- package/dist/ui/spinner.d.ts.map +0 -1
- package/dist/ui/spinner.js.map +0 -1
- package/dist/ui/symbols.d.ts.map +0 -1
- package/dist/ui/symbols.js.map +0 -1
- package/dist/ui/table.d.ts.map +0 -1
- package/dist/ui/table.js.map +0 -1
- package/dist/utils/__tests__/address.test.d.ts +0 -2
- package/dist/utils/__tests__/address.test.d.ts.map +0 -1
- package/dist/utils/__tests__/address.test.js +0 -70
- package/dist/utils/__tests__/address.test.js.map +0 -1
- package/dist/utils/__tests__/childProcessAdapter.maxBuffer.test.d.ts +0 -2
- package/dist/utils/__tests__/childProcessAdapter.maxBuffer.test.d.ts.map +0 -1
- package/dist/utils/__tests__/childProcessAdapter.maxBuffer.test.js +0 -43
- package/dist/utils/__tests__/childProcessAdapter.maxBuffer.test.js.map +0 -1
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts +0 -2
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts.map +0 -1
- package/dist/utils/__tests__/childProcessAdapter.test.js +0 -217
- package/dist/utils/__tests__/childProcessAdapter.test.js.map +0 -1
- package/dist/utils/__tests__/runCli.test.d.ts +0 -2
- package/dist/utils/__tests__/runCli.test.d.ts.map +0 -1
- package/dist/utils/__tests__/runCli.test.js +0 -187
- package/dist/utils/__tests__/runCli.test.js.map +0 -1
- package/dist/utils/address.d.ts.map +0 -1
- package/dist/utils/address.js.map +0 -1
- package/dist/utils/childProcessAdapter.d.ts.map +0 -1
- package/dist/utils/childProcessAdapter.js.map +0 -1
- package/dist/utils/parseCliOutput.d.ts.map +0 -1
- package/dist/utils/parseCliOutput.js.map +0 -1
- package/dist/utils/redact.d.ts.map +0 -1
- package/dist/utils/redact.js.map +0 -1
- package/dist/utils/runCli.d.ts.map +0 -1
- package/dist/utils/runCli.js.map +0 -1
- package/src/__tests__/deployContract.test.ts +0 -438
- package/src/__tests__/errors.test.ts +0 -84
- package/src/__tests__/exports.test.ts +0 -32
- package/src/__tests__/fixtures/sigint-deploy-harness.ts +0 -96
- package/src/__tests__/fork/api.test.ts +0 -148
- package/src/__tests__/fork/api.timeout.test.ts +0 -150
- package/src/__tests__/harness/Harness.createLive.test.ts +0 -57
- package/src/__tests__/harness/Harness.proxy.test.ts +0 -111
- package/src/__tests__/harness/_fixture.ts +0 -131
- package/src/__tests__/harness/codeObject.deploy.test.ts +0 -319
- package/src/__tests__/harness/codeObject.upgrade.test.ts +0 -156
- package/src/__tests__/harness/script.test.ts +0 -245
- package/src/__tests__/harness/view.test.ts +0 -104
- package/src/__tests__/runtime.test.ts +0 -182
- package/src/cli.ts +0 -164
- package/src/commands/__tests__/compile.test.ts +0 -407
- package/src/commands/__tests__/compile.toml-mutation.test.ts +0 -77
- package/src/commands/__tests__/init.test.ts +0 -210
- package/src/commands/__tests__/run.test.ts +0 -192
- package/src/commands/__tests__/test-move.test.ts +0 -81
- package/src/commands/__tests__/test.test.ts +0 -204
- package/src/commands/__tests__/update.test.ts +0 -223
- package/src/commands/compile.ts +0 -339
- package/src/commands/fork/__tests__/create.test.ts +0 -132
- package/src/commands/fork/__tests__/fund.test.ts +0 -104
- package/src/commands/fork/__tests__/list.test.ts +0 -139
- package/src/commands/fork/__tests__/serve.test.ts +0 -121
- package/src/commands/fork/__tests__/view-resource.test.ts +0 -101
- package/src/commands/fork/create.ts +0 -110
- package/src/commands/fork/fund.ts +0 -64
- package/src/commands/fork/list.ts +0 -98
- package/src/commands/fork/serve.ts +0 -80
- package/src/commands/fork/view-resource.ts +0 -51
- package/src/commands/init.ts +0 -264
- package/src/commands/run.ts +0 -125
- package/src/commands/test-move.ts +0 -27
- package/src/commands/test.ts +0 -255
- package/src/commands/update.ts +0 -201
- package/src/core/AccountManager.ts +0 -457
- package/src/core/Publisher.ts +0 -310
- package/src/core/__tests__/AccountManager.global-state.test.ts +0 -83
- package/src/core/__tests__/AccountManager.test.ts +0 -290
- package/src/core/__tests__/config.test.ts +0 -377
- package/src/core/__tests__/deployments.test.ts +0 -247
- package/src/core/__tests__/movementProfile.test.ts +0 -131
- package/src/core/__tests__/shell.test.ts +0 -138
- package/src/core/config.ts +0 -286
- package/src/core/contract.ts +0 -103
- package/src/core/deployments.ts +0 -155
- package/src/core/movementProfile.ts +0 -127
- package/src/core/shell.ts +0 -86
- package/src/errors.ts +0 -81
- package/src/fork/__tests__/manager.test.ts +0 -385
- package/src/fork/__tests__/server.cors.test.ts +0 -101
- package/src/fork/__tests__/server.test.ts +0 -65
- package/src/fork/__tests__/storage.test.ts +0 -281
- package/src/fork/__tests__/test.test.ts +0 -97
- package/src/fork/api.ts +0 -190
- package/src/fork/manager.ts +0 -343
- package/src/fork/server.ts +0 -380
- package/src/fork/storage.ts +0 -253
- package/src/fork/test.ts +0 -221
- package/src/harness/Harness.ts +0 -231
- package/src/harness/codeObject.ts +0 -381
- package/src/harness/errors.ts +0 -22
- package/src/harness/index.ts +0 -3
- package/src/harness/proxy.ts +0 -40
- package/src/harness/script.ts +0 -200
- package/src/harness/view.ts +0 -34
- package/src/helpers/__tests__/semver-utils.test.ts +0 -121
- package/src/helpers/__tests__/setupLocalTesting.fork-network.test.ts +0 -212
- package/src/helpers/assertions.ts +0 -29
- package/src/helpers/banner.ts +0 -63
- package/src/helpers/index.ts +0 -37
- package/src/helpers/move-tests.ts +0 -72
- package/src/helpers/npm-registry.ts +0 -72
- package/src/helpers/semver-utils.ts +0 -54
- package/src/helpers/setup.ts +0 -54
- package/src/helpers/setupLocalTesting.ts +0 -387
- package/src/helpers/testFixtures.ts +0 -210
- package/src/helpers/version-check.ts +0 -114
- package/src/index.ts +0 -30
- package/src/node/LocalNodeManager.ts +0 -383
- package/src/node/__tests__/LocalNodeManager.api-port.test.ts +0 -62
- package/src/node/__tests__/LocalNodeManager.test.ts +0 -579
- package/src/runtime.ts +0 -157
- package/src/templates/.env.example +0 -9
- package/src/templates/.mocharc.json +0 -8
- package/src/templates/.vscode/settings.json +0 -11
- package/src/templates/README.md +0 -146
- package/src/templates/gitignore +0 -22
- package/src/templates/move/Move.toml +0 -19
- package/src/templates/move/sources/Counter.move +0 -96
- package/src/templates/movehat.config.ts +0 -57
- package/src/templates/package.json +0 -27
- package/src/templates/scripts/deploy-counter.ts +0 -66
- package/src/templates/tests/Counter.test.ts +0 -113
- package/src/templates/tsconfig.json +0 -15
- package/src/templates/types/movehat.d.ts +0 -101
- package/src/types/config.ts +0 -83
- package/src/types/fork.ts +0 -47
- package/src/types/harness.ts +0 -182
- package/src/types/runtime.ts +0 -57
- package/src/ui/__tests__/colors.test.ts +0 -156
- package/src/ui/__tests__/logger.test.ts +0 -89
- package/src/ui/colors.ts +0 -144
- package/src/ui/formatters.ts +0 -246
- package/src/ui/index.ts +0 -62
- package/src/ui/logger.ts +0 -310
- package/src/ui/spinner.ts +0 -218
- package/src/ui/symbols.ts +0 -80
- package/src/ui/table.ts +0 -191
- package/src/utils/__tests__/address.test.ts +0 -93
- package/src/utils/__tests__/childProcessAdapter.maxBuffer.test.ts +0 -51
- package/src/utils/__tests__/childProcessAdapter.test.ts +0 -266
- package/src/utils/__tests__/runCli.test.ts +0 -240
- package/src/utils/address.ts +0 -52
- package/src/utils/childProcessAdapter.ts +0 -244
- package/src/utils/parseCliOutput.ts +0 -27
- package/src/utils/redact.ts +0 -24
- package/src/utils/runCli.ts +0 -64
package/dist/core/config.js
CHANGED
|
@@ -13,6 +13,45 @@ import { logger } from "../ui/index.js";
|
|
|
13
13
|
// same value here. No corruption, no in-flight-promise memoization
|
|
14
14
|
// needed.
|
|
15
15
|
const configCache = new Map();
|
|
16
|
+
// In-flight load deduplication (#47). When two callers hit a cold cache
|
|
17
|
+
// for the same config file concurrently, both would invoke
|
|
18
|
+
// `register()` from `tsx/esm/api` and race on the unregister cleanup.
|
|
19
|
+
// The dedup map ensures only ONE load runs per (path, mtime) burst —
|
|
20
|
+
// concurrent callers await the same Promise. Cleared after the load
|
|
21
|
+
// settles so a later edit (new mtime) can re-trigger a cold load.
|
|
22
|
+
const inFlightLoads = new Map();
|
|
23
|
+
// Hostnames recognized as safe targets for the deterministic test key
|
|
24
|
+
// auto-injection. Any URL whose hostname is not in this set causes the
|
|
25
|
+
// test-key path to be skipped even if the network NAME is 'testnet' or
|
|
26
|
+
// 'local' (#40 — name-only gating was spoofable when users named a
|
|
27
|
+
// production-pointing network 'testnet').
|
|
28
|
+
const TEST_ENDPOINT_HOSTS = new Set([
|
|
29
|
+
"testnet.movementnetwork.xyz",
|
|
30
|
+
"localhost",
|
|
31
|
+
"127.0.0.1",
|
|
32
|
+
"::1",
|
|
33
|
+
]);
|
|
34
|
+
function isKnownTestEndpoint(url) {
|
|
35
|
+
try {
|
|
36
|
+
return TEST_ENDPOINT_HOSTS.has(new URL(url).hostname.toLowerCase());
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Render a URL for log output without exposing userinfo (`user:pass@`)
|
|
43
|
+
// or query strings (`?apiKey=…`). Returns the protocol + host + pathname
|
|
44
|
+
// only, which is enough for the operator to identify the endpoint
|
|
45
|
+
// without leaking embedded credentials to CI logs.
|
|
46
|
+
function sanitizeUrlForLog(url) {
|
|
47
|
+
try {
|
|
48
|
+
const parsed = new URL(url);
|
|
49
|
+
return `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return "<invalid-url>";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
16
55
|
/**
|
|
17
56
|
* Loads the user's movehat.config.{ts,js} from the current working directory.
|
|
18
57
|
*
|
|
@@ -47,32 +86,58 @@ export async function loadUserConfig() {
|
|
|
47
86
|
if (cached && cached.mtimeMs === mtimeMs) {
|
|
48
87
|
return cached.config;
|
|
49
88
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
89
|
+
// Dedup concurrent cold-cache loads of the same file (#47).
|
|
90
|
+
// Without this, two callers race on tsx's register/unregister and
|
|
91
|
+
// the second may run its `await import()` after the first calls
|
|
92
|
+
// unregister(), removing the loader mid-flight. All callers go
|
|
93
|
+
// through the same `return await loadPromise` below so the outer
|
|
94
|
+
// try/catch wraps a consistent error regardless of who started the
|
|
95
|
+
// load.
|
|
96
|
+
let loadPromise = inFlightLoads.get(configPath);
|
|
97
|
+
if (!loadPromise) {
|
|
98
|
+
loadPromise = doLoadConfig(configPath, mtimeMs);
|
|
99
|
+
inFlightLoads.set(configPath, loadPromise);
|
|
100
|
+
// Clean up after settles. `.catch(() => undefined)` after the
|
|
101
|
+
// finally chain swallows the cleanup-promise rejection so it
|
|
102
|
+
// does not become an unhandled rejection — the actual awaiters
|
|
103
|
+
// still see the original rejection via `return await loadPromise`.
|
|
104
|
+
void loadPromise
|
|
105
|
+
.finally(() => {
|
|
106
|
+
if (inFlightLoads.get(configPath) === loadPromise) {
|
|
107
|
+
inFlightLoads.delete(configPath);
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
.catch(() => undefined);
|
|
61
111
|
}
|
|
62
|
-
|
|
112
|
+
return await loadPromise;
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
throw new Error(`Failed to load configuration file '${configPath}': ${error}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async function doLoadConfig(configPath, mtimeMs) {
|
|
119
|
+
let configModule;
|
|
120
|
+
if (configPath.endsWith('.ts')) {
|
|
121
|
+
const { register } = await import('tsx/esm/api');
|
|
122
|
+
const unregister = register();
|
|
123
|
+
try {
|
|
63
124
|
const configUrl = pathToFileURL(configPath).href;
|
|
64
125
|
configModule = await import(configUrl + '?mtime=' + mtimeMs);
|
|
65
126
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
throw new Error("No networks defined in configuration. Add at least one network in the 'networks' field.");
|
|
127
|
+
finally {
|
|
128
|
+
unregister();
|
|
69
129
|
}
|
|
70
|
-
configCache.set(configPath, { mtimeMs, config: userConfig });
|
|
71
|
-
return userConfig;
|
|
72
130
|
}
|
|
73
|
-
|
|
74
|
-
|
|
131
|
+
else {
|
|
132
|
+
const configUrl = pathToFileURL(configPath).href;
|
|
133
|
+
configModule = await import(configUrl + '?mtime=' + mtimeMs);
|
|
75
134
|
}
|
|
135
|
+
const userConfig = configModule.default;
|
|
136
|
+
if (!userConfig.networks || Object.keys(userConfig.networks).length === 0) {
|
|
137
|
+
throw new Error("No networks defined in configuration. Add at least one network in the 'networks' field.");
|
|
138
|
+
}
|
|
139
|
+
configCache.set(configPath, { mtimeMs, config: userConfig });
|
|
140
|
+
return userConfig;
|
|
76
141
|
}
|
|
77
142
|
/**
|
|
78
143
|
* Clear the in-memory config cache. Test-only escape hatch.
|
|
@@ -82,6 +147,7 @@ export async function loadUserConfig() {
|
|
|
82
147
|
*/
|
|
83
148
|
export function _resetConfigCache() {
|
|
84
149
|
configCache.clear();
|
|
150
|
+
inFlightLoads.clear();
|
|
85
151
|
}
|
|
86
152
|
/**
|
|
87
153
|
* Resolve configuration for a specific network
|
|
@@ -136,15 +202,30 @@ export async function resolveNetworkConfig(userConfig, networkName) {
|
|
|
136
202
|
if (accounts.length === 0 && process.env.PRIVATE_KEY) {
|
|
137
203
|
accounts = [process.env.PRIVATE_KEY];
|
|
138
204
|
}
|
|
139
|
-
// 4. Validate we have at least one account (unless using testnet/local
|
|
205
|
+
// 4. Validate we have at least one account (unless using testnet/local
|
|
206
|
+
// AND the URL is a recognized test endpoint — name alone is not enough
|
|
207
|
+
// per #40, since a user can name a network 'testnet' but point it at
|
|
208
|
+
// a production RPC and would otherwise inherit the deterministic test
|
|
209
|
+
// key with a production endpoint).
|
|
140
210
|
if (accounts.length === 0 || !accounts[0]) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
211
|
+
const isTestNetworkName = selectedNetwork === "testnet" || selectedNetwork === "local";
|
|
212
|
+
const isTestEndpoint = isTestNetworkName && isKnownTestEndpoint(networkConfig.url);
|
|
213
|
+
if (isTestNetworkName && !isTestEndpoint) {
|
|
214
|
+
// Name matches the reserved convention but URL is not a recognized
|
|
215
|
+
// test endpoint — block the deterministic test-key injection. Falls
|
|
216
|
+
// through to the standard "no accounts" throw below so the user gets
|
|
217
|
+
// actionable guidance.
|
|
218
|
+
logger.warning(`Network '${selectedNetwork}' uses a name reserved for testnet/local ` +
|
|
219
|
+
`but '${sanitizeUrlForLog(networkConfig.url)}' is not a recognized test endpoint. ` +
|
|
220
|
+
`Skipping auto-injection of the deterministic test key to protect ` +
|
|
221
|
+
`against accidental production use. Set PRIVATE_KEY explicitly, ` +
|
|
222
|
+
`configure 'accounts' in movehat.config.ts, or rename this network.`);
|
|
223
|
+
}
|
|
224
|
+
if (isTestEndpoint) {
|
|
145
225
|
// Security: Using a deterministic test account (like Hardhat's default accounts)
|
|
146
226
|
// This is SAFE because:
|
|
147
|
-
// 1. Only used for testnet/local
|
|
227
|
+
// 1. Only used for testnet/local against a known test endpoint
|
|
228
|
+
// (network NAME + URL allowlist enforced above; bypassed otherwise)
|
|
148
229
|
// 2. Perfect for transaction simulation (no real funds)
|
|
149
230
|
// 3. Deterministic = consistent test results
|
|
150
231
|
const testPrivateKey = "0x0000000000000000000000000000000000000000000000000000000000000001";
|
|
@@ -155,8 +236,9 @@ export async function resolveNetworkConfig(userConfig, networkName) {
|
|
|
155
236
|
logger.newline();
|
|
156
237
|
}
|
|
157
238
|
else {
|
|
158
|
-
// For any other network (
|
|
159
|
-
//
|
|
239
|
+
// For any other network (mainnet, or testnet/local with a non-test
|
|
240
|
+
// URL), REQUIRE explicit configuration. This prevents accidentally
|
|
241
|
+
// using the test key on production networks.
|
|
160
242
|
throw new Error(`Network '${selectedNetwork}' has no accounts configured.\n` +
|
|
161
243
|
`\n` +
|
|
162
244
|
`SECURITY: This network requires explicit account configuration.\n` +
|
|
@@ -233,4 +315,3 @@ function deriveAccountAddress(privateKeyHex) {
|
|
|
233
315
|
return "";
|
|
234
316
|
}
|
|
235
317
|
}
|
|
236
|
-
//# sourceMappingURL=config.js.map
|
package/dist/core/contract.d.ts
CHANGED
package/dist/core/contract.js
CHANGED
package/dist/core/deployments.js
CHANGED
package/dist/core/shell.d.ts
CHANGED
package/dist/core/shell.js
CHANGED
package/dist/errors.d.ts
CHANGED
package/dist/errors.js
CHANGED
package/dist/fork/api.d.ts
CHANGED
|
@@ -28,6 +28,18 @@ export declare class MovementApiClient {
|
|
|
28
28
|
* public endpoints.
|
|
29
29
|
*/
|
|
30
30
|
private get;
|
|
31
|
+
/**
|
|
32
|
+
* Make a POST request to the API with a JSON body.
|
|
33
|
+
*
|
|
34
|
+
* Mirrors `get<T>` for TLS/timeout/maxBytes/error-wrapping; differs
|
|
35
|
+
* only in `method: 'POST'`, the `Content-Type: application/json`
|
|
36
|
+
* header, and writing `body` to the request stream before `end()`.
|
|
37
|
+
*
|
|
38
|
+
* `extraHeaders` are merged in last and override defaults — used by
|
|
39
|
+
* the fork-server view proxy to forward client headers like
|
|
40
|
+
* `Accept` or `X-Aptos-Client` through to the upstream node.
|
|
41
|
+
*/
|
|
42
|
+
private post;
|
|
31
43
|
/**
|
|
32
44
|
* Build API path with proper prefix
|
|
33
45
|
*/
|
|
@@ -48,5 +60,16 @@ export declare class MovementApiClient {
|
|
|
48
60
|
* Get all resources for an account
|
|
49
61
|
*/
|
|
50
62
|
getAccountResources(address: string): Promise<AccountResource[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Execute a Move view function via the upstream node's POST /v1/view.
|
|
65
|
+
*
|
|
66
|
+
* Stateless passthrough — view results are not cached. Returns the raw
|
|
67
|
+
* array the upstream API returns (single-value views still come back as
|
|
68
|
+
* a one-element tuple).
|
|
69
|
+
*
|
|
70
|
+
* `extraHeaders` are forwarded to upstream — used by the fork server's
|
|
71
|
+
* view proxy to relay client headers (`Accept`, `X-Aptos-Client`, …)
|
|
72
|
+
* so downstream behavior such as BCS-encoded responses is preserved.
|
|
73
|
+
*/
|
|
74
|
+
view(payload: unknown, extraHeaders?: Record<string, string>): Promise<unknown[]>;
|
|
51
75
|
}
|
|
52
|
-
//# sourceMappingURL=api.d.ts.map
|
package/dist/fork/api.js
CHANGED
|
@@ -98,6 +98,87 @@ export class MovementApiClient {
|
|
|
98
98
|
req.end();
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Make a POST request to the API with a JSON body.
|
|
103
|
+
*
|
|
104
|
+
* Mirrors `get<T>` for TLS/timeout/maxBytes/error-wrapping; differs
|
|
105
|
+
* only in `method: 'POST'`, the `Content-Type: application/json`
|
|
106
|
+
* header, and writing `body` to the request stream before `end()`.
|
|
107
|
+
*
|
|
108
|
+
* `extraHeaders` are merged in last and override defaults — used by
|
|
109
|
+
* the fork-server view proxy to forward client headers like
|
|
110
|
+
* `Accept` or `X-Aptos-Client` through to the upstream node.
|
|
111
|
+
*/
|
|
112
|
+
async post(path, body, extraHeaders = {}) {
|
|
113
|
+
const fullUrl = `${this.nodeUrl}${path}`;
|
|
114
|
+
const parsedUrl = new URL(fullUrl);
|
|
115
|
+
const isHttps = parsedUrl.protocol === 'https:';
|
|
116
|
+
const client = isHttps ? https : http;
|
|
117
|
+
const payload = JSON.stringify(body);
|
|
118
|
+
const headers = {
|
|
119
|
+
'Content-Type': 'application/json',
|
|
120
|
+
'Content-Length': Buffer.byteLength(payload).toString(),
|
|
121
|
+
};
|
|
122
|
+
if (this.apiKey !== undefined) {
|
|
123
|
+
headers.Authorization = `Bearer ${this.apiKey}`;
|
|
124
|
+
}
|
|
125
|
+
for (const [k, v] of Object.entries(extraHeaders)) {
|
|
126
|
+
// Don't let callers override Content-Length — we just computed it.
|
|
127
|
+
if (k.toLowerCase() === 'content-length')
|
|
128
|
+
continue;
|
|
129
|
+
headers[k] = v;
|
|
130
|
+
}
|
|
131
|
+
const timeoutMs = this.timeoutMs;
|
|
132
|
+
const maxBytes = this.maxBytes;
|
|
133
|
+
return new Promise((resolve, reject) => {
|
|
134
|
+
let settled = false;
|
|
135
|
+
const settle = (fn) => {
|
|
136
|
+
if (settled)
|
|
137
|
+
return;
|
|
138
|
+
settled = true;
|
|
139
|
+
fn();
|
|
140
|
+
};
|
|
141
|
+
const req = client.request(fullUrl, { method: 'POST', headers }, (res) => {
|
|
142
|
+
const chunks = [];
|
|
143
|
+
let totalBytes = 0;
|
|
144
|
+
res.on('data', (chunk) => {
|
|
145
|
+
const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
146
|
+
totalBytes += buf.length;
|
|
147
|
+
if (totalBytes > maxBytes) {
|
|
148
|
+
req.destroy();
|
|
149
|
+
settle(() => reject(new Error(`Response exceeded maxBytes (${maxBytes}); ${totalBytes} bytes received before abort`)));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
chunks.push(buf);
|
|
153
|
+
});
|
|
154
|
+
res.on('end', () => {
|
|
155
|
+
if (settled)
|
|
156
|
+
return;
|
|
157
|
+
const data = Buffer.concat(chunks).toString('utf8');
|
|
158
|
+
if (res.statusCode !== 200) {
|
|
159
|
+
settle(() => reject(new Error(`API request failed with status ${res.statusCode}: ${data}`)));
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
const parsed = JSON.parse(data);
|
|
164
|
+
settle(() => resolve(parsed));
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
settle(() => reject(new Error(`Failed to parse JSON response: ${err}`)));
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
req.setTimeout(timeoutMs, () => {
|
|
172
|
+
req.destroy();
|
|
173
|
+
settle(() => reject(new Error(`API request timed out after ${timeoutMs}ms`)));
|
|
174
|
+
});
|
|
175
|
+
req.on('error', (err) => {
|
|
176
|
+
settle(() => reject(new Error(`API request failed: ${err.message}`)));
|
|
177
|
+
});
|
|
178
|
+
req.write(payload);
|
|
179
|
+
req.end();
|
|
180
|
+
});
|
|
181
|
+
}
|
|
101
182
|
/**
|
|
102
183
|
* Build API path with proper prefix
|
|
103
184
|
*/
|
|
@@ -135,5 +216,18 @@ export class MovementApiClient {
|
|
|
135
216
|
const normalizedAddress = normalizeAddressShort(address);
|
|
136
217
|
return this.get(this.apiPath(`/accounts/${normalizedAddress}/resources`));
|
|
137
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Execute a Move view function via the upstream node's POST /v1/view.
|
|
221
|
+
*
|
|
222
|
+
* Stateless passthrough — view results are not cached. Returns the raw
|
|
223
|
+
* array the upstream API returns (single-value views still come back as
|
|
224
|
+
* a one-element tuple).
|
|
225
|
+
*
|
|
226
|
+
* `extraHeaders` are forwarded to upstream — used by the fork server's
|
|
227
|
+
* view proxy to relay client headers (`Accept`, `X-Aptos-Client`, …)
|
|
228
|
+
* so downstream behavior such as BCS-encoded responses is preserved.
|
|
229
|
+
*/
|
|
230
|
+
async view(payload, extraHeaders = {}) {
|
|
231
|
+
return this.post(this.apiPath('/view'), payload, extraHeaders);
|
|
232
|
+
}
|
|
138
233
|
}
|
|
139
|
-
//# sourceMappingURL=api.js.map
|
package/dist/fork/manager.d.ts
CHANGED
|
@@ -38,6 +38,20 @@ export declare class ForkManager {
|
|
|
38
38
|
getAccount(address: string): Promise<AccountState>;
|
|
39
39
|
getResource(address: string, resourceType: string): Promise<any>;
|
|
40
40
|
getAllResources(address: string): Promise<Record<string, any>>;
|
|
41
|
+
/**
|
|
42
|
+
* Stateless passthrough of `POST /v1/view` to the upstream RPC.
|
|
43
|
+
*
|
|
44
|
+
* View results are not cached — they depend on ledger version and
|
|
45
|
+
* arguments, so any caching layer would need version-aware
|
|
46
|
+
* invalidation that the fork system does not implement today. The
|
|
47
|
+
* payload is forwarded verbatim and the upstream response array is
|
|
48
|
+
* returned unchanged.
|
|
49
|
+
*
|
|
50
|
+
* `extraHeaders` are forwarded to upstream so that client headers
|
|
51
|
+
* such as `Accept: application/x-bcs` (for BCS-encoded view results)
|
|
52
|
+
* or `X-Aptos-Client` round-trip through the proxy.
|
|
53
|
+
*/
|
|
54
|
+
forwardView(payload: unknown, extraHeaders?: Record<string, string>): Promise<unknown[]>;
|
|
41
55
|
setResource(address: string, resourceType: string, data: unknown): Promise<void>;
|
|
42
56
|
/** Adds to the existing balance rather than replacing it. */
|
|
43
57
|
fundAccount(address: string, amount: number, coinType?: string): Promise<void>;
|
|
@@ -76,4 +90,3 @@ export declare class ForkManager {
|
|
|
76
90
|
*/
|
|
77
91
|
getOrCreateAccount(address: string): Promise<AccountState>;
|
|
78
92
|
}
|
|
79
|
-
//# sourceMappingURL=manager.d.ts.map
|
package/dist/fork/manager.js
CHANGED
|
@@ -154,6 +154,25 @@ export class ForkManager {
|
|
|
154
154
|
}
|
|
155
155
|
return resources;
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Stateless passthrough of `POST /v1/view` to the upstream RPC.
|
|
159
|
+
*
|
|
160
|
+
* View results are not cached — they depend on ledger version and
|
|
161
|
+
* arguments, so any caching layer would need version-aware
|
|
162
|
+
* invalidation that the fork system does not implement today. The
|
|
163
|
+
* payload is forwarded verbatim and the upstream response array is
|
|
164
|
+
* returned unchanged.
|
|
165
|
+
*
|
|
166
|
+
* `extraHeaders` are forwarded to upstream so that client headers
|
|
167
|
+
* such as `Accept: application/x-bcs` (for BCS-encoded view results)
|
|
168
|
+
* or `X-Aptos-Client` round-trip through the proxy.
|
|
169
|
+
*/
|
|
170
|
+
async forwardView(payload, extraHeaders = {}) {
|
|
171
|
+
if (!this.apiClient) {
|
|
172
|
+
throw new Error('Fork not initialized. Call initialize() or load() first.');
|
|
173
|
+
}
|
|
174
|
+
return this.apiClient.view(payload, extraHeaders);
|
|
175
|
+
}
|
|
157
176
|
async setResource(address, resourceType, data) {
|
|
158
177
|
const normalizedAddress = normalizeAddress(address);
|
|
159
178
|
this.storage.saveResource(normalizedAddress, resourceType, data);
|
|
@@ -282,4 +301,3 @@ export class ForkManager {
|
|
|
282
301
|
}
|
|
283
302
|
}
|
|
284
303
|
}
|
|
285
|
-
//# sourceMappingURL=manager.js.map
|
package/dist/fork/server.d.ts
CHANGED
|
@@ -32,6 +32,11 @@ export declare class ForkServer {
|
|
|
32
32
|
* the allowlist. No-op otherwise.
|
|
33
33
|
*/
|
|
34
34
|
private applyCors;
|
|
35
|
+
private isOriginAllowed;
|
|
36
|
+
private allowedMethodsForPath;
|
|
37
|
+
private sendMethodNotAllowed;
|
|
38
|
+
private sendForbiddenOrigin;
|
|
39
|
+
private handleOptions;
|
|
35
40
|
/**
|
|
36
41
|
* Start the fork server
|
|
37
42
|
*/
|
|
@@ -44,6 +49,7 @@ export declare class ForkServer {
|
|
|
44
49
|
* Sanitize pathname for error messages to prevent log injection
|
|
45
50
|
*/
|
|
46
51
|
private sanitizePathname;
|
|
52
|
+
private sanitizeErrorMessage;
|
|
47
53
|
/**
|
|
48
54
|
* Handle incoming HTTP requests
|
|
49
55
|
*/
|
|
@@ -64,6 +70,19 @@ export declare class ForkServer {
|
|
|
64
70
|
* Handle GET /v1/accounts/:address/resources
|
|
65
71
|
*/
|
|
66
72
|
private handleGetResources;
|
|
73
|
+
/**
|
|
74
|
+
* Handle POST /v1/view — proxy to upstream RPC.
|
|
75
|
+
*
|
|
76
|
+
* Stateless: view results are not cached. Buffers the request body
|
|
77
|
+
* with a 1 MiB ceiling, parses JSON, delegates to
|
|
78
|
+
* `forkManager.forwardView`, and returns the upstream array verbatim.
|
|
79
|
+
*
|
|
80
|
+
* Errors map to:
|
|
81
|
+
* 413 — body exceeds MAX_VIEW_BODY_BYTES
|
|
82
|
+
* 400 — body is not valid JSON
|
|
83
|
+
* 502 — upstream RPC failed (timeout, network error, non-200 response)
|
|
84
|
+
*/
|
|
85
|
+
private handleViewProxy;
|
|
67
86
|
/**
|
|
68
87
|
* Send JSON response.
|
|
69
88
|
* unknown: arbitrary JSON-serializable payload; structural shape varies by
|
|
@@ -79,4 +98,3 @@ export declare class ForkServer {
|
|
|
79
98
|
*/
|
|
80
99
|
private sendError;
|
|
81
100
|
}
|
|
82
|
-
//# sourceMappingURL=server.d.ts.map
|