movehat 0.1.8 ā 0.2.0
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 +2 -2
- package/dist/__tests__/deployContract.test.d.ts +2 -0
- package/dist/__tests__/deployContract.test.d.ts.map +1 -0
- package/dist/__tests__/deployContract.test.js +368 -0
- package/dist/__tests__/deployContract.test.js.map +1 -0
- package/dist/__tests__/errors.test.d.ts +2 -0
- package/dist/__tests__/errors.test.d.ts.map +1 -0
- package/dist/__tests__/errors.test.js +46 -0
- package/dist/__tests__/errors.test.js.map +1 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts +24 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts.map +1 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.js +82 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.js.map +1 -0
- package/dist/__tests__/fork/api.test.d.ts +2 -0
- package/dist/__tests__/fork/api.test.d.ts.map +1 -0
- package/dist/__tests__/fork/api.test.js +110 -0
- package/dist/__tests__/fork/api.test.js.map +1 -0
- package/dist/__tests__/harness/Harness.createLive.test.d.ts +2 -0
- package/dist/__tests__/harness/Harness.createLive.test.d.ts.map +1 -0
- package/dist/__tests__/harness/Harness.createLive.test.js +53 -0
- package/dist/__tests__/harness/Harness.createLive.test.js.map +1 -0
- package/dist/__tests__/harness/Harness.proxy.test.d.ts +2 -0
- package/dist/__tests__/harness/Harness.proxy.test.d.ts.map +1 -0
- package/dist/__tests__/harness/Harness.proxy.test.js +93 -0
- package/dist/__tests__/harness/Harness.proxy.test.js.map +1 -0
- package/dist/__tests__/harness/_fixture.d.ts +54 -0
- package/dist/__tests__/harness/_fixture.d.ts.map +1 -0
- package/dist/__tests__/harness/_fixture.js +69 -0
- package/dist/__tests__/harness/_fixture.js.map +1 -0
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts +2 -0
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts.map +1 -0
- package/dist/__tests__/harness/codeObject.deploy.test.js +288 -0
- package/dist/__tests__/harness/codeObject.deploy.test.js.map +1 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts +2 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts.map +1 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.js +138 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.js.map +1 -0
- package/dist/__tests__/harness/script.test.d.ts +2 -0
- package/dist/__tests__/harness/script.test.d.ts.map +1 -0
- package/dist/__tests__/harness/script.test.js +219 -0
- package/dist/__tests__/harness/script.test.js.map +1 -0
- package/dist/__tests__/harness/view.test.d.ts +2 -0
- package/dist/__tests__/harness/view.test.d.ts.map +1 -0
- package/dist/__tests__/harness/view.test.js +92 -0
- package/dist/__tests__/harness/view.test.js.map +1 -0
- package/dist/__tests__/runtime.test.d.ts +2 -0
- package/dist/__tests__/runtime.test.d.ts.map +1 -0
- package/dist/__tests__/runtime.test.js +141 -0
- package/dist/__tests__/runtime.test.js.map +1 -0
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/__tests__/compile.test.d.ts +2 -0
- package/dist/commands/__tests__/compile.test.d.ts.map +1 -0
- package/dist/commands/__tests__/compile.test.js +351 -0
- package/dist/commands/__tests__/compile.test.js.map +1 -0
- package/dist/commands/__tests__/init.test.d.ts +2 -0
- package/dist/commands/__tests__/init.test.d.ts.map +1 -0
- package/dist/commands/__tests__/init.test.js +101 -0
- package/dist/commands/__tests__/init.test.js.map +1 -0
- package/dist/commands/__tests__/run.test.d.ts +2 -0
- package/dist/commands/__tests__/run.test.d.ts.map +1 -0
- package/dist/commands/__tests__/run.test.js +166 -0
- package/dist/commands/__tests__/run.test.js.map +1 -0
- package/dist/commands/__tests__/test-move.test.d.ts +2 -0
- package/dist/commands/__tests__/test-move.test.d.ts.map +1 -0
- package/dist/commands/__tests__/test-move.test.js +59 -0
- package/dist/commands/__tests__/test-move.test.js.map +1 -0
- package/dist/commands/__tests__/test.test.d.ts +2 -0
- package/dist/commands/__tests__/test.test.d.ts.map +1 -0
- package/dist/commands/__tests__/test.test.js +168 -0
- package/dist/commands/__tests__/test.test.js.map +1 -0
- package/dist/commands/__tests__/update.test.d.ts +2 -0
- package/dist/commands/__tests__/update.test.d.ts.map +1 -0
- package/dist/commands/__tests__/update.test.js +176 -0
- package/dist/commands/__tests__/update.test.js.map +1 -0
- package/dist/commands/compile.d.ts +7 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +150 -33
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/fork/__tests__/create.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/create.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/create.test.js +108 -0
- package/dist/commands/fork/__tests__/create.test.js.map +1 -0
- package/dist/commands/fork/__tests__/fund.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/fund.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/fund.test.js +72 -0
- package/dist/commands/fork/__tests__/fund.test.js.map +1 -0
- package/dist/commands/fork/__tests__/list.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/list.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/list.test.js +119 -0
- package/dist/commands/fork/__tests__/list.test.js.map +1 -0
- package/dist/commands/fork/__tests__/serve.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/serve.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/serve.test.js +97 -0
- package/dist/commands/fork/__tests__/serve.test.js.map +1 -0
- package/dist/commands/fork/__tests__/view-resource.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/view-resource.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/view-resource.test.js +77 -0
- package/dist/commands/fork/__tests__/view-resource.test.js.map +1 -0
- package/dist/commands/fork/create.d.ts +1 -1
- package/dist/commands/fork/create.d.ts.map +1 -1
- package/dist/commands/fork/create.js +3 -2
- package/dist/commands/fork/create.js.map +1 -1
- package/dist/commands/fork/fund.d.ts.map +1 -1
- package/dist/commands/fork/fund.js +15 -8
- package/dist/commands/fork/fund.js.map +1 -1
- package/dist/commands/fork/list.d.ts.map +1 -1
- package/dist/commands/fork/list.js +2 -1
- package/dist/commands/fork/list.js.map +1 -1
- package/dist/commands/fork/serve.d.ts +1 -0
- package/dist/commands/fork/serve.d.ts.map +1 -1
- package/dist/commands/fork/serve.js +4 -2
- package/dist/commands/fork/serve.js.map +1 -1
- package/dist/commands/fork/view-resource.d.ts.map +1 -1
- package/dist/commands/fork/view-resource.js +10 -5
- package/dist/commands/fork/view-resource.js.map +1 -1
- package/dist/commands/run.d.ts +15 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +50 -27
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/test-move.d.ts.map +1 -1
- package/dist/commands/test-move.js +3 -2
- package/dist/commands/test-move.js.map +1 -1
- package/dist/commands/test.js +52 -46
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +15 -13
- package/dist/commands/update.js.map +1 -1
- package/dist/core/AccountManager.d.ts +1 -1
- package/dist/core/AccountManager.d.ts.map +1 -1
- package/dist/core/AccountManager.js +20 -7
- package/dist/core/AccountManager.js.map +1 -1
- package/dist/core/Publisher.d.ts +31 -0
- package/dist/core/Publisher.d.ts.map +1 -0
- package/dist/core/Publisher.js +248 -0
- package/dist/core/Publisher.js.map +1 -0
- package/dist/core/__tests__/AccountManager.test.d.ts +2 -0
- package/dist/core/__tests__/AccountManager.test.d.ts.map +1 -0
- package/dist/core/__tests__/AccountManager.test.js +239 -0
- package/dist/core/__tests__/AccountManager.test.js.map +1 -0
- package/dist/core/__tests__/config.test.d.ts +2 -0
- package/dist/core/__tests__/config.test.d.ts.map +1 -0
- package/dist/core/__tests__/config.test.js +311 -0
- package/dist/core/__tests__/config.test.js.map +1 -0
- package/dist/core/__tests__/deployments.test.d.ts +2 -0
- package/dist/core/__tests__/deployments.test.d.ts.map +1 -0
- package/dist/core/__tests__/deployments.test.js +201 -0
- package/dist/core/__tests__/deployments.test.js.map +1 -0
- package/dist/core/__tests__/shell.test.d.ts +2 -0
- package/dist/core/__tests__/shell.test.d.ts.map +1 -0
- package/dist/core/__tests__/shell.test.js +107 -0
- package/dist/core/__tests__/shell.test.js.map +1 -0
- package/dist/core/config.d.ts +13 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +80 -11
- package/dist/core/config.js.map +1 -1
- package/dist/core/contract.d.ts +1 -1
- package/dist/core/contract.d.ts.map +1 -1
- package/dist/core/contract.js +15 -4
- package/dist/core/contract.js.map +1 -1
- package/dist/core/deployments.d.ts +2 -2
- package/dist/core/deployments.d.ts.map +1 -1
- package/dist/core/deployments.js +8 -6
- package/dist/core/deployments.js.map +1 -1
- package/dist/core/movementProfile.d.ts +34 -0
- package/dist/core/movementProfile.d.ts.map +1 -0
- package/dist/core/movementProfile.js +150 -0
- package/dist/core/movementProfile.js.map +1 -0
- package/dist/core/shell.d.ts +23 -7
- package/dist/core/shell.d.ts.map +1 -1
- package/dist/core/shell.js +32 -14
- package/dist/core/shell.js.map +1 -1
- package/dist/errors.d.ts +35 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +54 -0
- package/dist/errors.js.map +1 -1
- package/dist/fork/__tests__/manager.test.d.ts +2 -0
- package/dist/fork/__tests__/manager.test.d.ts.map +1 -0
- package/dist/fork/__tests__/manager.test.js +309 -0
- package/dist/fork/__tests__/manager.test.js.map +1 -0
- package/dist/fork/__tests__/server.test.d.ts +2 -0
- package/dist/fork/__tests__/server.test.d.ts.map +1 -0
- package/dist/fork/__tests__/server.test.js +54 -0
- package/dist/fork/__tests__/server.test.js.map +1 -0
- package/dist/fork/__tests__/storage.test.d.ts +2 -0
- package/dist/fork/__tests__/storage.test.d.ts.map +1 -0
- package/dist/fork/__tests__/storage.test.js +222 -0
- package/dist/fork/__tests__/storage.test.js.map +1 -0
- package/dist/fork/__tests__/test.test.d.ts +2 -0
- package/dist/fork/__tests__/test.test.d.ts.map +1 -0
- package/dist/fork/__tests__/test.test.js +81 -0
- package/dist/fork/__tests__/test.test.js.map +1 -0
- package/dist/fork/api.d.ts +14 -3
- package/dist/fork/api.d.ts.map +1 -1
- package/dist/fork/api.js +25 -14
- package/dist/fork/api.js.map +1 -1
- package/dist/fork/manager.d.ts +23 -9
- package/dist/fork/manager.d.ts.map +1 -1
- package/dist/fork/manager.js +79 -36
- package/dist/fork/manager.js.map +1 -1
- package/dist/fork/server.d.ts +11 -3
- package/dist/fork/server.d.ts.map +1 -1
- package/dist/fork/server.js +45 -13
- package/dist/fork/server.js.map +1 -1
- package/dist/fork/storage.d.ts +4 -4
- package/dist/fork/storage.d.ts.map +1 -1
- package/dist/fork/storage.js +7 -9
- package/dist/fork/storage.js.map +1 -1
- package/dist/fork/test.d.ts +13 -4
- package/dist/fork/test.d.ts.map +1 -1
- package/dist/fork/test.js +36 -27
- package/dist/fork/test.js.map +1 -1
- package/dist/harness/Harness.d.ts +124 -0
- package/dist/harness/Harness.d.ts.map +1 -0
- package/dist/harness/Harness.js +193 -0
- package/dist/harness/Harness.js.map +1 -0
- package/dist/harness/codeObject.d.ts +31 -0
- package/dist/harness/codeObject.d.ts.map +1 -0
- package/dist/harness/codeObject.js +271 -0
- package/dist/harness/codeObject.js.map +1 -0
- package/dist/harness/errors.d.ts +14 -0
- package/dist/harness/errors.d.ts.map +1 -0
- package/dist/harness/errors.js +22 -0
- package/dist/harness/errors.js.map +1 -0
- package/dist/harness/index.d.ts +4 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +3 -0
- package/dist/harness/index.js.map +1 -0
- package/dist/harness/proxy.d.ts +7 -0
- package/dist/harness/proxy.d.ts.map +1 -0
- package/dist/harness/proxy.js +36 -0
- package/dist/harness/proxy.js.map +1 -0
- package/dist/harness/script.d.ts +21 -0
- package/dist/harness/script.d.ts.map +1 -0
- package/dist/harness/script.js +155 -0
- package/dist/harness/script.js.map +1 -0
- package/dist/harness/view.d.ts +22 -0
- package/dist/harness/view.d.ts.map +1 -0
- package/dist/harness/view.js +28 -0
- package/dist/harness/view.js.map +1 -0
- package/dist/helpers/__tests__/semver-utils.test.d.ts +2 -0
- package/dist/helpers/__tests__/semver-utils.test.d.ts.map +1 -0
- package/dist/helpers/__tests__/semver-utils.test.js +103 -0
- package/dist/helpers/__tests__/semver-utils.test.js.map +1 -0
- package/dist/helpers/index.d.ts +3 -2
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +2 -2
- package/dist/helpers/index.js.map +1 -1
- package/dist/helpers/move-tests.d.ts +3 -3
- package/dist/helpers/move-tests.d.ts.map +1 -1
- package/dist/helpers/move-tests.js +21 -20
- package/dist/helpers/move-tests.js.map +1 -1
- package/dist/helpers/npm-registry.d.ts.map +1 -1
- package/dist/helpers/npm-registry.js +1 -3
- package/dist/helpers/npm-registry.js.map +1 -1
- package/dist/helpers/semver-utils.d.ts.map +1 -1
- package/dist/helpers/semver-utils.js +4 -3
- package/dist/helpers/semver-utils.js.map +1 -1
- package/dist/helpers/setup.d.ts.map +1 -1
- package/dist/helpers/setup.js +10 -6
- package/dist/helpers/setup.js.map +1 -1
- package/dist/helpers/setupLocalTesting.d.ts +32 -27
- package/dist/helpers/setupLocalTesting.d.ts.map +1 -1
- package/dist/helpers/setupLocalTesting.js +179 -180
- package/dist/helpers/setupLocalTesting.js.map +1 -1
- package/dist/helpers/testFixtures.d.ts +19 -53
- package/dist/helpers/testFixtures.d.ts.map +1 -1
- package/dist/helpers/testFixtures.js +89 -107
- package/dist/helpers/testFixtures.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/node/LocalNodeManager.d.ts +9 -1
- package/dist/node/LocalNodeManager.d.ts.map +1 -1
- package/dist/node/LocalNodeManager.js +75 -58
- package/dist/node/LocalNodeManager.js.map +1 -1
- package/dist/node/__tests__/LocalNodeManager.test.d.ts +2 -0
- package/dist/node/__tests__/LocalNodeManager.test.d.ts.map +1 -0
- package/dist/node/__tests__/LocalNodeManager.test.js +349 -0
- package/dist/node/__tests__/LocalNodeManager.test.js.map +1 -0
- package/dist/runtime.d.ts +12 -15
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +32 -241
- package/dist/runtime.js.map +1 -1
- package/dist/templates/README.md +1 -1
- package/dist/templates/movehat.config.ts +10 -0
- package/dist/templates/package.json +2 -1
- package/dist/templates/scripts/deploy-counter.ts +46 -38
- package/dist/templates/tests/Counter.test.ts +51 -51
- package/dist/templates/types/movehat.d.ts +6 -9
- package/dist/types/config.d.ts +8 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/fork.d.ts +7 -1
- package/dist/types/fork.d.ts.map +1 -1
- package/dist/types/harness.d.ts +166 -0
- package/dist/types/harness.d.ts.map +1 -0
- package/dist/types/harness.js +2 -0
- package/dist/types/harness.js.map +1 -0
- package/dist/types/runtime.d.ts +7 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/ui/__tests__/colors.test.d.ts +2 -0
- package/dist/ui/__tests__/colors.test.d.ts.map +1 -0
- package/dist/ui/__tests__/colors.test.js +127 -0
- package/dist/ui/__tests__/colors.test.js.map +1 -0
- package/dist/ui/colors.d.ts.map +1 -1
- package/dist/ui/colors.js +6 -2
- package/dist/ui/colors.js.map +1 -1
- package/dist/ui/logger.d.ts +17 -0
- package/dist/ui/logger.d.ts.map +1 -1
- package/dist/ui/logger.js +22 -0
- package/dist/ui/logger.js.map +1 -1
- package/dist/ui/symbols.d.ts +1 -0
- package/dist/ui/symbols.d.ts.map +1 -1
- package/dist/ui/symbols.js +7 -1
- package/dist/ui/symbols.js.map +1 -1
- package/dist/utils/__tests__/address.test.d.ts +2 -0
- package/dist/utils/__tests__/address.test.d.ts.map +1 -0
- package/dist/utils/__tests__/address.test.js +70 -0
- package/dist/utils/__tests__/address.test.js.map +1 -0
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts +2 -0
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts.map +1 -0
- package/dist/utils/__tests__/childProcessAdapter.test.js +217 -0
- package/dist/utils/__tests__/childProcessAdapter.test.js.map +1 -0
- package/dist/utils/__tests__/runCli.test.d.ts +2 -0
- package/dist/utils/__tests__/runCli.test.d.ts.map +1 -0
- package/dist/utils/__tests__/runCli.test.js +187 -0
- package/dist/utils/__tests__/runCli.test.js.map +1 -0
- package/dist/utils/address.d.ts +33 -0
- package/dist/utils/address.d.ts.map +1 -0
- package/dist/utils/address.js +52 -0
- package/dist/utils/address.js.map +1 -0
- package/dist/utils/childProcessAdapter.d.ts +93 -0
- package/dist/utils/childProcessAdapter.d.ts.map +1 -0
- package/dist/utils/childProcessAdapter.js +109 -0
- package/dist/utils/childProcessAdapter.js.map +1 -0
- package/dist/utils/parseCliOutput.d.ts +20 -0
- package/dist/utils/parseCliOutput.d.ts.map +1 -0
- package/dist/utils/parseCliOutput.js +26 -0
- package/dist/utils/parseCliOutput.js.map +1 -0
- package/dist/utils/redact.d.ts +15 -0
- package/dist/utils/redact.d.ts.map +1 -0
- package/dist/utils/redact.js +24 -0
- package/dist/utils/redact.js.map +1 -0
- package/dist/utils/runCli.d.ts +24 -0
- package/dist/utils/runCli.d.ts.map +1 -0
- package/dist/utils/runCli.js +37 -0
- package/dist/utils/runCli.js.map +1 -0
- package/package.json +14 -4
- package/src/__tests__/deployContract.test.ts +429 -0
- package/src/__tests__/errors.test.ts +84 -0
- package/src/__tests__/fixtures/sigint-deploy-harness.ts +95 -0
- package/src/__tests__/fork/api.test.ts +143 -0
- package/src/__tests__/harness/Harness.createLive.test.ts +57 -0
- package/src/__tests__/harness/Harness.proxy.test.ts +115 -0
- package/src/__tests__/harness/_fixture.ts +131 -0
- package/src/__tests__/harness/codeObject.deploy.test.ts +319 -0
- package/src/__tests__/harness/codeObject.upgrade.test.ts +156 -0
- package/src/__tests__/harness/script.test.ts +245 -0
- package/src/__tests__/harness/view.test.ts +104 -0
- package/src/__tests__/runtime.test.ts +182 -0
- package/src/cli.ts +2 -1
- package/src/commands/__tests__/compile.test.ts +407 -0
- package/src/commands/__tests__/init.test.ts +125 -0
- package/src/commands/__tests__/run.test.ts +192 -0
- package/src/commands/__tests__/test-move.test.ts +81 -0
- package/src/commands/__tests__/test.test.ts +204 -0
- package/src/commands/__tests__/update.test.ts +223 -0
- package/src/commands/compile.ts +168 -32
- package/src/commands/fork/__tests__/create.test.ts +132 -0
- package/src/commands/fork/__tests__/fund.test.ts +104 -0
- package/src/commands/fork/__tests__/list.test.ts +139 -0
- package/src/commands/fork/__tests__/serve.test.ts +121 -0
- package/src/commands/fork/__tests__/view-resource.test.ts +101 -0
- package/src/commands/fork/create.ts +4 -3
- package/src/commands/fork/fund.ts +16 -9
- package/src/commands/fork/list.ts +3 -2
- package/src/commands/fork/serve.ts +6 -3
- package/src/commands/fork/view-resource.ts +11 -6
- package/src/commands/run.ts +54 -28
- package/src/commands/test-move.ts +4 -3
- package/src/commands/test.ts +56 -44
- package/src/commands/update.ts +19 -16
- package/src/core/AccountManager.ts +23 -10
- package/src/core/Publisher.ts +322 -0
- package/src/core/__tests__/AccountManager.test.ts +290 -0
- package/src/core/__tests__/config.test.ts +377 -0
- package/src/core/__tests__/deployments.test.ts +247 -0
- package/src/core/__tests__/shell.test.ts +138 -0
- package/src/core/config.ts +96 -12
- package/src/core/contract.ts +13 -4
- package/src/core/deployments.ts +13 -11
- package/src/core/movementProfile.ts +179 -0
- package/src/core/shell.ts +34 -14
- package/src/errors.ts +60 -0
- package/src/fork/__tests__/manager.test.ts +385 -0
- package/src/fork/__tests__/server.test.ts +65 -0
- package/src/fork/__tests__/storage.test.ts +281 -0
- package/src/fork/__tests__/test.test.ts +97 -0
- package/src/fork/api.ts +28 -14
- package/src/fork/manager.ts +88 -43
- package/src/fork/server.ts +53 -19
- package/src/fork/storage.ts +12 -15
- package/src/fork/test.ts +58 -32
- package/src/harness/Harness.ts +228 -0
- package/src/harness/codeObject.ts +388 -0
- package/src/harness/errors.ts +22 -0
- package/src/harness/index.ts +3 -0
- package/src/harness/proxy.ts +40 -0
- package/src/harness/script.ts +196 -0
- package/src/harness/view.ts +34 -0
- package/src/helpers/__tests__/semver-utils.test.ts +121 -0
- package/src/helpers/index.ts +2 -8
- package/src/helpers/move-tests.ts +27 -23
- package/src/helpers/npm-registry.ts +4 -3
- package/src/helpers/semver-utils.ts +4 -3
- package/src/helpers/setup.ts +9 -5
- package/src/helpers/setupLocalTesting.ts +219 -200
- package/src/helpers/testFixtures.ts +106 -118
- package/src/index.ts +9 -3
- package/src/node/LocalNodeManager.ts +87 -62
- package/src/node/__tests__/LocalNodeManager.test.ts +452 -0
- package/src/runtime.ts +33 -289
- package/src/templates/README.md +1 -1
- package/src/templates/movehat.config.ts +10 -0
- package/src/templates/package.json +2 -1
- package/src/templates/scripts/deploy-counter.ts +46 -38
- package/src/templates/tests/Counter.test.ts +51 -51
- package/src/templates/types/movehat.d.ts +6 -9
- package/src/types/config.ts +8 -0
- package/src/types/fork.ts +7 -1
- package/src/types/harness.ts +182 -0
- package/src/types/runtime.ts +11 -3
- package/src/ui/__tests__/colors.test.ts +156 -0
- package/src/ui/colors.ts +5 -2
- package/src/ui/logger.ts +22 -0
- package/src/ui/symbols.ts +7 -1
- package/src/utils/__tests__/address.test.ts +93 -0
- package/src/utils/__tests__/childProcessAdapter.test.ts +266 -0
- package/src/utils/__tests__/runCli.test.ts +240 -0
- package/src/utils/address.ts +56 -0
- package/src/utils/childProcessAdapter.ts +215 -0
- package/src/utils/parseCliOutput.ts +27 -0
- package/src/utils/redact.ts +24 -0
- package/src/utils/runCli.ts +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.test.d.ts","sourceRoot":"","sources":["../../../src/fork/__tests__/test.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
2
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { snapshot, viewForkResource } from '../test.js';
|
|
6
|
+
/**
|
|
7
|
+
* Guards the exitCode-failure path that CodeRabbit flagged on PR #100:
|
|
8
|
+
* before this hardening, an `aptos` command that exited non-zero with a
|
|
9
|
+
* stderr containing the word "Success" (or no stderr at all) could slip
|
|
10
|
+
* past the stderr-defense check in `snapshot`, and a non-JSON stderr from
|
|
11
|
+
* `view-resource` produced a cryptic JSON parse error instead of the
|
|
12
|
+
* actual aptos failure.
|
|
13
|
+
*/
|
|
14
|
+
describe('fork/test ā exitCode failure paths', () => {
|
|
15
|
+
let tmpCwd;
|
|
16
|
+
let origCwd;
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
tmpCwd = mkdtempSync(join(tmpdir(), 'movehat-fork-test-'));
|
|
19
|
+
origCwd = process.cwd();
|
|
20
|
+
process.chdir(tmpCwd);
|
|
21
|
+
});
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
try {
|
|
24
|
+
process.chdir(origCwd);
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
rmSync(tmpCwd, { recursive: true, force: true });
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
function adapterReturning(result) {
|
|
31
|
+
return {
|
|
32
|
+
async run() {
|
|
33
|
+
return result;
|
|
34
|
+
},
|
|
35
|
+
spawn() {
|
|
36
|
+
throw new Error('spawn not used in fork/test failure-path tests');
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
it("snapshot throws on non-zero exit even when stderr contains 'Success'", async () => {
|
|
41
|
+
// The pre-fix edge case: aptos exits 1, stderr says
|
|
42
|
+
// "Failed: Success criteria not met" ā the stderr.includes('Success')
|
|
43
|
+
// gate returned false-positive ok, and a stale directory from a prior
|
|
44
|
+
// run would mask the failure entirely.
|
|
45
|
+
const adapter = adapterReturning({
|
|
46
|
+
exitCode: 1,
|
|
47
|
+
stdout: '',
|
|
48
|
+
stderr: 'Failed: Success criteria not met for snapshot init',
|
|
49
|
+
});
|
|
50
|
+
await expect(snapshot({ name: 'edge', adapter })).rejects.toThrow(/Success criteria not met/);
|
|
51
|
+
});
|
|
52
|
+
it('snapshot still throws when a stale directory from a prior run exists (the full edge case)', async () => {
|
|
53
|
+
// The pre-fix combined edge case: aptos exits non-zero, stderr happens
|
|
54
|
+
// to contain "Success" (so the stderr.includes('Success') gate would
|
|
55
|
+
// false-positive), AND the snapshot directory already exists from a
|
|
56
|
+
// previous successful run (so the existsSync check would false-positive
|
|
57
|
+
// too). The new exitCode check fires first and throws regardless.
|
|
58
|
+
const stalePath = join(tmpCwd, '.movehat', 'snapshots', 'stale');
|
|
59
|
+
mkdirSync(stalePath, { recursive: true });
|
|
60
|
+
writeFileSync(join(stalePath, 'config.json'), '{}');
|
|
61
|
+
const adapter = adapterReturning({
|
|
62
|
+
exitCode: 1,
|
|
63
|
+
stdout: '',
|
|
64
|
+
stderr: 'Failed but Success was nearby',
|
|
65
|
+
});
|
|
66
|
+
await expect(snapshot({ name: 'stale', path: stalePath, adapter })).rejects.toThrow(/Failed but Success was nearby/);
|
|
67
|
+
});
|
|
68
|
+
it('viewForkResource throws on non-zero exit with non-JSON stderr (informative message)', async () => {
|
|
69
|
+
// Pre-fix the failure surfaced as "Unexpected token ..." from
|
|
70
|
+
// JSON.parse, which obscured the actual aptos error.
|
|
71
|
+
const adapter = adapterReturning({
|
|
72
|
+
exitCode: 1,
|
|
73
|
+
stdout: '',
|
|
74
|
+
stderr: 'Error: session not found',
|
|
75
|
+
});
|
|
76
|
+
await expect(viewForkResource('/nonexistent/session', '0x1', '0x1::coin::CoinStore', {
|
|
77
|
+
adapter,
|
|
78
|
+
})).rejects.toThrow(/session not found/);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingUR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gBAAgB,CAAC;YAC/B,QAAQ,EAAE,CAAC;YACX,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;QAEH,MAAM,MAAM,CACV,gBAAgB,CAAC,sBAAsB,EAAE,KAAK,EAAE,sBAAsB,EAAE;YACtE,OAAO;SACR,CAAC,CACH,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/fork/api.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import type { LedgerInfo, AccountData, AccountResource } from '../types/fork.js';
|
|
2
2
|
/**
|
|
3
|
-
* Client for interacting with Movement
|
|
3
|
+
* Client for interacting with Movement L1 JSON API.
|
|
4
|
+
*
|
|
5
|
+
* When constructed with an `apiKey`, every outgoing request carries
|
|
6
|
+
* an `Authorization: Bearer <apiKey>` header. Use this for rate-
|
|
7
|
+
* limited public endpoints (e.g. Movement testnet under load) or
|
|
8
|
+
* auth-gated nodes.
|
|
4
9
|
*/
|
|
5
10
|
export declare class MovementApiClient {
|
|
6
11
|
private nodeUrl;
|
|
7
|
-
|
|
12
|
+
private readonly apiKey?;
|
|
13
|
+
constructor(nodeUrl: string, apiKey?: string);
|
|
8
14
|
/**
|
|
9
|
-
* Make a GET request to the API
|
|
15
|
+
* Make a GET request to the API.
|
|
16
|
+
*
|
|
17
|
+
* Adds `Authorization: Bearer <apiKey>` when the client was
|
|
18
|
+
* constructed with an `apiKey`. The header is omitted otherwise
|
|
19
|
+
* to preserve backwards-compatible behavior for unauthenticated
|
|
20
|
+
* public endpoints.
|
|
10
21
|
*/
|
|
11
22
|
private get;
|
|
12
23
|
/**
|
package/dist/fork/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/fork/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/fork/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGjF;;;;;;;GAOG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;gBAErB,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAc5C;;;;;;;OAOG;YACW,GAAG;IA6CjB;;OAEG;IACH,OAAO,CAAC,OAAO;IAMf;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAI1C;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAMvD;;OAEG;IACG,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAS7E;;OAEG;IACG,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAKvE"}
|
package/dist/fork/api.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import https from 'https';
|
|
2
2
|
import http from 'http';
|
|
3
3
|
import { URL } from 'url';
|
|
4
|
+
import { normalizeAddressShort } from '../utils/address.js';
|
|
4
5
|
/**
|
|
5
|
-
* Client for interacting with Movement
|
|
6
|
+
* Client for interacting with Movement L1 JSON API.
|
|
7
|
+
*
|
|
8
|
+
* When constructed with an `apiKey`, every outgoing request carries
|
|
9
|
+
* an `Authorization: Bearer <apiKey>` header. Use this for rate-
|
|
10
|
+
* limited public endpoints (e.g. Movement testnet under load) or
|
|
11
|
+
* auth-gated nodes.
|
|
6
12
|
*/
|
|
7
13
|
export class MovementApiClient {
|
|
8
14
|
nodeUrl;
|
|
9
|
-
|
|
15
|
+
apiKey;
|
|
16
|
+
constructor(nodeUrl, apiKey) {
|
|
10
17
|
// Remove trailing slash
|
|
11
18
|
let normalized = nodeUrl.replace(/\/$/, '');
|
|
12
19
|
// If URL already ends with /v1, use as is
|
|
@@ -15,17 +22,28 @@ export class MovementApiClient {
|
|
|
15
22
|
// Base URL without /v1, we'll add it in requests
|
|
16
23
|
}
|
|
17
24
|
this.nodeUrl = normalized;
|
|
25
|
+
if (apiKey !== undefined)
|
|
26
|
+
this.apiKey = apiKey;
|
|
18
27
|
}
|
|
19
28
|
/**
|
|
20
|
-
* Make a GET request to the API
|
|
29
|
+
* Make a GET request to the API.
|
|
30
|
+
*
|
|
31
|
+
* Adds `Authorization: Bearer <apiKey>` when the client was
|
|
32
|
+
* constructed with an `apiKey`. The header is omitted otherwise
|
|
33
|
+
* to preserve backwards-compatible behavior for unauthenticated
|
|
34
|
+
* public endpoints.
|
|
21
35
|
*/
|
|
22
36
|
async get(path) {
|
|
23
37
|
const fullUrl = `${this.nodeUrl}${path}`;
|
|
24
38
|
const parsedUrl = new URL(fullUrl);
|
|
25
39
|
const isHttps = parsedUrl.protocol === 'https:';
|
|
26
40
|
const client = isHttps ? https : http;
|
|
41
|
+
const requestOptions = { method: 'GET' };
|
|
42
|
+
if (this.apiKey !== undefined) {
|
|
43
|
+
requestOptions.headers = { Authorization: `Bearer ${this.apiKey}` };
|
|
44
|
+
}
|
|
27
45
|
return new Promise((resolve, reject) => {
|
|
28
|
-
const req = client.get(fullUrl, (res) => {
|
|
46
|
+
const req = client.get(fullUrl, requestOptions, (res) => {
|
|
29
47
|
let data = '';
|
|
30
48
|
res.on('data', (chunk) => {
|
|
31
49
|
data += chunk;
|
|
@@ -68,19 +86,14 @@ export class MovementApiClient {
|
|
|
68
86
|
* Get account information
|
|
69
87
|
*/
|
|
70
88
|
async getAccount(address) {
|
|
71
|
-
|
|
72
|
-
const normalizedAddress = address.toLowerCase().startsWith('0x')
|
|
73
|
-
? address.toLowerCase()
|
|
74
|
-
: `0x${address.toLowerCase()}`;
|
|
89
|
+
const normalizedAddress = normalizeAddressShort(address);
|
|
75
90
|
return this.get(this.apiPath(`/accounts/${normalizedAddress}`));
|
|
76
91
|
}
|
|
77
92
|
/**
|
|
78
93
|
* Get a specific account resource
|
|
79
94
|
*/
|
|
80
95
|
async getAccountResource(address, resourceType) {
|
|
81
|
-
const normalizedAddress = address
|
|
82
|
-
? address.toLowerCase()
|
|
83
|
-
: `0x${address.toLowerCase()}`;
|
|
96
|
+
const normalizedAddress = normalizeAddressShort(address);
|
|
84
97
|
// URL encode the resource type
|
|
85
98
|
const encodedType = encodeURIComponent(resourceType);
|
|
86
99
|
return this.get(this.apiPath(`/accounts/${normalizedAddress}/resource/${encodedType}`));
|
|
@@ -89,9 +102,7 @@ export class MovementApiClient {
|
|
|
89
102
|
* Get all resources for an account
|
|
90
103
|
*/
|
|
91
104
|
async getAccountResources(address) {
|
|
92
|
-
const normalizedAddress = address
|
|
93
|
-
? address.toLowerCase()
|
|
94
|
-
: `0x${address.toLowerCase()}`;
|
|
105
|
+
const normalizedAddress = normalizeAddressShort(address);
|
|
95
106
|
return this.get(this.apiPath(`/accounts/${normalizedAddress}/resources`));
|
|
96
107
|
}
|
|
97
108
|
}
|
package/dist/fork/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/fork/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/fork/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,GAAG,EAA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AAG,CAAa,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,OAAe;QAC9B,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAEzD,OAAO,IAAI,CAAC,GAAG,CAAc,IAAI,CAAC,OAAO,CAAC,aAAa,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CAAC,OAAe,EAAE,YAAoB;QAC5D,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAEzD,+BAA+B;QAC/B,MAAM,WAAW,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;QAErD,OAAO,IAAI,CAAC,GAAG,CAAM,IAAI,CAAC,OAAO,CAAC,aAAa,iBAAiB,aAAa,WAAW,EAAE,CAAC,CAAC,CAAC;IAC/F,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CAAC,OAAe;QACvC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAEzD,OAAO,IAAI,CAAC,GAAG,CAAoB,IAAI,CAAC,OAAO,CAAC,aAAa,iBAAiB,YAAY,CAAC,CAAC,CAAC;IAC/F,CAAC;CACF"}
|
package/dist/fork/manager.d.ts
CHANGED
|
@@ -7,13 +7,31 @@ export declare class ForkManager {
|
|
|
7
7
|
private storage;
|
|
8
8
|
private apiClient;
|
|
9
9
|
private metadata;
|
|
10
|
+
/**
|
|
11
|
+
* Optional API key sent as `Authorization: Bearer <key>` on every
|
|
12
|
+
* outgoing Movement API request. Not persisted to disk via
|
|
13
|
+
* {@link ForkMetadata} (keys stay in process memory). For the
|
|
14
|
+
* load-then-set pattern, call {@link setApiKey} after `load()`.
|
|
15
|
+
*/
|
|
16
|
+
private apiKey?;
|
|
10
17
|
constructor(forkPath: string);
|
|
11
18
|
/**
|
|
12
|
-
*
|
|
19
|
+
* Set or update the API key used for upstream Movement API requests.
|
|
20
|
+
* Reconstructs the internal `MovementApiClient` if one exists.
|
|
13
21
|
*/
|
|
14
|
-
|
|
22
|
+
setApiKey(apiKey: string | undefined): void;
|
|
15
23
|
/**
|
|
16
|
-
*
|
|
24
|
+
* Initialize a new fork from a network.
|
|
25
|
+
*
|
|
26
|
+
* @param nodeUrl - Upstream JSON-RPC base URL.
|
|
27
|
+
* @param networkName - Logical network label (defaults to `'custom'`).
|
|
28
|
+
* @param apiKey - Optional API key for `Authorization: Bearer` header.
|
|
29
|
+
*/
|
|
30
|
+
initialize(nodeUrl: string, networkName?: string, apiKey?: string): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Load an existing fork. The API key is NOT persisted to disk ā
|
|
33
|
+
* callers needing authenticated upstream reads after `load()` must
|
|
34
|
+
* call {@link setApiKey} explicitly.
|
|
17
35
|
*/
|
|
18
36
|
load(): void;
|
|
19
37
|
/**
|
|
@@ -35,15 +53,11 @@ export declare class ForkManager {
|
|
|
35
53
|
/**
|
|
36
54
|
* Set a resource value (for testing/mocking)
|
|
37
55
|
*/
|
|
38
|
-
setResource(address: string, resourceType: string, data:
|
|
56
|
+
setResource(address: string, resourceType: string, data: unknown): Promise<void>;
|
|
39
57
|
/**
|
|
40
58
|
* Fund an account with coins (adds to existing balance)
|
|
41
59
|
*/
|
|
42
60
|
fundAccount(address: string, amount: number, coinType?: string): Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Normalize address format
|
|
45
|
-
*/
|
|
46
|
-
private normalizeAddress;
|
|
47
61
|
/**
|
|
48
62
|
* List all accounts in the fork
|
|
49
63
|
*/
|
|
@@ -53,7 +67,7 @@ export declare class ForkManager {
|
|
|
53
67
|
*
|
|
54
68
|
* @param addresses Array of addresses to fund
|
|
55
69
|
* @param amount Amount of coins per account
|
|
56
|
-
* @param coinType Coin type (defaults to
|
|
70
|
+
* @param coinType Coin type (defaults to the chain's native coin)
|
|
57
71
|
*
|
|
58
72
|
* @example
|
|
59
73
|
* await forkManager.fundMultipleAccounts(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/fork/manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/fork/manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmBnE;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,QAAQ,CAA6B;IAE7C;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,CAAS;gBAEZ,QAAQ,EAAE,MAAM;IAI5B;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAW3C;;;;;;OAMG;IACG,UAAU,CACd,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,MAAiB,EAC9B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;IA6BhB;;;;OAIG;IACH,IAAI,IAAI,IAAI;IASZ;;OAEG;IACH,WAAW,IAAI,YAAY;IAO3B;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IA6BxD;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAiCtE;;OAEG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IA4BpE;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAMtF;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAqC,GAAG,OAAO,CAAC,IAAI,CAAC;IAiElH;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE;IAIxB;;;;;;;;;;;;OAYG;IACG,oBAAoB,CACxB,SAAS,EAAE,MAAM,EAAE,EACnB,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;;;OAMG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAYjC;;;;;;;;;OASG;IACG,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CAmBjE"}
|
package/dist/fork/manager.js
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
1
2
|
import { MovementApiClient } from './api.js';
|
|
2
3
|
import { ForkStorage } from './storage.js';
|
|
4
|
+
import { normalizeAddress } from '../utils/address.js';
|
|
5
|
+
import { logger } from '../ui/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Derive a deterministic 32-byte hex placeholder for the `authentication_key`
|
|
8
|
+
* of a fork-funded account. The real auth_key is `sha3_256(public_key || 0x00)`
|
|
9
|
+
* for Ed25519; the fork has no public key material, so we hash the address
|
|
10
|
+
* itself. This is NOT a real auth key ā downstream code must not treat it as
|
|
11
|
+
* trustworthy key material. Distinguishable from the address by construction
|
|
12
|
+
* (#63 ā prior code used `address.padEnd(66, '0')` which was a no-op since
|
|
13
|
+
* normalized addresses are already 66 chars).
|
|
14
|
+
*/
|
|
15
|
+
function forkAuthKeyPlaceholder(normalizedAddress) {
|
|
16
|
+
const stripped = normalizedAddress.startsWith('0x') ? normalizedAddress.slice(2) : normalizedAddress;
|
|
17
|
+
const digest = createHash('sha3-256').update(stripped, 'hex').digest('hex');
|
|
18
|
+
return `0x${digest}`;
|
|
19
|
+
}
|
|
3
20
|
/**
|
|
4
21
|
* Manager for fork operations
|
|
5
22
|
* Orchestrates API client and storage
|
|
@@ -8,15 +25,43 @@ export class ForkManager {
|
|
|
8
25
|
storage;
|
|
9
26
|
apiClient = null;
|
|
10
27
|
metadata = null;
|
|
28
|
+
/**
|
|
29
|
+
* Optional API key sent as `Authorization: Bearer <key>` on every
|
|
30
|
+
* outgoing Movement API request. Not persisted to disk via
|
|
31
|
+
* {@link ForkMetadata} (keys stay in process memory). For the
|
|
32
|
+
* load-then-set pattern, call {@link setApiKey} after `load()`.
|
|
33
|
+
*/
|
|
34
|
+
apiKey;
|
|
11
35
|
constructor(forkPath) {
|
|
12
36
|
this.storage = new ForkStorage(forkPath);
|
|
13
37
|
}
|
|
14
38
|
/**
|
|
15
|
-
*
|
|
39
|
+
* Set or update the API key used for upstream Movement API requests.
|
|
40
|
+
* Reconstructs the internal `MovementApiClient` if one exists.
|
|
16
41
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
42
|
+
setApiKey(apiKey) {
|
|
43
|
+
if (apiKey === undefined) {
|
|
44
|
+
delete this.apiKey;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.apiKey = apiKey;
|
|
48
|
+
}
|
|
49
|
+
if (this.apiClient && this.metadata) {
|
|
50
|
+
this.apiClient = new MovementApiClient(this.metadata.nodeUrl, this.apiKey);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Initialize a new fork from a network.
|
|
55
|
+
*
|
|
56
|
+
* @param nodeUrl - Upstream JSON-RPC base URL.
|
|
57
|
+
* @param networkName - Logical network label (defaults to `'custom'`).
|
|
58
|
+
* @param apiKey - Optional API key for `Authorization: Bearer` header.
|
|
59
|
+
*/
|
|
60
|
+
async initialize(nodeUrl, networkName = 'custom', apiKey) {
|
|
61
|
+
if (apiKey !== undefined)
|
|
62
|
+
this.apiKey = apiKey;
|
|
63
|
+
// Create API client (with optional Authorization header)
|
|
64
|
+
this.apiClient = new MovementApiClient(nodeUrl, this.apiKey);
|
|
20
65
|
// Fetch network info
|
|
21
66
|
const ledgerInfo = await this.apiClient.getLedgerInfo();
|
|
22
67
|
// Create fork structure
|
|
@@ -36,14 +81,16 @@ export class ForkManager {
|
|
|
36
81
|
console.log(`ā Fork initialized at ledger version ${ledgerInfo.ledger_version}`);
|
|
37
82
|
}
|
|
38
83
|
/**
|
|
39
|
-
* Load an existing fork
|
|
84
|
+
* Load an existing fork. The API key is NOT persisted to disk ā
|
|
85
|
+
* callers needing authenticated upstream reads after `load()` must
|
|
86
|
+
* call {@link setApiKey} explicitly.
|
|
40
87
|
*/
|
|
41
88
|
load() {
|
|
42
89
|
if (!this.storage.exists()) {
|
|
43
90
|
throw new Error('Fork does not exist. Run `initialize()` first.');
|
|
44
91
|
}
|
|
45
92
|
this.metadata = this.storage.loadMetadata();
|
|
46
|
-
this.apiClient = new MovementApiClient(this.metadata.nodeUrl);
|
|
93
|
+
this.apiClient = new MovementApiClient(this.metadata.nodeUrl, this.apiKey);
|
|
47
94
|
}
|
|
48
95
|
/**
|
|
49
96
|
* Get fork metadata
|
|
@@ -59,7 +106,7 @@ export class ForkManager {
|
|
|
59
106
|
*/
|
|
60
107
|
async getAccount(address) {
|
|
61
108
|
// Normalize address
|
|
62
|
-
const normalizedAddress =
|
|
109
|
+
const normalizedAddress = normalizeAddress(address);
|
|
63
110
|
// Check cache first
|
|
64
111
|
let accountState = this.storage.getAccount(normalizedAddress);
|
|
65
112
|
if (!accountState) {
|
|
@@ -83,7 +130,7 @@ export class ForkManager {
|
|
|
83
130
|
* Get a specific resource (with lazy loading)
|
|
84
131
|
*/
|
|
85
132
|
async getResource(address, resourceType) {
|
|
86
|
-
const normalizedAddress =
|
|
133
|
+
const normalizedAddress = normalizeAddress(address);
|
|
87
134
|
// Check cache first
|
|
88
135
|
let resource = this.storage.getResource(normalizedAddress, resourceType);
|
|
89
136
|
if (!resource) {
|
|
@@ -100,7 +147,8 @@ export class ForkManager {
|
|
|
100
147
|
console.log(` ā Cached resource ${resourceType}`);
|
|
101
148
|
}
|
|
102
149
|
catch (error) {
|
|
103
|
-
|
|
150
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
151
|
+
if (msg.includes('404')) {
|
|
104
152
|
throw new Error(`Resource ${resourceType} not found for account ${normalizedAddress}`);
|
|
105
153
|
}
|
|
106
154
|
throw error;
|
|
@@ -112,7 +160,7 @@ export class ForkManager {
|
|
|
112
160
|
* Get all resources for an account (with lazy loading)
|
|
113
161
|
*/
|
|
114
162
|
async getAllResources(address) {
|
|
115
|
-
const normalizedAddress =
|
|
163
|
+
const normalizedAddress = normalizeAddress(address);
|
|
116
164
|
// Check if we have any cached resources
|
|
117
165
|
let resources = this.storage.getAllResources(normalizedAddress);
|
|
118
166
|
// If no cached resources, fetch all from network
|
|
@@ -136,7 +184,7 @@ export class ForkManager {
|
|
|
136
184
|
* Set a resource value (for testing/mocking)
|
|
137
185
|
*/
|
|
138
186
|
async setResource(address, resourceType, data) {
|
|
139
|
-
const normalizedAddress =
|
|
187
|
+
const normalizedAddress = normalizeAddress(address);
|
|
140
188
|
this.storage.saveResource(normalizedAddress, resourceType, data);
|
|
141
189
|
console.log(` ā Updated resource ${resourceType} for ${normalizedAddress}`);
|
|
142
190
|
}
|
|
@@ -144,16 +192,21 @@ export class ForkManager {
|
|
|
144
192
|
* Fund an account with coins (adds to existing balance)
|
|
145
193
|
*/
|
|
146
194
|
async fundAccount(address, amount, coinType = '0x1::aptos_coin::AptosCoin') {
|
|
147
|
-
const normalizedAddress =
|
|
195
|
+
const normalizedAddress = normalizeAddress(address);
|
|
148
196
|
const resourceType = `0x1::coin::CoinStore<${coinType}>`;
|
|
149
|
-
// Try to get existing coin store
|
|
197
|
+
// Try to get existing coin store. The coin store is a CoinStore<T>
|
|
198
|
+
// resource whose `data` is Movement-side untyped JSON; we shape it
|
|
199
|
+
// locally as a structural object with `coin.value: string`.
|
|
200
|
+
// any: full CoinStore schema lives at the Movement REST boundary ā
|
|
201
|
+
// proper validation deferred to the boundary-validation follow-up of #57.
|
|
150
202
|
let coinStore;
|
|
151
203
|
try {
|
|
152
204
|
coinStore = await this.getResource(normalizedAddress, resourceType);
|
|
153
205
|
}
|
|
154
206
|
catch (error) {
|
|
155
207
|
// Only catch "not found" errors, rethrow others (network, API, etc.)
|
|
156
|
-
|
|
208
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
209
|
+
if (!msg.includes('not found')) {
|
|
157
210
|
throw error;
|
|
158
211
|
}
|
|
159
212
|
// If doesn't exist, create new one
|
|
@@ -191,26 +244,12 @@ export class ForkManager {
|
|
|
191
244
|
if (!account) {
|
|
192
245
|
account = {
|
|
193
246
|
sequenceNumber: '0',
|
|
194
|
-
authenticationKey: normalizedAddress
|
|
247
|
+
authenticationKey: forkAuthKeyPlaceholder(normalizedAddress),
|
|
195
248
|
};
|
|
196
249
|
this.storage.saveAccount(normalizedAddress, account);
|
|
197
250
|
}
|
|
198
251
|
console.log(` ā Funded ${normalizedAddress} with ${amount} coins`);
|
|
199
252
|
}
|
|
200
|
-
/**
|
|
201
|
-
* Normalize address format
|
|
202
|
-
*/
|
|
203
|
-
normalizeAddress(address) {
|
|
204
|
-
let normalized = address.toLowerCase();
|
|
205
|
-
if (!normalized.startsWith('0x')) {
|
|
206
|
-
normalized = `0x${normalized}`;
|
|
207
|
-
}
|
|
208
|
-
// Pad to 66 characters (0x + 64 hex chars)
|
|
209
|
-
if (normalized.length < 66) {
|
|
210
|
-
normalized = '0x' + normalized.slice(2).padStart(64, '0');
|
|
211
|
-
}
|
|
212
|
-
return normalized;
|
|
213
|
-
}
|
|
214
253
|
/**
|
|
215
254
|
* List all accounts in the fork
|
|
216
255
|
*/
|
|
@@ -222,7 +261,7 @@ export class ForkManager {
|
|
|
222
261
|
*
|
|
223
262
|
* @param addresses Array of addresses to fund
|
|
224
263
|
* @param amount Amount of coins per account
|
|
225
|
-
* @param coinType Coin type (defaults to
|
|
264
|
+
* @param coinType Coin type (defaults to the chain's native coin)
|
|
226
265
|
*
|
|
227
266
|
* @example
|
|
228
267
|
* await forkManager.fundMultipleAccounts(
|
|
@@ -231,11 +270,13 @@ export class ForkManager {
|
|
|
231
270
|
* );
|
|
232
271
|
*/
|
|
233
272
|
async fundMultipleAccounts(addresses, amount, coinType = '0x1::aptos_coin::AptosCoin') {
|
|
234
|
-
|
|
273
|
+
logger.newline();
|
|
274
|
+
logger.step(`Funding ${addresses.length} accounts with ${amount} coins each...`);
|
|
235
275
|
for (const address of addresses) {
|
|
236
276
|
await this.fundAccount(address, amount, coinType);
|
|
237
277
|
}
|
|
238
|
-
|
|
278
|
+
logger.success("All accounts funded successfully");
|
|
279
|
+
logger.newline();
|
|
239
280
|
}
|
|
240
281
|
/**
|
|
241
282
|
* Reset fork state to initial snapshot
|
|
@@ -245,11 +286,13 @@ export class ForkManager {
|
|
|
245
286
|
* await forkManager.resetState();
|
|
246
287
|
*/
|
|
247
288
|
async resetState() {
|
|
248
|
-
|
|
289
|
+
logger.newline();
|
|
290
|
+
logger.step("Resetting fork state...");
|
|
249
291
|
// Clear all accounts and resources from storage
|
|
250
292
|
this.storage.clearAccounts();
|
|
251
293
|
this.storage.clearResources();
|
|
252
|
-
|
|
294
|
+
logger.success("Fork state reset to initial snapshot");
|
|
295
|
+
logger.newline();
|
|
253
296
|
}
|
|
254
297
|
/**
|
|
255
298
|
* Get or create an account, ensuring it exists in the fork
|
|
@@ -262,7 +305,7 @@ export class ForkManager {
|
|
|
262
305
|
* const account = await forkManager.getOrCreateAccount("0x123...");
|
|
263
306
|
*/
|
|
264
307
|
async getOrCreateAccount(address) {
|
|
265
|
-
const normalizedAddress =
|
|
308
|
+
const normalizedAddress = normalizeAddress(address);
|
|
266
309
|
// Try to get existing account
|
|
267
310
|
try {
|
|
268
311
|
return await this.getAccount(normalizedAddress);
|
|
@@ -271,7 +314,7 @@ export class ForkManager {
|
|
|
271
314
|
// If account doesn't exist, create a minimal one
|
|
272
315
|
const newAccount = {
|
|
273
316
|
sequenceNumber: '0',
|
|
274
|
-
authenticationKey: normalizedAddress
|
|
317
|
+
authenticationKey: forkAuthKeyPlaceholder(normalizedAddress),
|
|
275
318
|
};
|
|
276
319
|
this.storage.saveAccount(normalizedAddress, newAccount);
|
|
277
320
|
console.log(` ā Created new account ${normalizedAddress}`);
|
package/dist/fork/manager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/fork/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/fork/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;;;;GAQG;AACH,SAAS,sBAAsB,CAAC,iBAAyB;IACvD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC;IACrG,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,OAAO,KAAK,MAAM,EAAE,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,WAAW;IACd,OAAO,CAAc;IACrB,SAAS,GAA6B,IAAI,CAAC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CAAC,CAAC;YAE5D,OAAO,UAAU,CAAC;QACpB,CAAC;IACH,CAAC;CACF"}
|
package/dist/fork/server.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Fork Server - Serves fork data via Movement
|
|
2
|
+
* Fork Server - Serves fork data via Movement L1 RPC API
|
|
3
3
|
* Emulates a Movement L1 node using local fork storage
|
|
4
4
|
*/
|
|
5
5
|
export declare class ForkServer {
|
|
6
6
|
private server;
|
|
7
7
|
private forkManager;
|
|
8
8
|
private port;
|
|
9
|
-
|
|
9
|
+
private host;
|
|
10
|
+
/**
|
|
11
|
+
* @param host Interface to bind. Defaults to `127.0.0.1` so cached fork
|
|
12
|
+
* state (which may include sensitive resources) is not exposed on the LAN.
|
|
13
|
+
* Pass `'0.0.0.0'` only if you intentionally need to expose the server.
|
|
14
|
+
*/
|
|
15
|
+
constructor(forkPath: string, port?: number, host?: string);
|
|
10
16
|
/**
|
|
11
17
|
* Start the fork server
|
|
12
18
|
*/
|
|
@@ -40,7 +46,9 @@ export declare class ForkServer {
|
|
|
40
46
|
*/
|
|
41
47
|
private handleGetResources;
|
|
42
48
|
/**
|
|
43
|
-
* Send JSON response
|
|
49
|
+
* Send JSON response.
|
|
50
|
+
* unknown: arbitrary JSON-serializable payload; structural shape varies by
|
|
51
|
+
* endpoint (account metadata, resource arrays, error envelopes).
|
|
44
52
|
*/
|
|
45
53
|
private sendJSON;
|
|
46
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/fork/server.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,IAAI,CAAS;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/fork/server.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;IAErB;;;;OAIG;gBACS,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,MAAa,EAAE,IAAI,GAAE,MAAoB;IAM7E;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA8E5B;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAarB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;YACW,aAAa;IA6D3B;;OAEG;YACW,gBAAgB;IA0B9B;;OAEG;YACW,gBAAgB;IAqB9B;;OAEG;YACW,iBAAiB;IAsB/B;;OAEG;YACW,kBAAkB;IAwBhC;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAiBhB;;OAEG;IACH,OAAO,CAAC,OAAO;IAQf;;OAEG;IACH,OAAO,CAAC,SAAS;CAOlB"}
|