@mysten-incubation/devstack 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +189 -0
- package/README.md +94 -0
- package/dist/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/api/define-capabilities.d.mts +25 -0
- package/dist/api/define-capabilities.mjs +19 -0
- package/dist/api/define-capabilities.mjs.map +1 -0
- package/dist/api/define-devstack-with.d.mts +41 -0
- package/dist/api/define-devstack-with.mjs +24 -0
- package/dist/api/define-devstack-with.mjs.map +1 -0
- package/dist/api/define-devstack.d.mts +62 -0
- package/dist/api/define-devstack.mjs +108 -0
- package/dist/api/define-devstack.mjs.map +1 -0
- package/dist/api/define-plugin.d.mts +1 -0
- package/dist/api/inference-network.mjs +122 -0
- package/dist/api/inference-network.mjs.map +1 -0
- package/dist/api/mode-narrowed-factory.d.mts +26 -0
- package/dist/api/mode-narrowed-factory.mjs +8 -0
- package/dist/api/mode-narrowed-factory.mjs.map +1 -0
- package/dist/api/plugin-errors.mjs +10 -0
- package/dist/api/plugin-errors.mjs.map +1 -0
- package/dist/api/run-stack.d.mts +82 -0
- package/dist/api/run-stack.mjs +127 -0
- package/dist/api/run-stack.mjs.map +1 -0
- package/dist/build-integrations/playwright/config.d.mts +92 -0
- package/dist/build-integrations/playwright/config.mjs +71 -0
- package/dist/build-integrations/playwright/config.mjs.map +1 -0
- package/dist/build-integrations/playwright/errors.d.mts +82 -0
- package/dist/build-integrations/playwright/errors.mjs +43 -0
- package/dist/build-integrations/playwright/errors.mjs.map +1 -0
- package/dist/build-integrations/playwright/global-setup.d.mts +64 -0
- package/dist/build-integrations/playwright/global-setup.mjs +44 -0
- package/dist/build-integrations/playwright/global-setup.mjs.map +1 -0
- package/dist/build-integrations/playwright/index.d.mts +6 -0
- package/dist/build-integrations/playwright/index.mjs +6 -0
- package/dist/build-integrations/playwright/stack-context.d.mts +95 -0
- package/dist/build-integrations/playwright/stack-context.mjs +277 -0
- package/dist/build-integrations/playwright/stack-context.mjs.map +1 -0
- package/dist/build-integrations/playwright/wallet-context.d.mts +87 -0
- package/dist/build-integrations/playwright/wallet-context.mjs +148 -0
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -0
- package/dist/build-integrations/runtime/cold-start-url.d.mts +67 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs +56 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -0
- package/dist/build-integrations/runtime/dapp-kit-slot.mjs +10 -0
- package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -0
- package/dist/build-integrations/runtime/discover.d.mts +78 -0
- package/dist/build-integrations/runtime/discover.mjs +124 -0
- package/dist/build-integrations/runtime/discover.mjs.map +1 -0
- package/dist/build-integrations/runtime/endpoint-registry.d.mts +26 -0
- package/dist/build-integrations/runtime/endpoint-registry.mjs +41 -0
- package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -0
- package/dist/build-integrations/runtime/errors.d.mts +64 -0
- package/dist/build-integrations/runtime/errors.mjs +51 -0
- package/dist/build-integrations/runtime/errors.mjs.map +1 -0
- package/dist/build-integrations/runtime/index.d.mts +7 -0
- package/dist/build-integrations/runtime/index.mjs +6 -0
- package/dist/build-integrations/runtime/read-stack-context.d.mts +38 -0
- package/dist/build-integrations/runtime/read-stack-context.mjs +130 -0
- package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -0
- package/dist/build-integrations/runtime/stack-context.d.mts +53 -0
- package/dist/build-integrations/vitest/config.d.mts +62 -0
- package/dist/build-integrations/vitest/config.mjs +80 -0
- package/dist/build-integrations/vitest/config.mjs.map +1 -0
- package/dist/build-integrations/vitest/env.d.mts +48 -0
- package/dist/build-integrations/vitest/env.mjs +50 -0
- package/dist/build-integrations/vitest/env.mjs.map +1 -0
- package/dist/build-integrations/vitest/errors.d.mts +44 -0
- package/dist/build-integrations/vitest/errors.mjs +18 -0
- package/dist/build-integrations/vitest/errors.mjs.map +1 -0
- package/dist/build-integrations/vitest/index.d.mts +6 -0
- package/dist/build-integrations/vitest/index.mjs +6 -0
- package/dist/build-integrations/vitest/setup.d.mts +53 -0
- package/dist/build-integrations/vitest/setup.mjs +56 -0
- package/dist/build-integrations/vitest/setup.mjs.map +1 -0
- package/dist/build-integrations/vitest/stack-context.d.mts +58 -0
- package/dist/build-integrations/vitest/stack-context.mjs +67 -0
- package/dist/build-integrations/vitest/stack-context.mjs.map +1 -0
- package/dist/cli/main.d.mts +5 -0
- package/dist/cli/main.mjs +586 -0
- package/dist/cli/main.mjs.map +1 -0
- package/dist/cli/prune-direct.mjs +216 -0
- package/dist/cli/prune-direct.mjs.map +1 -0
- package/dist/cli/snapshot-reader.mjs +73 -0
- package/dist/cli/snapshot-reader.mjs.map +1 -0
- package/dist/cli/up-lifecycle.mjs +28 -0
- package/dist/cli/up-lifecycle.mjs.map +1 -0
- package/dist/contracts/capability-decl.d.mts +42 -0
- package/dist/contracts/chain-probe.d.mts +26 -0
- package/dist/contracts/chain-probe.mjs +8 -0
- package/dist/contracts/chain-probe.mjs.map +1 -0
- package/dist/contracts/codegenable.d.mts +43 -0
- package/dist/contracts/container-runtime.d.mts +245 -0
- package/dist/contracts/liveness-classifier.d.mts +19 -0
- package/dist/contracts/network-resolver.d.mts +15 -0
- package/dist/contracts/network-resolver.mjs +7 -0
- package/dist/contracts/network-resolver.mjs.map +1 -0
- package/dist/contracts/projection.d.mts +15 -0
- package/dist/contracts/routable.d.mts +53 -0
- package/dist/contracts/snapshotable.d.mts +39 -0
- package/dist/contracts/strategy-contributor.d.mts +26 -0
- package/dist/index.d.mts +89 -0
- package/dist/index.mjs +37 -0
- package/dist/orchestrators/codegen/bindings.d.mts +2 -0
- package/dist/orchestrators/codegen/bindings.mjs +340 -0
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -0
- package/dist/orchestrators/codegen/emit.mjs +56 -0
- package/dist/orchestrators/codegen/emit.mjs.map +1 -0
- package/dist/orchestrators/codegen/errors.d.mts +1 -0
- package/dist/orchestrators/codegen/errors.mjs +66 -0
- package/dist/orchestrators/codegen/errors.mjs.map +1 -0
- package/dist/orchestrators/codegen/extras.mjs +16 -0
- package/dist/orchestrators/codegen/extras.mjs.map +1 -0
- package/dist/orchestrators/codegen/format.mjs +109 -0
- package/dist/orchestrators/codegen/format.mjs.map +1 -0
- package/dist/orchestrators/codegen/gitignore.mjs +67 -0
- package/dist/orchestrators/codegen/gitignore.mjs.map +1 -0
- package/dist/orchestrators/codegen/paths.d.mts +1 -0
- package/dist/orchestrators/codegen/paths.mjs +33 -0
- package/dist/orchestrators/codegen/paths.mjs.map +1 -0
- package/dist/orchestrators/codegen/permissions.mjs +6 -0
- package/dist/orchestrators/codegen/permissions.mjs.map +1 -0
- package/dist/orchestrators/codegen/service.d.mts +1 -0
- package/dist/orchestrators/codegen/service.mjs +276 -0
- package/dist/orchestrators/codegen/service.mjs.map +1 -0
- package/dist/orchestrators/router/cleanup.mjs +58 -0
- package/dist/orchestrators/router/cleanup.mjs.map +1 -0
- package/dist/orchestrators/router/cors.mjs +31 -0
- package/dist/orchestrators/router/cors.mjs.map +1 -0
- package/dist/orchestrators/router/entrypoints.d.mts +1 -0
- package/dist/orchestrators/router/entrypoints.mjs +80 -0
- package/dist/orchestrators/router/entrypoints.mjs.map +1 -0
- package/dist/orchestrators/router/errors.d.mts +1 -0
- package/dist/orchestrators/router/errors.mjs +103 -0
- package/dist/orchestrators/router/errors.mjs.map +1 -0
- package/dist/orchestrators/router/file-provider.d.mts +1 -0
- package/dist/orchestrators/router/file-provider.mjs +320 -0
- package/dist/orchestrators/router/file-provider.mjs.map +1 -0
- package/dist/orchestrators/router/hostname.d.mts +1 -0
- package/dist/orchestrators/router/hostname.mjs +107 -0
- package/dist/orchestrators/router/hostname.mjs.map +1 -0
- package/dist/orchestrators/router/index.d.mts +1 -0
- package/dist/orchestrators/router/profile.d.mts +1 -0
- package/dist/orchestrators/router/profile.mjs +109 -0
- package/dist/orchestrators/router/profile.mjs.map +1 -0
- package/dist/orchestrators/router/service.d.mts +3 -0
- package/dist/orchestrators/router/service.mjs +421 -0
- package/dist/orchestrators/router/service.mjs.map +1 -0
- package/dist/orchestrators/router/traefik-container.d.mts +1 -0
- package/dist/orchestrators/router/traefik-container.mjs +229 -0
- package/dist/orchestrators/router/traefik-container.mjs.map +1 -0
- package/dist/orchestrators/runtime-composition.d.mts +10 -0
- package/dist/orchestrators/runtime-composition.mjs +168 -0
- package/dist/orchestrators/runtime-composition.mjs.map +1 -0
- package/dist/orchestrators/snapshot/capture.d.mts +1 -0
- package/dist/orchestrators/snapshot/capture.mjs +350 -0
- package/dist/orchestrators/snapshot/capture.mjs.map +1 -0
- package/dist/orchestrators/snapshot/descriptor.d.mts +1 -0
- package/dist/orchestrators/snapshot/descriptor.mjs +109 -0
- package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -0
- package/dist/orchestrators/snapshot/identity-guard.d.mts +1 -0
- package/dist/orchestrators/snapshot/identity-guard.mjs +132 -0
- package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -0
- package/dist/orchestrators/snapshot/image-bundle-tags.mjs +207 -0
- package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -0
- package/dist/orchestrators/snapshot/index.d.mts +1 -0
- package/dist/orchestrators/snapshot/integrity.d.mts +1 -0
- package/dist/orchestrators/snapshot/integrity.mjs +74 -0
- package/dist/orchestrators/snapshot/integrity.mjs.map +1 -0
- package/dist/orchestrators/snapshot/prune.d.mts +1 -0
- package/dist/orchestrators/snapshot/prune.mjs +110 -0
- package/dist/orchestrators/snapshot/prune.mjs.map +1 -0
- package/dist/orchestrators/snapshot/restore.d.mts +1 -0
- package/dist/orchestrators/snapshot/restore.mjs +404 -0
- package/dist/orchestrators/snapshot/restore.mjs.map +1 -0
- package/dist/orchestrators/snapshot/service.d.mts +1 -0
- package/dist/orchestrators/snapshot/service.mjs +296 -0
- package/dist/orchestrators/snapshot/service.mjs.map +1 -0
- package/dist/orchestrators/snapshot/state-document.mjs +18 -0
- package/dist/orchestrators/snapshot/state-document.mjs.map +1 -0
- package/dist/orchestrators/snapshot/wipe.d.mts +1 -0
- package/dist/orchestrators/snapshot/wipe.mjs +59 -0
- package/dist/orchestrators/snapshot/wipe.mjs.map +1 -0
- package/dist/plugins/account/codegen.d.mts +12 -0
- package/dist/plugins/account/codegen.mjs +22 -0
- package/dist/plugins/account/codegen.mjs.map +1 -0
- package/dist/plugins/account/errors.d.mts +44 -0
- package/dist/plugins/account/errors.mjs +16 -0
- package/dist/plugins/account/errors.mjs.map +1 -0
- package/dist/plugins/account/funding.d.mts +94 -0
- package/dist/plugins/account/funding.mjs +199 -0
- package/dist/plugins/account/funding.mjs.map +1 -0
- package/dist/plugins/account/index.d.mts +54 -0
- package/dist/plugins/account/index.mjs +151 -0
- package/dist/plugins/account/index.mjs.map +1 -0
- package/dist/plugins/account/keypair.d.mts +32 -0
- package/dist/plugins/account/keypair.mjs +99 -0
- package/dist/plugins/account/keypair.mjs.map +1 -0
- package/dist/plugins/account/lease.mjs +21 -0
- package/dist/plugins/account/lease.mjs.map +1 -0
- package/dist/plugins/account/registry.d.mts +33 -0
- package/dist/plugins/account/registry.mjs +36 -0
- package/dist/plugins/account/registry.mjs.map +1 -0
- package/dist/plugins/account/service.d.mts +104 -0
- package/dist/plugins/account/service.mjs +405 -0
- package/dist/plugins/account/service.mjs.map +1 -0
- package/dist/plugins/account/snapshot.mjs +33 -0
- package/dist/plugins/account/snapshot.mjs.map +1 -0
- package/dist/plugins/account/variants/env.mjs +24 -0
- package/dist/plugins/account/variants/env.mjs.map +1 -0
- package/dist/plugins/account/variants/ephemeral.mjs +72 -0
- package/dist/plugins/account/variants/ephemeral.mjs.map +1 -0
- package/dist/plugins/account/variants/impersonate.d.mts +16 -0
- package/dist/plugins/account/variants/impersonate.mjs +48 -0
- package/dist/plugins/account/variants/impersonate.mjs.map +1 -0
- package/dist/plugins/account/variants/inline.mjs +13 -0
- package/dist/plugins/account/variants/inline.mjs.map +1 -0
- package/dist/plugins/account/variants/keystore.mjs +93 -0
- package/dist/plugins/account/variants/keystore.mjs.map +1 -0
- package/dist/plugins/account/variants/signer.mjs +31 -0
- package/dist/plugins/account/variants/signer.mjs.map +1 -0
- package/dist/plugins/action/build-context.d.mts +41 -0
- package/dist/plugins/action/discriminator.d.mts +20 -0
- package/dist/plugins/action/discriminator.mjs +13 -0
- package/dist/plugins/action/discriminator.mjs.map +1 -0
- package/dist/plugins/action/errors.d.mts +31 -0
- package/dist/plugins/action/errors.mjs +13 -0
- package/dist/plugins/action/errors.mjs.map +1 -0
- package/dist/plugins/action/execute.d.mts +2 -0
- package/dist/plugins/action/execute.mjs +145 -0
- package/dist/plugins/action/execute.mjs.map +1 -0
- package/dist/plugins/action/index.d.mts +56 -0
- package/dist/plugins/action/index.mjs +82 -0
- package/dist/plugins/action/index.mjs.map +1 -0
- package/dist/plugins/action/service.d.mts +26 -0
- package/dist/plugins/action/service.mjs +84 -0
- package/dist/plugins/action/service.mjs.map +1 -0
- package/dist/plugins/coin/address-resolution.d.mts +34 -0
- package/dist/plugins/coin/address-resolution.mjs +80 -0
- package/dist/plugins/coin/address-resolution.mjs.map +1 -0
- package/dist/plugins/coin/codegen.d.mts +16 -0
- package/dist/plugins/coin/codegen.mjs +21 -0
- package/dist/plugins/coin/codegen.mjs.map +1 -0
- package/dist/plugins/coin/discovery.d.mts +26 -0
- package/dist/plugins/coin/discovery.mjs +112 -0
- package/dist/plugins/coin/discovery.mjs.map +1 -0
- package/dist/plugins/coin/errors.d.mts +48 -0
- package/dist/plugins/coin/errors.mjs +13 -0
- package/dist/plugins/coin/errors.mjs.map +1 -0
- package/dist/plugins/coin/index.d.mts +95 -0
- package/dist/plugins/coin/index.mjs +172 -0
- package/dist/plugins/coin/index.mjs.map +1 -0
- package/dist/plugins/coin/metadata.d.mts +15 -0
- package/dist/plugins/coin/metadata.mjs +99 -0
- package/dist/plugins/coin/metadata.mjs.map +1 -0
- package/dist/plugins/coin/mint.d.mts +34 -0
- package/dist/plugins/coin/mint.mjs +164 -0
- package/dist/plugins/coin/mint.mjs.map +1 -0
- package/dist/plugins/coin/registry.d.mts +1 -0
- package/dist/plugins/coin/registry.mjs +37 -0
- package/dist/plugins/coin/registry.mjs.map +1 -0
- package/dist/plugins/coin/service.d.mts +47 -0
- package/dist/plugins/coin/service.mjs +51 -0
- package/dist/plugins/coin/service.mjs.map +1 -0
- package/dist/plugins/coin/snapshot.mjs +19 -0
- package/dist/plugins/coin/snapshot.mjs.map +1 -0
- package/dist/plugins/coin/type-strings.mjs +49 -0
- package/dist/plugins/coin/type-strings.mjs.map +1 -0
- package/dist/plugins/deepbook/codegen.d.mts +39 -0
- package/dist/plugins/deepbook/codegen.mjs +15 -0
- package/dist/plugins/deepbook/codegen.mjs.map +1 -0
- package/dist/plugins/deepbook/deploy.mjs +437 -0
- package/dist/plugins/deepbook/deploy.mjs.map +1 -0
- package/dist/plugins/deepbook/errors.d.mts +29 -0
- package/dist/plugins/deepbook/errors.mjs +26 -0
- package/dist/plugins/deepbook/errors.mjs.map +1 -0
- package/dist/plugins/deepbook/faucet-strategy.d.mts +8 -0
- package/dist/plugins/deepbook/faucet-strategy.mjs +81 -0
- package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -0
- package/dist/plugins/deepbook/index.d.mts +171 -0
- package/dist/plugins/deepbook/index.mjs +359 -0
- package/dist/plugins/deepbook/index.mjs.map +1 -0
- package/dist/plugins/deepbook/plugin-key.mjs +7 -0
- package/dist/plugins/deepbook/plugin-key.mjs.map +1 -0
- package/dist/plugins/deepbook/pyth/index.mjs +226 -0
- package/dist/plugins/deepbook/pyth/index.mjs.map +1 -0
- package/dist/plugins/deepbook/routable.mjs +21 -0
- package/dist/plugins/deepbook/routable.mjs.map +1 -0
- package/dist/plugins/deepbook/snapshot.mjs +49 -0
- package/dist/plugins/deepbook/snapshot.mjs.map +1 -0
- package/dist/plugins/deepbook/types.d.mts +125 -0
- package/dist/plugins/deepbook/types.mjs +12 -0
- package/dist/plugins/deepbook/types.mjs.map +1 -0
- package/dist/plugins/faucet/dispatcher.d.mts +9 -0
- package/dist/plugins/faucet/dispatcher.mjs +13 -0
- package/dist/plugins/faucet/dispatcher.mjs.map +1 -0
- package/dist/plugins/faucet/errors.d.mts +86 -0
- package/dist/plugins/faucet/errors.mjs +19 -0
- package/dist/plugins/faucet/errors.mjs.map +1 -0
- package/dist/plugins/faucet/http.mjs +127 -0
- package/dist/plugins/faucet/http.mjs.map +1 -0
- package/dist/plugins/faucet/index.d.mts +43 -0
- package/dist/plugins/faucet/index.mjs +42 -0
- package/dist/plugins/faucet/index.mjs.map +1 -0
- package/dist/plugins/faucet/service.d.mts +20 -0
- package/dist/plugins/faucet/strategies/sui-local.d.mts +23 -0
- package/dist/plugins/faucet/strategies/sui-local.mjs +29 -0
- package/dist/plugins/faucet/strategies/sui-local.mjs.map +1 -0
- package/dist/plugins/host-service/errors.d.mts +27 -0
- package/dist/plugins/host-service/errors.mjs +14 -0
- package/dist/plugins/host-service/errors.mjs.map +1 -0
- package/dist/plugins/host-service/index.d.mts +10 -0
- package/dist/plugins/host-service/index.mjs +48 -0
- package/dist/plugins/host-service/index.mjs.map +1 -0
- package/dist/plugins/host-service/routable.mjs +24 -0
- package/dist/plugins/host-service/routable.mjs.map +1 -0
- package/dist/plugins/host-service/service.d.mts +49 -0
- package/dist/plugins/host-service/service.mjs +375 -0
- package/dist/plugins/host-service/service.mjs.map +1 -0
- package/dist/plugins/package/build.d.mts +1 -0
- package/dist/plugins/package/build.mjs +24 -0
- package/dist/plugins/package/build.mjs.map +1 -0
- package/dist/plugins/package/codegen.d.mts +19 -0
- package/dist/plugins/package/codegen.mjs +41 -0
- package/dist/plugins/package/codegen.mjs.map +1 -0
- package/dist/plugins/package/dep-resolution.mjs +10 -0
- package/dist/plugins/package/dep-resolution.mjs.map +1 -0
- package/dist/plugins/package/errors.d.mts +34 -0
- package/dist/plugins/package/errors.mjs +13 -0
- package/dist/plugins/package/errors.mjs.map +1 -0
- package/dist/plugins/package/index.d.mts +109 -0
- package/dist/plugins/package/index.mjs +207 -0
- package/dist/plugins/package/index.mjs.map +1 -0
- package/dist/plugins/package/mode-known.mjs +41 -0
- package/dist/plugins/package/mode-known.mjs.map +1 -0
- package/dist/plugins/package/mode-local.d.mts +1 -0
- package/dist/plugins/package/mode-local.mjs +183 -0
- package/dist/plugins/package/mode-local.mjs.map +1 -0
- package/dist/plugins/package/publish-executor.mjs +202 -0
- package/dist/plugins/package/publish-executor.mjs.map +1 -0
- package/dist/plugins/package/publish-output.d.mts +28 -0
- package/dist/plugins/package/publish-output.mjs +45 -0
- package/dist/plugins/package/publish-output.mjs.map +1 -0
- package/dist/plugins/package/registry.d.mts +25 -0
- package/dist/plugins/package/registry.mjs +30 -0
- package/dist/plugins/package/registry.mjs.map +1 -0
- package/dist/plugins/package/service.mjs +20 -0
- package/dist/plugins/package/service.mjs.map +1 -0
- package/dist/plugins/package/snapshot.mjs +25 -0
- package/dist/plugins/package/snapshot.mjs.map +1 -0
- package/dist/plugins/postgres/codegen.mjs +42 -0
- package/dist/plugins/postgres/codegen.mjs.map +1 -0
- package/dist/plugins/postgres/connection.d.mts +33 -0
- package/dist/plugins/postgres/connection.mjs +19 -0
- package/dist/plugins/postgres/connection.mjs.map +1 -0
- package/dist/plugins/postgres/db-ensure.mjs +100 -0
- package/dist/plugins/postgres/db-ensure.mjs.map +1 -0
- package/dist/plugins/postgres/errors.d.mts +55 -0
- package/dist/plugins/postgres/errors.mjs +29 -0
- package/dist/plugins/postgres/errors.mjs.map +1 -0
- package/dist/plugins/postgres/index.d.mts +37 -0
- package/dist/plugins/postgres/index.mjs +75 -0
- package/dist/plugins/postgres/index.mjs.map +1 -0
- package/dist/plugins/postgres/routable.mjs +33 -0
- package/dist/plugins/postgres/routable.mjs.map +1 -0
- package/dist/plugins/postgres/service.d.mts +50 -0
- package/dist/plugins/postgres/service.mjs +145 -0
- package/dist/plugins/postgres/service.mjs.map +1 -0
- package/dist/plugins/postgres/snapshot.d.mts +1 -0
- package/dist/plugins/postgres/snapshot.mjs +32 -0
- package/dist/plugins/postgres/snapshot.mjs.map +1 -0
- package/dist/plugins/router-entrypoints.mjs +21 -0
- package/dist/plugins/router-entrypoints.mjs.map +1 -0
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +59 -0
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -0
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +132 -0
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -0
- package/dist/plugins/seal/codegen.d.mts +19 -0
- package/dist/plugins/seal/codegen.mjs +16 -0
- package/dist/plugins/seal/codegen.mjs.map +1 -0
- package/dist/plugins/seal/config-render.mjs +82 -0
- package/dist/plugins/seal/config-render.mjs.map +1 -0
- package/dist/plugins/seal/deploy.mjs +198 -0
- package/dist/plugins/seal/deploy.mjs.map +1 -0
- package/dist/plugins/seal/errors.d.mts +52 -0
- package/dist/plugins/seal/errors.mjs +19 -0
- package/dist/plugins/seal/errors.mjs.map +1 -0
- package/dist/plugins/seal/index.d.mts +161 -0
- package/dist/plugins/seal/index.mjs +235 -0
- package/dist/plugins/seal/index.mjs.map +1 -0
- package/dist/plugins/seal/key-manager.d.mts +22 -0
- package/dist/plugins/seal/key-manager.mjs +22 -0
- package/dist/plugins/seal/key-manager.mjs.map +1 -0
- package/dist/plugins/seal/key-server.mjs +175 -0
- package/dist/plugins/seal/key-server.mjs.map +1 -0
- package/dist/plugins/seal/keygen.mjs +96 -0
- package/dist/plugins/seal/keygen.mjs.map +1 -0
- package/dist/plugins/seal/mode/fork-known.d.mts +8 -0
- package/dist/plugins/seal/mode/fork-known.mjs +23 -0
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -0
- package/dist/plugins/seal/mode/live.d.mts +18 -0
- package/dist/plugins/seal/mode/live.mjs +64 -0
- package/dist/plugins/seal/mode/live.mjs.map +1 -0
- package/dist/plugins/seal/mode/local-keygen.mjs +180 -0
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -0
- package/dist/plugins/seal/plugin-key.mjs +7 -0
- package/dist/plugins/seal/plugin-key.mjs.map +1 -0
- package/dist/plugins/seal/registry-publish.d.mts +43 -0
- package/dist/plugins/seal/registry-publish.mjs +9 -0
- package/dist/plugins/seal/registry-publish.mjs.map +1 -0
- package/dist/plugins/seal/routable.mjs +57 -0
- package/dist/plugins/seal/routable.mjs.map +1 -0
- package/dist/plugins/seal/service.mjs +17 -0
- package/dist/plugins/seal/service.mjs.map +1 -0
- package/dist/plugins/seal/snapshot.mjs +51 -0
- package/dist/plugins/seal/snapshot.mjs.map +1 -0
- package/dist/plugins/sui/auto-tick.mjs +45 -0
- package/dist/plugins/sui/auto-tick.mjs.map +1 -0
- package/dist/plugins/sui/chain-build-container.d.mts +1 -0
- package/dist/plugins/sui/chain-probe.d.mts +85 -0
- package/dist/plugins/sui/chain-probe.mjs +104 -0
- package/dist/plugins/sui/chain-probe.mjs.map +1 -0
- package/dist/plugins/sui/codegen.d.mts +14 -0
- package/dist/plugins/sui/codegen.mjs +26 -0
- package/dist/plugins/sui/codegen.mjs.map +1 -0
- package/dist/plugins/sui/errors.d.mts +74 -0
- package/dist/plugins/sui/errors.mjs +28 -0
- package/dist/plugins/sui/errors.mjs.map +1 -0
- package/dist/plugins/sui/fork-orchestration.mjs +24 -0
- package/dist/plugins/sui/fork-orchestration.mjs.map +1 -0
- package/dist/plugins/sui/fork-transaction.mjs +96 -0
- package/dist/plugins/sui/fork-transaction.mjs.map +1 -0
- package/dist/plugins/sui/index.d.mts +318 -0
- package/dist/plugins/sui/index.mjs +182 -0
- package/dist/plugins/sui/index.mjs.map +1 -0
- package/dist/plugins/sui/mode/external.mjs +60 -0
- package/dist/plugins/sui/mode/external.mjs.map +1 -0
- package/dist/plugins/sui/mode/fork.mjs +283 -0
- package/dist/plugins/sui/mode/fork.mjs.map +1 -0
- package/dist/plugins/sui/mode/live.mjs +103 -0
- package/dist/plugins/sui/mode/live.mjs.map +1 -0
- package/dist/plugins/sui/mode/local.mjs +293 -0
- package/dist/plugins/sui/mode/local.mjs.map +1 -0
- package/dist/plugins/sui/mode/shared-boot.mjs +254 -0
- package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -0
- package/dist/plugins/sui/mode/shared.d.mts +103 -0
- package/dist/plugins/sui/mode/shared.mjs +12 -0
- package/dist/plugins/sui/mode/shared.mjs.map +1 -0
- package/dist/plugins/sui/mode/spec.d.mts +94 -0
- package/dist/plugins/sui/network-resolver.d.mts +23 -0
- package/dist/plugins/sui/routable.mjs +88 -0
- package/dist/plugins/sui/routable.mjs.map +1 -0
- package/dist/plugins/sui/seed-objects.d.mts +18 -0
- package/dist/plugins/sui/seed-objects.mjs +25 -0
- package/dist/plugins/sui/seed-objects.mjs.map +1 -0
- package/dist/plugins/sui/service.mjs +38 -0
- package/dist/plugins/sui/service.mjs.map +1 -0
- package/dist/plugins/sui/snapshot.mjs +53 -0
- package/dist/plugins/sui/snapshot.mjs.map +1 -0
- package/dist/plugins/wallet/codegen.d.mts +33 -0
- package/dist/plugins/wallet/codegen.mjs +34 -0
- package/dist/plugins/wallet/codegen.mjs.map +1 -0
- package/dist/plugins/wallet/errors.d.mts +66 -0
- package/dist/plugins/wallet/errors.mjs +16 -0
- package/dist/plugins/wallet/errors.mjs.map +1 -0
- package/dist/plugins/wallet/index.d.mts +63 -0
- package/dist/plugins/wallet/index.mjs +126 -0
- package/dist/plugins/wallet/index.mjs.map +1 -0
- package/dist/plugins/wallet/origin-policy.d.mts +1 -0
- package/dist/plugins/wallet/origin-policy.mjs +65 -0
- package/dist/plugins/wallet/origin-policy.mjs.map +1 -0
- package/dist/plugins/wallet/pairing.d.mts +11 -0
- package/dist/plugins/wallet/pairing.mjs +125 -0
- package/dist/plugins/wallet/pairing.mjs.map +1 -0
- package/dist/plugins/wallet/protocol.d.mts +1 -0
- package/dist/plugins/wallet/protocol.mjs +96 -0
- package/dist/plugins/wallet/protocol.mjs.map +1 -0
- package/dist/plugins/wallet/routable.mjs +32 -0
- package/dist/plugins/wallet/routable.mjs.map +1 -0
- package/dist/plugins/wallet/server.d.mts +12 -0
- package/dist/plugins/wallet/server.mjs +317 -0
- package/dist/plugins/wallet/server.mjs.map +1 -0
- package/dist/plugins/wallet/service.d.mts +68 -0
- package/dist/plugins/wallet/service.mjs +97 -0
- package/dist/plugins/wallet/service.mjs.map +1 -0
- package/dist/plugins/wallet/snapshot.d.mts +1 -0
- package/dist/plugins/wallet/snapshot.mjs +14 -0
- package/dist/plugins/wallet/snapshot.mjs.map +1 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +42 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -0
- package/dist/plugins/walrus/codegen.d.mts +38 -0
- package/dist/plugins/walrus/codegen.mjs +34 -0
- package/dist/plugins/walrus/codegen.mjs.map +1 -0
- package/dist/plugins/walrus/deploy-paths.mjs +14 -0
- package/dist/plugins/walrus/deploy-paths.mjs.map +1 -0
- package/dist/plugins/walrus/deploy.d.mts +1 -0
- package/dist/plugins/walrus/deploy.mjs +224 -0
- package/dist/plugins/walrus/deploy.mjs.map +1 -0
- package/dist/plugins/walrus/errors.d.mts +38 -0
- package/dist/plugins/walrus/errors.mjs +26 -0
- package/dist/plugins/walrus/errors.mjs.map +1 -0
- package/dist/plugins/walrus/faucet-strategy.d.mts +12 -0
- package/dist/plugins/walrus/faucet-strategy.mjs +62 -0
- package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -0
- package/dist/plugins/walrus/index.d.mts +177 -0
- package/dist/plugins/walrus/index.mjs +284 -0
- package/dist/plugins/walrus/index.mjs.map +1 -0
- package/dist/plugins/walrus/mode/known-deploy.d.mts +25 -0
- package/dist/plugins/walrus/mode/known-deploy.mjs +71 -0
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -0
- package/dist/plugins/walrus/mode/local-cluster.d.mts +34 -0
- package/dist/plugins/walrus/mode/local-cluster.mjs +153 -0
- package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -0
- package/dist/plugins/walrus/plugin-key.mjs +7 -0
- package/dist/plugins/walrus/plugin-key.mjs.map +1 -0
- package/dist/plugins/walrus/registry-publish.d.mts +24 -0
- package/dist/plugins/walrus/registry-publish.mjs +7 -0
- package/dist/plugins/walrus/registry-publish.mjs.map +1 -0
- package/dist/plugins/walrus/routable.mjs +99 -0
- package/dist/plugins/walrus/routable.mjs.map +1 -0
- package/dist/plugins/walrus/service.mjs +20 -0
- package/dist/plugins/walrus/service.mjs.map +1 -0
- package/dist/plugins/walrus/snapshot.mjs +53 -0
- package/dist/plugins/walrus/snapshot.mjs.map +1 -0
- package/dist/plugins/walrus/storage-nodes.d.mts +15 -0
- package/dist/plugins/walrus/storage-nodes.mjs +154 -0
- package/dist/plugins/walrus/storage-nodes.mjs.map +1 -0
- package/dist/plugins/walrus/wal-swap.d.mts +2 -0
- package/dist/plugins/walrus/wal-swap.mjs +58 -0
- package/dist/plugins/walrus/wal-swap.mjs.map +1 -0
- package/dist/primitives/artifact-publisher.d.mts +12 -0
- package/dist/primitives/cache.d.mts +1 -0
- package/dist/runtime/built-in-plugin-layers.mjs +49 -0
- package/dist/runtime/built-in-plugin-layers.mjs.map +1 -0
- package/dist/runtime/docker/client.d.mts +2 -0
- package/dist/runtime/docker/client.mjs +54 -0
- package/dist/runtime/docker/client.mjs.map +1 -0
- package/dist/runtime/docker/container.d.mts +1 -0
- package/dist/runtime/docker/container.mjs +562 -0
- package/dist/runtime/docker/container.mjs.map +1 -0
- package/dist/runtime/docker/errors.d.mts +1 -0
- package/dist/runtime/docker/errors.mjs +187 -0
- package/dist/runtime/docker/errors.mjs.map +1 -0
- package/dist/runtime/docker/exec.d.mts +1 -0
- package/dist/runtime/docker/exec.mjs +63 -0
- package/dist/runtime/docker/exec.mjs.map +1 -0
- package/dist/runtime/docker/image.d.mts +1 -0
- package/dist/runtime/docker/image.mjs +278 -0
- package/dist/runtime/docker/image.mjs.map +1 -0
- package/dist/runtime/docker/index.d.mts +1 -0
- package/dist/runtime/docker/inventory.d.mts +1 -0
- package/dist/runtime/docker/inventory.mjs +167 -0
- package/dist/runtime/docker/inventory.mjs.map +1 -0
- package/dist/runtime/docker/labels.d.mts +1 -0
- package/dist/runtime/docker/labels.mjs +97 -0
- package/dist/runtime/docker/labels.mjs.map +1 -0
- package/dist/runtime/docker/logs.d.mts +1 -0
- package/dist/runtime/docker/logs.mjs +34 -0
- package/dist/runtime/docker/logs.mjs.map +1 -0
- package/dist/runtime/docker/network.d.mts +1 -0
- package/dist/runtime/docker/network.mjs +168 -0
- package/dist/runtime/docker/network.mjs.map +1 -0
- package/dist/runtime/docker/service.d.mts +9 -0
- package/dist/runtime/docker/service.mjs +266 -0
- package/dist/runtime/docker/service.mjs.map +1 -0
- package/dist/runtime/docker/sweep.d.mts +1 -0
- package/dist/runtime/docker/sweep.mjs +220 -0
- package/dist/runtime/docker/sweep.mjs.map +1 -0
- package/dist/runtime/docker/volume.d.mts +1 -0
- package/dist/runtime/docker/volume.mjs +24 -0
- package/dist/runtime/docker/volume.mjs.map +1 -0
- package/dist/runtime/docker/wrap.d.mts +1 -0
- package/dist/runtime/docker/wrap.mjs +131 -0
- package/dist/runtime/docker/wrap.mjs.map +1 -0
- package/dist/substrate/brand.d.mts +24 -0
- package/dist/substrate/brand.mjs +14 -0
- package/dist/substrate/brand.mjs.map +1 -0
- package/dist/substrate/cross-process.d.mts +1 -0
- package/dist/substrate/cross-process.mjs +28 -0
- package/dist/substrate/cross-process.mjs.map +1 -0
- package/dist/substrate/events.d.mts +117 -0
- package/dist/substrate/identity.d.mts +13 -0
- package/dist/substrate/lifecycle.d.mts +12 -0
- package/dist/substrate/manifest.d.mts +39 -0
- package/dist/substrate/manifest.mjs +33 -0
- package/dist/substrate/manifest.mjs.map +1 -0
- package/dist/substrate/network.d.mts +34 -0
- package/dist/substrate/options.d.mts +23 -0
- package/dist/substrate/plugin.d.mts +101 -0
- package/dist/substrate/plugin.mjs +61 -0
- package/dist/substrate/plugin.mjs.map +1 -0
- package/dist/substrate/projection.d.mts +100 -0
- package/dist/substrate/runtime/artifact-publisher/index.mjs +76 -0
- package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -0
- package/dist/substrate/runtime/atomic-write.mjs +106 -0
- package/dist/substrate/runtime/atomic-write.mjs.map +1 -0
- package/dist/substrate/runtime/cache/index.d.mts +1 -0
- package/dist/substrate/runtime/cache/schema.d.mts +1 -0
- package/dist/substrate/runtime/cache/schema.mjs +22 -0
- package/dist/substrate/runtime/cache/schema.mjs.map +1 -0
- package/dist/substrate/runtime/cache/service.d.mts +1 -0
- package/dist/substrate/runtime/cache/service.mjs +89 -0
- package/dist/substrate/runtime/cache/service.mjs.map +1 -0
- package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -0
- package/dist/substrate/runtime/capability-sinks/layer.d.mts +1 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs +31 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs.map +1 -0
- package/dist/substrate/runtime/capability-sinks/service.d.mts +36 -0
- package/dist/substrate/runtime/capability-sinks/service.mjs +74 -0
- package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -0
- package/dist/substrate/runtime/config-validation.d.mts +38 -0
- package/dist/substrate/runtime/config-validation.mjs +137 -0
- package/dist/substrate/runtime/config-validation.mjs.map +1 -0
- package/dist/substrate/runtime/context-helpers.mjs +32 -0
- package/dist/substrate/runtime/context-helpers.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +128 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +136 -0
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +49 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +9 -0
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs +119 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/roster.mjs +275 -0
- package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +117 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/stack-lock.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/stack-lock.mjs +142 -0
- package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -0
- package/dist/substrate/runtime/current-plugin.mjs +15 -0
- package/dist/substrate/runtime/current-plugin.mjs.map +1 -0
- package/dist/substrate/runtime/errors.d.mts +1 -0
- package/dist/substrate/runtime/errors.mjs +76 -0
- package/dist/substrate/runtime/errors.mjs.map +1 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs +364 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -0
- package/dist/substrate/runtime/http-probe.d.mts +35 -0
- package/dist/substrate/runtime/http-probe.mjs +65 -0
- package/dist/substrate/runtime/http-probe.mjs.map +1 -0
- package/dist/substrate/runtime/lease-broker/index.d.mts +1 -0
- package/dist/substrate/runtime/lease-broker/service.d.mts +64 -0
- package/dist/substrate/runtime/lease-broker/service.mjs +155 -0
- package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/dep-graph.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs +138 -0
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/index.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +31 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +133 -0
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/ready-gate.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/ready-gate.mjs +34 -0
- package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/selective-restart.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs +43 -0
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/signals.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/signals.mjs +64 -0
- package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/state-machine.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/state-machine.mjs +38 -0
- package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +27 -0
- package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -0
- package/dist/substrate/runtime/managed-container.d.mts +30 -0
- package/dist/substrate/runtime/managed-container.mjs +32 -0
- package/dist/substrate/runtime/managed-container.mjs.map +1 -0
- package/dist/substrate/runtime/manifest/manifest.mjs +73 -0
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -0
- package/dist/substrate/runtime/mode-errors.d.mts +36 -0
- package/dist/substrate/runtime/observability/cascade-formatter.d.mts +1 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs +135 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -0
- package/dist/substrate/runtime/observability/formatter-registry.d.mts +1 -0
- package/dist/substrate/runtime/observability/formatter-registry.mjs +65 -0
- package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -0
- package/dist/substrate/runtime/observability/index.d.mts +3 -0
- package/dist/substrate/runtime/observability/logger.d.mts +58 -0
- package/dist/substrate/runtime/observability/logger.mjs +89 -0
- package/dist/substrate/runtime/observability/logger.mjs.map +1 -0
- package/dist/substrate/runtime/observability/pretty-error.d.mts +1 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs +119 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -0
- package/dist/substrate/runtime/observability/process-lines.d.mts +31 -0
- package/dist/substrate/runtime/observability/process-lines.mjs +40 -0
- package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -0
- package/dist/substrate/runtime/observability/redaction.d.mts +28 -0
- package/dist/substrate/runtime/observability/redaction.mjs +45 -0
- package/dist/substrate/runtime/observability/redaction.mjs.map +1 -0
- package/dist/substrate/runtime/observability/spans.d.mts +1 -0
- package/dist/substrate/runtime/observability/spans.mjs +87 -0
- package/dist/substrate/runtime/observability/spans.mjs.map +1 -0
- package/dist/substrate/runtime/observability/subprocess-capture.d.mts +2 -0
- package/dist/substrate/runtime/observability/subprocess-capture.mjs +82 -0
- package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -0
- package/dist/substrate/runtime/paths.d.mts +17 -0
- package/dist/substrate/runtime/paths.mjs +61 -0
- package/dist/substrate/runtime/paths.mjs.map +1 -0
- package/dist/substrate/runtime/port-broker/index.d.mts +1 -0
- package/dist/substrate/runtime/port-broker/service.d.mts +1 -0
- package/dist/substrate/runtime/port-broker/service.mjs +319 -0
- package/dist/substrate/runtime/port-broker/service.mjs.map +1 -0
- package/dist/substrate/runtime/post-acquire-tasks.d.mts +1 -0
- package/dist/substrate/runtime/post-acquire-tasks.mjs +34 -0
- package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -0
- package/dist/substrate/runtime/probes.d.mts +51 -0
- package/dist/substrate/runtime/probes.mjs +84 -0
- package/dist/substrate/runtime/probes.mjs.map +1 -0
- package/dist/substrate/runtime/process-supervisor.d.mts +57 -0
- package/dist/substrate/runtime/process-supervisor.mjs +73 -0
- package/dist/substrate/runtime/process-supervisor.mjs.map +1 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs +44 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -0
- package/dist/substrate/runtime/projection/persisted.mjs +195 -0
- package/dist/substrate/runtime/projection/persisted.mjs.map +1 -0
- package/dist/substrate/runtime/projection/state-ref.mjs +48 -0
- package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -0
- package/dist/substrate/runtime/projection/update.mjs +200 -0
- package/dist/substrate/runtime/projection/update.mjs.map +1 -0
- package/dist/substrate/runtime/retry-policy.d.mts +18 -0
- package/dist/substrate/runtime/retry-policy.mjs +16 -0
- package/dist/substrate/runtime/retry-policy.mjs.map +1 -0
- package/dist/substrate/runtime/run.mjs +86 -0
- package/dist/substrate/runtime/run.mjs.map +1 -0
- package/dist/substrate/runtime/runtime-decode.d.mts +32 -0
- package/dist/substrate/runtime/runtime-decode.mjs +53 -0
- package/dist/substrate/runtime/runtime-decode.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-http-server.mjs +36 -0
- package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs +83 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -0
- package/dist/substrate/runtime/stage-and-swap/index.d.mts +1 -0
- package/dist/substrate/runtime/stage-and-swap/index.mjs +131 -0
- package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -0
- package/dist/substrate/runtime/state-store/schema.mjs +36 -0
- package/dist/substrate/runtime/state-store/schema.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +22 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +30 -0
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/index.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/service.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs +67 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -0
- package/dist/substrate/runtime/sui-execute/index.d.mts +11 -0
- package/dist/substrate/runtime/sui-execute/index.mjs +144 -0
- package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -0
- package/dist/substrate/runtime/sui-move-build/index.d.mts +1 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs +283 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor.d.mts +1 -0
- package/dist/substrate/runtime/supervisor.mjs +831 -0
- package/dist/substrate/runtime/supervisor.mjs.map +1 -0
- package/dist/surfaces/cli/command-tree.mjs +276 -0
- package/dist/surfaces/cli/command-tree.mjs.map +1 -0
- package/dist/surfaces/cli/commands/config.mjs +31 -0
- package/dist/surfaces/cli/commands/config.mjs.map +1 -0
- package/dist/surfaces/cli/commands/confirm-node.mjs +26 -0
- package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -0
- package/dist/surfaces/cli/commands/confirm.mjs +26 -0
- package/dist/surfaces/cli/commands/confirm.mjs.map +1 -0
- package/dist/surfaces/cli/commands/doctor-probes.mjs +452 -0
- package/dist/surfaces/cli/commands/doctor-probes.mjs.map +1 -0
- package/dist/surfaces/cli/commands/doctor.mjs +38 -0
- package/dist/surfaces/cli/commands/doctor.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs +347 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune.mjs +178 -0
- package/dist/surfaces/cli/commands/prune.mjs.map +1 -0
- package/dist/surfaces/cli/commands/snapshot.mjs +141 -0
- package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -0
- package/dist/surfaces/cli/commands/status.mjs +95 -0
- package/dist/surfaces/cli/commands/status.mjs.map +1 -0
- package/dist/surfaces/cli/commands/supervisor-presence.mjs +33 -0
- package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -0
- package/dist/surfaces/cli/commands/wipe.mjs +28 -0
- package/dist/surfaces/cli/commands/wipe.mjs.map +1 -0
- package/dist/surfaces/cli/envelope.mjs +43 -0
- package/dist/surfaces/cli/envelope.mjs.map +1 -0
- package/dist/surfaces/cli/errors.mjs +110 -0
- package/dist/surfaces/cli/errors.mjs.map +1 -0
- package/dist/surfaces/cli/flags.mjs +56 -0
- package/dist/surfaces/cli/flags.mjs.map +1 -0
- package/dist/surfaces/cli/index.mjs +418 -0
- package/dist/surfaces/cli/index.mjs.map +1 -0
- package/dist/surfaces/cli/output.mjs +115 -0
- package/dist/surfaces/cli/output.mjs.map +1 -0
- package/dist/surfaces/cli/sysexits.mjs +139 -0
- package/dist/surfaces/cli/sysexits.mjs.map +1 -0
- package/dist/surfaces/tui/app.mjs +104 -0
- package/dist/surfaces/tui/app.mjs.map +1 -0
- package/dist/surfaces/tui/dashboard.mjs +261 -0
- package/dist/surfaces/tui/dashboard.mjs.map +1 -0
- package/dist/surfaces/tui/display-derivation.mjs +395 -0
- package/dist/surfaces/tui/display-derivation.mjs.map +1 -0
- package/dist/surfaces/tui/errors.mjs +11 -0
- package/dist/surfaces/tui/errors.mjs.map +1 -0
- package/dist/surfaces/tui/event-log.mjs +155 -0
- package/dist/surfaces/tui/event-log.mjs.map +1 -0
- package/dist/surfaces/tui/heartbeat.mjs +33 -0
- package/dist/surfaces/tui/heartbeat.mjs.map +1 -0
- package/dist/surfaces/tui/index.mjs +50 -0
- package/dist/surfaces/tui/index.mjs.map +1 -0
- package/dist/surfaces/tui/input.mjs +104 -0
- package/dist/surfaces/tui/input.mjs.map +1 -0
- package/dist/surfaces/tui/mode-detect.mjs +32 -0
- package/dist/surfaces/tui/mode-detect.mjs.map +1 -0
- package/dist/surfaces/tui/mount-ink.mjs +31 -0
- package/dist/surfaces/tui/mount-ink.mjs.map +1 -0
- package/dist/surfaces/tui/plain-renderer.mjs +170 -0
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -0
- package/dist/surfaces/tui/resource-table.mjs +507 -0
- package/dist/surfaces/tui/resource-table.mjs.map +1 -0
- package/images/_shared/signal-forward.sh +77 -0
- package/images/postgres/Dockerfile +32 -0
- package/images/seal/Dockerfile +68 -0
- package/images/seal/entrypoint.sh +65 -0
- package/images/sui/Dockerfile +73 -0
- package/images/sui/entrypoint.sh +244 -0
- package/images/sui-fork/Dockerfile +53 -0
- package/images/sui-fork/entrypoint.sh +51 -0
- package/images/walrus/Dockerfile +122 -0
- package/images/walrus/deploy-walrus.sh +305 -0
- package/images/walrus/run-walrus.sh +53 -0
- package/package.json +94 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { AnyResourceRef, ResourceRef } from "../../substrate/plugin.mjs";
|
|
2
|
+
import { CoinResourceId } from "../coin/index.mjs";
|
|
3
|
+
import { AccountValue } from "./service.mjs";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
|
+
|
|
6
|
+
//#region src/plugins/account/funding.d.ts
|
|
7
|
+
/** Direct resource ref shape for a coin upstream. The user passes the
|
|
8
|
+
* result of `coin.fromPackage(...)` / `coin.known(...)` /
|
|
9
|
+
* `coin.builtin(...)` — NOT a bare string or discriminator. Generic
|
|
10
|
+
* over the literal symbol so the account's dependency tuple preserves
|
|
11
|
+
* each per-coin resource id (`coin:managed_coin/managed_coin`,
|
|
12
|
+
* `coin:wal`, ...).
|
|
13
|
+
*
|
|
14
|
+
* Architecture (Direct Member Refs): cross-plugin references at the
|
|
15
|
+
* user-facing surface are plugin/resource refs directly — no opaque
|
|
16
|
+
* tag or string discriminator vocabulary. */
|
|
17
|
+
interface AccountFundingCoinValue {
|
|
18
|
+
readonly fullCoinType: string;
|
|
19
|
+
readonly symbol?: string;
|
|
20
|
+
}
|
|
21
|
+
type CoinMember<Sym extends string = string> = ResourceRef<CoinResourceId<Sym>, AccountFundingCoinValue>;
|
|
22
|
+
/** Optional dependency edge for the plugin that contributes the
|
|
23
|
+
* funding strategy. Coin refs force the coin metadata edge; `via`
|
|
24
|
+
* forces the strategy-provider edge (e.g. a known DeepBook
|
|
25
|
+
* deployment that contributes `coinType:<DEEP>`). */
|
|
26
|
+
type CrossCuttingFundingProvider = AnyResourceRef | readonly AnyResourceRef[];
|
|
27
|
+
/** Built-in SUI funding entry. This uses the same account funding
|
|
28
|
+
* list as arbitrary coins but avoids requiring `coin.builtin('sui')`
|
|
29
|
+
* for the normal SUI faucet path. */
|
|
30
|
+
interface SuiFundingEntry {
|
|
31
|
+
readonly coin: 'sui';
|
|
32
|
+
readonly amount: number | bigint;
|
|
33
|
+
}
|
|
34
|
+
/** A single cross-cutting funding entry. `coin` is a direct member ref
|
|
35
|
+
* (the value returned by `coin.fromPackage(...)` etc.) — the account plugin
|
|
36
|
+
* threads it through `dependsOn` so the substrate's dep graph forces
|
|
37
|
+
* the publishing / discovery edge to land before funding.
|
|
38
|
+
*
|
|
39
|
+
* Distilled-doc invariant ("Strict upstream declaration"): coin
|
|
40
|
+
* references cited by Account must force a dep edge. `via` is the
|
|
41
|
+
* same contract for the strategy contributor that can satisfy the
|
|
42
|
+
* funding request. */
|
|
43
|
+
interface CrossCuttingFundingEntry<M extends CoinMember = CoinMember> {
|
|
44
|
+
readonly coin: M;
|
|
45
|
+
readonly amount: bigint;
|
|
46
|
+
readonly via?: CrossCuttingFundingProvider;
|
|
47
|
+
}
|
|
48
|
+
type AccountFundingEntry<M extends CoinMember = CoinMember> = SuiFundingEntry | CrossCuttingFundingEntry<M>;
|
|
49
|
+
type AccountFunding = ReadonlyArray<AccountFundingEntry>;
|
|
50
|
+
/** Internal projected shape — the acquire body in `account/index.ts`
|
|
51
|
+
* receives each funding entry's resolved `CoinValue`, reads
|
|
52
|
+
* `fullCoinType`, and passes the projected entries to
|
|
53
|
+
* `applyCrossCuttingFunding`. The funding pass never sees the raw
|
|
54
|
+
* member refs — keeps the strategy dispatch logic
|
|
55
|
+
* substrate-name-blind. */
|
|
56
|
+
interface ProjectedFundingEntry {
|
|
57
|
+
readonly coin: string;
|
|
58
|
+
readonly fullCoinType: string;
|
|
59
|
+
readonly amount: bigint;
|
|
60
|
+
}
|
|
61
|
+
type ProjectedFunding = ReadonlyArray<ProjectedFundingEntry>;
|
|
62
|
+
interface AccountFundingResult {
|
|
63
|
+
readonly requested: ProjectedFunding;
|
|
64
|
+
readonly applied: ProjectedFunding;
|
|
65
|
+
}
|
|
66
|
+
/** Request passed to account funding strategies. `amount` uses the
|
|
67
|
+
* funded coin's smallest unit. The resolved account handle is present
|
|
68
|
+
* so strategies without an admin signer can perform account-owned
|
|
69
|
+
* swaps while still sharing the central funding dispatcher. */
|
|
70
|
+
interface AccountFundingRequest {
|
|
71
|
+
readonly address: string;
|
|
72
|
+
readonly amount: bigint;
|
|
73
|
+
readonly account: AccountValue;
|
|
74
|
+
}
|
|
75
|
+
interface AccountFundingStrategy<E = unknown> {
|
|
76
|
+
readonly request: (req: AccountFundingRequest) => Effect.Effect<void, E>;
|
|
77
|
+
/** True when the strategy calls `account.withTransactionSigner`.
|
|
78
|
+
* The dispatcher must not acquire the same non-reentrant
|
|
79
|
+
* per-address lease outside the strategy. */
|
|
80
|
+
readonly usesAccountSigner?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/** The canonical builtin SUI coin type. Used by the funding dispatch
|
|
83
|
+
* to route SUI entries to the faucet strategy (same key as the
|
|
84
|
+
* default-funding pass), and by everything that needs to detect
|
|
85
|
+
* "this is the protocol-defined SUI". Mirrors `BUILTIN_COINS.sui`
|
|
86
|
+
* in the coin plugin. */
|
|
87
|
+
declare const SUI_FULL_COIN_TYPE: "0x2::sui::SUI";
|
|
88
|
+
/** Default funding amount for ephemeral accounts — 1 SUI in MIST.
|
|
89
|
+
* Documented at the user-facing factory so a bare `account('alice')`
|
|
90
|
+
* is predictable. */
|
|
91
|
+
declare const DEFAULT_EPHEMERAL_FUND_MIST = 1000000000n;
|
|
92
|
+
//#endregion
|
|
93
|
+
export { AccountFunding, AccountFundingCoinValue, AccountFundingEntry, AccountFundingRequest, AccountFundingResult, AccountFundingStrategy, CoinMember, CrossCuttingFundingEntry, CrossCuttingFundingProvider, DEFAULT_EPHEMERAL_FUND_MIST, ProjectedFunding, ProjectedFundingEntry, SUI_FULL_COIN_TYPE, SuiFundingEntry };
|
|
94
|
+
//# sourceMappingURL=funding.d.mts.map
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { setCurrentPluginPhase } from "../../substrate/runtime/current-plugin.mjs";
|
|
2
|
+
import { StrategyRegistryService } from "../../substrate/runtime/strategy-registry/service.mjs";
|
|
3
|
+
import { faucetCapabilityFor } from "../../substrate/runtime/strategy-registry/faucet-capability-for.mjs";
|
|
4
|
+
import { accountAcquireError } from "./errors.mjs";
|
|
5
|
+
import { withAddressLease } from "./lease.mjs";
|
|
6
|
+
import { Duration, Effect } from "effect";
|
|
7
|
+
//#region src/plugins/account/funding.ts
|
|
8
|
+
/** The canonical builtin SUI coin type. Used by the funding dispatch
|
|
9
|
+
* to route SUI entries to the faucet strategy (same key as the
|
|
10
|
+
* default-funding pass), and by everything that needs to detect
|
|
11
|
+
* "this is the protocol-defined SUI". Mirrors `BUILTIN_COINS.sui`
|
|
12
|
+
* in the coin plugin. */
|
|
13
|
+
const SUI_FULL_COIN_TYPE = "0x2::sui::SUI";
|
|
14
|
+
/** Default funding amount for ephemeral accounts — 1 SUI in MIST.
|
|
15
|
+
* Documented at the user-facing factory so a bare `account('alice')`
|
|
16
|
+
* is predictable. */
|
|
17
|
+
const DEFAULT_EPHEMERAL_FUND_MIST = 1000000000n;
|
|
18
|
+
const FUNDING_SETTLEMENT_INTERVAL_MS = 250;
|
|
19
|
+
const FUNDING_SETTLEMENT_TIMEOUT_MS = 3e4;
|
|
20
|
+
/** Apply the default-funding pass for an ephemeral account.
|
|
21
|
+
*
|
|
22
|
+
* Wiring: yields `StrategyRegistryService` (the R-channel from
|
|
23
|
+
* Round 7), looks up the faucet strategy registered by the Sui
|
|
24
|
+
* plugin under `faucet:request:<chainId>`, and dispatches a request
|
|
25
|
+
* through it. Per-address serialization is enforced by acquiring
|
|
26
|
+
* the address lock around the wire call. */
|
|
27
|
+
const fundEphemeralDefault = (parts) => Effect.gen(function* () {
|
|
28
|
+
if (parts.suiMode === "fork") yield* parts.emitAutoPromotionEvent();
|
|
29
|
+
if (parts.amountMist <= 0n) return;
|
|
30
|
+
yield* setCurrentPluginPhase("checking SUI funding");
|
|
31
|
+
const existingBalance = yield* readExistingBalance(parts.balanceReader, {
|
|
32
|
+
owner: parts.address,
|
|
33
|
+
coinType: SUI_FULL_COIN_TYPE
|
|
34
|
+
});
|
|
35
|
+
if (existingBalance !== null && existingBalance >= parts.amountMist) return;
|
|
36
|
+
const strategy = yield* faucetCapabilityFor(parts.chainId).pipe(Effect.catchTag("StrategyNotFoundError", (err) => Effect.fail(accountAcquireError({
|
|
37
|
+
phase: "fund-default",
|
|
38
|
+
accountName: parts.accountName,
|
|
39
|
+
variant: "ephemeral",
|
|
40
|
+
message: `Account '${parts.accountName}': no faucet strategy registered for chain '${parts.chainId}' (sui mode=${parts.suiMode}). Registered keys: [${err.registeredKeys.join(", ")}].`,
|
|
41
|
+
hint: parts.suiMode === "fork" ? "Fork networks have no HTTP faucet — compose a plugin that contributes defineFaucetStrategy(...) for this chain id." : "Ensure a sui() plugin with a faucet-bearing mode (local/live-testnet/live-devnet) is in the stack."
|
|
42
|
+
}))));
|
|
43
|
+
const wrapFaucetFailure = (cause) => Effect.fail(accountAcquireError({
|
|
44
|
+
phase: "fund-default",
|
|
45
|
+
accountName: parts.accountName,
|
|
46
|
+
variant: "ephemeral",
|
|
47
|
+
message: `Account '${parts.accountName}': faucet strategy request failed for chain '${parts.chainId}' (tag=${cause._tag}).`,
|
|
48
|
+
cause,
|
|
49
|
+
hint: "See the cause chain — typical roots are the faucet container not yet ready (FaucetUnreachable), the wall-clock budget elapsed (FaucetExhausted), or the body returned Failure (FaucetBodyError)."
|
|
50
|
+
}));
|
|
51
|
+
yield* setCurrentPluginPhase("funding SUI");
|
|
52
|
+
yield* withAddressLease(parts.broker, parts.accountName, parts.address, strategy.request({
|
|
53
|
+
address: parts.address,
|
|
54
|
+
amount: parts.amountMist
|
|
55
|
+
}).pipe(Effect.catchTags({
|
|
56
|
+
FaucetUnreachable: wrapFaucetFailure,
|
|
57
|
+
FaucetExhausted: wrapFaucetFailure,
|
|
58
|
+
FaucetBodyError: wrapFaucetFailure
|
|
59
|
+
})));
|
|
60
|
+
yield* setCurrentPluginPhase("waiting for SUI funding settlement");
|
|
61
|
+
yield* waitForBalanceAtLeast({
|
|
62
|
+
balanceReader: parts.balanceReader,
|
|
63
|
+
accountName: parts.accountName,
|
|
64
|
+
variant: "ephemeral",
|
|
65
|
+
phase: "fund-default",
|
|
66
|
+
owner: parts.address,
|
|
67
|
+
coinType: SUI_FULL_COIN_TYPE,
|
|
68
|
+
coinLabel: "SUI",
|
|
69
|
+
amount: parts.amountMist
|
|
70
|
+
});
|
|
71
|
+
yield* Effect.annotateCurrentSpan({
|
|
72
|
+
"account.name": parts.accountName,
|
|
73
|
+
"account.address": parts.address,
|
|
74
|
+
"fund.amount.mist": parts.amountMist.toString(),
|
|
75
|
+
"sui.chain": parts.chainId,
|
|
76
|
+
"sui.mode": parts.suiMode
|
|
77
|
+
});
|
|
78
|
+
}).pipe(Effect.withSpan("devstack.plugin.account.fundEphemeralDefault", { attributes: {
|
|
79
|
+
"account.name": parts.accountName,
|
|
80
|
+
"account.address": parts.address,
|
|
81
|
+
"sui.mode": parts.suiMode
|
|
82
|
+
} }));
|
|
83
|
+
/** Apply the cross-cutting funding pass. Variant-agnostic — runs for
|
|
84
|
+
* every variant once the keypair / impersonation slot is bound and
|
|
85
|
+
* the address is known.
|
|
86
|
+
*
|
|
87
|
+
* Distilled-doc invariant: "Optional Faucet is a noop, not an
|
|
88
|
+
* error". Absence of a registered strategy for a non-SUI coin's
|
|
89
|
+
* capability key short-circuits silently (the entry is dropped).
|
|
90
|
+
* Explicit SUI entries are stricter: they route through the active
|
|
91
|
+
* chain's faucet strategy and fail loudly when none is registered.
|
|
92
|
+
* This lets a test author opt INTO arbitrary-coin funding without
|
|
93
|
+
* forcing every surrounding network to satisfy every custom coin.
|
|
94
|
+
*
|
|
95
|
+
* Wiring: SUI entries (`fullCoinType === '0x2::sui::SUI'`) dispatch
|
|
96
|
+
* through `faucet:request:<chainId>` (same key as the default pass);
|
|
97
|
+
* other entries dispatch through `coinType:<fullCoinType>` keys
|
|
98
|
+
* contributed by the respective Coin/Walrus/Seal plugins.
|
|
99
|
+
*
|
|
100
|
+
* Entries are processed serially. Strategies that use the resolved
|
|
101
|
+
* account signer acquire the per-address lease internally; strategies
|
|
102
|
+
* that do not are wrapped by this dispatcher. */
|
|
103
|
+
const applyCrossCuttingFunding = (parts) => Effect.gen(function* () {
|
|
104
|
+
if (parts.funding.length === 0) return [];
|
|
105
|
+
const registry = yield* StrategyRegistryService;
|
|
106
|
+
const applied = [];
|
|
107
|
+
for (const entry of parts.funding) {
|
|
108
|
+
if (entry.amount <= 0n) continue;
|
|
109
|
+
yield* setCurrentPluginPhase(`checking ${entry.coin} funding`);
|
|
110
|
+
const existingBalance = yield* readExistingBalance(parts.balanceReader, {
|
|
111
|
+
owner: parts.address,
|
|
112
|
+
coinType: entry.fullCoinType
|
|
113
|
+
});
|
|
114
|
+
if (existingBalance !== null && existingBalance >= entry.amount) {
|
|
115
|
+
applied.push(entry);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const isSui = entry.fullCoinType === SUI_FULL_COIN_TYPE;
|
|
119
|
+
const coinKey = `coinType:${entry.fullCoinType}`;
|
|
120
|
+
const strategy = yield* (isSui ? faucetCapabilityFor(parts.chainId) : registry.get(coinKey)).pipe(Effect.catchTag("StrategyNotFoundError", (err) => isSui ? Effect.fail(accountAcquireError({
|
|
121
|
+
phase: "fund-cross-cutting",
|
|
122
|
+
accountName: parts.accountName,
|
|
123
|
+
variant: parts.variant,
|
|
124
|
+
message: `Account '${parts.accountName}': no SUI funding strategy registered for chain '${parts.chainId}'. Registered keys: [${err.registeredKeys.join(", ")}].`,
|
|
125
|
+
cause: err,
|
|
126
|
+
hint: "Ensure a sui() plugin with a faucet-bearing mode (local/live-testnet/live-devnet) is in the stack."
|
|
127
|
+
})) : Effect.succeed(null)));
|
|
128
|
+
if (strategy === null) continue;
|
|
129
|
+
const key = isSui ? `faucet:request:${parts.chainId}` : coinKey;
|
|
130
|
+
const wrapCrossCuttingFailure = (cause) => {
|
|
131
|
+
const tag = typeof cause === "object" && cause !== null && "_tag" in cause ? String(cause._tag) : "unknown";
|
|
132
|
+
return accountAcquireError({
|
|
133
|
+
phase: "fund-cross-cutting",
|
|
134
|
+
accountName: parts.accountName,
|
|
135
|
+
variant: parts.variant,
|
|
136
|
+
message: `Account '${parts.accountName}': cross-cutting funding failed for coin (key='${key}') amount=${entry.amount} (tag=${tag}).`,
|
|
137
|
+
cause,
|
|
138
|
+
hint: "Cross-cutting funding requires the matching strategy to be registered at the time of acquire — check the plugin that contributes this coin and any `via` dependency."
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
const request = strategy.request({
|
|
142
|
+
address: parts.address,
|
|
143
|
+
amount: entry.amount,
|
|
144
|
+
account: parts.account
|
|
145
|
+
}).pipe(Effect.mapError(wrapCrossCuttingFailure));
|
|
146
|
+
yield* setCurrentPluginPhase(`funding ${entry.coin}`);
|
|
147
|
+
yield* strategy.usesAccountSigner === true ? request : withAddressLease(parts.broker, parts.accountName, parts.address, request);
|
|
148
|
+
yield* setCurrentPluginPhase(`waiting for ${entry.coin} funding settlement`);
|
|
149
|
+
yield* waitForBalanceAtLeast({
|
|
150
|
+
balanceReader: parts.balanceReader,
|
|
151
|
+
accountName: parts.accountName,
|
|
152
|
+
variant: parts.variant,
|
|
153
|
+
phase: "fund-cross-cutting",
|
|
154
|
+
owner: parts.address,
|
|
155
|
+
coinType: entry.fullCoinType,
|
|
156
|
+
coinLabel: entry.coin,
|
|
157
|
+
amount: entry.amount
|
|
158
|
+
});
|
|
159
|
+
applied.push(entry);
|
|
160
|
+
}
|
|
161
|
+
yield* Effect.annotateCurrentSpan({
|
|
162
|
+
"account.name": parts.accountName,
|
|
163
|
+
"account.address": parts.address,
|
|
164
|
+
"fund.cross-cutting.count": parts.funding.length,
|
|
165
|
+
"sui.chain": parts.chainId
|
|
166
|
+
});
|
|
167
|
+
return applied;
|
|
168
|
+
}).pipe(Effect.withSpan("devstack.plugin.account.applyCrossCuttingFunding", { attributes: {
|
|
169
|
+
"account.name": parts.accountName,
|
|
170
|
+
"account.address": parts.address,
|
|
171
|
+
"fund.cross-cutting.entries": parts.funding.length
|
|
172
|
+
} }));
|
|
173
|
+
const readExistingBalance = (balanceReader, args) => balanceReader === void 0 ? Effect.succeed(null) : balanceReader.readBalance(args);
|
|
174
|
+
const waitForBalanceAtLeast = (parts) => {
|
|
175
|
+
if (parts.balanceReader === void 0) return Effect.void;
|
|
176
|
+
return Effect.gen(function* () {
|
|
177
|
+
const startedAt = Date.now();
|
|
178
|
+
let lastBalance = null;
|
|
179
|
+
for (;;) {
|
|
180
|
+
lastBalance = yield* readExistingBalance(parts.balanceReader, {
|
|
181
|
+
owner: parts.owner,
|
|
182
|
+
coinType: parts.coinType
|
|
183
|
+
});
|
|
184
|
+
if (lastBalance !== null && lastBalance >= parts.amount) return;
|
|
185
|
+
if (Date.now() - startedAt >= FUNDING_SETTLEMENT_TIMEOUT_MS) return yield* Effect.fail(accountAcquireError({
|
|
186
|
+
phase: parts.phase,
|
|
187
|
+
accountName: parts.accountName,
|
|
188
|
+
variant: parts.variant,
|
|
189
|
+
message: `Account '${parts.accountName}': funding for ${parts.coinLabel} was accepted but balance did not reach ${parts.amount} before the settlement timeout (last=${lastBalance === null ? "<unavailable>" : lastBalance}).`,
|
|
190
|
+
hint: "The faucet or funding strategy returned before the funded coin became spendable. Check the funding strategy finality gate and Sui RPC health."
|
|
191
|
+
}));
|
|
192
|
+
yield* Effect.sleep(Duration.millis(FUNDING_SETTLEMENT_INTERVAL_MS));
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
//#endregion
|
|
197
|
+
export { DEFAULT_EPHEMERAL_FUND_MIST, SUI_FULL_COIN_TYPE, applyCrossCuttingFunding, fundEphemeralDefault };
|
|
198
|
+
|
|
199
|
+
//# sourceMappingURL=funding.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funding.mjs","names":[],"sources":["../../../src/plugins/account/funding.ts"],"sourcesContent":["// Account plugin — funding logic.\n//\n// Two funding paths converge here:\n//\n// 1. **Default funding** — applies to the `ephemeral` variant only.\n// On non-fork networks: faucet POST via the SUI HTTP strategy\n// auto-registered by Faucet (see 11-faucet.md). On fork networks:\n// \"pay from a seed via impersonation\" because forks have no\n// faucet. The auto-promotion is LOUD by default per the\n// architecture's \"no silent surprises\" principle — we emit a\n// `log.appended` event the first time a stack hits this path.\n//\n// 2. **Cross-cutting funding** — declared per-account via\n// `AccountOptions.funding`. Applies to every variant.\n// Dispatched through the ambient strategy registry. Missing\n// strategy for non-SUI coins ⇒ silent noop (architecture-\n// mandated test-ergonomics contract, distilled-doc invariant:\n// \"Optional Faucet is a noop, not an error\"). Explicit SUI\n// entries use the SUI faucet strategy and fail loudly when no\n// faucet-bearing strategy exists.\n//\n// Distilled-doc invariant: per-address serialization — concurrent\n// funding requests for the same address MUST serialize. We share the\n// substrate `LeaseBroker` handle from `service.ts` and open a fresh\n// scope per wire call so the lease releases the moment that call\n// returns. Each cross-cutting iteration is its own scope: the broker\n// is non-reentrant by design, so a hypothetical loop holding a single\n// lease across iterations would deadlock the second one.\n\nimport { Duration, Effect } from 'effect';\n\nimport type { FaucetStrategy } from '../faucet/strategies/sui-local.ts';\nimport {\n\tfaucetCapabilityFor,\n\tStrategyRegistryService,\n} from '../../substrate/runtime/strategy-registry/index.ts';\nimport type { AnyResourceRef, ResourceRef } from '../../api/define-plugin.ts';\nimport type { LeaseBroker } from '../../substrate/runtime/lease-broker/index.ts';\nimport type { ChainId } from '../../substrate/brand.ts';\nimport type { CoinResourceId } from '../coin/index.ts';\nimport { setCurrentPluginPhase } from '../../substrate/runtime/current-plugin.ts';\n\nimport {\n\taccountAcquireError,\n\ttype AccountAcquireError,\n\ttype AccountVariantKind,\n} from './errors.ts';\nimport { withAddressLease } from './lease.ts';\nimport type { AccountValue } from './service.ts';\n\n/** Direct resource ref shape for a coin upstream. The user passes the\n * result of `coin.fromPackage(...)` / `coin.known(...)` /\n * `coin.builtin(...)` — NOT a bare string or discriminator. Generic\n * over the literal symbol so the account's dependency tuple preserves\n * each per-coin resource id (`coin:managed_coin/managed_coin`,\n * `coin:wal`, ...).\n *\n * Architecture (Direct Member Refs): cross-plugin references at the\n * user-facing surface are plugin/resource refs directly — no opaque\n * tag or string discriminator vocabulary. */\nexport interface AccountFundingCoinValue {\n\treadonly fullCoinType: string;\n\treadonly symbol?: string;\n}\n\nexport type CoinMember<Sym extends string = string> = ResourceRef<\n\tCoinResourceId<Sym>,\n\tAccountFundingCoinValue\n>;\n\n/** Optional dependency edge for the plugin that contributes the\n * funding strategy. Coin refs force the coin metadata edge; `via`\n * forces the strategy-provider edge (e.g. a known DeepBook\n * deployment that contributes `coinType:<DEEP>`). */\nexport type CrossCuttingFundingProvider = AnyResourceRef | readonly AnyResourceRef[];\n\n/** Built-in SUI funding entry. This uses the same account funding\n * list as arbitrary coins but avoids requiring `coin.builtin('sui')`\n * for the normal SUI faucet path. */\nexport interface SuiFundingEntry {\n\treadonly coin: 'sui';\n\treadonly amount: number | bigint;\n}\n\n/** A single cross-cutting funding entry. `coin` is a direct member ref\n * (the value returned by `coin.fromPackage(...)` etc.) — the account plugin\n * threads it through `dependsOn` so the substrate's dep graph forces\n * the publishing / discovery edge to land before funding.\n *\n * Distilled-doc invariant (\"Strict upstream declaration\"): coin\n * references cited by Account must force a dep edge. `via` is the\n * same contract for the strategy contributor that can satisfy the\n * funding request. */\nexport interface CrossCuttingFundingEntry<M extends CoinMember = CoinMember> {\n\treadonly coin: M;\n\treadonly amount: bigint;\n\treadonly via?: CrossCuttingFundingProvider;\n}\n\nexport type AccountFundingEntry<M extends CoinMember = CoinMember> =\n\t| SuiFundingEntry\n\t| CrossCuttingFundingEntry<M>;\n\nexport type AccountFunding = ReadonlyArray<AccountFundingEntry>;\n\n/** Internal projected shape — the acquire body in `account/index.ts`\n * receives each funding entry's resolved `CoinValue`, reads\n * `fullCoinType`, and passes the projected entries to\n * `applyCrossCuttingFunding`. The funding pass never sees the raw\n * member refs — keeps the strategy dispatch logic\n * substrate-name-blind. */\nexport interface ProjectedFundingEntry {\n\treadonly coin: string;\n\treadonly fullCoinType: string;\n\treadonly amount: bigint;\n}\n\nexport type ProjectedFunding = ReadonlyArray<ProjectedFundingEntry>;\n\nexport interface AccountFundingResult {\n\treadonly requested: ProjectedFunding;\n\treadonly applied: ProjectedFunding;\n}\n\n/** Request passed to account funding strategies. `amount` uses the\n * funded coin's smallest unit. The resolved account handle is present\n * so strategies without an admin signer can perform account-owned\n * swaps while still sharing the central funding dispatcher. */\nexport interface AccountFundingRequest {\n\treadonly address: string;\n\treadonly amount: bigint;\n\treadonly account: AccountValue;\n}\n\nexport interface AccountFundingStrategy<E = unknown> {\n\treadonly request: (req: AccountFundingRequest) => Effect.Effect<void, E>;\n\t/** True when the strategy calls `account.withTransactionSigner`.\n\t * The dispatcher must not acquire the same non-reentrant\n\t * per-address lease outside the strategy. */\n\treadonly usesAccountSigner?: boolean;\n}\n\nexport interface FundingBalanceReader {\n\treadonly readBalance: (args: {\n\t\treadonly owner: string;\n\t\treadonly coinType: string;\n\t}) => Effect.Effect<bigint | null>;\n}\n\n/** The canonical builtin SUI coin type. Used by the funding dispatch\n * to route SUI entries to the faucet strategy (same key as the\n * default-funding pass), and by everything that needs to detect\n * \"this is the protocol-defined SUI\". Mirrors `BUILTIN_COINS.sui`\n * in the coin plugin. */\nexport const SUI_FULL_COIN_TYPE = '0x2::sui::SUI' as const;\n\n/** Default funding amount for ephemeral accounts — 1 SUI in MIST.\n * Documented at the user-facing factory so a bare `account('alice')`\n * is predictable. */\nexport const DEFAULT_EPHEMERAL_FUND_MIST = 1_000_000_000n;\n\nconst FUNDING_SETTLEMENT_INTERVAL_MS = 250;\nconst FUNDING_SETTLEMENT_TIMEOUT_MS = 30_000;\n\n/** Inputs the default-funding pass needs from the per-acquire ctx. */\nexport interface FundEphemeralDefaultArgs {\n\treadonly accountName: string;\n\treadonly address: string;\n\treadonly amountMist: bigint;\n\treadonly suiMode: 'local' | 'local-rpc' | 'live' | 'fork';\n\t/** Resolved sui chain id — the substrate-level chain identity used\n\t * to compose the faucet strategy's capability key\n\t * (`faucet:request:<chainId>`). */\n\treadonly chainId: ChainId;\n\t/** Loud-by-default auto-promotion event (called on fork before the\n\t * strategy is invoked, per the architecture's \"no silent surprises\"\n\t * principle). */\n\treadonly emitAutoPromotionEvent: () => Effect.Effect<void>;\n\t/** Substrate lease-broker handle — funding opens a fresh scope per\n\t * wire call and acquires the per-address lease so concurrent wire\n\t * calls for the same address serialize at the chain boundary. */\n\treadonly broker: LeaseBroker;\n\treadonly balanceReader?: FundingBalanceReader;\n}\n\n/** Apply the default-funding pass for an ephemeral account.\n *\n * Wiring: yields `StrategyRegistryService` (the R-channel from\n * Round 7), looks up the faucet strategy registered by the Sui\n * plugin under `faucet:request:<chainId>`, and dispatches a request\n * through it. Per-address serialization is enforced by acquiring\n * the address lock around the wire call. */\nexport const fundEphemeralDefault = (\n\tparts: FundEphemeralDefaultArgs,\n): Effect.Effect<void, AccountAcquireError, StrategyRegistryService> =>\n\tEffect.gen(function* () {\n\t\t// LOUD AUTO-PROMOTION — distilled-doc invariant: \"no silent\n\t\t// surprises\". Emit BEFORE attempting the dispatch so the user\n\t\t// sees the path change even if the wire call subsequently\n\t\t// fails. On fork we surface the path-change event; on non-fork\n\t\t// the strategy registered by Sui IS the canonical default and\n\t\t// no auto-promotion is needed.\n\t\tif (parts.suiMode === 'fork') {\n\t\t\tyield* parts.emitAutoPromotionEvent();\n\t\t}\n\n\t\t// Zero-amount short-circuit — both real strategies treat zero\n\t\t// as a no-op; doing the same here avoids a registry lookup +\n\t\t// span emission for the legitimately-no-funding case.\n\t\tif (parts.amountMist <= 0n) {\n\t\t\treturn;\n\t\t}\n\n\t\tyield* setCurrentPluginPhase('checking SUI funding');\n\t\tconst existingBalance = yield* readExistingBalance(parts.balanceReader, {\n\t\t\towner: parts.address,\n\t\t\tcoinType: SUI_FULL_COIN_TYPE,\n\t\t});\n\t\tif (existingBalance !== null && existingBalance >= parts.amountMist) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Look up the strategy. Sui auto-registers a faucet strategy\n\t\t// on non-fork modes; fork-mode strategies have to be supplied\n\t\t// by the faucet plugin (with the fork admin closed over). If\n\t\t// nothing is registered we surface a typed, actionable error\n\t\t// pointing at the architecture's contract: ephemeral-on-non-\n\t\t// fork without a Faucet MUST fail at acquire time.\n\t\tconst strategy = yield* faucetCapabilityFor<FaucetStrategy>(parts.chainId).pipe(\n\t\t\tEffect.catchTag('StrategyNotFoundError', (err) =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\taccountAcquireError({\n\t\t\t\t\t\tphase: 'fund-default',\n\t\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\t\tvariant: 'ephemeral',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Account '${parts.accountName}': no faucet strategy registered for ` +\n\t\t\t\t\t\t\t`chain '${parts.chainId}' (sui mode=${parts.suiMode}). ` +\n\t\t\t\t\t\t\t`Registered keys: [${err.registeredKeys.join(', ')}].`,\n\t\t\t\t\t\thint:\n\t\t\t\t\t\t\tparts.suiMode === 'fork'\n\t\t\t\t\t\t\t\t? 'Fork networks have no HTTP faucet — compose a plugin that contributes defineFaucetStrategy(...) for this chain id.'\n\t\t\t\t\t\t\t\t: 'Ensure a sui() plugin with a faucet-bearing mode (local/live-testnet/live-devnet) is in the stack.',\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\t// Per-address serialization around the wire call. The lease is\n\t\t// scope-bound and releases as soon as `request(...)` returns;\n\t\t// two concurrent funding requests for the same address — e.g.\n\t\t// ephemeral default + cross-cutting SUI top-up — interleave\n\t\t// deterministically via the broker's FIFO queue.\n\t\tconst wrapFaucetFailure = (cause: {\n\t\t\treadonly _tag: 'FaucetUnreachable' | 'FaucetExhausted' | 'FaucetBodyError';\n\t\t}) =>\n\t\t\tEffect.fail(\n\t\t\t\taccountAcquireError({\n\t\t\t\t\tphase: 'fund-default',\n\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\tvariant: 'ephemeral',\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Account '${parts.accountName}': faucet strategy request failed ` +\n\t\t\t\t\t\t`for chain '${parts.chainId}' (tag=${cause._tag}).`,\n\t\t\t\t\tcause,\n\t\t\t\t\thint:\n\t\t\t\t\t\t'See the cause chain — typical roots are the faucet container ' +\n\t\t\t\t\t\t'not yet ready (FaucetUnreachable), the wall-clock budget elapsed ' +\n\t\t\t\t\t\t'(FaucetExhausted), or the body returned Failure (FaucetBodyError).',\n\t\t\t\t}),\n\t\t\t);\n\t\tyield* setCurrentPluginPhase('funding SUI');\n\t\tyield* withAddressLease(\n\t\t\tparts.broker,\n\t\t\tparts.accountName,\n\t\t\tparts.address,\n\t\t\tstrategy.request({ address: parts.address, amount: parts.amountMist }).pipe(\n\t\t\t\tEffect.catchTags({\n\t\t\t\t\tFaucetUnreachable: wrapFaucetFailure,\n\t\t\t\t\tFaucetExhausted: wrapFaucetFailure,\n\t\t\t\t\tFaucetBodyError: wrapFaucetFailure,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t\tyield* setCurrentPluginPhase('waiting for SUI funding settlement');\n\t\tyield* waitForBalanceAtLeast({\n\t\t\tbalanceReader: parts.balanceReader,\n\t\t\taccountName: parts.accountName,\n\t\t\tvariant: 'ephemeral',\n\t\t\tphase: 'fund-default',\n\t\t\towner: parts.address,\n\t\t\tcoinType: SUI_FULL_COIN_TYPE,\n\t\t\tcoinLabel: 'SUI',\n\t\t\tamount: parts.amountMist,\n\t\t});\n\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t'account.name': parts.accountName,\n\t\t\t'account.address': parts.address,\n\t\t\t'fund.amount.mist': parts.amountMist.toString(),\n\t\t\t'sui.chain': parts.chainId,\n\t\t\t'sui.mode': parts.suiMode,\n\t\t});\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.account.fundEphemeralDefault', {\n\t\t\tattributes: {\n\t\t\t\t'account.name': parts.accountName,\n\t\t\t\t'account.address': parts.address,\n\t\t\t\t'sui.mode': parts.suiMode,\n\t\t\t},\n\t\t}),\n\t);\n\n/** Inputs the cross-cutting funding pass needs from the per-acquire ctx.\n *\n * `funding` is the PROJECTED shape — the acquire body in\n * `account/index.ts` receives each user-supplied `CoinMember` as a\n * resolved dependency and projects to `{fullCoinType, amount}` BEFORE\n * invoking this pass. Keeps the dispatch logic substrate-name-blind. */\nexport interface ApplyCrossCuttingFundingArgs {\n\treadonly accountName: string;\n\treadonly address: string;\n\treadonly variant: AccountVariantKind;\n\treadonly account: AccountValue;\n\treadonly funding: ProjectedFunding;\n\treadonly chainId: ChainId;\n\treadonly broker: LeaseBroker;\n\treadonly balanceReader?: FundingBalanceReader;\n}\n\n/** Apply the cross-cutting funding pass. Variant-agnostic — runs for\n * every variant once the keypair / impersonation slot is bound and\n * the address is known.\n *\n * Distilled-doc invariant: \"Optional Faucet is a noop, not an\n * error\". Absence of a registered strategy for a non-SUI coin's\n * capability key short-circuits silently (the entry is dropped).\n * Explicit SUI entries are stricter: they route through the active\n * chain's faucet strategy and fail loudly when none is registered.\n * This lets a test author opt INTO arbitrary-coin funding without\n * forcing every surrounding network to satisfy every custom coin.\n *\n * Wiring: SUI entries (`fullCoinType === '0x2::sui::SUI'`) dispatch\n * through `faucet:request:<chainId>` (same key as the default pass);\n * other entries dispatch through `coinType:<fullCoinType>` keys\n * contributed by the respective Coin/Walrus/Seal plugins.\n *\n * Entries are processed serially. Strategies that use the resolved\n * account signer acquire the per-address lease internally; strategies\n * that do not are wrapped by this dispatcher. */\nexport const applyCrossCuttingFunding = (\n\tparts: ApplyCrossCuttingFundingArgs,\n): Effect.Effect<ProjectedFunding, AccountAcquireError, StrategyRegistryService> =>\n\tEffect.gen(function* () {\n\t\tif (parts.funding.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst registry = yield* StrategyRegistryService;\n\t\tconst applied: ProjectedFundingEntry[] = [];\n\n\t\tfor (const entry of parts.funding) {\n\t\t\tif (entry.amount <= 0n) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tyield* setCurrentPluginPhase(`checking ${entry.coin} funding`);\n\t\t\tconst existingBalance = yield* readExistingBalance(parts.balanceReader, {\n\t\t\t\towner: parts.address,\n\t\t\t\tcoinType: entry.fullCoinType,\n\t\t\t});\n\t\t\tif (existingBalance !== null && existingBalance >= entry.amount) {\n\t\t\t\tapplied.push(entry);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Resolve the capability key from the projected coin type.\n\t\t\t//\n\t\t\t// SUI (`0x2::sui::SUI`) → reuse the faucet-request key so the\n\t\t\t// SUI auto-registered strategy fields the request (this\n\t\t\t// matches the default-funding pass and keeps the registry\n\t\t\t// surface uniform).\n\t\t\t//\n\t\t\t// Everything else → `coinType:<fullCoinType>` so user-defined\n\t\t\t// Coin plugins (and Walrus's exchange strategy keyed by\n\t\t\t// `coinType:<WAL fullCoinType>`) can contribute strategies\n\t\t\t// declaratively.\n\t\t\tconst isSui = entry.fullCoinType === SUI_FULL_COIN_TYPE;\n\t\t\tconst coinKey = `coinType:${entry.fullCoinType}` as const;\n\t\t\tconst lookup = isSui\n\t\t\t\t? faucetCapabilityFor<AccountFundingStrategy>(parts.chainId)\n\t\t\t\t: registry.get<typeof coinKey, AccountFundingStrategy>(coinKey);\n\n\t\t\t// Architecture-distilled: optional-faucet-is-noop for\n\t\t\t// arbitrary coins. Explicit SUI entries are the normal gas\n\t\t\t// faucet path, so missing strategy is actionable and loud.\n\t\t\tconst strategy = yield* lookup.pipe(\n\t\t\t\tEffect.catchTag('StrategyNotFoundError', (err) =>\n\t\t\t\t\tisSui\n\t\t\t\t\t\t? Effect.fail(\n\t\t\t\t\t\t\t\taccountAcquireError({\n\t\t\t\t\t\t\t\t\tphase: 'fund-cross-cutting',\n\t\t\t\t\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\t\t\t\t\tvariant: parts.variant,\n\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t`Account '${parts.accountName}': no SUI funding strategy registered ` +\n\t\t\t\t\t\t\t\t\t\t`for chain '${parts.chainId}'. Registered keys: [${err.registeredKeys.join(', ')}].`,\n\t\t\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t\t\t\thint: 'Ensure a sui() plugin with a faucet-bearing mode (local/live-testnet/live-devnet) is in the stack.',\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: Effect.succeed(null as AccountFundingStrategy | null),\n\t\t\t\t),\n\t\t\t);\n\t\t\tif (strategy === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst key = isSui ? (`faucet:request:${parts.chainId}` as const) : coinKey;\n\t\t\tconst wrapCrossCuttingFailure = (cause: unknown): AccountAcquireError => {\n\t\t\t\tconst tag =\n\t\t\t\t\ttypeof cause === 'object' && cause !== null && '_tag' in cause\n\t\t\t\t\t\t? String((cause as { readonly _tag?: unknown })._tag)\n\t\t\t\t\t\t: 'unknown';\n\t\t\t\treturn accountAcquireError({\n\t\t\t\t\tphase: 'fund-cross-cutting',\n\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\tvariant: parts.variant,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Account '${parts.accountName}': cross-cutting funding ` +\n\t\t\t\t\t\t`failed for coin (key='${key}') amount=${entry.amount} ` +\n\t\t\t\t\t\t`(tag=${tag}).`,\n\t\t\t\t\tcause,\n\t\t\t\t\thint:\n\t\t\t\t\t\t'Cross-cutting funding requires the matching strategy ' +\n\t\t\t\t\t\t'to be registered at the time of acquire — check the ' +\n\t\t\t\t\t\t'plugin that contributes this coin and any `via` dependency.',\n\t\t\t\t});\n\t\t\t};\n\t\t\tconst request = strategy\n\t\t\t\t.request({ address: parts.address, amount: entry.amount, account: parts.account })\n\t\t\t\t.pipe(Effect.mapError(wrapCrossCuttingFailure));\n\t\t\tyield* setCurrentPluginPhase(`funding ${entry.coin}`);\n\t\t\tyield* strategy.usesAccountSigner === true\n\t\t\t\t? request\n\t\t\t\t: withAddressLease(parts.broker, parts.accountName, parts.address, request);\n\t\t\tyield* setCurrentPluginPhase(`waiting for ${entry.coin} funding settlement`);\n\t\t\tyield* waitForBalanceAtLeast({\n\t\t\t\tbalanceReader: parts.balanceReader,\n\t\t\t\taccountName: parts.accountName,\n\t\t\t\tvariant: parts.variant,\n\t\t\t\tphase: 'fund-cross-cutting',\n\t\t\t\towner: parts.address,\n\t\t\t\tcoinType: entry.fullCoinType,\n\t\t\t\tcoinLabel: entry.coin,\n\t\t\t\tamount: entry.amount,\n\t\t\t});\n\t\t\tapplied.push(entry);\n\t\t}\n\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t'account.name': parts.accountName,\n\t\t\t'account.address': parts.address,\n\t\t\t'fund.cross-cutting.count': parts.funding.length,\n\t\t\t'sui.chain': parts.chainId,\n\t\t});\n\t\treturn applied;\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.account.applyCrossCuttingFunding', {\n\t\t\tattributes: {\n\t\t\t\t'account.name': parts.accountName,\n\t\t\t\t'account.address': parts.address,\n\t\t\t\t'fund.cross-cutting.entries': parts.funding.length,\n\t\t\t},\n\t\t}),\n\t);\n\nconst readExistingBalance = (\n\tbalanceReader: FundingBalanceReader | undefined,\n\targs: {\n\t\treadonly owner: string;\n\t\treadonly coinType: string;\n\t},\n): Effect.Effect<bigint | null> =>\n\tbalanceReader === undefined ? Effect.succeed(null) : balanceReader.readBalance(args);\n\nconst waitForBalanceAtLeast = (parts: {\n\treadonly balanceReader: FundingBalanceReader | undefined;\n\treadonly accountName: string;\n\treadonly variant: AccountVariantKind;\n\treadonly phase: 'fund-default' | 'fund-cross-cutting';\n\treadonly owner: string;\n\treadonly coinType: string;\n\treadonly coinLabel: string;\n\treadonly amount: bigint;\n}): Effect.Effect<void, AccountAcquireError> => {\n\tif (parts.balanceReader === undefined) {\n\t\treturn Effect.void;\n\t}\n\treturn Effect.gen(function* () {\n\t\tconst startedAt = Date.now();\n\t\tlet lastBalance: bigint | null = null;\n\t\tfor (;;) {\n\t\t\tlastBalance = yield* readExistingBalance(parts.balanceReader, {\n\t\t\t\towner: parts.owner,\n\t\t\t\tcoinType: parts.coinType,\n\t\t\t});\n\t\t\tif (lastBalance !== null && lastBalance >= parts.amount) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (Date.now() - startedAt >= FUNDING_SETTLEMENT_TIMEOUT_MS) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\taccountAcquireError({\n\t\t\t\t\t\tphase: parts.phase,\n\t\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\t\tvariant: parts.variant,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Account '${parts.accountName}': funding for ${parts.coinLabel} was accepted ` +\n\t\t\t\t\t\t\t`but balance did not reach ${parts.amount} before the settlement timeout ` +\n\t\t\t\t\t\t\t`(last=${lastBalance === null ? '<unavailable>' : lastBalance}).`,\n\t\t\t\t\t\thint:\n\t\t\t\t\t\t\t'The faucet or funding strategy returned before the funded coin became spendable. ' +\n\t\t\t\t\t\t\t'Check the funding strategy finality gate and Sui RPC health.',\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tyield* Effect.sleep(Duration.millis(FUNDING_SETTLEMENT_INTERVAL_MS));\n\t\t}\n\t});\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CodegenableDecl } from "../../contracts/codegenable.mjs";
|
|
2
|
+
import { ProjectionDecl } from "../../contracts/projection.mjs";
|
|
3
|
+
import { SnapshotableDecl } from "../../contracts/snapshotable.mjs";
|
|
4
|
+
import { StrategyContributorDecl } from "../../contracts/strategy-contributor.mjs";
|
|
5
|
+
import { AnyResourceRef, Plugin, ResourceRef } from "../../substrate/plugin.mjs";
|
|
6
|
+
import { SeedObjectsAccumulator } from "../sui/seed-objects.mjs";
|
|
7
|
+
import { SuiClient } from "../sui/mode/shared.mjs";
|
|
8
|
+
import { SuiOptions } from "../sui/mode/spec.mjs";
|
|
9
|
+
import { AccountAcquireError, AccountAcquirePhase, AccountError, AccountSignError, AccountSignPhase, AccountVariantKind } from "./errors.mjs";
|
|
10
|
+
import { AccountOptions, AccountValue, TxResult } from "./service.mjs";
|
|
11
|
+
import { AccountFunding, AccountFundingCoinValue, AccountFundingEntry, AccountFundingRequest, AccountFundingResult, AccountFundingStrategy, CoinMember, CrossCuttingFundingEntry, CrossCuttingFundingProvider, DEFAULT_EPHEMERAL_FUND_MIST, ProjectedFunding, ProjectedFundingEntry, SUI_FULL_COIN_TYPE, SuiFundingEntry } from "./funding.mjs";
|
|
12
|
+
import { AccountRegistryEntry, AccountRegistryFunding } from "./registry.mjs";
|
|
13
|
+
import { AccountBindings } from "./codegen.mjs";
|
|
14
|
+
import { ResolvedKeypair, SignatureScheme } from "./keypair.mjs";
|
|
15
|
+
import { SyntheticImpersonationSigner } from "./variants/impersonate.mjs";
|
|
16
|
+
//#region src/plugins/account/index.d.ts
|
|
17
|
+
/** Per-account-instance resource. The substrate's resource id MUST be unique
|
|
18
|
+
* across the stack — we encode the account name as a literal-typed
|
|
19
|
+
* template literal so the compiler catches duplicate-name composes
|
|
20
|
+
* at the `defineDevstack` call site.
|
|
21
|
+
*
|
|
22
|
+
* Distilled-doc invariant: resource id flows into the on-disk path, the
|
|
23
|
+
* manifest key, container labels, and generated TypeScript exports —
|
|
24
|
+
* the identifier-safe name validation (in `service.ts`) protects
|
|
25
|
+
* those call sites. */
|
|
26
|
+
type AccountResourceId<Name extends string> = `account/${Name}`;
|
|
27
|
+
/** Construct the account plugin instance.
|
|
28
|
+
*
|
|
29
|
+
* Variants — typed at the API boundary via the discriminated
|
|
30
|
+
* `AccountOptions` union. The factory's second arg is OPTIONAL —
|
|
31
|
+
* omitting it yields the bare-form default (ephemeral + default
|
|
32
|
+
* funding). Passing a non-matching `kind:` is a compile error
|
|
33
|
+
* thanks to the union's discriminator.
|
|
34
|
+
*
|
|
35
|
+
* Distilled-doc invariant: the name is validated at the FACTORY
|
|
36
|
+
* boundary (not just at acquire time) so a typo surfaces
|
|
37
|
+
* immediately, not at runtime. */
|
|
38
|
+
type FundingCoinDependencies<Entries extends readonly unknown[]> = Entries extends readonly [infer Head, ...infer Tail] ? Head extends {
|
|
39
|
+
readonly coin: infer Coin;
|
|
40
|
+
} ? Coin extends CoinMember ? readonly [Coin, ...FundingCoinDependencies<Tail>] : FundingCoinDependencies<Tail> : FundingCoinDependencies<Tail> : readonly [];
|
|
41
|
+
type FundingProviderDependenciesFor<Provider> = Provider extends readonly AnyResourceRef[] ? Provider : Provider extends AnyResourceRef ? readonly [Provider] : readonly [];
|
|
42
|
+
type FundingEntryProviderDependencies<Entry> = Entry extends {
|
|
43
|
+
readonly coin: CoinMember;
|
|
44
|
+
} ? 'via' extends keyof Entry ? Entry extends {
|
|
45
|
+
readonly via: infer Provider;
|
|
46
|
+
} ? FundingProviderDependenciesFor<Provider> : readonly [] : readonly [] : readonly [];
|
|
47
|
+
type FundingProviderDependencies<Entries extends readonly unknown[]> = Entries extends readonly [infer Head, ...infer Tail] ? readonly [...FundingEntryProviderDependencies<Head>, ...FundingProviderDependencies<Tail>] : readonly [];
|
|
48
|
+
declare const account: <const N extends string, const Funding extends AccountFunding = readonly []>(name: N, opts?: AccountOptions<Funding>) => Plugin<`account/${N}`, AccountValue, readonly [ResourceRef<"sui", SuiClient & {
|
|
49
|
+
readonly mode: SuiOptions["mode"];
|
|
50
|
+
readonly seedObjects: SeedObjectsAccumulator;
|
|
51
|
+
}>, ...FundingCoinDependencies<Funding>, ...FundingProviderDependencies<Funding>], readonly [SnapshotableDecl, CodegenableDecl<`account/${N}`>, StrategyContributorDecl<`account:${N}`, AccountRegistryEntry>, ProjectionDecl]>;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { AccountResourceId, account };
|
|
54
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { definePlugin, resource } from "../../substrate/plugin.mjs";
|
|
2
|
+
import { pluginErrorContributions } from "../../api/plugin-errors.mjs";
|
|
3
|
+
import { IdentityContext, StackPathsService } from "../../substrate/runtime/paths.mjs";
|
|
4
|
+
import { SpanAttr } from "../../substrate/runtime/observability/spans.mjs";
|
|
5
|
+
import { suiResource } from "../sui/index.mjs";
|
|
6
|
+
import { makeAccountCodegen } from "./codegen.mjs";
|
|
7
|
+
import { ACCOUNT_ERROR_TAGS } from "./errors.mjs";
|
|
8
|
+
import { SUI_FULL_COIN_TYPE } from "./funding.mjs";
|
|
9
|
+
import { makeAccountProjectionContribution, makeAccountRegistryContribution } from "./registry.mjs";
|
|
10
|
+
import { makeAccountSnapshotable } from "./snapshot.mjs";
|
|
11
|
+
import { acquireAccount, assertAccountName } from "./service.mjs";
|
|
12
|
+
import { Effect } from "effect";
|
|
13
|
+
//#region src/plugins/account/index.ts
|
|
14
|
+
const accountErrorContributions = pluginErrorContributions(ACCOUNT_ERROR_TAGS);
|
|
15
|
+
const accountResource = (name) => resource(`account/${name}`);
|
|
16
|
+
const isCoinFundingEntry = (entry) => typeof entry === "object" && entry.coin !== "sui";
|
|
17
|
+
const fundingProviders = (provider) => {
|
|
18
|
+
if (provider === void 0) return [];
|
|
19
|
+
return Array.isArray(provider) ? provider : [provider];
|
|
20
|
+
};
|
|
21
|
+
const fundingAmountToBigInt = (amount) => {
|
|
22
|
+
if (typeof amount === "bigint") {
|
|
23
|
+
if (amount < 0n) throw new TypeError(`SUI funding amount must be a non-negative integer in MIST.`);
|
|
24
|
+
return amount;
|
|
25
|
+
}
|
|
26
|
+
if (!Number.isSafeInteger(amount) || amount < 0) throw new TypeError(`SUI funding amount must be a non-negative safe integer in MIST.`);
|
|
27
|
+
return BigInt(amount);
|
|
28
|
+
};
|
|
29
|
+
const coinLabelFor = (coin) => coin.symbol ?? coin.fullCoinType.split("::").at(-1) ?? coin.fullCoinType;
|
|
30
|
+
const account = (name, opts) => {
|
|
31
|
+
assertAccountName(name);
|
|
32
|
+
const opts2 = opts === void 0 ? {
|
|
33
|
+
kind: "ephemeral",
|
|
34
|
+
name
|
|
35
|
+
} : {
|
|
36
|
+
...opts,
|
|
37
|
+
name
|
|
38
|
+
};
|
|
39
|
+
const accountRef = accountResource(name);
|
|
40
|
+
const fundingEntryList = opts?.funding ?? [];
|
|
41
|
+
const coinFundingEntries = fundingEntryList.filter(isCoinFundingEntry);
|
|
42
|
+
const fundingMembers = coinFundingEntries.map((e) => e.coin);
|
|
43
|
+
const strategyProviderMembers = coinFundingEntries.flatMap((entry) => fundingProviders(entry.via));
|
|
44
|
+
const dependencies = [
|
|
45
|
+
suiResource,
|
|
46
|
+
...fundingMembers,
|
|
47
|
+
...strategyProviderMembers
|
|
48
|
+
];
|
|
49
|
+
return definePlugin({
|
|
50
|
+
id: accountRef.id,
|
|
51
|
+
dependsOn: dependencies,
|
|
52
|
+
role: "task",
|
|
53
|
+
start: (deps) => Effect.gen(function* () {
|
|
54
|
+
const [sui, ...resolvedDeps] = deps;
|
|
55
|
+
const resolvedCoinValues = resolvedDeps.slice(0, coinFundingEntries.length);
|
|
56
|
+
const identity = yield* IdentityContext;
|
|
57
|
+
const paths = yield* StackPathsService;
|
|
58
|
+
let coinIndex = 0;
|
|
59
|
+
const projectedFunding = fundingEntryList.map((entry) => {
|
|
60
|
+
if (entry.coin === "sui") return {
|
|
61
|
+
coin: "SUI",
|
|
62
|
+
fullCoinType: SUI_FULL_COIN_TYPE,
|
|
63
|
+
amount: fundingAmountToBigInt(entry.amount)
|
|
64
|
+
};
|
|
65
|
+
const resolvedCoin = resolvedCoinValues[coinIndex];
|
|
66
|
+
coinIndex += 1;
|
|
67
|
+
return {
|
|
68
|
+
coin: coinLabelFor(resolvedCoin),
|
|
69
|
+
fullCoinType: resolvedCoin.fullCoinType,
|
|
70
|
+
amount: entry.amount
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
return yield* acquireAccount(opts2, {
|
|
74
|
+
sui: {
|
|
75
|
+
mode: sui.mode,
|
|
76
|
+
chain: sui.chain,
|
|
77
|
+
sdk: sui.sdk,
|
|
78
|
+
fork: sui.fork
|
|
79
|
+
},
|
|
80
|
+
runtimeRoot: paths.stackRoot,
|
|
81
|
+
app: identity.app,
|
|
82
|
+
stack: identity.stack,
|
|
83
|
+
emitAutoPromotionEvent: () => Effect.logWarning("account funding auto-promoted for fork mode").pipe(Effect.annotateLogs({
|
|
84
|
+
[SpanAttr.accountName]: name,
|
|
85
|
+
[SpanAttr.accountFundingFrom]: "faucet",
|
|
86
|
+
[SpanAttr.accountFundingTo]: "pay-from-seed-via-impersonate",
|
|
87
|
+
[SpanAttr.suiMode]: "fork"
|
|
88
|
+
})),
|
|
89
|
+
projectedFunding
|
|
90
|
+
});
|
|
91
|
+
}),
|
|
92
|
+
errorContributions: accountErrorContributions,
|
|
93
|
+
capabilities: ({ value: resolved, runtime: acquireCtx2 }) => {
|
|
94
|
+
const realEntry = {
|
|
95
|
+
name,
|
|
96
|
+
address: resolved.address,
|
|
97
|
+
scheme: resolved.scheme,
|
|
98
|
+
source: resolved.source,
|
|
99
|
+
funding: fundingProjectionForResult(resolved.funding)
|
|
100
|
+
};
|
|
101
|
+
const bindings = {
|
|
102
|
+
name,
|
|
103
|
+
address: resolved.address,
|
|
104
|
+
scheme: resolved.scheme,
|
|
105
|
+
source: resolved.source
|
|
106
|
+
};
|
|
107
|
+
return [
|
|
108
|
+
makeAccountSnapshotable({
|
|
109
|
+
accountName: name,
|
|
110
|
+
variant: opts2.kind,
|
|
111
|
+
app: acquireCtx2.identity.app,
|
|
112
|
+
stack: acquireCtx2.identity.stack
|
|
113
|
+
}),
|
|
114
|
+
makeAccountCodegen({
|
|
115
|
+
name,
|
|
116
|
+
resolved: bindings
|
|
117
|
+
}),
|
|
118
|
+
makeAccountRegistryContribution(realEntry),
|
|
119
|
+
makeAccountProjectionContribution(realEntry)
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
const fundingProjectionForResult = (funding) => {
|
|
125
|
+
if (funding.requested.length === 0) return {
|
|
126
|
+
status: "skipped",
|
|
127
|
+
balanceMist: null,
|
|
128
|
+
requestedMist: null,
|
|
129
|
+
entries: []
|
|
130
|
+
};
|
|
131
|
+
const appliedKeys = new Set(funding.applied.map(fundingEntryKey));
|
|
132
|
+
const entries = funding.requested.map((entry) => ({
|
|
133
|
+
coin: entry.coin,
|
|
134
|
+
fullCoinType: entry.fullCoinType,
|
|
135
|
+
amount: entry.amount.toString(),
|
|
136
|
+
status: appliedKeys.has(fundingEntryKey(entry)) ? "funded" : "skipped"
|
|
137
|
+
}));
|
|
138
|
+
const requestedMist = funding.requested.find((entry) => entry.fullCoinType === "0x2::sui::SUI")?.amount.toString() ?? null;
|
|
139
|
+
const fundedCount = entries.filter((entry) => entry.status === "funded").length;
|
|
140
|
+
return {
|
|
141
|
+
status: fundedCount === entries.length ? "funded" : fundedCount === 0 ? "skipped" : "unknown",
|
|
142
|
+
balanceMist: null,
|
|
143
|
+
requestedMist,
|
|
144
|
+
entries
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
const fundingEntryKey = (entry) => `${entry.fullCoinType}:${entry.amount}`;
|
|
148
|
+
//#endregion
|
|
149
|
+
export { account };
|
|
150
|
+
|
|
151
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/account/keypair.d.ts
|
|
4
|
+
/** Lowercased signature scheme — the canonical wire form. The SDK
|
|
5
|
+
* occasionally hands us `'ED25519'` / `'Secp256k1'`; the boundary
|
|
6
|
+
* conversion lives in `normalizeScheme`. */
|
|
7
|
+
type SignatureScheme = 'ed25519' | 'secp256k1' | 'secp256r1';
|
|
8
|
+
/** Resolved keypair shape — the variant resolvers all funnel into
|
|
9
|
+
* this so the funding + register passes are variant-agnostic.
|
|
10
|
+
*
|
|
11
|
+
* Note: impersonation accounts do NOT produce a `Keypair`; they
|
|
12
|
+
* produce a `SyntheticImpersonationSigner` (see
|
|
13
|
+
* `variants/impersonate.ts`). The discriminator lives on the
|
|
14
|
+
* resolved `AccountValue` (architecture: distilled doc opportunity
|
|
15
|
+
* "Tighten the resolved-account type"). */
|
|
16
|
+
interface ResolvedKeypair {
|
|
17
|
+
readonly address: string;
|
|
18
|
+
readonly scheme: SignatureScheme;
|
|
19
|
+
readonly publicKey: Uint8Array;
|
|
20
|
+
/** Opaque signer handle — typed loosely here because the four
|
|
21
|
+
* real variants (ed25519/secp256k1/secp256r1 + bring-your-own
|
|
22
|
+
* Signer) share no narrow TS type beyond `Signer`. The wallet /
|
|
23
|
+
* sign-and-execute capability narrows downstream. */
|
|
24
|
+
readonly signer: unknown;
|
|
25
|
+
/** Bech32-encoded secret. Only present for ephemeral / inline /
|
|
26
|
+
* env / keystore variants — `null` for `signer` (we never ask
|
|
27
|
+
* for it) and `impersonate` (no secret exists). */
|
|
28
|
+
readonly bech32Secret: string | null;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ResolvedKeypair, SignatureScheme };
|
|
32
|
+
//# sourceMappingURL=keypair.d.mts.map
|