@mysten-incubation/devstack 0.0.1 → 0.1.1
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 +8 -4
- package/dashboard-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dashboard-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dashboard-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dashboard-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
- package/dashboard-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dashboard-ui/assets/index-Bmi1UtAg.js +1356 -0
- package/dashboard-ui/assets/index-D5EShVt4.js +3 -0
- package/dashboard-ui/assets/index-Deml9drg.css +1 -0
- package/dashboard-ui/index.html +13 -0
- package/dist/api/define-capabilities.d.mts +14 -3
- package/dist/api/define-capabilities.mjs +18 -1
- package/dist/api/define-capabilities.mjs.map +1 -1
- package/dist/api/define-devstack.d.mts +1 -1
- package/dist/api/define-devstack.mjs +6 -26
- package/dist/api/define-devstack.mjs.map +1 -1
- package/dist/api/define-plugin.d.mts +1 -0
- package/dist/api/define-plugin.mjs +2 -0
- package/dist/api/inference-network.d.mts +132 -0
- package/dist/api/inference-network.mjs +105 -16
- package/dist/api/inference-network.mjs.map +1 -1
- package/dist/api/plugin-errors.d.mts +7 -0
- package/dist/api/run-stack.d.mts +20 -9
- package/dist/api/run-stack.mjs +56 -29
- package/dist/api/run-stack.mjs.map +1 -1
- package/dist/build-integrations/playwright/config.d.mts +6 -4
- package/dist/build-integrations/playwright/config.mjs +5 -3
- package/dist/build-integrations/playwright/config.mjs.map +1 -1
- package/dist/build-integrations/playwright/errors.d.mts +1 -1
- package/dist/build-integrations/playwright/global-setup.d.mts +43 -17
- package/dist/build-integrations/playwright/global-setup.mjs +250 -13
- package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
- package/dist/build-integrations/playwright/index.d.mts +5 -3
- package/dist/build-integrations/playwright/index.mjs +4 -2
- package/dist/build-integrations/playwright/stack-context.d.mts +0 -1
- package/dist/build-integrations/playwright/stack-context.mjs +24 -63
- package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
- package/dist/build-integrations/playwright/wallet-context.d.mts +7 -10
- package/dist/build-integrations/playwright/wallet-context.mjs +8 -13
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/cold-start-url.d.mts +5 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs +4 -3
- package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
- package/dist/build-integrations/runtime/conventional-routes.d.mts +51 -0
- package/dist/build-integrations/runtime/conventional-routes.mjs +92 -0
- package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -0
- package/dist/build-integrations/runtime/discover.d.mts +38 -30
- package/dist/build-integrations/runtime/discover.mjs +73 -70
- package/dist/build-integrations/runtime/discover.mjs.map +1 -1
- package/dist/build-integrations/runtime/endpoint-registry.d.mts +3 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs +3 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
- package/dist/build-integrations/runtime/index.d.mts +7 -2
- package/dist/build-integrations/runtime/index.mjs +9 -2
- package/dist/build-integrations/runtime/manifest-types.d.mts +2 -0
- package/dist/build-integrations/runtime/manifest-types.mjs +3 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.d.mts +29 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs +10 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs.map +1 -0
- package/dist/build-integrations/runtime/read-stack-context.d.mts +1 -1
- package/dist/build-integrations/runtime/read-stack-context.mjs +10 -4
- package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +48 -0
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs +42 -0
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -0
- package/dist/build-integrations/runtime/stack-context.d.mts +1 -1
- package/dist/build-integrations/runtime/wallet-paths.mjs +2 -0
- package/dist/build-integrations/vite/index.d.mts +51 -0
- package/dist/build-integrations/vite/index.mjs +73 -0
- package/dist/build-integrations/vite/index.mjs.map +1 -0
- package/dist/build-integrations/vitest/env.d.mts +4 -3
- package/dist/build-integrations/vitest/env.mjs +6 -4
- package/dist/build-integrations/vitest/env.mjs.map +1 -1
- package/dist/build-integrations/vitest/errors.d.mts +25 -4
- package/dist/build-integrations/vitest/errors.mjs +15 -2
- package/dist/build-integrations/vitest/errors.mjs.map +1 -1
- package/dist/build-integrations/vitest/index.d.mts +2 -2
- package/dist/build-integrations/vitest/index.mjs +3 -3
- package/dist/build-integrations/vitest/setup.d.mts +4 -2
- package/dist/build-integrations/vitest/setup.mjs +2 -2
- package/dist/build-integrations/vitest/setup.mjs.map +1 -1
- package/dist/build-integrations/vitest/stack-context.d.mts +0 -1
- package/dist/build-integrations/vitest/stack-context.mjs +33 -13
- package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
- package/dist/cli/bail.mjs +23 -0
- package/dist/cli/bail.mjs.map +1 -0
- package/dist/{surfaces/cli/commands → cli}/doctor-probes.mjs +26 -16
- package/dist/cli/doctor-probes.mjs.map +1 -0
- package/dist/cli/main.d.mts +15 -1
- package/dist/cli/main.mjs +166 -482
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/prune-direct.mjs +31 -201
- package/dist/cli/prune-direct.mjs.map +1 -1
- package/dist/cli/snapshot-reader.mjs +14 -11
- package/dist/cli/snapshot-reader.mjs.map +1 -1
- package/dist/cli/up-lifecycle.mjs +4 -1
- package/dist/cli/up-lifecycle.mjs.map +1 -1
- package/dist/cli/wirings/apply.mjs +95 -0
- package/dist/cli/wirings/apply.mjs.map +1 -0
- package/dist/cli/wirings/build-verb-layers.mjs +42 -0
- package/dist/cli/wirings/build-verb-layers.mjs.map +1 -0
- package/dist/cli/wirings/config-loader.mjs +69 -0
- package/dist/cli/wirings/config-loader.mjs.map +1 -0
- package/dist/cli/wirings/engine-command.mjs +30 -0
- package/dist/cli/wirings/engine-command.mjs.map +1 -0
- package/dist/cli/wirings/identity.mjs +72 -0
- package/dist/cli/wirings/identity.mjs.map +1 -0
- package/dist/cli/wirings/provide-file-system.mjs +7 -0
- package/dist/cli/wirings/provide-file-system.mjs.map +1 -0
- package/dist/cli/wirings/snapshot.mjs +177 -0
- package/dist/cli/wirings/snapshot.mjs.map +1 -0
- package/dist/cli/wirings/up.mjs +287 -0
- package/dist/cli/wirings/up.mjs.map +1 -0
- package/dist/cli/wirings/wipe.mjs +40 -0
- package/dist/cli/wirings/wipe.mjs.map +1 -0
- package/dist/contracts/capability-decl.d.mts +0 -2
- package/dist/contracts/codegenable.d.mts +43 -0
- package/dist/contracts/container-runtime.d.mts +26 -1
- package/dist/contracts/faucet-strategy.d.mts +25 -0
- package/dist/contracts/funding-strategy.d.mts +42 -0
- package/dist/contracts/plugin-expander.mjs +60 -0
- package/dist/contracts/plugin-expander.mjs.map +1 -0
- package/dist/contracts/projection.d.mts +5 -3
- package/dist/contracts/renderer.d.mts +23 -0
- package/dist/contracts/routable.d.mts +14 -1
- package/dist/contracts/snapshotable.d.mts +25 -3
- package/dist/contracts/wallet-protocol.d.mts +52 -0
- package/dist/contracts/wallet-protocol.mjs +52 -0
- package/dist/contracts/wallet-protocol.mjs.map +1 -0
- package/dist/index.d.mts +26 -25
- package/dist/index.mjs +20 -13
- package/dist/{runtime → orchestrators}/built-in-plugin-layers.mjs +10 -5
- package/dist/orchestrators/built-in-plugin-layers.mjs.map +1 -0
- package/dist/orchestrators/codegen/bindings.d.mts +1 -2
- package/dist/orchestrators/codegen/bindings.mjs +52 -186
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
- package/dist/orchestrators/codegen/emit.mjs +19 -1
- package/dist/orchestrators/codegen/emit.mjs.map +1 -1
- package/dist/orchestrators/codegen/errors.mjs +8 -3
- package/dist/orchestrators/codegen/errors.mjs.map +1 -1
- package/dist/orchestrators/codegen/format.mjs +47 -39
- package/dist/orchestrators/codegen/format.mjs.map +1 -1
- package/dist/orchestrators/codegen/gitignore.mjs +3 -1
- package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
- package/dist/orchestrators/codegen/output-location.mjs +41 -0
- package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
- package/dist/orchestrators/codegen/paths.d.mts +1 -1
- package/dist/orchestrators/codegen/paths.mjs +40 -14
- package/dist/orchestrators/codegen/paths.mjs.map +1 -1
- package/dist/orchestrators/codegen/permissions.mjs +3 -1
- package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
- package/dist/orchestrators/codegen/service.mjs +157 -105
- package/dist/orchestrators/codegen/service.mjs.map +1 -1
- package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
- package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
- package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
- package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
- package/dist/orchestrators/router/cleanup.mjs +26 -27
- package/dist/orchestrators/router/cleanup.mjs.map +1 -1
- package/dist/orchestrators/router/entrypoints.mjs +2 -2
- package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
- package/dist/orchestrators/router/file-provider.mjs +14 -5
- package/dist/orchestrators/router/file-provider.mjs.map +1 -1
- package/dist/orchestrators/router/hostname.mjs +19 -55
- package/dist/orchestrators/router/hostname.mjs.map +1 -1
- package/dist/orchestrators/router/index.mjs +11 -0
- package/dist/orchestrators/router/profile.mjs +2 -2
- package/dist/orchestrators/router/sentinels.mjs +26 -0
- package/dist/orchestrators/router/sentinels.mjs.map +1 -0
- package/dist/orchestrators/router/service.mjs +40 -37
- package/dist/orchestrators/router/service.mjs.map +1 -1
- package/dist/orchestrators/router/traefik-container.mjs +27 -16
- package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
- package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
- package/dist/orchestrators/run.mjs.map +1 -0
- package/dist/orchestrators/runtime-composition.d.mts +1 -1
- package/dist/orchestrators/runtime-composition.mjs +123 -39
- package/dist/orchestrators/runtime-composition.mjs.map +1 -1
- package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
- package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
- package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
- package/dist/orchestrators/snapshot/capture.mjs +42 -28
- package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
- package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
- package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
- package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
- package/dist/orchestrators/snapshot/index.mjs +13 -0
- package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
- package/dist/orchestrators/snapshot/integrity.mjs +73 -17
- package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
- package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
- package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
- package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
- package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
- package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
- package/dist/orchestrators/snapshot/prune.mjs +20 -55
- package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
- package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
- package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
- package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
- package/dist/orchestrators/snapshot/restore.mjs +118 -84
- package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
- package/dist/orchestrators/snapshot/service.mjs +53 -56
- package/dist/orchestrators/snapshot/service.mjs.map +1 -1
- package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
- package/dist/orchestrators/snapshot/state-document.mjs +47 -7
- package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
- package/dist/orchestrators/snapshot/wipe.mjs +67 -10
- package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
- package/dist/plugins/account/codegen.mjs +9 -8
- package/dist/plugins/account/codegen.mjs.map +1 -1
- package/dist/plugins/account/errors.d.mts +33 -6
- package/dist/plugins/account/errors.mjs.map +1 -1
- package/dist/plugins/account/funding.d.mts +29 -19
- package/dist/plugins/account/funding.mjs +84 -66
- package/dist/plugins/account/funding.mjs.map +1 -1
- package/dist/plugins/account/index.d.mts +2 -4
- package/dist/plugins/account/index.mjs +64 -31
- package/dist/plugins/account/index.mjs.map +1 -1
- package/dist/plugins/account/keypair.mjs +6 -9
- package/dist/plugins/account/keypair.mjs.map +1 -1
- package/dist/plugins/account/lease.mjs +1 -0
- package/dist/plugins/account/lease.mjs.map +1 -1
- package/dist/plugins/account/registry.d.mts +14 -1
- package/dist/plugins/account/registry.mjs +18 -18
- package/dist/plugins/account/registry.mjs.map +1 -1
- package/dist/plugins/account/service.d.mts +23 -4
- package/dist/plugins/account/service.mjs +83 -45
- package/dist/plugins/account/service.mjs.map +1 -1
- package/dist/plugins/account/snapshot.mjs +2 -5
- package/dist/plugins/account/snapshot.mjs.map +1 -1
- package/dist/plugins/account/spans.mjs +16 -0
- package/dist/plugins/account/spans.mjs.map +1 -0
- package/dist/plugins/account/variants/keystore.mjs +6 -8
- package/dist/plugins/account/variants/keystore.mjs.map +1 -1
- package/dist/plugins/action/build-context.d.mts +3 -2
- package/dist/plugins/action/errors.d.mts +16 -12
- package/dist/plugins/action/errors.mjs.map +1 -1
- package/dist/plugins/action/execute.mjs +65 -103
- package/dist/plugins/action/execute.mjs.map +1 -1
- package/dist/plugins/action/index.d.mts +0 -2
- package/dist/plugins/action/index.mjs +17 -13
- package/dist/plugins/action/index.mjs.map +1 -1
- package/dist/plugins/action/service.mjs +38 -35
- package/dist/plugins/action/service.mjs.map +1 -1
- package/dist/plugins/action/spans.mjs +11 -0
- package/dist/plugins/action/spans.mjs.map +1 -0
- package/dist/plugins/coin/codegen.mjs +9 -8
- package/dist/plugins/coin/codegen.mjs.map +1 -1
- package/dist/plugins/coin/discovery.mjs +8 -4
- package/dist/plugins/coin/discovery.mjs.map +1 -1
- package/dist/plugins/coin/index.d.mts +11 -29
- package/dist/plugins/coin/index.mjs +56 -27
- package/dist/plugins/coin/index.mjs.map +1 -1
- package/dist/plugins/coin/metadata.mjs +8 -15
- package/dist/plugins/coin/metadata.mjs.map +1 -1
- package/dist/plugins/coin/mint.d.mts +30 -11
- package/dist/plugins/coin/mint.mjs +78 -74
- package/dist/plugins/coin/mint.mjs.map +1 -1
- package/dist/plugins/coin/registry.mjs +4 -7
- package/dist/plugins/coin/registry.mjs.map +1 -1
- package/dist/plugins/coin/service.d.mts +39 -1
- package/dist/plugins/coin/service.mjs +11 -4
- package/dist/plugins/coin/service.mjs.map +1 -1
- package/dist/plugins/coin/spans.mjs +20 -0
- package/dist/plugins/coin/spans.mjs.map +1 -0
- package/dist/plugins/dashboard/domain.mjs +402 -0
- package/dist/plugins/dashboard/domain.mjs.map +1 -0
- package/dist/plugins/dashboard/index.d.mts +29 -0
- package/dist/plugins/dashboard/index.mjs +91 -0
- package/dist/plugins/dashboard/index.mjs.map +1 -0
- package/dist/plugins/dashboard/origin-policy.mjs +36 -0
- package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
- package/dist/plugins/dashboard/routable.mjs +27 -0
- package/dist/plugins/dashboard/routable.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/builder.mjs +21 -0
- package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/enums.mjs +72 -0
- package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/root.mjs +351 -0
- package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/types.mjs +508 -0
- package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
- package/dist/plugins/dashboard/schema.mjs +11 -0
- package/dist/plugins/dashboard/schema.mjs.map +1 -0
- package/dist/plugins/dashboard/server.mjs +166 -0
- package/dist/plugins/dashboard/server.mjs.map +1 -0
- package/dist/plugins/deepbook/deploy.mjs +53 -115
- package/dist/plugins/deepbook/deploy.mjs.map +1 -1
- package/dist/plugins/deepbook/errors.mjs +1 -0
- package/dist/plugins/deepbook/errors.mjs.map +1 -1
- package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
- package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/deepbook/hash.mjs +9 -0
- package/dist/plugins/deepbook/hash.mjs.map +1 -0
- package/dist/plugins/deepbook/index.d.mts +1 -10
- package/dist/plugins/deepbook/index.mjs +25 -22
- package/dist/plugins/deepbook/index.mjs.map +1 -1
- package/dist/plugins/deepbook/pyth/index.mjs +26 -55
- package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
- package/dist/plugins/deepbook/snapshot.mjs +17 -29
- package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
- package/dist/plugins/deepbook/spans.mjs +18 -0
- package/dist/plugins/deepbook/spans.mjs.map +1 -0
- package/dist/plugins/deepbook/type-strings.mjs +65 -0
- package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
- package/dist/plugins/deepbook/types.d.mts +2 -3
- package/dist/plugins/deepbook/types.mjs.map +1 -1
- package/dist/plugins/faucet/dispatcher.d.mts +21 -2
- package/dist/plugins/faucet/dispatcher.mjs +1 -2
- package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
- package/dist/plugins/faucet/errors.d.mts +11 -24
- package/dist/plugins/faucet/errors.mjs.map +1 -1
- package/dist/plugins/faucet/http.mjs +33 -14
- package/dist/plugins/faucet/http.mjs.map +1 -1
- package/dist/plugins/faucet/index.d.mts +15 -5
- package/dist/plugins/faucet/index.mjs +3 -0
- package/dist/plugins/faucet/index.mjs.map +1 -1
- package/dist/plugins/faucet/spans.mjs +12 -0
- package/dist/plugins/faucet/spans.mjs.map +1 -0
- package/dist/plugins/host-service/errors.d.mts +1 -1
- package/dist/plugins/host-service/index.mjs +34 -8
- package/dist/plugins/host-service/index.mjs.map +1 -1
- package/dist/plugins/host-service/routable.mjs +2 -1
- package/dist/plugins/host-service/routable.mjs.map +1 -1
- package/dist/plugins/host-service/service.d.mts +21 -0
- package/dist/plugins/host-service/service.mjs +136 -81
- package/dist/plugins/host-service/service.mjs.map +1 -1
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
- package/dist/plugins/internal/codegen-helpers.mjs +18 -0
- package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
- package/dist/plugins/internal/funding-failure-error.mjs +32 -0
- package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
- package/dist/plugins/package/build.mjs +1 -1
- package/dist/plugins/package/build.mjs.map +1 -1
- package/dist/plugins/package/codegen.mjs +26 -0
- package/dist/plugins/package/codegen.mjs.map +1 -1
- package/dist/plugins/package/errors.d.mts +16 -6
- package/dist/plugins/package/errors.mjs.map +1 -1
- package/dist/plugins/package/index.d.mts +0 -4
- package/dist/plugins/package/index.mjs +27 -21
- package/dist/plugins/package/index.mjs.map +1 -1
- package/dist/plugins/package/mode-known.mjs +26 -12
- package/dist/plugins/package/mode-known.mjs.map +1 -1
- package/dist/plugins/package/mode-local.mjs +47 -41
- package/dist/plugins/package/mode-local.mjs.map +1 -1
- package/dist/plugins/package/publish-executor.mjs +55 -114
- package/dist/plugins/package/publish-executor.mjs.map +1 -1
- package/dist/plugins/package/registry.mjs +2 -1
- package/dist/plugins/package/registry.mjs.map +1 -1
- package/dist/plugins/package/service.mjs.map +1 -1
- package/dist/plugins/package/spans.mjs +14 -0
- package/dist/plugins/package/spans.mjs.map +1 -0
- package/dist/plugins/postgres/db-ensure.mjs +19 -12
- package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
- package/dist/plugins/postgres/errors.d.mts +5 -0
- package/dist/plugins/postgres/errors.mjs.map +1 -1
- package/dist/plugins/postgres/index.mjs +10 -17
- package/dist/plugins/postgres/index.mjs.map +1 -1
- package/dist/plugins/postgres/service.mjs +58 -24
- package/dist/plugins/postgres/service.mjs.map +1 -1
- package/dist/plugins/postgres/snapshot.mjs.map +1 -1
- package/dist/plugins/postgres/spans.mjs +11 -0
- package/dist/plugins/postgres/spans.mjs.map +1 -0
- package/dist/plugins/router-entrypoints.mjs +4 -4
- package/dist/plugins/router-entrypoints.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
- package/dist/plugins/seal/codegen.d.mts +2 -3
- package/dist/plugins/seal/codegen.mjs.map +1 -1
- package/dist/plugins/seal/config-render.mjs +35 -8
- package/dist/plugins/seal/config-render.mjs.map +1 -1
- package/dist/plugins/seal/deploy.mjs +31 -39
- package/dist/plugins/seal/deploy.mjs.map +1 -1
- package/dist/plugins/seal/errors.d.mts +1 -3
- package/dist/plugins/seal/errors.mjs +7 -1
- package/dist/plugins/seal/errors.mjs.map +1 -1
- package/dist/plugins/seal/index.d.mts +1 -6
- package/dist/plugins/seal/index.mjs +40 -14
- package/dist/plugins/seal/index.mjs.map +1 -1
- package/dist/plugins/seal/key-manager.d.mts +1 -9
- package/dist/plugins/seal/key-manager.mjs +2 -18
- package/dist/plugins/seal/key-manager.mjs.map +1 -1
- package/dist/plugins/seal/key-server.mjs +37 -36
- package/dist/plugins/seal/key-server.mjs.map +1 -1
- package/dist/plugins/seal/keygen.mjs +16 -17
- package/dist/plugins/seal/keygen.mjs.map +1 -1
- package/dist/plugins/seal/mode/fork-known.mjs +36 -14
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
- package/dist/plugins/seal/mode/live.d.mts +6 -4
- package/dist/plugins/seal/mode/live.mjs +14 -21
- package/dist/plugins/seal/mode/live.mjs.map +1 -1
- package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
- package/dist/plugins/seal/registry-publish.mjs +1 -0
- package/dist/plugins/seal/registry-publish.mjs.map +1 -1
- package/dist/plugins/seal/routable.mjs.map +1 -1
- package/dist/plugins/seal/service.mjs.map +1 -1
- package/dist/plugins/seal/spans.mjs +18 -0
- package/dist/plugins/seal/spans.mjs.map +1 -0
- package/dist/plugins/sui/auto-tick.mjs +17 -23
- package/dist/plugins/sui/auto-tick.mjs.map +1 -1
- package/dist/plugins/sui/chain-build-container.mjs +18 -0
- package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
- package/dist/plugins/sui/chain-probe.d.mts +5 -5
- package/dist/plugins/sui/chain-probe.mjs +28 -58
- package/dist/plugins/sui/chain-probe.mjs.map +1 -1
- package/dist/plugins/sui/codegen.mjs +26 -0
- package/dist/plugins/sui/codegen.mjs.map +1 -1
- package/dist/plugins/sui/errors.d.mts +2 -29
- package/dist/plugins/sui/errors.mjs +1 -3
- package/dist/plugins/sui/errors.mjs.map +1 -1
- package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
- package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
- package/dist/plugins/sui/fork-orchestration.mjs +170 -2
- package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
- package/dist/plugins/sui/fork-transaction.d.mts +2 -0
- package/dist/plugins/sui/fork-transaction.mjs +92 -28
- package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
- package/dist/plugins/sui/index.d.mts +33 -70
- package/dist/plugins/sui/index.mjs +58 -35
- package/dist/plugins/sui/index.mjs.map +1 -1
- package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
- package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
- package/dist/plugins/sui/mode/external.mjs +7 -13
- package/dist/plugins/sui/mode/external.mjs.map +1 -1
- package/dist/plugins/sui/mode/fork.mjs +136 -59
- package/dist/plugins/sui/mode/fork.mjs.map +1 -1
- package/dist/plugins/sui/mode/live.mjs +10 -16
- package/dist/plugins/sui/mode/live.mjs.map +1 -1
- package/dist/plugins/sui/mode/local.mjs +37 -36
- package/dist/plugins/sui/mode/local.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
- package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared.d.mts +1 -5
- package/dist/plugins/sui/mode/shared.mjs.map +1 -1
- package/dist/plugins/sui/mode/spec.d.mts +18 -0
- package/dist/plugins/sui/move-summary-runner.mjs +207 -0
- package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
- package/dist/plugins/sui/network-resolver.d.mts +4 -3
- package/dist/plugins/sui/service.mjs.map +1 -1
- package/dist/plugins/sui/snapshot.mjs +3 -0
- package/dist/plugins/sui/snapshot.mjs.map +1 -1
- package/dist/plugins/sui/spans.mjs +17 -0
- package/dist/plugins/sui/spans.mjs.map +1 -0
- package/dist/plugins/wallet/codegen.d.mts +0 -1
- package/dist/plugins/wallet/codegen.mjs +8 -9
- package/dist/plugins/wallet/codegen.mjs.map +1 -1
- package/dist/plugins/wallet/index.d.mts +6 -8
- package/dist/plugins/wallet/index.mjs +46 -35
- package/dist/plugins/wallet/index.mjs.map +1 -1
- package/dist/plugins/wallet/origin-policy.mjs +12 -28
- package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
- package/dist/plugins/wallet/pairing.mjs +6 -4
- package/dist/plugins/wallet/pairing.mjs.map +1 -1
- package/dist/plugins/wallet/protocol.d.mts +1 -0
- package/dist/plugins/wallet/protocol.mjs +5 -44
- package/dist/plugins/wallet/protocol.mjs.map +1 -1
- package/dist/plugins/wallet/routable.mjs +2 -8
- package/dist/plugins/wallet/routable.mjs.map +1 -1
- package/dist/plugins/wallet/server.mjs +36 -44
- package/dist/plugins/wallet/server.mjs.map +1 -1
- package/dist/plugins/wallet/service.d.mts +1 -5
- package/dist/plugins/wallet/service.mjs +22 -18
- package/dist/plugins/wallet/service.mjs.map +1 -1
- package/dist/plugins/wallet/spans.mjs +22 -0
- package/dist/plugins/wallet/spans.mjs.map +1 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/walrus/codegen.d.mts +3 -3
- package/dist/plugins/walrus/codegen.mjs.map +1 -1
- package/dist/plugins/walrus/deploy-paths.mjs +21 -5
- package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
- package/dist/plugins/walrus/deploy.mjs +67 -69
- package/dist/plugins/walrus/deploy.mjs.map +1 -1
- package/dist/plugins/walrus/errors.mjs +1 -0
- package/dist/plugins/walrus/errors.mjs.map +1 -1
- package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
- package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/walrus/index.d.mts +2 -13
- package/dist/plugins/walrus/index.mjs +18 -23
- package/dist/plugins/walrus/index.mjs.map +1 -1
- package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
- package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
- package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
- package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
- package/dist/plugins/walrus/routable.mjs +7 -23
- package/dist/plugins/walrus/routable.mjs.map +1 -1
- package/dist/plugins/walrus/service.mjs.map +1 -1
- package/dist/plugins/walrus/spans.mjs +18 -0
- package/dist/plugins/walrus/spans.mjs.map +1 -0
- package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
- package/dist/plugins/walrus/storage-nodes.mjs +15 -8
- package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
- package/dist/plugins/walrus/wal-swap.mjs +58 -15
- package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
- package/dist/primitives/artifact-publisher.d.mts +1 -1
- package/dist/primitives/artifact-publisher.mjs +15 -0
- package/dist/primitives/artifact-publisher.mjs.map +1 -0
- package/dist/runtime/docker/client.mjs +17 -4
- package/dist/runtime/docker/client.mjs.map +1 -1
- package/dist/runtime/docker/container.mjs +219 -132
- package/dist/runtime/docker/container.mjs.map +1 -1
- package/dist/runtime/docker/errors.mjs +0 -6
- package/dist/runtime/docker/errors.mjs.map +1 -1
- package/dist/runtime/docker/exec.mjs +21 -18
- package/dist/runtime/docker/exec.mjs.map +1 -1
- package/dist/runtime/docker/image.mjs +36 -13
- package/dist/runtime/docker/image.mjs.map +1 -1
- package/dist/runtime/docker/index.mjs +14 -0
- package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
- package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
- package/dist/runtime/docker/inventory.mjs +14 -11
- package/dist/runtime/docker/inventory.mjs.map +1 -1
- package/dist/runtime/docker/labels.mjs +38 -5
- package/dist/runtime/docker/labels.mjs.map +1 -1
- package/dist/runtime/docker/logs.d.mts +1 -1
- package/dist/runtime/docker/logs.mjs.map +1 -1
- package/dist/runtime/docker/network.mjs +83 -47
- package/dist/runtime/docker/network.mjs.map +1 -1
- package/dist/runtime/docker/render-run-args.mjs +82 -0
- package/dist/runtime/docker/render-run-args.mjs.map +1 -0
- package/dist/runtime/docker/service.d.mts +1 -1
- package/dist/runtime/docker/service.mjs +12 -7
- package/dist/runtime/docker/service.mjs.map +1 -1
- package/dist/runtime/docker/sweep.mjs +118 -43
- package/dist/runtime/docker/sweep.mjs.map +1 -1
- package/dist/runtime/docker/volume.mjs +2 -0
- package/dist/runtime/docker/volume.mjs.map +1 -1
- package/dist/runtime/docker/wrap.mjs +30 -1
- package/dist/runtime/docker/wrap.mjs.map +1 -1
- package/dist/substrate/cross-process.mjs +14 -8
- package/dist/substrate/cross-process.mjs.map +1 -1
- package/dist/substrate/event-time.mjs +33 -0
- package/dist/substrate/event-time.mjs.map +1 -0
- package/dist/substrate/events.d.mts +28 -8
- package/dist/substrate/identity.d.mts +2 -1
- package/dist/substrate/manifest.d.mts +68 -5
- package/dist/substrate/manifest.mjs +34 -5
- package/dist/substrate/manifest.mjs.map +1 -1
- package/dist/substrate/network.d.mts +3 -5
- package/dist/substrate/options.d.mts +0 -2
- package/dist/substrate/plugin.d.mts +13 -0
- package/dist/substrate/plugin.mjs +4 -2
- package/dist/substrate/plugin.mjs.map +1 -1
- package/dist/substrate/projection.d.mts +35 -3
- package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
- package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
- package/dist/substrate/runtime/atomic-write.mjs +97 -32
- package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
- package/dist/substrate/runtime/cache/index.mjs +3 -0
- package/dist/substrate/runtime/cache/schema.mjs +2 -2
- package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
- package/dist/substrate/runtime/cache/service.mjs +9 -7
- package/dist/substrate/runtime/cache/service.mjs.map +1 -1
- package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
- package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
- package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
- package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
- package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
- package/dist/substrate/runtime/config-validation.d.mts +1 -13
- package/dist/substrate/runtime/config-validation.mjs +2 -91
- package/dist/substrate/runtime/config-validation.mjs.map +1 -1
- package/dist/substrate/runtime/container-runtime.d.mts +1 -0
- package/dist/substrate/runtime/container-runtime.mjs +2 -0
- package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
- package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
- package/dist/substrate/runtime/control-plane/service.mjs +7 -0
- package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
- package/dist/substrate/runtime/cross-process/index.mjs +11 -0
- package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
- package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
- package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
- package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
- package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
- package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
- package/dist/substrate/runtime/current-plugin.mjs +2 -2
- package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
- package/dist/substrate/runtime/errors.mjs +12 -6
- package/dist/substrate/runtime/errors.mjs.map +1 -1
- package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
- package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
- package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
- package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
- package/dist/substrate/runtime/host-gateway.mjs +20 -0
- package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
- package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
- package/dist/substrate/runtime/http-probe.d.mts +1 -1
- package/dist/substrate/runtime/index.mjs +14 -0
- package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
- package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
- package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
- package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
- package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
- package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
- package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
- package/dist/substrate/runtime/managed-container.d.mts +19 -1
- package/dist/substrate/runtime/managed-container.mjs +20 -1
- package/dist/substrate/runtime/managed-container.mjs.map +1 -1
- package/dist/substrate/runtime/manifest/index.mjs +3 -0
- package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
- package/dist/substrate/runtime/mode-errors.mjs +20 -0
- package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
- package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
- package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
- package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
- package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
- package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
- package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
- package/dist/substrate/runtime/observability/index.d.mts +1 -1
- package/dist/substrate/runtime/observability/index.mjs +13 -0
- package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
- package/dist/substrate/runtime/observability/log-store.mjs +175 -0
- package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
- package/dist/substrate/runtime/observability/logger.d.mts +2 -1
- package/dist/substrate/runtime/observability/logger.mjs +5 -9
- package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
- package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
- package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
- package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
- package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
- package/dist/substrate/runtime/observability/redaction.mjs +8 -14
- package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
- package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
- package/dist/substrate/runtime/observability/span-store.mjs +110 -0
- package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
- package/dist/substrate/runtime/observability/spans.mjs +14 -14
- package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
- package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
- package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
- package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
- package/dist/substrate/runtime/paths.d.mts +1 -1
- package/dist/substrate/runtime/paths.mjs +4 -3
- package/dist/substrate/runtime/paths.mjs.map +1 -1
- package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
- package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
- package/dist/substrate/runtime/port-broker/index.mjs +3 -0
- package/dist/substrate/runtime/port-broker/service.mjs +170 -126
- package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
- package/dist/substrate/runtime/probes.d.mts +7 -5
- package/dist/substrate/runtime/probes.mjs +3 -1
- package/dist/substrate/runtime/probes.mjs.map +1 -1
- package/dist/substrate/runtime/projection/index.mjs +4 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
- package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
- package/dist/substrate/runtime/projection/persisted.mjs +33 -15
- package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
- package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
- package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
- package/dist/substrate/runtime/projection/update.mjs +88 -24
- package/dist/substrate/runtime/projection/update.mjs.map +1 -1
- package/dist/substrate/runtime/random-suffix.mjs +11 -0
- package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
- package/dist/substrate/runtime/retry-policy.d.mts +59 -1
- package/dist/substrate/runtime/retry-policy.mjs +66 -1
- package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
- package/dist/substrate/runtime/routed-url.d.mts +1 -0
- package/dist/substrate/runtime/routed-url.mjs +79 -0
- package/dist/substrate/runtime/routed-url.mjs.map +1 -0
- package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
- package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
- package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
- package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
- package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
- package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
- package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
- package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
- package/dist/substrate/runtime/state-store/index.d.mts +1 -0
- package/dist/substrate/runtime/state-store/index.mjs +3 -0
- package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
- package/dist/substrate/runtime/state-store/schema.mjs +19 -14
- package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
- package/dist/substrate/runtime/state-store/service.d.mts +1 -0
- package/dist/substrate/runtime/state-store/service.mjs +145 -0
- package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
- package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
- package/dist/substrate/runtime/subnet-broker.mjs +60 -0
- package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
- package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
- package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
- package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
- package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
- package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
- package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
- package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
- package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/index.mjs +3 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/state.mjs +22 -0
- package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
- package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
- package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
- package/dist/substrate/runtime/typed-env.mjs +8 -0
- package/dist/substrate/runtime/typed-env.mjs.map +1 -0
- package/dist/substrate/state-store.d.mts +1 -0
- package/dist/substrate/versioned-doc-schema.mjs +17 -0
- package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
- package/dist/substrate/versioned-doc-sync.mjs +94 -0
- package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
- package/dist/surfaces/cli/command-tree.mjs.map +1 -1
- package/dist/surfaces/cli/commands/index.mjs +9 -0
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
- package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune.mjs +34 -17
- package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
- package/dist/surfaces/cli/commands/status.mjs +2 -2
- package/dist/surfaces/cli/commands/status.mjs.map +1 -1
- package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
- package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
- package/dist/surfaces/cli/commands/wipe.mjs +38 -4
- package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
- package/dist/surfaces/cli/errors.mjs +1 -1
- package/dist/surfaces/cli/errors.mjs.map +1 -1
- package/dist/surfaces/cli/flags.mjs +0 -1
- package/dist/surfaces/cli/flags.mjs.map +1 -1
- package/dist/surfaces/cli/index.mjs +98 -18
- package/dist/surfaces/cli/index.mjs.map +1 -1
- package/dist/surfaces/cli/output.mjs +1 -0
- package/dist/surfaces/cli/output.mjs.map +1 -1
- package/dist/surfaces/cli/sysexits.mjs +2 -1
- package/dist/surfaces/cli/sysexits.mjs.map +1 -1
- package/dist/surfaces/tui/app.mjs +25 -3
- package/dist/surfaces/tui/app.mjs.map +1 -1
- package/dist/surfaces/tui/display-derivation.mjs +23 -74
- package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
- package/dist/surfaces/tui/event-log.mjs +35 -23
- package/dist/surfaces/tui/event-log.mjs.map +1 -1
- package/dist/surfaces/tui/input.mjs +5 -1
- package/dist/surfaces/tui/input.mjs.map +1 -1
- package/dist/surfaces/tui/plain-renderer.mjs +70 -34
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
- package/package.json +24 -4
- package/dist/contracts/liveness-classifier.d.mts +0 -19
- package/dist/contracts/network-resolver.d.mts +0 -15
- package/dist/contracts/network-resolver.mjs +0 -7
- package/dist/contracts/network-resolver.mjs.map +0 -1
- package/dist/orchestrators/codegen/extras.mjs +0 -16
- package/dist/orchestrators/codegen/extras.mjs.map +0 -1
- package/dist/plugins/deepbook/routable.mjs +0 -21
- package/dist/plugins/deepbook/routable.mjs.map +0 -1
- package/dist/plugins/faucet/service.d.mts +0 -20
- package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
- package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
- package/dist/plugins/sui/seed-objects.d.mts +0 -18
- package/dist/plugins/sui/seed-objects.mjs +0 -25
- package/dist/plugins/sui/seed-objects.mjs.map +0 -1
- package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
- package/dist/substrate/runtime/context-helpers.mjs +0 -32
- package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
- package/dist/substrate/runtime/run.mjs.map +0 -1
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
- package/dist/substrate/runtime/supervisor.d.mts +0 -1
- package/dist/substrate/runtime/supervisor.mjs +0 -831
- package/dist/substrate/runtime/supervisor.mjs.map +0 -1
- package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
- /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.d.mts} +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { definePlugin, resource } from "../../substrate/plugin.mjs";
|
|
2
|
-
import
|
|
2
|
+
import "../../api/define-plugin.mjs";
|
|
3
3
|
import { IdentityContext, StackPathsService } from "../../substrate/runtime/paths.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { pluginErrorContributions } from "../../api/plugin-errors.mjs";
|
|
5
|
+
import { SuiSpans } from "../sui/spans.mjs";
|
|
5
6
|
import { suiResource } from "../sui/index.mjs";
|
|
7
|
+
import { AccountSpans } from "./spans.mjs";
|
|
6
8
|
import { makeAccountCodegen } from "./codegen.mjs";
|
|
7
|
-
import { ACCOUNT_ERROR_TAGS } from "./errors.mjs";
|
|
9
|
+
import { ACCOUNT_ERROR_TAGS, accountAcquireError } from "./errors.mjs";
|
|
8
10
|
import { SUI_FULL_COIN_TYPE } from "./funding.mjs";
|
|
9
11
|
import { makeAccountProjectionContribution, makeAccountRegistryContribution } from "./registry.mjs";
|
|
10
12
|
import { makeAccountSnapshotable } from "./snapshot.mjs";
|
|
@@ -18,13 +20,28 @@ const fundingProviders = (provider) => {
|
|
|
18
20
|
if (provider === void 0) return [];
|
|
19
21
|
return Array.isArray(provider) ? provider : [provider];
|
|
20
22
|
};
|
|
21
|
-
|
|
23
|
+
/** Validate a SUI funding amount and project it to bigint MIST.
|
|
24
|
+
* Returns a typed-error Effect so a bad amount surfaces as
|
|
25
|
+
* `AccountAcquireError(phase: 'validate-funding')` on the failure
|
|
26
|
+
* channel — NOT a synchronous throw lifted to a defect when called
|
|
27
|
+
* from inside the acquire body's `Effect.gen`. */
|
|
28
|
+
const fundingAmountToBigInt = (amount, accountName) => {
|
|
22
29
|
if (typeof amount === "bigint") {
|
|
23
|
-
if (amount < 0n)
|
|
24
|
-
|
|
30
|
+
if (amount < 0n) return Effect.fail(accountAcquireError({
|
|
31
|
+
phase: "validate-funding",
|
|
32
|
+
accountName,
|
|
33
|
+
variant: "ephemeral",
|
|
34
|
+
message: `Account '${accountName}': SUI funding amount must be a non-negative integer in MIST (got ${amount}).`
|
|
35
|
+
}));
|
|
36
|
+
return Effect.succeed(amount);
|
|
25
37
|
}
|
|
26
|
-
if (!Number.isSafeInteger(amount) || amount < 0)
|
|
27
|
-
|
|
38
|
+
if (!Number.isSafeInteger(amount) || amount < 0) return Effect.fail(accountAcquireError({
|
|
39
|
+
phase: "validate-funding",
|
|
40
|
+
accountName,
|
|
41
|
+
variant: "ephemeral",
|
|
42
|
+
message: `Account '${accountName}': SUI funding amount must be a non-negative safe integer in MIST (got ${amount}).`
|
|
43
|
+
}));
|
|
44
|
+
return Effect.succeed(BigInt(amount));
|
|
28
45
|
};
|
|
29
46
|
const coinLabelFor = (coin) => coin.symbol ?? coin.fullCoinType.split("::").at(-1) ?? coin.fullCoinType;
|
|
30
47
|
const account = (name, opts) => {
|
|
@@ -50,26 +67,33 @@ const account = (name, opts) => {
|
|
|
50
67
|
id: accountRef.id,
|
|
51
68
|
dependsOn: dependencies,
|
|
52
69
|
role: "task",
|
|
70
|
+
section: "account",
|
|
53
71
|
start: (deps) => Effect.gen(function* () {
|
|
54
72
|
const [sui, ...resolvedDeps] = deps;
|
|
55
73
|
const resolvedCoinValues = resolvedDeps.slice(0, coinFundingEntries.length);
|
|
56
74
|
const identity = yield* IdentityContext;
|
|
57
75
|
const paths = yield* StackPathsService;
|
|
58
76
|
let coinIndex = 0;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
const projectedFundingMutable = [];
|
|
78
|
+
for (const entry of fundingEntryList) {
|
|
79
|
+
if (entry.coin === "sui") {
|
|
80
|
+
const amount = yield* fundingAmountToBigInt(entry.amount, name);
|
|
81
|
+
projectedFundingMutable.push({
|
|
82
|
+
coin: "SUI",
|
|
83
|
+
fullCoinType: SUI_FULL_COIN_TYPE,
|
|
84
|
+
amount
|
|
85
|
+
});
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
65
88
|
const resolvedCoin = resolvedCoinValues[coinIndex];
|
|
66
89
|
coinIndex += 1;
|
|
67
|
-
|
|
90
|
+
projectedFundingMutable.push({
|
|
68
91
|
coin: coinLabelFor(resolvedCoin),
|
|
69
92
|
fullCoinType: resolvedCoin.fullCoinType,
|
|
70
93
|
amount: entry.amount
|
|
71
|
-
};
|
|
72
|
-
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const projectedFunding = projectedFundingMutable;
|
|
73
97
|
return yield* acquireAccount(opts2, {
|
|
74
98
|
sui: {
|
|
75
99
|
mode: sui.mode,
|
|
@@ -81,10 +105,10 @@ const account = (name, opts) => {
|
|
|
81
105
|
app: identity.app,
|
|
82
106
|
stack: identity.stack,
|
|
83
107
|
emitAutoPromotionEvent: () => Effect.logWarning("account funding auto-promoted for fork mode").pipe(Effect.annotateLogs({
|
|
84
|
-
[
|
|
85
|
-
[
|
|
86
|
-
[
|
|
87
|
-
[
|
|
108
|
+
[AccountSpans.name]: name,
|
|
109
|
+
[AccountSpans.fundingFrom]: "faucet",
|
|
110
|
+
[AccountSpans.fundingTo]: "pay-from-seed-via-impersonate",
|
|
111
|
+
[SuiSpans.mode]: "fork"
|
|
88
112
|
})),
|
|
89
113
|
projectedFunding
|
|
90
114
|
});
|
|
@@ -121,6 +145,10 @@ const account = (name, opts) => {
|
|
|
121
145
|
}
|
|
122
146
|
});
|
|
123
147
|
};
|
|
148
|
+
/** @internal — exported only for the projection regression test
|
|
149
|
+
* (`test/plugins/account/funding-projection.test.ts`). Projects the runtime
|
|
150
|
+
* `AccountFundingResult` (requested + applied) into the registry's
|
|
151
|
+
* per-row funded/already-satisfied/skipped status. */
|
|
124
152
|
const fundingProjectionForResult = (funding) => {
|
|
125
153
|
if (funding.requested.length === 0) return {
|
|
126
154
|
status: "skipped",
|
|
@@ -128,23 +156,28 @@ const fundingProjectionForResult = (funding) => {
|
|
|
128
156
|
requestedMist: null,
|
|
129
157
|
entries: []
|
|
130
158
|
};
|
|
131
|
-
|
|
132
|
-
const entries = funding.requested.map((entry) =>
|
|
133
|
-
|
|
134
|
-
fullCoinType
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
159
|
+
let appliedCursor = 0;
|
|
160
|
+
const entries = funding.requested.map((entry) => {
|
|
161
|
+
const candidate = funding.applied[appliedCursor];
|
|
162
|
+
const matches = candidate !== void 0 && candidate.fullCoinType === entry.fullCoinType && candidate.amount === entry.amount;
|
|
163
|
+
const outcome = matches ? candidate.outcome : void 0;
|
|
164
|
+
if (matches) appliedCursor += 1;
|
|
165
|
+
return {
|
|
166
|
+
coin: entry.coin,
|
|
167
|
+
fullCoinType: entry.fullCoinType,
|
|
168
|
+
amount: entry.amount.toString(),
|
|
169
|
+
status: outcome === "funded" ? "funded" : outcome === "already-satisfied" ? "already-satisfied" : "skipped"
|
|
170
|
+
};
|
|
171
|
+
});
|
|
138
172
|
const requestedMist = funding.requested.find((entry) => entry.fullCoinType === "0x2::sui::SUI")?.amount.toString() ?? null;
|
|
139
|
-
const
|
|
173
|
+
const settledCount = entries.filter((entry) => entry.status === "funded" || entry.status === "already-satisfied").length;
|
|
140
174
|
return {
|
|
141
|
-
status:
|
|
175
|
+
status: settledCount === entries.length ? "funded" : settledCount === 0 ? "skipped" : "unknown",
|
|
142
176
|
balanceMist: null,
|
|
143
177
|
requestedMist,
|
|
144
178
|
entries
|
|
145
179
|
};
|
|
146
180
|
};
|
|
147
|
-
const fundingEntryKey = (entry) => `${entry.fullCoinType}:${entry.amount}`;
|
|
148
181
|
//#endregion
|
|
149
182
|
export { account };
|
|
150
183
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/account/index.ts"],"sourcesContent":["// Account plugin — barrel + `account(name, opts?)` factory.\n//\n// Architecture (12-account.md): Account is the named-identity layer\n// for devstack. It acquires a keypair (or impersonation slot), funds\n// it (default + cross-cutting), registers `{name, address}`, and\n// publishes a per-account resolved value via a unique resource id.\n//\n// User-facing factory shape:\n//\n// account('alice') // default ephemeral\n// account('alice', { kind: 'ephemeral', funding: [{ coin: 'sui', amount: 5_000_000_000n }] })\n// account('alice', { kind: 'keystore', path: '~/.sui/keystore', aliasOrAddress: 'alice' })\n// account('alice', { kind: 'env', key: 'ALICE_PRIVATE_KEY' })\n// account('alice', { kind: 'inline', privateKey: 'suiprivkey1...' })\n// account('alice', { kind: 'signer', signer: hardwareWallet })\n// account('alice', { kind: 'impersonate', address: '0xabc...' })\n//\n// **Bare-form default**: `account('alice')` is shorthand for\n//\n// { kind: 'ephemeral' } plus default SUI funding.\n//\n// Distilled-doc invariant (12-account.md \"Make the bare-form auto-\n// promotion to fork-impersonate funding discoverable\"): on fork-\n// runtime Sui, the default-funding pass internally promotes from\n// \"faucet POST\" to \"pay-from-seed-via-impersonate\" because no\n// faucet exists on a fork. The promotion is LOUD by default — we\n// emit a `log.appended` event the first time the promotion fires\n// (see `funding.ts`).\n//\n// The plugin emits THREE capability decls + an error-tag contribution:\n//\n// 1. Snapshotable — secret-material subtree (ephemeral only).\n// 2. Codegenable — `account-map` bindings (name → address).\n// 3. StrategyContributor — per-stack `account:<name>` registry entry.\n//\n// Plus `errorContributions: [{ errorTags: ACCOUNT_ERROR_TAGS }]` —\n// harvested by the supervisor into the FormatterRegistry so the\n// cascade formatter renders account-tagged failures with the right\n// taxonomy header.\n\nimport { Effect } from 'effect';\n\nimport { definePlugin, resource, type AnyResourceRef } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport { SpanAttr } from '../../substrate/runtime/observability/spans.ts';\nimport { IdentityContext, StackPathsService } from '../../substrate/runtime/paths.ts';\nimport { suiResource } from '../sui/index.ts';\n\nimport { makeAccountCodegen, type AccountBindings } from './codegen.ts';\nimport { ACCOUNT_ERROR_TAGS } from './errors.ts';\nimport {\n\tSUI_FULL_COIN_TYPE,\n\ttype AccountFunding,\n\ttype AccountFundingEntry,\n\ttype AccountFundingResult,\n\ttype CrossCuttingFundingEntry,\n\ttype CrossCuttingFundingProvider,\n\ttype CoinMember,\n\ttype ProjectedFundingEntry,\n} from './funding.ts';\nimport {\n\tmakeAccountProjectionContribution,\n\tmakeAccountRegistryContribution,\n\ttype AccountRegistryEntry,\n\ttype AccountRegistryFunding,\n} from './registry.ts';\nimport { makeAccountSnapshotable } from './snapshot.ts';\nimport {\n\tacquireAccount,\n\tassertAccountName,\n\ttype AccountAcquireContext,\n\ttype AccountOptions,\n\ttype ResolvedAccountOptions,\n\ttype AccountValue,\n} from './service.ts';\n\nconst accountErrorContributions = pluginErrorContributions(ACCOUNT_ERROR_TAGS);\n\n// ---------------------------------------------------------------------------\n// Resource construction\n// ---------------------------------------------------------------------------\n\n/** Per-account-instance resource. The substrate's resource id MUST be unique\n * across the stack — we encode the account name as a literal-typed\n * template literal so the compiler catches duplicate-name composes\n * at the `defineDevstack` call site.\n *\n * Distilled-doc invariant: resource id flows into the on-disk path, the\n * manifest key, container labels, and generated TypeScript exports —\n * the identifier-safe name validation (in `service.ts`) protects\n * those call sites. */\nexport type AccountResourceId<Name extends string> = `account/${Name}`;\n\nconst accountResource = <Name extends string>(name: Name) =>\n\tresource<AccountResourceId<Name>, AccountValue>(`account/${name}` as AccountResourceId<Name>);\n\n// ---------------------------------------------------------------------------\n// User-facing factory\n// ---------------------------------------------------------------------------\n\n/** Construct the account plugin instance.\n *\n * Variants — typed at the API boundary via the discriminated\n * `AccountOptions` union. The factory's second arg is OPTIONAL —\n * omitting it yields the bare-form default (ephemeral + default\n * funding). Passing a non-matching `kind:` is a compile error\n * thanks to the union's discriminator.\n *\n * Distilled-doc invariant: the name is validated at the FACTORY\n * boundary (not just at acquire time) so a typo surfaces\n * immediately, not at runtime. */\ntype FundingCoinDependencies<Entries extends readonly unknown[]> = Entries extends readonly [\n\tinfer Head,\n\t...infer Tail,\n]\n\t? Head extends { readonly coin: infer Coin }\n\t\t? Coin extends CoinMember\n\t\t\t? readonly [Coin, ...FundingCoinDependencies<Tail>]\n\t\t\t: FundingCoinDependencies<Tail>\n\t\t: FundingCoinDependencies<Tail>\n\t: readonly [];\n\ntype FundingProviderDependenciesFor<Provider> = Provider extends readonly AnyResourceRef[]\n\t? Provider\n\t: Provider extends AnyResourceRef\n\t\t? readonly [Provider]\n\t\t: readonly [];\n\ntype FundingEntryProviderDependencies<Entry> = Entry extends { readonly coin: CoinMember }\n\t? 'via' extends keyof Entry\n\t\t? Entry extends { readonly via: infer Provider }\n\t\t\t? FundingProviderDependenciesFor<Provider>\n\t\t\t: readonly []\n\t\t: readonly []\n\t: readonly [];\n\ntype FundingProviderDependencies<Entries extends readonly unknown[]> = Entries extends readonly [\n\tinfer Head,\n\t...infer Tail,\n]\n\t? readonly [...FundingEntryProviderDependencies<Head>, ...FundingProviderDependencies<Tail>]\n\t: readonly [];\n\ntype AccountDependencyMembers<Funding extends AccountFunding> = readonly [\n\ttypeof suiResource,\n\t...FundingCoinDependencies<Funding>,\n\t...FundingProviderDependencies<Funding>,\n];\n\nconst isCoinFundingEntry = (entry: AccountFundingEntry): entry is CrossCuttingFundingEntry =>\n\ttypeof entry === 'object' && entry.coin !== 'sui';\n\nconst fundingProviders = (\n\tprovider: CrossCuttingFundingProvider | undefined,\n): ReadonlyArray<AnyResourceRef> => {\n\tif (provider === undefined) return [];\n\treturn Array.isArray(provider)\n\t\t? (provider as ReadonlyArray<AnyResourceRef>)\n\t\t: [provider as AnyResourceRef];\n};\n\nconst fundingAmountToBigInt = (amount: number | bigint): bigint => {\n\tif (typeof amount === 'bigint') {\n\t\tif (amount < 0n) {\n\t\t\tthrow new TypeError(`SUI funding amount must be a non-negative integer in MIST.`);\n\t\t}\n\t\treturn amount;\n\t}\n\tif (!Number.isSafeInteger(amount) || amount < 0) {\n\t\tthrow new TypeError(`SUI funding amount must be a non-negative safe integer in MIST.`);\n\t}\n\treturn BigInt(amount);\n};\n\nconst coinLabelFor = (coin: { readonly fullCoinType: string; readonly symbol?: string }): string =>\n\tcoin.symbol ?? coin.fullCoinType.split('::').at(-1) ?? coin.fullCoinType;\n\nexport const account = <const N extends string, const Funding extends AccountFunding = readonly []>(\n\tname: N,\n\topts?: AccountOptions<Funding>,\n) => {\n\tassertAccountName(name);\n\n\t// Normalize bare-form to ephemeral default. The user-facing\n\t// `AccountOptions` union does not include \"kind absent\" — we\n\t// inject the default here so the rest of the body sees a\n\t// fully-discriminated value.\n\tconst opts2: ResolvedAccountOptions =\n\t\topts === undefined\n\t\t\t? { kind: 'ephemeral', name }\n\t\t\t: ({ ...opts, name } as ResolvedAccountOptions);\n\n\tconst accountRef = accountResource(name);\n\n\t// Pull the funding resource tuple out of opts (may be undefined for\n\t// the bare form / variants without funding). The tuple preserves\n\t// plugin-valued refs when the caller passed coin plugins, so\n\t// recursive stack composition can include those publishers.\n\tconst fundingEntries = (opts?.funding ?? []) as unknown as Funding;\n\tconst fundingEntryList = fundingEntries as AccountFunding;\n\tconst coinFundingEntries = fundingEntryList.filter(isCoinFundingEntry);\n\tconst fundingMembers = coinFundingEntries.map((e) => e.coin);\n\tconst strategyProviderMembers = coinFundingEntries.flatMap((entry) =>\n\t\tfundingProviders(entry.via),\n\t);\n\tconst dependencies = [\n\t\tsuiResource,\n\t\t...fundingMembers,\n\t\t...strategyProviderMembers,\n\t] as unknown as AccountDependencyMembers<Funding>;\n\n\treturn definePlugin({\n\t\tid: accountRef.id,\n\t\tdependsOn: dependencies,\n\t\t// Account is a value-producer (no long-lived server / container);\n\t\t// tasks acquire their value, publish contributions, then reach\n\t\t// `done`.\n\t\trole: 'task',\n\t\tstart: (deps) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst [sui, ...resolvedDeps] = deps;\n\t\t\t\tconst resolvedCoinValues = resolvedDeps.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tcoinFundingEntries.length,\n\t\t\t\t) as ReadonlyArray<{\n\t\t\t\t\treadonly fullCoinType: string;\n\t\t\t\t\treadonly symbol?: string;\n\t\t\t\t}>;\n\t\t\t\t// Identity + on-disk runtime root come from the\n\t\t\t\t// supervisor-provided substrate context.\n\t\t\t\tconst identity = yield* IdentityContext;\n\t\t\t\tconst paths = yield* StackPathsService;\n\n\t\t\t\t// Project each funding dependency value to a\n\t\t\t\t// `{fullCoinType, amount}` projection. Dependency order\n\t\t\t\t// mirrors `fundingEntries`, after the hard Sui upstream.\n\t\t\t\tlet coinIndex = 0;\n\t\t\t\tconst projectedFunding: ReadonlyArray<ProjectedFundingEntry> = fundingEntryList.map(\n\t\t\t\t\t(entry) => {\n\t\t\t\t\t\tif (entry.coin === 'sui') {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tcoin: 'SUI',\n\t\t\t\t\t\t\t\tfullCoinType: SUI_FULL_COIN_TYPE,\n\t\t\t\t\t\t\t\tamount: fundingAmountToBigInt(entry.amount),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst resolvedCoin = resolvedCoinValues[coinIndex]!;\n\t\t\t\t\t\tcoinIndex += 1;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcoin: coinLabelFor(resolvedCoin),\n\t\t\t\t\t\t\tfullCoinType: resolvedCoin.fullCoinType,\n\t\t\t\t\t\t\tamount: entry.amount,\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tconst acquireCtx: AccountAcquireContext = {\n\t\t\t\t\tsui: {\n\t\t\t\t\t\tmode: sui.mode,\n\t\t\t\t\t\tchain: sui.chain,\n\t\t\t\t\t\tsdk: sui.sdk,\n\t\t\t\t\t\tfork: sui.fork,\n\t\t\t\t\t},\n\t\t\t\t\truntimeRoot: paths.stackRoot,\n\t\t\t\t\tapp: identity.app,\n\t\t\t\t\tstack: identity.stack,\n\t\t\t\t\temitAutoPromotionEvent: () =>\n\t\t\t\t\t\tEffect.logWarning('account funding auto-promoted for fork mode').pipe(\n\t\t\t\t\t\t\tEffect.annotateLogs({\n\t\t\t\t\t\t\t\t[SpanAttr.accountName]: name,\n\t\t\t\t\t\t\t\t[SpanAttr.accountFundingFrom]: 'faucet',\n\t\t\t\t\t\t\t\t[SpanAttr.accountFundingTo]: 'pay-from-seed-via-impersonate',\n\t\t\t\t\t\t\t\t[SpanAttr.suiMode]: 'fork',\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\tprojectedFunding,\n\t\t\t\t};\n\t\t\t\treturn yield* acquireAccount(opts2, acquireCtx);\n\t\t\t}),\n\t\t// Dynamic capability factory — receives the resolved\n\t\t// `AccountValue` + acquire context AFTER `acquire` succeeds.\n\t\t// Lets snapshot + codegen + registry decls reference the\n\t\t// REAL address (and identity app/stack) — the static form\n\t\t// would force placeholder values for fields only known at\n\t\t// acquire time.\n\t\terrorContributions: accountErrorContributions,\n\t\tcapabilities: ({ value: resolved, runtime: acquireCtx2 }) => {\n\t\t\tconst realEntry: AccountRegistryEntry = {\n\t\t\t\tname,\n\t\t\t\taddress: resolved.address,\n\t\t\t\tscheme: resolved.scheme,\n\t\t\t\tsource: resolved.source,\n\t\t\t\tfunding: fundingProjectionForResult(resolved.funding),\n\t\t\t};\n\t\t\tconst bindings: AccountBindings = {\n\t\t\t\tname,\n\t\t\t\taddress: resolved.address,\n\t\t\t\tscheme: resolved.scheme,\n\t\t\t\tsource: resolved.source,\n\t\t\t};\n\t\t\tconst snapshot = makeAccountSnapshotable({\n\t\t\t\taccountName: name,\n\t\t\t\tvariant: opts2.kind,\n\t\t\t\tapp: acquireCtx2.identity.app,\n\t\t\t\tstack: acquireCtx2.identity.stack,\n\t\t\t});\n\t\t\tconst codegen = makeAccountCodegen<N>({ name, resolved: bindings });\n\t\t\tconst registry = makeAccountRegistryContribution<N>(\n\t\t\t\trealEntry as AccountRegistryEntry & { readonly name: N },\n\t\t\t);\n\t\t\tconst projection = makeAccountProjectionContribution<N>(\n\t\t\t\trealEntry as AccountRegistryEntry & { readonly name: N },\n\t\t\t);\n\t\t\treturn [snapshot, codegen, registry, projection] as const;\n\t\t},\n\t});\n};\n\nconst fundingProjectionForResult = (funding: AccountFundingResult): AccountRegistryFunding => {\n\tif (funding.requested.length === 0) {\n\t\treturn { status: 'skipped', balanceMist: null, requestedMist: null, entries: [] };\n\t}\n\n\tconst appliedKeys = new Set(funding.applied.map(fundingEntryKey));\n\tconst entries = funding.requested.map((entry) => ({\n\t\tcoin: entry.coin,\n\t\tfullCoinType: entry.fullCoinType,\n\t\tamount: entry.amount.toString(),\n\t\tstatus: appliedKeys.has(fundingEntryKey(entry)) ? ('funded' as const) : ('skipped' as const),\n\t}));\n\tconst requestedMist =\n\t\tfunding.requested\n\t\t\t.find((entry) => entry.fullCoinType === SUI_FULL_COIN_TYPE)\n\t\t\t?.amount.toString() ?? null;\n\tconst fundedCount = entries.filter((entry) => entry.status === 'funded').length;\n\treturn {\n\t\tstatus: fundedCount === entries.length ? 'funded' : fundedCount === 0 ? 'skipped' : 'unknown',\n\t\tbalanceMist: null,\n\t\trequestedMist,\n\t\tentries,\n\t};\n};\n\nconst fundingEntryKey = (entry: ProjectedFundingEntry): string =>\n\t`${entry.fullCoinType}:${entry.amount}`;\n\n// ---------------------------------------------------------------------------\n// Re-exports for advanced callers (Coin, Wallet, Package)\n// ---------------------------------------------------------------------------\n\nexport type { AccountOptions, ResolvedAccountOptions, AccountValue, TxResult } from './service.ts';\nexport type {\n\tAccountError,\n\tAccountAcquireError,\n\tAccountAcquirePhase,\n\tAccountSignError,\n\tAccountSignPhase,\n\tAccountVariantKind,\n} from './errors.ts';\nexport { ACCOUNT_ERROR_TAGS } from './errors.ts';\nexport type {\n\tAccountFunding,\n\tAccountFundingEntry,\n\tAccountFundingCoinValue,\n\tAccountFundingResult,\n\tAccountFundingRequest,\n\tAccountFundingStrategy,\n\tCoinMember,\n\tCrossCuttingFundingEntry,\n\tCrossCuttingFundingProvider,\n\tProjectedFunding,\n\tProjectedFundingEntry,\n\tSuiFundingEntry,\n} from './funding.ts';\nexport { DEFAULT_EPHEMERAL_FUND_MIST, SUI_FULL_COIN_TYPE } from './funding.ts';\nexport type { AccountBindings } from './codegen.ts';\nexport type {\n\tAccountRegistryEntry,\n\tAccountRegistryFunding,\n\tAccountRegistryKey,\n} from './registry.ts';\nexport { accountRegistryKey } from './registry.ts';\nexport type { SyntheticImpersonationSigner } from './variants/impersonate.ts';\nexport type { SignatureScheme, ResolvedKeypair } from './keypair.ts';\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/account/index.ts"],"sourcesContent":["// Account plugin — barrel + `account(name, opts?)` factory.\n//\n// Architecture (12-account.md): Account is the named-identity layer\n// for devstack. It acquires a keypair (or impersonation slot), funds\n// it (default + cross-cutting), registers `{name, address}`, and\n// publishes a per-account resolved value via a unique resource id.\n//\n// User-facing factory shape:\n//\n// account('alice') // default ephemeral\n// account('alice', { kind: 'ephemeral', funding: [{ coin: 'sui', amount: 5_000_000_000n }] })\n// account('alice', { kind: 'keystore', path: '~/.sui/keystore', aliasOrAddress: 'alice' })\n// account('alice', { kind: 'env', key: 'ALICE_PRIVATE_KEY' })\n// account('alice', { kind: 'inline', privateKey: 'suiprivkey1...' })\n// account('alice', { kind: 'signer', signer: hardwareWallet })\n// account('alice', { kind: 'impersonate', address: '0xabc...' })\n//\n// **Bare-form default**: `account('alice')` is shorthand for\n//\n// { kind: 'ephemeral' } plus default SUI funding.\n//\n// Distilled-doc invariant (12-account.md \"Make the bare-form auto-\n// promotion to fork-impersonate funding discoverable\"): on fork-\n// runtime Sui, the default-funding pass internally promotes from\n// \"faucet POST\" to \"pay-from-seed-via-impersonate\" because no\n// faucet exists on a fork. The promotion is LOUD by default — we\n// emit a `log.appended` event the first time the promotion fires\n// (see `funding.ts`).\n//\n// The plugin emits THREE capability decls + an error-tag contribution:\n//\n// 1. Snapshotable — secret-material subtree (ephemeral only).\n// 2. Codegenable — `account-map` bindings (name → address).\n// 3. StrategyContributor — per-stack `account:<name>` registry entry.\n//\n// Plus `errorContributions: [{ errorTags: ACCOUNT_ERROR_TAGS }]` —\n// harvested by the supervisor into the FormatterRegistry so the\n// cascade formatter renders account-tagged failures with the right\n// taxonomy header.\n\nimport { Effect } from 'effect';\n\nimport { definePlugin, resource, type AnyResourceRef } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport { IdentityContext, StackPathsService } from '../../substrate/runtime/paths.ts';\nimport { suiResource, SuiSpans } from '../sui/index.ts';\n\nimport { AccountSpans } from './spans.ts';\n\nimport { makeAccountCodegen, type AccountBindings } from './codegen.ts';\nimport { ACCOUNT_ERROR_TAGS, accountAcquireError, type AccountAcquireError } from './errors.ts';\nimport {\n\tSUI_FULL_COIN_TYPE,\n\ttype AccountFunding,\n\ttype AccountFundingEntry,\n\ttype AccountFundingResult,\n\ttype CrossCuttingFundingEntry,\n\ttype CrossCuttingFundingProvider,\n\ttype CoinMember,\n\ttype ProjectedFundingEntry,\n} from './funding.ts';\nimport {\n\tmakeAccountProjectionContribution,\n\tmakeAccountRegistryContribution,\n\ttype AccountRegistryEntry,\n\ttype AccountRegistryFunding,\n} from './registry.ts';\nimport { makeAccountSnapshotable } from './snapshot.ts';\nimport {\n\tacquireAccount,\n\tassertAccountName,\n\ttype AccountAcquireContext,\n\ttype AccountOptions,\n\ttype ResolvedAccountOptions,\n\ttype AccountValue,\n} from './service.ts';\n\nconst accountErrorContributions = pluginErrorContributions(ACCOUNT_ERROR_TAGS);\n\n// ---------------------------------------------------------------------------\n// Resource construction\n// ---------------------------------------------------------------------------\n\n/** Per-account-instance resource. The substrate's resource id MUST be unique\n * across the stack — we encode the account name as a literal-typed\n * template literal so the compiler catches duplicate-name composes\n * at the `defineDevstack` call site.\n *\n * Distilled-doc invariant: resource id flows into the on-disk path, the\n * manifest key, container labels, and generated TypeScript exports —\n * the identifier-safe name validation (in `service.ts`) protects\n * those call sites. */\nexport type AccountResourceId<Name extends string> = `account/${Name}`;\n\nconst accountResource = <Name extends string>(name: Name) =>\n\tresource<AccountResourceId<Name>, AccountValue>(`account/${name}` as AccountResourceId<Name>);\n\n// ---------------------------------------------------------------------------\n// User-facing factory\n// ---------------------------------------------------------------------------\n\n/** Construct the account plugin instance.\n *\n * Variants — typed at the API boundary via the discriminated\n * `AccountOptions` union. The factory's second arg is OPTIONAL —\n * omitting it yields the bare-form default (ephemeral + default\n * funding). Passing a non-matching `kind:` is a compile error\n * thanks to the union's discriminator.\n *\n * Distilled-doc invariant: the name is validated at the FACTORY\n * boundary (not just at acquire time) so a typo surfaces\n * immediately, not at runtime. */\ntype FundingCoinDependencies<Entries extends readonly unknown[]> = Entries extends readonly [\n\tinfer Head,\n\t...infer Tail,\n]\n\t? Head extends { readonly coin: infer Coin }\n\t\t? Coin extends CoinMember\n\t\t\t? readonly [Coin, ...FundingCoinDependencies<Tail>]\n\t\t\t: FundingCoinDependencies<Tail>\n\t\t: FundingCoinDependencies<Tail>\n\t: readonly [];\n\ntype FundingProviderDependenciesFor<Provider> = Provider extends readonly AnyResourceRef[]\n\t? Provider\n\t: Provider extends AnyResourceRef\n\t\t? readonly [Provider]\n\t\t: readonly [];\n\ntype FundingEntryProviderDependencies<Entry> = Entry extends { readonly coin: CoinMember }\n\t? 'via' extends keyof Entry\n\t\t? Entry extends { readonly via: infer Provider }\n\t\t\t? FundingProviderDependenciesFor<Provider>\n\t\t\t: readonly []\n\t\t: readonly []\n\t: readonly [];\n\ntype FundingProviderDependencies<Entries extends readonly unknown[]> = Entries extends readonly [\n\tinfer Head,\n\t...infer Tail,\n]\n\t? readonly [...FundingEntryProviderDependencies<Head>, ...FundingProviderDependencies<Tail>]\n\t: readonly [];\n\ntype AccountDependencyMembers<Funding extends AccountFunding> = readonly [\n\ttypeof suiResource,\n\t...FundingCoinDependencies<Funding>,\n\t...FundingProviderDependencies<Funding>,\n];\n\nconst isCoinFundingEntry = (entry: AccountFundingEntry): entry is CrossCuttingFundingEntry =>\n\ttypeof entry === 'object' && entry.coin !== 'sui';\n\nconst fundingProviders = (\n\tprovider: CrossCuttingFundingProvider | undefined,\n): ReadonlyArray<AnyResourceRef> => {\n\tif (provider === undefined) return [];\n\treturn Array.isArray(provider)\n\t\t? (provider as ReadonlyArray<AnyResourceRef>)\n\t\t: [provider as AnyResourceRef];\n};\n\n/** Validate a SUI funding amount and project it to bigint MIST.\n * Returns a typed-error Effect so a bad amount surfaces as\n * `AccountAcquireError(phase: 'validate-funding')` on the failure\n * channel — NOT a synchronous throw lifted to a defect when called\n * from inside the acquire body's `Effect.gen`. */\nconst fundingAmountToBigInt = (\n\tamount: number | bigint,\n\taccountName: string,\n): Effect.Effect<bigint, AccountAcquireError> => {\n\tif (typeof amount === 'bigint') {\n\t\tif (amount < 0n) {\n\t\t\treturn Effect.fail(\n\t\t\t\taccountAcquireError({\n\t\t\t\t\tphase: 'validate-funding',\n\t\t\t\t\taccountName,\n\t\t\t\t\tvariant: 'ephemeral',\n\t\t\t\t\tmessage: `Account '${accountName}': SUI funding amount must be a non-negative integer in MIST (got ${amount}).`,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn Effect.succeed(amount);\n\t}\n\tif (!Number.isSafeInteger(amount) || amount < 0) {\n\t\treturn Effect.fail(\n\t\t\taccountAcquireError({\n\t\t\t\tphase: 'validate-funding',\n\t\t\t\taccountName,\n\t\t\t\tvariant: 'ephemeral',\n\t\t\t\tmessage: `Account '${accountName}': SUI funding amount must be a non-negative safe integer in MIST (got ${amount}).`,\n\t\t\t}),\n\t\t);\n\t}\n\treturn Effect.succeed(BigInt(amount));\n};\n\nconst coinLabelFor = (coin: { readonly fullCoinType: string; readonly symbol?: string }): string =>\n\tcoin.symbol ?? coin.fullCoinType.split('::').at(-1) ?? coin.fullCoinType;\n\nexport const account = <const N extends string, const Funding extends AccountFunding = readonly []>(\n\tname: N,\n\topts?: AccountOptions<Funding>,\n) => {\n\tassertAccountName(name);\n\n\t// Normalize bare-form to ephemeral default. The user-facing\n\t// `AccountOptions` union does not include \"kind absent\" — we\n\t// inject the default here so the rest of the body sees a\n\t// fully-discriminated value.\n\tconst opts2: ResolvedAccountOptions =\n\t\topts === undefined\n\t\t\t? { kind: 'ephemeral', name }\n\t\t\t: ({ ...opts, name } as ResolvedAccountOptions);\n\n\tconst accountRef = accountResource(name);\n\n\t// Pull the funding resource tuple out of opts (may be undefined for\n\t// the bare form / variants without funding). The tuple preserves\n\t// plugin-valued refs when the caller passed coin plugins, so\n\t// recursive stack composition can include those publishers.\n\tconst fundingEntries = (opts?.funding ?? []) as unknown as Funding;\n\tconst fundingEntryList = fundingEntries as AccountFunding;\n\tconst coinFundingEntries = fundingEntryList.filter(isCoinFundingEntry);\n\tconst fundingMembers = coinFundingEntries.map((e) => e.coin);\n\tconst strategyProviderMembers = coinFundingEntries.flatMap((entry) =>\n\t\tfundingProviders(entry.via),\n\t);\n\tconst dependencies = [\n\t\tsuiResource,\n\t\t...fundingMembers,\n\t\t...strategyProviderMembers,\n\t] as unknown as AccountDependencyMembers<Funding>;\n\n\treturn definePlugin({\n\t\tid: accountRef.id,\n\t\tdependsOn: dependencies,\n\t\t// Account is a value-producer (no long-lived server / container);\n\t\t// tasks acquire their value, publish contributions, then reach\n\t\t// `done`.\n\t\trole: 'task',\n\t\tsection: 'account',\n\t\tstart: (deps) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst [sui, ...resolvedDeps] = deps;\n\t\t\t\tconst resolvedCoinValues = resolvedDeps.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tcoinFundingEntries.length,\n\t\t\t\t) as ReadonlyArray<{\n\t\t\t\t\treadonly fullCoinType: string;\n\t\t\t\t\treadonly symbol?: string;\n\t\t\t\t}>;\n\t\t\t\t// Identity + on-disk runtime root come from the\n\t\t\t\t// supervisor-provided substrate context.\n\t\t\t\tconst identity = yield* IdentityContext;\n\t\t\t\tconst paths = yield* StackPathsService;\n\n\t\t\t\t// Project each funding dependency value to a\n\t\t\t\t// `{fullCoinType, amount}` projection. Dependency order\n\t\t\t\t// mirrors `fundingEntries`, after the hard Sui upstream.\n\t\t\t\t// SUI amount validation lives on the failure channel so a\n\t\t\t\t// negative / non-integer amount surfaces as a typed\n\t\t\t\t// `AccountAcquireError(phase: 'validate-funding')` instead\n\t\t\t\t// of a defect (the old sync-throw lifted to a defect when\n\t\t\t\t// run inside this `Effect.gen`).\n\t\t\t\tlet coinIndex = 0;\n\t\t\t\tconst projectedFundingMutable: ProjectedFundingEntry[] = [];\n\t\t\t\tfor (const entry of fundingEntryList) {\n\t\t\t\t\tif (entry.coin === 'sui') {\n\t\t\t\t\t\tconst amount = yield* fundingAmountToBigInt(entry.amount, name);\n\t\t\t\t\t\tprojectedFundingMutable.push({\n\t\t\t\t\t\t\tcoin: 'SUI',\n\t\t\t\t\t\t\tfullCoinType: SUI_FULL_COIN_TYPE,\n\t\t\t\t\t\t\tamount,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst resolvedCoin = resolvedCoinValues[coinIndex]!;\n\t\t\t\t\tcoinIndex += 1;\n\t\t\t\t\tprojectedFundingMutable.push({\n\t\t\t\t\t\tcoin: coinLabelFor(resolvedCoin),\n\t\t\t\t\t\tfullCoinType: resolvedCoin.fullCoinType,\n\t\t\t\t\t\tamount: entry.amount,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst projectedFunding: ReadonlyArray<ProjectedFundingEntry> = projectedFundingMutable;\n\n\t\t\t\tconst acquireCtx: AccountAcquireContext = {\n\t\t\t\t\tsui: {\n\t\t\t\t\t\tmode: sui.mode,\n\t\t\t\t\t\tchain: sui.chain,\n\t\t\t\t\t\tsdk: sui.sdk,\n\t\t\t\t\t\tfork: sui.fork,\n\t\t\t\t\t},\n\t\t\t\t\truntimeRoot: paths.stackRoot,\n\t\t\t\t\tapp: identity.app,\n\t\t\t\t\tstack: identity.stack,\n\t\t\t\t\temitAutoPromotionEvent: () =>\n\t\t\t\t\t\tEffect.logWarning('account funding auto-promoted for fork mode').pipe(\n\t\t\t\t\t\t\tEffect.annotateLogs({\n\t\t\t\t\t\t\t\t[AccountSpans.name]: name,\n\t\t\t\t\t\t\t\t[AccountSpans.fundingFrom]: 'faucet',\n\t\t\t\t\t\t\t\t[AccountSpans.fundingTo]: 'pay-from-seed-via-impersonate',\n\t\t\t\t\t\t\t\t[SuiSpans.mode]: 'fork',\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\tprojectedFunding,\n\t\t\t\t};\n\t\t\t\treturn yield* acquireAccount(opts2, acquireCtx);\n\t\t\t}),\n\t\t// Dynamic capability factory — receives the resolved\n\t\t// `AccountValue` + acquire context AFTER `acquire` succeeds.\n\t\t// Lets snapshot + codegen + registry decls reference the\n\t\t// REAL address (and identity app/stack) — the static form\n\t\t// would force placeholder values for fields only known at\n\t\t// acquire time.\n\t\terrorContributions: accountErrorContributions,\n\t\tcapabilities: ({ value: resolved, runtime: acquireCtx2 }) => {\n\t\t\tconst realEntry: AccountRegistryEntry = {\n\t\t\t\tname,\n\t\t\t\taddress: resolved.address,\n\t\t\t\tscheme: resolved.scheme,\n\t\t\t\tsource: resolved.source,\n\t\t\t\tfunding: fundingProjectionForResult(resolved.funding),\n\t\t\t};\n\t\t\tconst bindings: AccountBindings = {\n\t\t\t\tname,\n\t\t\t\taddress: resolved.address,\n\t\t\t\tscheme: resolved.scheme,\n\t\t\t\tsource: resolved.source,\n\t\t\t};\n\t\t\tconst snapshot = makeAccountSnapshotable({\n\t\t\t\taccountName: name,\n\t\t\t\tvariant: opts2.kind,\n\t\t\t\tapp: acquireCtx2.identity.app,\n\t\t\t\tstack: acquireCtx2.identity.stack,\n\t\t\t});\n\t\t\tconst codegen = makeAccountCodegen<N>({ name, resolved: bindings });\n\t\t\tconst registry = makeAccountRegistryContribution<N>(\n\t\t\t\trealEntry as AccountRegistryEntry & { readonly name: N },\n\t\t\t);\n\t\t\tconst projection = makeAccountProjectionContribution<N>(\n\t\t\t\trealEntry as AccountRegistryEntry & { readonly name: N },\n\t\t\t);\n\t\t\treturn [snapshot, codegen, registry, projection] as const;\n\t\t},\n\t});\n};\n\n/** @internal — exported only for the projection regression test\n * (`test/plugins/account/funding-projection.test.ts`). Projects the runtime\n * `AccountFundingResult` (requested + applied) into the registry's\n * per-row funded/already-satisfied/skipped status. */\nexport const fundingProjectionForResult = (\n\tfunding: AccountFundingResult,\n): AccountRegistryFunding => {\n\tif (funding.requested.length === 0) {\n\t\treturn { status: 'skipped', balanceMist: null, requestedMist: null, entries: [] };\n\t}\n\n\t// Positional outcome consume so the projection can distinguish a\n\t// real faucet call (`funded`) from the pre-existing-balance\n\t// short-circuit (`already-satisfied`). `applied` is an\n\t// order-preserving SUBSEQUENCE of `requested`:\n\t// `applyCrossCuttingFunding` (and the default-funding pass) iterate\n\t// `requested` in order and only push a processed entry onto\n\t// `applied`, dropping zero-amount and no-strategy entries. So we\n\t// walk a cursor through `applied` and adopt its outcome for the\n\t// matching requested row by (fullCoinType, amount) — a keyed Map\n\t// would collapse duplicate (coin, amount) entries and mislabel the\n\t// genuinely-funded first row as `already-satisfied`. An entry the\n\t// funding pass never reached (zero-amount, or absent from `applied`)\n\t// does not match the cursor and projects as `skipped` without\n\t// advancing it.\n\tlet appliedCursor = 0;\n\tconst entries = funding.requested.map((entry) => {\n\t\tconst candidate = funding.applied[appliedCursor];\n\t\tconst matches =\n\t\t\tcandidate !== undefined &&\n\t\t\tcandidate.fullCoinType === entry.fullCoinType &&\n\t\t\tcandidate.amount === entry.amount;\n\t\tconst outcome = matches ? candidate.outcome : undefined;\n\t\tif (matches) {\n\t\t\tappliedCursor += 1;\n\t\t}\n\t\treturn {\n\t\t\tcoin: entry.coin,\n\t\t\tfullCoinType: entry.fullCoinType,\n\t\t\tamount: entry.amount.toString(),\n\t\t\tstatus:\n\t\t\t\toutcome === 'funded'\n\t\t\t\t\t? ('funded' as const)\n\t\t\t\t\t: outcome === 'already-satisfied'\n\t\t\t\t\t\t? ('already-satisfied' as const)\n\t\t\t\t\t\t: ('skipped' as const),\n\t\t};\n\t});\n\tconst requestedMist =\n\t\tfunding.requested\n\t\t\t.find((entry) => entry.fullCoinType === SUI_FULL_COIN_TYPE)\n\t\t\t?.amount.toString() ?? null;\n\tconst settledCount = entries.filter(\n\t\t(entry) => entry.status === 'funded' || entry.status === 'already-satisfied',\n\t).length;\n\treturn {\n\t\t// `funded` here means \"every requested entry is satisfied\" —\n\t\t// either the faucet succeeded or the pre-existing balance\n\t\t// already covered it. `unknown` covers the mixed partial-success\n\t\t// case so consumers can distinguish from \"nothing ran at all\".\n\t\tstatus: settledCount === entries.length ? 'funded' : settledCount === 0 ? 'skipped' : 'unknown',\n\t\tbalanceMist: null,\n\t\trequestedMist,\n\t\tentries,\n\t};\n};\n\n// ---------------------------------------------------------------------------\n// Re-exports for advanced callers (Coin, Wallet, Package)\n// ---------------------------------------------------------------------------\n\nexport type {\n\tAccountOptions,\n\tResolvedAccountOptions,\n\tAccountValue,\n\tSignAndExecuteResult,\n\tTxResult,\n} from './service.ts';\nexport type {\n\tAccountError,\n\tAccountAcquireError,\n\tAccountAcquirePhase,\n\tAccountSignError,\n\tAccountSignPhase,\n\tAccountVariantKind,\n} from './errors.ts';\nexport { ACCOUNT_ERROR_TAGS } from './errors.ts';\nexport type {\n\tAccountFunding,\n\tAccountFundingEntry,\n\tAccountFundingCoinValue,\n\tAccountFundingResult,\n\tAccountFundingRequest,\n\tAccountFundingStrategy,\n\tAppliedFunding,\n\tAppliedFundingEntry,\n\tAppliedFundingOutcome,\n\tCoinMember,\n\tCrossCuttingFundingEntry,\n\tCrossCuttingFundingProvider,\n\tFundEphemeralDefaultOutcome,\n\tProjectedFunding,\n\tProjectedFundingEntry,\n\tSuiFundingEntry,\n} from './funding.ts';\nexport { DEFAULT_EPHEMERAL_FUND_MIST, SUI_FULL_COIN_TYPE } from './funding.ts';\nexport type { AccountBindings } from './codegen.ts';\nexport type {\n\tAccountRegistryEntry,\n\tAccountRegistryFunding,\n\tAccountRegistryKey,\n} from './registry.ts';\nexport { accountRegistryKey } from './registry.ts';\nexport type { SyntheticImpersonationSigner } from './variants/impersonate.ts';\nexport type { SignatureScheme, ResolvedKeypair } from './keypair.ts';\nexport { AccountSpans } from './spans.ts';\n"],"mappings":"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"}
|
|
@@ -42,12 +42,11 @@ const generateEd25519Keypair = (accountName) => Effect.try({
|
|
|
42
42
|
const decodeBech32Secret = (bech32, accountName, variant) => Effect.gen(function* () {
|
|
43
43
|
const parsed = yield* Effect.try({
|
|
44
44
|
try: () => decodeSuiPrivateKey(bech32),
|
|
45
|
-
catch: (
|
|
45
|
+
catch: () => accountAcquireError({
|
|
46
46
|
phase: "decode-inline",
|
|
47
47
|
accountName,
|
|
48
48
|
variant,
|
|
49
|
-
message: `Account '${accountName}': decodeSuiPrivateKey() rejected the supplied bech32 secret
|
|
50
|
-
cause
|
|
49
|
+
message: `Account '${accountName}': decodeSuiPrivateKey() rejected the supplied bech32 secret.`
|
|
51
50
|
})
|
|
52
51
|
});
|
|
53
52
|
const scheme = yield* normalizeScheme(parsed.scheme, accountName, variant);
|
|
@@ -62,12 +61,11 @@ const decodeBech32Secret = (bech32, accountName, variant) => Effect.gen(function
|
|
|
62
61
|
try: () => {
|
|
63
62
|
return resolvedKeypairFromEd25519(Ed25519Keypair.fromSecretKey(parsed.secretKey));
|
|
64
63
|
},
|
|
65
|
-
catch: (
|
|
64
|
+
catch: () => accountAcquireError({
|
|
66
65
|
phase: "decode-inline",
|
|
67
66
|
accountName,
|
|
68
67
|
variant,
|
|
69
|
-
message: `Account '${accountName}': Ed25519Keypair.fromSecretKey() rejected the decoded secret
|
|
70
|
-
cause
|
|
68
|
+
message: `Account '${accountName}': Ed25519Keypair.fromSecretKey() rejected the decoded secret.`
|
|
71
69
|
})
|
|
72
70
|
});
|
|
73
71
|
});
|
|
@@ -78,12 +76,11 @@ const resolvedKeypairFromEd25519Bytes = (secretKey, accountName, variant) => Eff
|
|
|
78
76
|
try: () => {
|
|
79
77
|
return resolvedKeypairFromEd25519(Ed25519Keypair.fromSecretKey(secretKey));
|
|
80
78
|
},
|
|
81
|
-
catch: (
|
|
79
|
+
catch: () => accountAcquireError({
|
|
82
80
|
phase: "decode-inline",
|
|
83
81
|
accountName,
|
|
84
82
|
variant,
|
|
85
|
-
message: `Account '${accountName}': Ed25519Keypair.fromSecretKey() rejected the supplied raw bytes
|
|
86
|
-
cause
|
|
83
|
+
message: `Account '${accountName}': Ed25519Keypair.fromSecretKey() rejected the supplied raw bytes.`
|
|
87
84
|
})
|
|
88
85
|
});
|
|
89
86
|
const resolvedKeypairFromEd25519 = (kp) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keypair.mjs","names":[],"sources":["../../../src/plugins/account/keypair.ts"],"sourcesContent":["// Account plugin — keypair generation + scheme normalization helpers.\n//\n// Distilled-doc finding (12-account.md \"Scheme normalization\"\n// invariant): scheme surfaced to consumers MUST be lowercased at the\n// account boundary. Mixed-case from the SDK leaks into manifest\n// serialization and on-chain Move type matching if not converted. We\n// pin the canonical lowercased union at this module's boundary and\n// every variant resolver dumps through `normalizeScheme` before\n// producing the resolved value.\n//\n// Distilled-doc opportunity (\"Co-locate the canonical Account-value\n// Schema with the canonical type\"): the canonical signature scheme\n// union lives here, NOT next to the factory, so future Schema sits\n// alongside the type.\n\nimport { Effect } from 'effect';\n\nimport { decodeSuiPrivateKey, encodeSuiPrivateKey } from '@mysten/sui/cryptography';\nimport { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';\n\nimport {\n\taccountAcquireError,\n\ttype AccountAcquireError,\n\ttype AccountVariantKind,\n} from './errors.ts';\n\n/** Lowercased signature scheme — the canonical wire form. The SDK\n * occasionally hands us `'ED25519'` / `'Secp256k1'`; the boundary\n * conversion lives in `normalizeScheme`. */\nexport type SignatureScheme = 'ed25519' | 'secp256k1' | 'secp256r1';\n\n/** Resolved keypair shape — the variant resolvers all funnel into\n * this so the funding + register passes are variant-agnostic.\n *\n * Note: impersonation accounts do NOT produce a `Keypair`; they\n * produce a `SyntheticImpersonationSigner` (see\n * `variants/impersonate.ts`). The discriminator lives on the\n * resolved `AccountValue` (architecture: distilled doc opportunity\n * \"Tighten the resolved-account type\"). */\nexport interface ResolvedKeypair {\n\treadonly address: string;\n\treadonly scheme: SignatureScheme;\n\treadonly publicKey: Uint8Array;\n\t/** Opaque signer handle — typed loosely here because the four\n\t * real variants (ed25519/secp256k1/secp256r1 + bring-your-own\n\t * Signer) share no narrow TS type beyond `Signer`. The wallet /\n\t * sign-and-execute capability narrows downstream. */\n\treadonly signer: unknown;\n\t/** Bech32-encoded secret. Only present for ephemeral / inline /\n\t * env / keystore variants — `null` for `signer` (we never ask\n\t * for it) and `impersonate` (no secret exists). */\n\treadonly bech32Secret: string | null;\n}\n\n/** Normalize the SDK's mixed-case scheme to the lowercased wire form.\n * Unknown schemes surface as a typed acquisition error (distilled\n * doc: \"Unsupported signature scheme (multisig / zklogin / passkey)\n * — currently a raw throw; should be promoted to the typed-error\n * channel\"). */\nexport const normalizeScheme = (\n\traw: string,\n\taccountName: string,\n\tvariant: AccountVariantKind,\n): Effect.Effect<SignatureScheme, AccountAcquireError> => {\n\tconst lower = raw.toLowerCase();\n\tif (lower === 'ed25519' || lower === 'secp256k1' || lower === 'secp256r1') {\n\t\treturn Effect.succeed(lower);\n\t}\n\treturn Effect.fail(\n\t\taccountAcquireError({\n\t\t\tphase: 'unsupported-scheme',\n\t\t\taccountName,\n\t\t\tvariant,\n\t\t\tmessage: `Account '${accountName}': unsupported signature scheme '${raw}'. devstack supports ed25519, secp256k1, secp256r1.`,\n\t\t\thint: 'Multisig, zklogin, and passkey schemes are not yet supported via the Account plugin — bring your own Signer via {kind:\"signer\"}.',\n\t\t}),\n\t);\n};\n\n/** Generate a fresh Ed25519 keypair. The default for the\n * `ephemeral` variant.\n *\n * Architecture-distilled invariant: schemes other than Ed25519\n * must be loaded via keystore/env/inline; we never generate\n * Secp256* keys from scratch. */\nexport const generateEd25519Keypair = (\n\taccountName: string,\n): Effect.Effect<ResolvedKeypair, AccountAcquireError> =>\n\tEffect.try({\n\t\ttry: () => {\n\t\t\tconst kp = Ed25519Keypair.generate();\n\t\t\treturn resolvedKeypairFromEd25519(kp);\n\t\t},\n\t\tcatch: (cause): AccountAcquireError =>\n\t\t\taccountAcquireError({\n\t\t\t\tphase: 'generate-keypair',\n\t\t\t\taccountName,\n\t\t\t\tvariant: 'ephemeral',\n\t\t\t\tmessage: `Account '${accountName}': Ed25519Keypair.generate() threw.`,\n\t\t\t\tcause,\n\t\t\t}),\n\t});\n\n/** Decode a bech32 `suiprivkey1...` string into a resolved keypair.\n * Used by the inline / env / keystore variants. */\nexport const decodeBech32Secret = (\n\tbech32: string,\n\taccountName: string,\n\tvariant: AccountVariantKind,\n): Effect.Effect<ResolvedKeypair, AccountAcquireError> =>\n\tEffect.gen(function* () {\n\t\tconst parsed = yield* Effect.try({\n\t\t\ttry: () => decodeSuiPrivateKey(bech32),\n\t\t\tcatch: (
|
|
1
|
+
{"version":3,"file":"keypair.mjs","names":[],"sources":["../../../src/plugins/account/keypair.ts"],"sourcesContent":["// Account plugin — keypair generation + scheme normalization helpers.\n//\n// Distilled-doc finding (12-account.md \"Scheme normalization\"\n// invariant): scheme surfaced to consumers MUST be lowercased at the\n// account boundary. Mixed-case from the SDK leaks into manifest\n// serialization and on-chain Move type matching if not converted. We\n// pin the canonical lowercased union at this module's boundary and\n// every variant resolver dumps through `normalizeScheme` before\n// producing the resolved value.\n//\n// Distilled-doc opportunity (\"Co-locate the canonical Account-value\n// Schema with the canonical type\"): the canonical signature scheme\n// union lives here, NOT next to the factory, so future Schema sits\n// alongside the type.\n\nimport { Effect } from 'effect';\n\nimport { decodeSuiPrivateKey, encodeSuiPrivateKey } from '@mysten/sui/cryptography';\nimport { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';\n\nimport {\n\taccountAcquireError,\n\ttype AccountAcquireError,\n\ttype AccountVariantKind,\n} from './errors.ts';\n\n/** Lowercased signature scheme — the canonical wire form. The SDK\n * occasionally hands us `'ED25519'` / `'Secp256k1'`; the boundary\n * conversion lives in `normalizeScheme`. */\nexport type SignatureScheme = 'ed25519' | 'secp256k1' | 'secp256r1';\n\n/** Resolved keypair shape — the variant resolvers all funnel into\n * this so the funding + register passes are variant-agnostic.\n *\n * Note: impersonation accounts do NOT produce a `Keypair`; they\n * produce a `SyntheticImpersonationSigner` (see\n * `variants/impersonate.ts`). The discriminator lives on the\n * resolved `AccountValue` (architecture: distilled doc opportunity\n * \"Tighten the resolved-account type\"). */\nexport interface ResolvedKeypair {\n\treadonly address: string;\n\treadonly scheme: SignatureScheme;\n\treadonly publicKey: Uint8Array;\n\t/** Opaque signer handle — typed loosely here because the four\n\t * real variants (ed25519/secp256k1/secp256r1 + bring-your-own\n\t * Signer) share no narrow TS type beyond `Signer`. The wallet /\n\t * sign-and-execute capability narrows downstream. */\n\treadonly signer: unknown;\n\t/** Bech32-encoded secret. Only present for ephemeral / inline /\n\t * env / keystore variants — `null` for `signer` (we never ask\n\t * for it) and `impersonate` (no secret exists). */\n\treadonly bech32Secret: string | null;\n}\n\n/** Normalize the SDK's mixed-case scheme to the lowercased wire form.\n * Unknown schemes surface as a typed acquisition error (distilled\n * doc: \"Unsupported signature scheme (multisig / zklogin / passkey)\n * — currently a raw throw; should be promoted to the typed-error\n * channel\"). */\nexport const normalizeScheme = (\n\traw: string,\n\taccountName: string,\n\tvariant: AccountVariantKind,\n): Effect.Effect<SignatureScheme, AccountAcquireError> => {\n\tconst lower = raw.toLowerCase();\n\tif (lower === 'ed25519' || lower === 'secp256k1' || lower === 'secp256r1') {\n\t\treturn Effect.succeed(lower);\n\t}\n\treturn Effect.fail(\n\t\taccountAcquireError({\n\t\t\tphase: 'unsupported-scheme',\n\t\t\taccountName,\n\t\t\tvariant,\n\t\t\tmessage: `Account '${accountName}': unsupported signature scheme '${raw}'. devstack supports ed25519, secp256k1, secp256r1.`,\n\t\t\thint: 'Multisig, zklogin, and passkey schemes are not yet supported via the Account plugin — bring your own Signer via {kind:\"signer\"}.',\n\t\t}),\n\t);\n};\n\n/** Generate a fresh Ed25519 keypair. The default for the\n * `ephemeral` variant.\n *\n * Architecture-distilled invariant: schemes other than Ed25519\n * must be loaded via keystore/env/inline; we never generate\n * Secp256* keys from scratch. */\nexport const generateEd25519Keypair = (\n\taccountName: string,\n): Effect.Effect<ResolvedKeypair, AccountAcquireError> =>\n\tEffect.try({\n\t\ttry: () => {\n\t\t\tconst kp = Ed25519Keypair.generate();\n\t\t\treturn resolvedKeypairFromEd25519(kp);\n\t\t},\n\t\tcatch: (cause): AccountAcquireError =>\n\t\t\taccountAcquireError({\n\t\t\t\tphase: 'generate-keypair',\n\t\t\t\taccountName,\n\t\t\t\tvariant: 'ephemeral',\n\t\t\t\tmessage: `Account '${accountName}': Ed25519Keypair.generate() threw.`,\n\t\t\t\tcause,\n\t\t\t}),\n\t});\n\n/** Decode a bech32 `suiprivkey1...` string into a resolved keypair.\n * Used by the inline / env / keystore variants. */\nexport const decodeBech32Secret = (\n\tbech32: string,\n\taccountName: string,\n\tvariant: AccountVariantKind,\n): Effect.Effect<ResolvedKeypair, AccountAcquireError> =>\n\tEffect.gen(function* () {\n\t\tconst parsed = yield* Effect.try({\n\t\t\ttry: () => decodeSuiPrivateKey(bech32),\n\t\t\t// Secret-leak guard: the thrown error from `decodeSuiPrivateKey`\n\t\t\t// can echo the rejected bech32 string back in its message, so we\n\t\t\t// deliberately DROP the raw `cause`. The typed `message` already\n\t\t\t// names the failure; a malformed-secret error carries no\n\t\t\t// actionable diagnostic beyond \"it was malformed\".\n\t\t\tcatch: (): AccountAcquireError =>\n\t\t\t\taccountAcquireError({\n\t\t\t\t\tphase: 'decode-inline',\n\t\t\t\t\taccountName,\n\t\t\t\t\tvariant,\n\t\t\t\t\tmessage: `Account '${accountName}': decodeSuiPrivateKey() rejected the supplied bech32 secret.`,\n\t\t\t\t}),\n\t\t});\n\t\tconst scheme = yield* normalizeScheme(parsed.scheme, accountName, variant);\n\t\tif (scheme !== 'ed25519') {\n\t\t\t// Architecture-distilled: today we only construct Ed25519 here.\n\t\t\t// Secp256k1 / Secp256r1 paths land when the SDK's per-scheme\n\t\t\t// Keypair classes are wired in; the typed-error channel keeps\n\t\t\t// the failure actionable until then.\n\t\t\treturn yield* Effect.fail(\n\t\t\t\taccountAcquireError({\n\t\t\t\t\tphase: 'unsupported-scheme',\n\t\t\t\t\taccountName,\n\t\t\t\t\tvariant,\n\t\t\t\t\tmessage: `Account '${accountName}': scheme '${scheme}' is not yet wired for the ${variant} variant.`,\n\t\t\t\t\thint: 'Wire the matching @mysten/sui/keypairs/<scheme> import next to the Ed25519 path.',\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn yield* Effect.try({\n\t\t\ttry: () => {\n\t\t\t\tconst kp = Ed25519Keypair.fromSecretKey(parsed.secretKey);\n\t\t\t\treturn resolvedKeypairFromEd25519(kp);\n\t\t\t},\n\t\t\t// Secret-leak guard: `fromSecretKey` can echo the decoded\n\t\t\t// secret-key bytes in its error — DROP the raw `cause`.\n\t\t\tcatch: (): AccountAcquireError =>\n\t\t\t\taccountAcquireError({\n\t\t\t\t\tphase: 'decode-inline',\n\t\t\t\t\taccountName,\n\t\t\t\t\tvariant,\n\t\t\t\t\tmessage: `Account '${accountName}': Ed25519Keypair.fromSecretKey() rejected the decoded secret.`,\n\t\t\t\t}),\n\t\t});\n\t});\n\n/** Build a `ResolvedKeypair` view from a raw Ed25519 secret-key\n * byte array. Used by the inline-bytes path (`variants/inline.ts`\n * Uint8Array branch). */\nexport const resolvedKeypairFromEd25519Bytes = (\n\tsecretKey: Uint8Array,\n\taccountName: string,\n\tvariant: AccountVariantKind,\n): Effect.Effect<ResolvedKeypair, AccountAcquireError> =>\n\tEffect.try({\n\t\ttry: () => {\n\t\t\tconst kp = Ed25519Keypair.fromSecretKey(secretKey);\n\t\t\treturn resolvedKeypairFromEd25519(kp);\n\t\t},\n\t\t// Secret-leak guard: `fromSecretKey` can echo the raw secret-key\n\t\t// bytes in its error — DROP the raw `cause`. (Mirrors the\n\t\t// bech32 path in `decodeBech32Secret`.)\n\t\tcatch: (): AccountAcquireError =>\n\t\t\taccountAcquireError({\n\t\t\t\tphase: 'decode-inline',\n\t\t\t\taccountName,\n\t\t\t\tvariant,\n\t\t\t\tmessage: `Account '${accountName}': Ed25519Keypair.fromSecretKey() rejected the supplied raw bytes.`,\n\t\t\t}),\n\t});\n\n/** Encode a 32-byte secret key as a bech32 `suiprivkey1...` string\n * for the canonical wire form. Re-exported because the\n * `variants/inline.ts` Uint8Array branch needs it. */\nexport const encodeEd25519Bech32 = (bytes: Uint8Array): string =>\n\tencodeSuiPrivateKey(bytes, 'ED25519');\n\nconst resolvedKeypairFromEd25519 = (kp: Ed25519Keypair): ResolvedKeypair => ({\n\taddress: kp.toSuiAddress(),\n\tscheme: 'ed25519',\n\tpublicKey: kp.getPublicKey().toRawBytes(),\n\tsigner: kp,\n\tbech32Secret: kp.getSecretKey(),\n});\n"],"mappings":";;;;;;;;;;AA2DA,MAAa,mBACZ,KACA,aACA,YACyD;CACzD,MAAM,QAAQ,IAAI,aAAa;AAC/B,KAAI,UAAU,aAAa,UAAU,eAAe,UAAU,YAC7D,QAAO,OAAO,QAAQ,MAAM;AAE7B,QAAO,OAAO,KACb,oBAAoB;EACnB,OAAO;EACP;EACA;EACA,SAAS,YAAY,YAAY,mCAAmC,IAAI;EACxE,MAAM;EACN,CAAC,CACF;;;;;;;;AASF,MAAa,0BACZ,gBAEA,OAAO,IAAI;CACV,WAAW;AAEV,SAAO,2BADI,eAAe,UACU,CAAC;;CAEtC,QAAQ,UACP,oBAAoB;EACnB,OAAO;EACP;EACA,SAAS;EACT,SAAS,YAAY,YAAY;EACjC;EACA,CAAC;CACH,CAAC;;;AAIH,MAAa,sBACZ,QACA,aACA,YAEA,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,OAAO,IAAI;EAChC,WAAW,oBAAoB,OAAO;EAMtC,aACC,oBAAoB;GACnB,OAAO;GACP;GACA;GACA,SAAS,YAAY,YAAY;GACjC,CAAC;EACH,CAAC;CACF,MAAM,SAAS,OAAO,gBAAgB,OAAO,QAAQ,aAAa,QAAQ;AAC1E,KAAI,WAAW,UAKd,QAAO,OAAO,OAAO,KACpB,oBAAoB;EACnB,OAAO;EACP;EACA;EACA,SAAS,YAAY,YAAY,aAAa,OAAO,6BAA6B,QAAQ;EAC1F,MAAM;EACN,CAAC,CACF;AAEF,QAAO,OAAO,OAAO,IAAI;EACxB,WAAW;AAEV,UAAO,2BADI,eAAe,cAAc,OAAO,UACX,CAAC;;EAItC,aACC,oBAAoB;GACnB,OAAO;GACP;GACA;GACA,SAAS,YAAY,YAAY;GACjC,CAAC;EACH,CAAC;EACD;;;;AAKH,MAAa,mCACZ,WACA,aACA,YAEA,OAAO,IAAI;CACV,WAAW;AAEV,SAAO,2BADI,eAAe,cAAc,UACJ,CAAC;;CAKtC,aACC,oBAAoB;EACnB,OAAO;EACP;EACA;EACA,SAAS,YAAY,YAAY;EACjC,CAAC;CACH,CAAC;AAQH,MAAM,8BAA8B,QAAyC;CAC5E,SAAS,GAAG,cAAc;CAC1B,QAAQ;CACR,WAAW,GAAG,cAAc,CAAC,YAAY;CACzC,QAAQ;CACR,cAAc,GAAG,cAAc;CAC/B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { leaseKey } from "../../substrate/runtime/lease-broker/service.mjs";
|
|
2
|
+
import "../../substrate/runtime/lease-broker/index.mjs";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
4
|
//#region src/plugins/account/lease.ts
|
|
4
5
|
/** Run `effect` while holding the per-address lease. Scope-bound
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease.mjs","names":[],"sources":["../../../src/plugins/account/lease.ts"],"sourcesContent":["// Account plugin — per-address lease helper.\n//\n// Thin wrapper over `LeaseBrokerService.acquire(...)` that opens a\n// fresh scope per call and keys the lease as `account:<address>`.\n// Both the funding pass (`funding.ts`) and the resolved-value\n// sign/execute closures (`service.ts`) share this helper so the\n// per-key encoding lives in exactly one place.\n//\n// Substrate name-blindness: the broker treats the key as opaque —\n// the `account:` prefix is a plugin convention so the broker's\n// `holders()` snapshot is readable in the renderer / debug logs.\n\nimport { Effect } from 'effect';\n\nimport { leaseKey, type LeaseBroker } from '../../substrate/runtime/lease-broker/index.ts';\n\n/** Run `effect` while holding the per-address lease. Scope-bound\n * release: a fresh scope is opened per call, the broker installs\n * an uninterruptible finalizer, and the lease drops the moment\n * the inner Effect returns. Same-address concurrent callers\n * serialize via the broker's FIFO queue.\n *\n * Non-reentrant: nested calls for the SAME (broker, accountName,\n * address) tuple deadlock. The broker has no concept of\n * re-entrancy by design — per-address sequence-number semantics\n * require at-most-one in-flight. */\nexport const withAddressLease = <A, E, R>(\n\tbroker: LeaseBroker,\n\taccountName: string,\n\taddress: string,\n\teffect: Effect.Effect<A, E, R>,\n): Effect.Effect<A, E, R> =>\n\tEffect.scoped(\n\t\tEffect.gen(function* () {\n\t\t\tyield* broker.acquire(leaseKey(`account:${address}`), accountName);\n\t\t\treturn yield* effect;\n\t\t}),\n\t);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"lease.mjs","names":[],"sources":["../../../src/plugins/account/lease.ts"],"sourcesContent":["// Account plugin — per-address lease helper.\n//\n// Thin wrapper over `LeaseBrokerService.acquire(...)` that opens a\n// fresh scope per call and keys the lease as `account:<address>`.\n// Both the funding pass (`funding.ts`) and the resolved-value\n// sign/execute closures (`service.ts`) share this helper so the\n// per-key encoding lives in exactly one place.\n//\n// Substrate name-blindness: the broker treats the key as opaque —\n// the `account:` prefix is a plugin convention so the broker's\n// `holders()` snapshot is readable in the renderer / debug logs.\n\nimport { Effect } from 'effect';\n\nimport { leaseKey, type LeaseBroker } from '../../substrate/runtime/lease-broker/index.ts';\n\n/** Run `effect` while holding the per-address lease. Scope-bound\n * release: a fresh scope is opened per call, the broker installs\n * an uninterruptible finalizer, and the lease drops the moment\n * the inner Effect returns. Same-address concurrent callers\n * serialize via the broker's FIFO queue.\n *\n * Non-reentrant: nested calls for the SAME (broker, accountName,\n * address) tuple deadlock. The broker has no concept of\n * re-entrancy by design — per-address sequence-number semantics\n * require at-most-one in-flight. */\nexport const withAddressLease = <A, E, R>(\n\tbroker: LeaseBroker,\n\taccountName: string,\n\taddress: string,\n\teffect: Effect.Effect<A, E, R>,\n): Effect.Effect<A, E, R> =>\n\tEffect.scoped(\n\t\tEffect.gen(function* () {\n\t\t\tyield* broker.acquire(leaseKey(`account:${address}`), accountName);\n\t\t\treturn yield* effect;\n\t\t}),\n\t);\n"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAa,oBACZ,QACA,aACA,SACA,WAEA,OAAO,OACN,OAAO,IAAI,aAAa;AACvB,QAAO,OAAO,QAAQ,SAAS,WAAW,UAAU,EAAE,YAAY;AAClE,QAAO,OAAO;EACb,CACF"}
|
|
@@ -22,11 +22,24 @@ interface AccountRegistryFunding {
|
|
|
22
22
|
readonly requestedMist: string | null;
|
|
23
23
|
readonly entries?: ReadonlyArray<AccountRegistryFundingEntry>;
|
|
24
24
|
}
|
|
25
|
+
/** Per-entry funding status — the projection's per-row "did we actually
|
|
26
|
+
* hit the faucet?" signal.
|
|
27
|
+
*
|
|
28
|
+
* - `'funded'` — a wire call ran and balance settled.
|
|
29
|
+
* - `'already-satisfied'` — the pre-existing balance covered the
|
|
30
|
+
* request, so no wire call ran.
|
|
31
|
+
* - `'skipped'` — the entry was zero-amount, dropped at
|
|
32
|
+
* the funding-pass boundary, or there was
|
|
33
|
+
* no registered strategy (cross-cutting
|
|
34
|
+
* non-SUI silent-noop).
|
|
35
|
+
*
|
|
36
|
+
* Splitting `'funded'` from `'already-satisfied'` matches the
|
|
37
|
+
* applied-projection invariant in `service.ts:858-887`. */
|
|
25
38
|
interface AccountRegistryFundingEntry {
|
|
26
39
|
readonly coin: string;
|
|
27
40
|
readonly fullCoinType: string;
|
|
28
41
|
readonly amount: string;
|
|
29
|
-
readonly status: 'funded' | 'skipped';
|
|
42
|
+
readonly status: 'funded' | 'already-satisfied' | 'skipped';
|
|
30
43
|
}
|
|
31
44
|
//#endregion
|
|
32
45
|
export { AccountRegistryEntry, AccountRegistryFunding };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { projection } from "../../api/define-capabilities.mjs";
|
|
1
2
|
//#region src/plugins/account/registry.ts
|
|
2
3
|
const accountRegistryKey = (name) => `account:${name}`;
|
|
3
4
|
/** Construct the strategy-contributor decl Account emits for one
|
|
@@ -11,24 +12,23 @@ const makeAccountRegistryContribution = (entry) => ({
|
|
|
11
12
|
});
|
|
12
13
|
const makeAccountProjectionContribution = (entry) => {
|
|
13
14
|
const updatedAt = Date.now();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
15
|
+
const key = `account/${entry.name}`;
|
|
16
|
+
return projection({
|
|
17
|
+
kind: "account",
|
|
18
|
+
key,
|
|
19
|
+
payload: {
|
|
20
|
+
key,
|
|
21
|
+
rowKey: null,
|
|
22
|
+
name: entry.name,
|
|
23
|
+
address: entry.address,
|
|
24
|
+
scheme: entry.scheme,
|
|
25
|
+
source: entry.source,
|
|
26
|
+
funding: entry.funding,
|
|
27
|
+
walletVisible: false,
|
|
28
|
+
updatedAt
|
|
29
|
+
},
|
|
30
|
+
at: updatedAt
|
|
31
|
+
});
|
|
32
32
|
};
|
|
33
33
|
//#endregion
|
|
34
34
|
export { accountRegistryKey, makeAccountProjectionContribution, makeAccountRegistryContribution };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.mjs","names":[],"sources":["../../../src/plugins/account/registry.ts"],"sourcesContent":["// Account plugin — per-stack registry contribution.\n//\n// Architecture (12-account.md \"Outputs / capabilities provided\"):\n// Account publishes `{name, address}` to a per-stack account\n// registry. Downstream consumers (Wallet, Codegen, the manifest\n// emitter, Coin's deepbook market maker) look accounts up by name.\n//\n// The architecture's `strategy-contributor` capability covers this\n// shape — Account contributes one entry per acquired account under\n// the capability key `account:<name>`. The strategy value is the\n// resolved-account view (sans signing closures, which stay scoped\n// to the acquire body's lifetime; consumers ask the Account tag\n// directly when they need to sign).\n//\n// Distilled-doc opportunity: today's `publishAccount(...)` writes\n// into an engine-singleton registry. The redesign moves it onto the\n// capability-decl surface so the substrate orchestrates dedup-by-\n// name and last-write-wins without an engine import.\n\nimport type { ProjectionDecl } from '../../contracts/projection.ts';\nimport type { StrategyContributorDecl } from '../../contracts/strategy-contributor.ts';\n\n/** Capability key for the per-name account registry. The literal\n * form (`account:<name>`) lets downstream consumers (Coin, Wallet,\n * the manifest emitter) `StrategyFor<Caps, \"account:alice\">` to\n * recover the registered address at the type level. */\nexport type AccountRegistryKey<Name extends string> = `account:${Name}`;\n\nexport const accountRegistryKey = <Name extends string>(name: Name): AccountRegistryKey<Name> =>\n\t`account:${name}` as AccountRegistryKey<Name>;\n\n/** The strategy value published under `account:<name>`. Carries the\n * load-bearing identity columns only — signing closures stay on\n * the Account tag's resolved value because their lifetime is\n * scope-bounded.\n *\n * Architecture-distilled (12-account.md \"Tighten the resolved-\n * account type\"): the `source` discriminator is mandatory so\n * consumers can branch on impersonation without a `publicKey`\n * nullcheck (impersonation accounts have a zero-buffer publicKey\n * — a type-level lie). */\nexport interface AccountRegistryEntry {\n\treadonly name: string;\n\treadonly address: string;\n\treadonly scheme: 'ed25519' | 'secp256k1' | 'secp256r1';\n\treadonly source: 'real' | 'impersonate';\n\treadonly funding: AccountRegistryFunding;\n}\n\nexport interface AccountRegistryFunding {\n\treadonly status: 'funded' | 'skipped' | 'unknown';\n\treadonly balanceMist: string | null;\n\treadonly requestedMist: string | null;\n\treadonly entries?: ReadonlyArray<AccountRegistryFundingEntry>;\n}\n\nexport interface AccountRegistryFundingEntry {\n\treadonly coin: string;\n\treadonly fullCoinType: string;\n\treadonly amount: string;\n\treadonly status: 'funded' | 'skipped';\n}\n\n/** Construct the strategy-contributor decl Account emits for one\n * acquired identity. Auto-mounted: the registry's role is\n * infrastructure; the user never types it explicitly. */\nexport const makeAccountRegistryContribution = <Name extends string>(\n\tentry: AccountRegistryEntry & { readonly name: Name },\n): StrategyContributorDecl<AccountRegistryKey<Name>, AccountRegistryEntry> => ({\n\tkind: 'strategy-contributor',\n\tcapabilityKey: accountRegistryKey(entry.name),\n\tstrategy: entry,\n\tautoMounted: true,\n});\n\nexport const makeAccountProjectionContribution = <Name extends string>(\n\tentry: AccountRegistryEntry & { readonly name: Name },\n): ProjectionDecl => {\n\tconst updatedAt = Date.now();\n\
|
|
1
|
+
{"version":3,"file":"registry.mjs","names":[],"sources":["../../../src/plugins/account/registry.ts"],"sourcesContent":["// Account plugin — per-stack registry contribution.\n//\n// Architecture (12-account.md \"Outputs / capabilities provided\"):\n// Account publishes `{name, address}` to a per-stack account\n// registry. Downstream consumers (Wallet, Codegen, the manifest\n// emitter, Coin's deepbook market maker) look accounts up by name.\n//\n// The architecture's `strategy-contributor` capability covers this\n// shape — Account contributes one entry per acquired account under\n// the capability key `account:<name>`. The strategy value is the\n// resolved-account view (sans signing closures, which stay scoped\n// to the acquire body's lifetime; consumers ask the Account tag\n// directly when they need to sign).\n//\n// Distilled-doc opportunity: today's `publishAccount(...)` writes\n// into an engine-singleton registry. The redesign moves it onto the\n// capability-decl surface so the substrate orchestrates dedup-by-\n// name and last-write-wins without an engine import.\n\nimport { projection } from '../../api/define-capabilities.ts';\nimport type { ProjectionDecl } from '../../contracts/projection.ts';\nimport type { StrategyContributorDecl } from '../../contracts/strategy-contributor.ts';\n\n/** Capability key for the per-name account registry. The literal\n * form (`account:<name>`) lets downstream consumers (Coin, Wallet,\n * the manifest emitter) `StrategyFor<Caps, \"account:alice\">` to\n * recover the registered address at the type level. */\nexport type AccountRegistryKey<Name extends string> = `account:${Name}`;\n\nexport const accountRegistryKey = <Name extends string>(name: Name): AccountRegistryKey<Name> =>\n\t`account:${name}` as AccountRegistryKey<Name>;\n\n/** The strategy value published under `account:<name>`. Carries the\n * load-bearing identity columns only — signing closures stay on\n * the Account tag's resolved value because their lifetime is\n * scope-bounded.\n *\n * Architecture-distilled (12-account.md \"Tighten the resolved-\n * account type\"): the `source` discriminator is mandatory so\n * consumers can branch on impersonation without a `publicKey`\n * nullcheck (impersonation accounts have a zero-buffer publicKey\n * — a type-level lie). */\nexport interface AccountRegistryEntry {\n\treadonly name: string;\n\treadonly address: string;\n\treadonly scheme: 'ed25519' | 'secp256k1' | 'secp256r1';\n\treadonly source: 'real' | 'impersonate';\n\treadonly funding: AccountRegistryFunding;\n}\n\nexport interface AccountRegistryFunding {\n\treadonly status: 'funded' | 'skipped' | 'unknown';\n\treadonly balanceMist: string | null;\n\treadonly requestedMist: string | null;\n\treadonly entries?: ReadonlyArray<AccountRegistryFundingEntry>;\n}\n\n/** Per-entry funding status — the projection's per-row \"did we actually\n * hit the faucet?\" signal.\n *\n * - `'funded'` — a wire call ran and balance settled.\n * - `'already-satisfied'` — the pre-existing balance covered the\n * request, so no wire call ran.\n * - `'skipped'` — the entry was zero-amount, dropped at\n * the funding-pass boundary, or there was\n * no registered strategy (cross-cutting\n * non-SUI silent-noop).\n *\n * Splitting `'funded'` from `'already-satisfied'` matches the\n * applied-projection invariant in `service.ts:858-887`. */\nexport interface AccountRegistryFundingEntry {\n\treadonly coin: string;\n\treadonly fullCoinType: string;\n\treadonly amount: string;\n\treadonly status: 'funded' | 'already-satisfied' | 'skipped';\n}\n\n/** Construct the strategy-contributor decl Account emits for one\n * acquired identity. Auto-mounted: the registry's role is\n * infrastructure; the user never types it explicitly. */\nexport const makeAccountRegistryContribution = <Name extends string>(\n\tentry: AccountRegistryEntry & { readonly name: Name },\n): StrategyContributorDecl<AccountRegistryKey<Name>, AccountRegistryEntry> => ({\n\tkind: 'strategy-contributor',\n\tcapabilityKey: accountRegistryKey(entry.name),\n\tstrategy: entry,\n\tautoMounted: true,\n});\n\nexport const makeAccountProjectionContribution = <Name extends string>(\n\tentry: AccountRegistryEntry & { readonly name: Name },\n): ProjectionDecl => {\n\tconst updatedAt = Date.now();\n\tconst key = `account/${entry.name}` as `account/${string}`;\n\treturn projection({\n\t\tkind: 'account',\n\t\tkey,\n\t\tpayload: {\n\t\t\tkey,\n\t\t\trowKey: null,\n\t\t\tname: entry.name,\n\t\t\taddress: entry.address,\n\t\t\tscheme: entry.scheme,\n\t\t\tsource: entry.source,\n\t\t\tfunding: entry.funding,\n\t\t\twalletVisible: false,\n\t\t\tupdatedAt,\n\t\t},\n\t\tat: updatedAt,\n\t});\n};\n"],"mappings":";;AA6BA,MAAa,sBAA2C,SACvD,WAAW;;;;AAkDZ,MAAa,mCACZ,WAC8E;CAC9E,MAAM;CACN,eAAe,mBAAmB,MAAM,KAAK;CAC7C,UAAU;CACV,aAAa;CACb;AAED,MAAa,qCACZ,UACoB;CACpB,MAAM,YAAY,KAAK,KAAK;CAC5B,MAAM,MAAM,WAAW,MAAM;AAC7B,QAAO,WAAW;EACjB,MAAM;EACN;EACA,SAAS;GACR;GACA,QAAQ;GACR,MAAM,MAAM;GACZ,SAAS,MAAM;GACf,QAAQ,MAAM;GACd,QAAQ,MAAM;GACd,SAAS,MAAM;GACf,eAAe;GACf;GACA;EACD,IAAI;EACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccountSignError } from "./errors.mjs";
|
|
2
|
-
import { TransactionSignerScope } from "../../substrate/runtime/sui-execute/index.mjs";
|
|
2
|
+
import { ExecutedFailure, TransactionSignerScope } from "../../substrate/runtime/sui-execute/index.mjs";
|
|
3
3
|
import { AccountFunding, AccountFundingResult } from "./funding.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
|
|
@@ -70,7 +70,7 @@ interface AccountValue {
|
|
|
70
70
|
* For impersonation accounts, routes through Sui's fork
|
|
71
71
|
* admin `impersonate` surface; for real signers, routes
|
|
72
72
|
* through the SDK's executeTransaction surface. */
|
|
73
|
-
readonly signAndExecute: (tx: Uint8Array) => Effect.Effect<
|
|
73
|
+
readonly signAndExecute: (tx: Uint8Array) => Effect.Effect<SignAndExecuteResult, AccountSignError>;
|
|
74
74
|
/** Run a full account-bound transaction critical section.
|
|
75
75
|
* Callers that must serialize `Transaction.build({ client })`
|
|
76
76
|
* together with signing/execution use the signer passed to this
|
|
@@ -89,16 +89,35 @@ interface AccountValue {
|
|
|
89
89
|
readonly funding: AccountFundingResult;
|
|
90
90
|
}
|
|
91
91
|
/** Submit result projection — kept narrow so downstream consumers
|
|
92
|
-
* don't depend on the full @mysten/sui execute envelope.
|
|
92
|
+
* don't depend on the full @mysten/sui execute envelope. Populated
|
|
93
|
+
* only when the on-chain execution succeeded (the `'Transaction'`
|
|
94
|
+
* variant of `SignAndExecuteResult`). */
|
|
93
95
|
interface TxResult {
|
|
94
96
|
readonly digest: string;
|
|
95
97
|
readonly effects: unknown;
|
|
96
98
|
readonly objectChanges: ReadonlyArray<unknown>;
|
|
97
99
|
readonly balanceChanges: ReadonlyArray<unknown>;
|
|
98
100
|
}
|
|
101
|
+
/** Outcome of `signAndExecute`. Mirrors the SDK's discriminated
|
|
102
|
+
* `SuiClientTypes.TransactionResult` shape — on-chain failures are
|
|
103
|
+
* a RETURN VALUE (callers dispatch on `$kind`), NOT an error. Only
|
|
104
|
+
* transport / lifecycle failures (sign refused, RPC unreachable,
|
|
105
|
+
* finality wait broke) surface through `AccountSignError`.
|
|
106
|
+
*
|
|
107
|
+
* The on-chain `FailedTransaction` projection is the substrate
|
|
108
|
+
* `ExecutedFailure` shape — single source of truth lives in
|
|
109
|
+
* `substrate/runtime/sui-execute/index.ts`. An envelope without a
|
|
110
|
+
* digest fails at projection with `AccountSignError(phase: 'no-digest')`. */
|
|
111
|
+
type SignAndExecuteResult = {
|
|
112
|
+
readonly $kind: 'Transaction';
|
|
113
|
+
readonly Transaction: TxResult;
|
|
114
|
+
} | {
|
|
115
|
+
readonly $kind: 'FailedTransaction';
|
|
116
|
+
readonly FailedTransaction: ExecutedFailure;
|
|
117
|
+
};
|
|
99
118
|
interface AccountTransactionSigner extends TransactionSignerScope<AccountSignError> {
|
|
100
119
|
readonly signAndExecute: AccountValue['signAndExecute'];
|
|
101
120
|
}
|
|
102
121
|
//#endregion
|
|
103
|
-
export { AccountOptions, AccountValue, TxResult };
|
|
122
|
+
export { AccountOptions, AccountValue, SignAndExecuteResult, TxResult };
|
|
104
123
|
//# sourceMappingURL=service.d.mts.map
|