@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 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.mjs","names":[],"sources":["../../../src/plugins/coin/discovery.ts"],"sourcesContent":["// Coin auto-discovery — pure projection over a `LocalPackagePublishOutput`.\n//\n// Distilled-doc 13-coin.md §\"Capabilities PRODUCED\" §\"Registry\n// entries\" + Invariant 6 + Invariant 7:\n//\n// - Iterate `output.objectChanges`,\n// - Find paired Sui-framework `coin::TreasuryCap<T>` +\n// `coin::CoinMetadata<T>`,\n// - Reject nested generics (`TreasuryCap<A<B>>` returns no record),\n// - Sort ascending by fullCoinType for deterministic order.\n//\n// This file is PURE — no Effect, no RPC. Metadata enrichment (the\n// `getCoinMetadata` RPC fold) lives in `metadata.ts`; we just emit\n// the raw discovered shape here. The input is structural so Coin does\n// not import Package internals.\n\nimport {\n\tpickSuiFrameworkInnerGeneric,\n\tpickSuiFrameworkInnerGenericFromModule,\n} from './type-strings.ts';\n\nexport interface CoinDiscoveryObjectChange {\n\treadonly type: 'created' | 'published' | 'mutated' | 'wrapped' | 'transferred';\n\treadonly objectId?: string;\n\treadonly objectType?: string;\n\treadonly owner?: unknown;\n\treadonly json?: unknown;\n}\n\nexport interface CoinDiscoveryPublishOutput {\n\treadonly publisher: string;\n\treadonly objectChanges: ReadonlyArray<CoinDiscoveryObjectChange>;\n}\n\n/** A discovered coin pulled out of a publish output. The downstream\n * metadata enricher in `metadata.ts` turns this into a full\n * `CoinRecord`. */\nexport interface DiscoveredCoin {\n\t/** `0xPKG::module::Witness`. */\n\treadonly fullCoinType: string;\n\t/** Lower-cased witness name. */\n\treadonly witness: string;\n\t/** Lower-cased module name. */\n\treadonly moduleName: string;\n\treadonly treasuryCapId?: string;\n\treadonly treasuryCapOwner?: string;\n\treadonly metadataId?: string;\n\treadonly decimals?: number;\n\treadonly symbol?: string;\n\treadonly displayName?: string;\n\treadonly iconUrl?: string;\n\t/** True when the cap is address-owned by the publisher at the\n\t * end of the publish tx. Distilled-doc invariant: the faucet's\n\t * treasury-cap-mint auto-registration is gated off this flag. */\n\treadonly publisherOwnsCap: boolean;\n}\n\ninterface DiscoveredMetadata {\n\treadonly id: string;\n\treadonly decimals?: number;\n\treadonly symbol?: string;\n\treadonly displayName?: string;\n\treadonly iconUrl?: string;\n}\n\n/** Extract module + witness from `0xPKG::module::Witness`. */\nconst splitCoinType = (\n\tfullCoinType: string,\n): { readonly moduleName: string; readonly witness: string } | null => {\n\tconst parts = fullCoinType.split('::');\n\tif (parts.length !== 3) return null;\n\tconst [, moduleName, witness] = parts;\n\tif (moduleName === undefined || witness === undefined) return null;\n\treturn { moduleName, witness };\n};\n\n/** Read the address owner from a package-publish-output change. Handles\n * the SDK's discriminated owner-shape; non-address owners surface as\n * `undefined`. The owner shape varies across SDK versions; this\n * helper covers the common surface and degrades gracefully. */\nconst pickAddressOwner = (change: CoinDiscoveryObjectChange): string | undefined => {\n\tconst owner = change.owner as\n\t\t| { readonly AddressOwner?: string; readonly $kind?: string }\n\t\t| string\n\t\t| undefined;\n\tif (owner === undefined || owner === null) return undefined;\n\tif (typeof owner === 'string') return owner; // some SDK projections flatten\n\tif (typeof owner === 'object' && 'AddressOwner' in owner) {\n\t\treturn owner.AddressOwner;\n\t}\n\treturn undefined;\n};\n\nconst pickString = (json: Record<string, unknown>, key: string): string | undefined => {\n\tconst value = json[key];\n\treturn typeof value === 'string' && value.length > 0 ? value : undefined;\n};\n\nconst pickNumber = (json: Record<string, unknown>, key: string): number | undefined => {\n\tconst value = json[key];\n\treturn typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n};\n\nconst pickMetadata = (change: CoinDiscoveryObjectChange): Omit<DiscoveredMetadata, 'id'> | null => {\n\tconst json = change.json;\n\tif (json === null || typeof json !== 'object' || Array.isArray(json)) return null;\n\tconst record = json as Record<string, unknown>;\n\tconst decimals = pickNumber(record, 'decimals');\n\tconst symbol = pickString(record, 'symbol');\n\tconst displayName = pickString(record, 'name');\n\tconst iconUrl = pickString(record, 'iconUrl') ?? pickString(record, 'icon_url');\n\tif (\n\t\tdecimals === undefined &&\n\t\tsymbol === undefined &&\n\t\tdisplayName === undefined &&\n\t\ticonUrl === undefined\n\t) {\n\t\treturn null;\n\t}\n\treturn {\n\t\t...(decimals === undefined ? {} : { decimals }),\n\t\t...(symbol === undefined ? {} : { symbol }),\n\t\t...(displayName === undefined ? {} : { displayName }),\n\t\t...(iconUrl === undefined ? {} : { iconUrl }),\n\t};\n};\n\n/** Walk a publish output for coin pairs.\n *\n * Sort ascending by fullCoinType — distilled-doc invariant 6 — so\n * the registry sees a stable order across re-runs of the same\n * publish.\n *\n * Pure. No Effect / RPC. */\nexport const discoverCoinsFromPublish = (\n\toutput: CoinDiscoveryPublishOutput,\n): ReadonlyArray<DiscoveredCoin> => {\n\tconst publisher = output.publisher;\n\t// Two passes over the changes: collect caps, collect metadata,\n\t// then JOIN on fullCoinType. The straightforward \"iterate once and\n\t// build per-coin records\" is harder to read when the two object\n\t// types interleave in the output.\n\tconst caps = new Map<string, { readonly id: string; readonly owner: string | undefined }>();\n\tconst metadata = new Map<string, DiscoveredMetadata>();\n\n\tfor (const change of output.objectChanges) {\n\t\tif (change.type !== 'created') continue;\n\t\tif (!change.objectType) continue;\n\t\tconst capInner = pickSuiFrameworkInnerGeneric(change.objectType, 'TreasuryCap');\n\t\tif (capInner !== null && change.objectId !== undefined) {\n\t\t\tcaps.set(capInner, {\n\t\t\t\tid: change.objectId,\n\t\t\t\towner: pickAddressOwner(change),\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst metaInner = pickSuiFrameworkInnerGeneric(change.objectType, 'CoinMetadata');\n\t\tif (metaInner !== null && change.objectId !== undefined) {\n\t\t\tmetadata.set(metaInner, {\n\t\t\t\tid: change.objectId,\n\t\t\t\t...(pickMetadata(change) ?? {}),\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst currencyInner = pickSuiFrameworkInnerGenericFromModule(\n\t\t\tchange.objectType,\n\t\t\t'coin_registry',\n\t\t\t'Currency',\n\t\t);\n\t\tif (currencyInner !== null && change.objectId !== undefined) {\n\t\t\tmetadata.set(currencyInner, {\n\t\t\t\tid: change.objectId,\n\t\t\t\t...(pickMetadata(change) ?? {}),\n\t\t\t});\n\t\t}\n\t}\n\n\t// Union the two sets of coin types — a coin with only a cap or\n\t// only metadata is still a coin (distilled-doc invariant: we\n\t// surface degraded records rather than drop them).\n\tconst allTypes = new Set<string>([...caps.keys(), ...metadata.keys()]);\n\tconst records: Array<DiscoveredCoin> = [];\n\tfor (const fullCoinType of allTypes) {\n\t\tconst parts = splitCoinType(fullCoinType);\n\t\tif (!parts) continue;\n\t\tconst cap = caps.get(fullCoinType);\n\t\tconst meta = metadata.get(fullCoinType);\n\t\tconst publisherOwnsCap = cap !== undefined && cap.owner === publisher;\n\t\trecords.push({\n\t\t\tfullCoinType,\n\t\t\twitness: parts.witness.toLowerCase(),\n\t\t\tmoduleName: parts.moduleName.toLowerCase(),\n\t\t\ttreasuryCapId: cap?.id,\n\t\t\ttreasuryCapOwner: cap?.owner,\n\t\t\tmetadataId: meta?.id,\n\t\t\t...(meta?.decimals === undefined ? {} : { decimals: meta.decimals }),\n\t\t\t...(meta?.symbol === undefined ? {} : { symbol: meta.symbol }),\n\t\t\t...(meta?.displayName === undefined ? {} : { displayName: meta.displayName }),\n\t\t\t...(meta?.iconUrl === undefined ? {} : { iconUrl: meta.iconUrl }),\n\t\t\tpublisherOwnsCap,\n\t\t});\n\t}\n\t// Distilled-doc invariant 6: ascending sort by fullCoinType. Stable\n\t// across re-runs so the \"first wins on collision\" tie-break is\n\t// deterministic.\n\trecords.sort((a, b) =>\n\t\ta.fullCoinType < b.fullCoinType ? -1 : a.fullCoinType > b.fullCoinType ? 1 : 0,\n\t);\n\treturn records;\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/plugins/coin/errors.d.ts
|
|
2
|
+
/** Phases for `CoinError`. Closed sum — adding a phase requires
|
|
3
|
+
* editing this list AND the cause walker's display table.
|
|
4
|
+
*
|
|
5
|
+
* Phase semantics:
|
|
6
|
+
* - `not-found` — symbol/witness/bare-type didn't resolve
|
|
7
|
+
* against the registry / on-chain metadata.
|
|
8
|
+
* - `ambiguous` — two distinct coin types matched a single
|
|
9
|
+
* registry-key lookup. Caller should
|
|
10
|
+
* disambiguate via the witness form.
|
|
11
|
+
* - `nested-generic` — bare-coin-type rejected because it
|
|
12
|
+
* carried a nested generic (`<T<U>>`).
|
|
13
|
+
* Distilled-doc invariant 7: refuse to
|
|
14
|
+
* guess. Surfaces during the discovery
|
|
15
|
+
* walker AND during the address-resolution
|
|
16
|
+
* bare-string branch.
|
|
17
|
+
* - `cap-missing` — the package didn't capture a
|
|
18
|
+
* `TreasuryCap` under the requested field
|
|
19
|
+
* (either no cap at all, or the captured
|
|
20
|
+
* record key is wrong).
|
|
21
|
+
* - `metadata-fetch` — `getCoinMetadata` failed after retries.
|
|
22
|
+
* Soft-degradation path: the discovery
|
|
23
|
+
* walker swallows this to keep partial
|
|
24
|
+
* coverage; the bare-coin-type branch of
|
|
25
|
+
* the user-facing factory surfaces it.
|
|
26
|
+
* - `mint-tx` — sign-and-execute of the mint tx failed.
|
|
27
|
+
* - `mint-parse` — the minted `Coin<T>` was not present in
|
|
28
|
+
* the resulting `objectChanges`. */
|
|
29
|
+
type CoinPhase = 'not-found' | 'ambiguous' | 'nested-generic' | 'cap-missing' | 'metadata-fetch' | 'mint-tx' | 'mint-parse';
|
|
30
|
+
/** Single tagged coin error. */
|
|
31
|
+
interface CoinError {
|
|
32
|
+
readonly _tag: 'CoinError';
|
|
33
|
+
readonly phase: CoinPhase;
|
|
34
|
+
/** User-facing identifier — the symbol / witness / bare-type the
|
|
35
|
+
* caller passed. Populated even when the cause was a mint
|
|
36
|
+
* (in which case it carries the resolved fullCoinType so the
|
|
37
|
+
* pretty-cause walker can render context). */
|
|
38
|
+
readonly identifier: string;
|
|
39
|
+
readonly message: string;
|
|
40
|
+
/** Optional list of registered candidates — populated by
|
|
41
|
+
* `not-found` / `ambiguous` so the renderer can show what WAS
|
|
42
|
+
* available. */
|
|
43
|
+
readonly candidates?: ReadonlyArray<string>;
|
|
44
|
+
readonly cause?: unknown;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { CoinError, CoinPhase };
|
|
48
|
+
//# sourceMappingURL=errors.d.mts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/plugins/coin/errors.ts
|
|
2
|
+
const coinError = (phase, parts) => ({
|
|
3
|
+
_tag: "CoinError",
|
|
4
|
+
phase,
|
|
5
|
+
...parts
|
|
6
|
+
});
|
|
7
|
+
/** Error tags this plugin contributes — surfaced to the cause walker
|
|
8
|
+
* via `PluginErrorContribution`. */
|
|
9
|
+
const COIN_ERROR_TAGS = ["CoinError"];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { COIN_ERROR_TAGS, coinError };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=errors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/coin/errors.ts"],"sourcesContent":["// Coin plugin — typed errors.\n//\n// Distilled-doc finding (13-coin.md Pain point #8 \"No CoinError tag at\n// all\"): the v3 coin module reused `PublishError` for mint failures\n// and surfaced `CoinNotFoundError` / `CoinAmbiguousError` only on the\n// factory path. The redesign unifies coin-side failures into a SINGLE\n// tagged error with a CLOSED phase set so downstream `catchTag`\n// callers can distinguish \"not in registry\" from \"mint failed\" from\n// \"cap missing\".\n//\n// Effect v4: plain interface + `_tag` literal discriminator (no\n// subclassing). Mirrors the Account plugin's split shape and the\n// substrate's per-plugin tagged-error convention.\n\n/** Phases for `CoinError`. Closed sum — adding a phase requires\n * editing this list AND the cause walker's display table.\n *\n * Phase semantics:\n * - `not-found` — symbol/witness/bare-type didn't resolve\n * against the registry / on-chain metadata.\n * - `ambiguous` — two distinct coin types matched a single\n * registry-key lookup. Caller should\n * disambiguate via the witness form.\n * - `nested-generic` — bare-coin-type rejected because it\n * carried a nested generic (`<T<U>>`).\n * Distilled-doc invariant 7: refuse to\n * guess. Surfaces during the discovery\n * walker AND during the address-resolution\n * bare-string branch.\n * - `cap-missing` — the package didn't capture a\n * `TreasuryCap` under the requested field\n * (either no cap at all, or the captured\n * record key is wrong).\n * - `metadata-fetch` — `getCoinMetadata` failed after retries.\n * Soft-degradation path: the discovery\n * walker swallows this to keep partial\n * coverage; the bare-coin-type branch of\n * the user-facing factory surfaces it.\n * - `mint-tx` — sign-and-execute of the mint tx failed.\n * - `mint-parse` — the minted `Coin<T>` was not present in\n * the resulting `objectChanges`. */\nexport type CoinPhase =\n\t| 'not-found'\n\t| 'ambiguous'\n\t| 'nested-generic'\n\t| 'cap-missing'\n\t| 'metadata-fetch'\n\t| 'mint-tx'\n\t| 'mint-parse';\n\n/** Single tagged coin error. */\nexport interface CoinError {\n\treadonly _tag: 'CoinError';\n\treadonly phase: CoinPhase;\n\t/** User-facing identifier — the symbol / witness / bare-type the\n\t * caller passed. Populated even when the cause was a mint\n\t * (in which case it carries the resolved fullCoinType so the\n\t * pretty-cause walker can render context). */\n\treadonly identifier: string;\n\treadonly message: string;\n\t/** Optional list of registered candidates — populated by\n\t * `not-found` / `ambiguous` so the renderer can show what WAS\n\t * available. */\n\treadonly candidates?: ReadonlyArray<string>;\n\treadonly cause?: unknown;\n}\n\nexport const coinError = (\n\tphase: CoinPhase,\n\tparts: Omit<CoinError, '_tag' | 'phase'>,\n): CoinError => ({ _tag: 'CoinError', phase, ...parts });\n\n/** Error tags this plugin contributes — surfaced to the cause walker\n * via `PluginErrorContribution`. */\nexport const COIN_ERROR_TAGS = ['CoinError'] as const;\n"],"mappings":";AAmEA,MAAa,aACZ,OACA,WACgB;CAAE,MAAM;CAAa;CAAO,GAAG;CAAO;;;AAIvD,MAAa,kBAAkB,CAAC,YAAY"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { CodegenableDecl } from "../../contracts/codegenable.mjs";
|
|
2
|
+
import { SnapshotableDecl } from "../../contracts/snapshotable.mjs";
|
|
3
|
+
import { StrategyContributorDecl } from "../../contracts/strategy-contributor.mjs";
|
|
4
|
+
import { AnyResourceRef, Plugin, ResourceRef } from "../../substrate/plugin.mjs";
|
|
5
|
+
import { SeedObjectsAccumulator } from "../sui/seed-objects.mjs";
|
|
6
|
+
import { SuiClient } from "../sui/mode/shared.mjs";
|
|
7
|
+
import { SuiOptions } from "../sui/mode/spec.mjs";
|
|
8
|
+
import { ArtifactPublishError } from "../../primitives/artifact-publisher.mjs";
|
|
9
|
+
import { CoinError, CoinPhase } from "./errors.mjs";
|
|
10
|
+
import { MintResult, MintSigner } from "./mint.mjs";
|
|
11
|
+
import { isBareCoinType, validateBareCoinType } from "./metadata.mjs";
|
|
12
|
+
import { BUILTIN_COINS, BuiltinCoinName, ResolvedCoin } from "./address-resolution.mjs";
|
|
13
|
+
import { CoinAddressForm, CoinValue } from "./service.mjs";
|
|
14
|
+
import { CoinBindings } from "./codegen.mjs";
|
|
15
|
+
import { DiscoveredCoin } from "./discovery.mjs";
|
|
16
|
+
import { Effect } from "effect";
|
|
17
|
+
|
|
18
|
+
//#region src/plugins/coin/index.d.ts
|
|
19
|
+
type CoinResourceId<Sym extends string> = `coin:${Sym}`;
|
|
20
|
+
type PackageNameOf<Pkg extends PackageMember> = Pkg extends ResourceRef<`package:${infer Name}`, PackageMemberValue> ? Name : string;
|
|
21
|
+
/** A user-supplied package ref. The user passes the result of
|
|
22
|
+
* `localPackage('foo', …)` / `knownPackage('foo', …)` — NOT a bare string
|
|
23
|
+
* value. Generic over the literal package name so the witness-form
|
|
24
|
+
* coin's dependency preserves the per-package resource id. */
|
|
25
|
+
interface PackageMemberValue {
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly packageId: string;
|
|
28
|
+
readonly publisher?: MintSigner;
|
|
29
|
+
}
|
|
30
|
+
type PackageMember<Name extends string = string> = ResourceRef<`package:${Name}`, PackageMemberValue>;
|
|
31
|
+
/** User-facing factory namespace. Three variants — see file header for
|
|
32
|
+
* the rationale on not exposing a `coin(identifier)` form-guessing
|
|
33
|
+
* entry. */
|
|
34
|
+
declare const coin: {
|
|
35
|
+
readonly fromPackage: <const Pkg extends PackageMember, Wit extends string>(pkg: Pkg, witnessName: Wit) => Plugin<`coin:${PackageNameOf<Pkg>}/${Lowercase<Wit>}`, CoinValue, {
|
|
36
|
+
readonly pkg: Pkg;
|
|
37
|
+
readonly sui: ResourceRef<"sui", SuiClient & {
|
|
38
|
+
readonly mode: SuiOptions["mode"];
|
|
39
|
+
readonly seedObjects: SeedObjectsAccumulator;
|
|
40
|
+
}>;
|
|
41
|
+
} extends infer T ? T extends {
|
|
42
|
+
readonly pkg: Pkg;
|
|
43
|
+
readonly sui: ResourceRef<"sui", SuiClient & {
|
|
44
|
+
readonly mode: SuiOptions["mode"];
|
|
45
|
+
readonly seedObjects: SeedObjectsAccumulator;
|
|
46
|
+
}>;
|
|
47
|
+
} ? T extends Readonly<Record<string, AnyResourceRef>> ? readonly T[keyof T][] : readonly [] : never : never, readonly [SnapshotableDecl, CodegenableDecl<`coin/${string}`>, StrategyContributorDecl<"coin-registry", {
|
|
48
|
+
readonly symbol: string;
|
|
49
|
+
}>, ...{
|
|
50
|
+
kind: "strategy-contributor";
|
|
51
|
+
capabilityKey: `coinType:${string}`;
|
|
52
|
+
strategy: {
|
|
53
|
+
readonly request: (req: {
|
|
54
|
+
readonly address: string;
|
|
55
|
+
readonly amount: bigint;
|
|
56
|
+
}) => Effect.Effect<void, CoinError | ArtifactPublishError>;
|
|
57
|
+
};
|
|
58
|
+
autoMounted: true;
|
|
59
|
+
}[]]>;
|
|
60
|
+
readonly known: <FullType extends string>(fullCoinType: FullType) => Plugin<`coin:${string}`, CoinValue, readonly ResourceRef<"sui", SuiClient & {
|
|
61
|
+
readonly mode: SuiOptions["mode"];
|
|
62
|
+
readonly seedObjects: SeedObjectsAccumulator;
|
|
63
|
+
}>[], readonly [SnapshotableDecl, CodegenableDecl<`coin/${string}`>, StrategyContributorDecl<"coin-registry", {
|
|
64
|
+
readonly symbol: string;
|
|
65
|
+
}>, ...{
|
|
66
|
+
kind: "strategy-contributor";
|
|
67
|
+
capabilityKey: `coinType:${string}`;
|
|
68
|
+
strategy: {
|
|
69
|
+
readonly request: (req: {
|
|
70
|
+
readonly address: string;
|
|
71
|
+
readonly amount: bigint;
|
|
72
|
+
}) => Effect.Effect<void, CoinError | ArtifactPublishError>;
|
|
73
|
+
};
|
|
74
|
+
autoMounted: true;
|
|
75
|
+
}[]]>;
|
|
76
|
+
readonly builtin: <Name extends keyof typeof BUILTIN_COINS>(name: Name) => Plugin<`coin:${Name}`, CoinValue, readonly ResourceRef<"sui", SuiClient & {
|
|
77
|
+
readonly mode: SuiOptions["mode"];
|
|
78
|
+
readonly seedObjects: SeedObjectsAccumulator;
|
|
79
|
+
}>[], readonly [SnapshotableDecl, CodegenableDecl<`coin/${string}`>, StrategyContributorDecl<"coin-registry", {
|
|
80
|
+
readonly symbol: string;
|
|
81
|
+
}>, ...{
|
|
82
|
+
kind: "strategy-contributor";
|
|
83
|
+
capabilityKey: `coinType:${string}`;
|
|
84
|
+
strategy: {
|
|
85
|
+
readonly request: (req: {
|
|
86
|
+
readonly address: string;
|
|
87
|
+
readonly amount: bigint;
|
|
88
|
+
}) => Effect.Effect<void, CoinError | ArtifactPublishError>;
|
|
89
|
+
};
|
|
90
|
+
autoMounted: true;
|
|
91
|
+
}[]]>;
|
|
92
|
+
};
|
|
93
|
+
//#endregion
|
|
94
|
+
export { CoinResourceId, PackageMember, coin };
|
|
95
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { definePlugin, resource } from "../../substrate/plugin.mjs";
|
|
2
|
+
import { pluginErrorContributions } from "../../api/plugin-errors.mjs";
|
|
3
|
+
import { suiResource } from "../sui/index.mjs";
|
|
4
|
+
import { ArtifactPublisherService } from "../../substrate/runtime/artifact-publisher/index.mjs";
|
|
5
|
+
import "./discovery.mjs";
|
|
6
|
+
import { COIN_REGISTRY_CAPABILITY_KEY, CoinRegistryService } from "./registry.mjs";
|
|
7
|
+
import { makeCoinCodegen } from "./codegen.mjs";
|
|
8
|
+
import { makeCoinSnapshotable } from "./snapshot.mjs";
|
|
9
|
+
import { COIN_ERROR_TAGS } from "./errors.mjs";
|
|
10
|
+
import "./metadata.mjs";
|
|
11
|
+
import "./address-resolution.mjs";
|
|
12
|
+
import "./mint.mjs";
|
|
13
|
+
import { acquireCoin } from "./service.mjs";
|
|
14
|
+
import { Effect } from "effect";
|
|
15
|
+
//#region src/plugins/coin/index.ts
|
|
16
|
+
const coinErrorContributions = pluginErrorContributions(COIN_ERROR_TAGS);
|
|
17
|
+
const coinFundingCapabilityKey = (fullCoinType) => `coinType:${fullCoinType}`;
|
|
18
|
+
/** Resource id constructor. The symbolic name is part of the resource identity
|
|
19
|
+
* so the substrate's compose-time dedup catches collisions. */
|
|
20
|
+
const coinResourceId = (symbol) => `coin:${symbol}`;
|
|
21
|
+
const packageNameFromMember = (pkg) => pkg.id.slice(8);
|
|
22
|
+
const projectCoinSdk = (sui) => {
|
|
23
|
+
const grpcClient = sui.sdk.client;
|
|
24
|
+
return {
|
|
25
|
+
core: {
|
|
26
|
+
getObject: sui.sdk.core.getObject,
|
|
27
|
+
getCoinMetadata: (args) => grpcClient.core.getCoinMetadata(args)
|
|
28
|
+
},
|
|
29
|
+
client: sui.sdk.client
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const buildCapabilities = (symbol, resolved) => {
|
|
33
|
+
const bindings = {
|
|
34
|
+
symbol: resolved.symbol ?? symbol,
|
|
35
|
+
fullCoinType: resolved.fullCoinType,
|
|
36
|
+
decimals: resolved.decimals,
|
|
37
|
+
source: resolved.source,
|
|
38
|
+
...resolved.displayName !== void 0 ? { displayName: resolved.displayName } : {},
|
|
39
|
+
...resolved.iconUrl !== void 0 ? { iconUrl: resolved.iconUrl } : {},
|
|
40
|
+
...resolved.treasuryCapId !== void 0 ? { treasuryCapId: resolved.treasuryCapId } : {},
|
|
41
|
+
...resolved.metadataId !== void 0 ? { metadataId: resolved.metadataId } : {},
|
|
42
|
+
...resolved.packageId !== void 0 ? { packageId: resolved.packageId } : {}
|
|
43
|
+
};
|
|
44
|
+
return [
|
|
45
|
+
makeCoinSnapshotable({ symbol }),
|
|
46
|
+
makeCoinCodegen({
|
|
47
|
+
symbol,
|
|
48
|
+
resolved: bindings
|
|
49
|
+
}),
|
|
50
|
+
{
|
|
51
|
+
kind: "strategy-contributor",
|
|
52
|
+
capabilityKey: COIN_REGISTRY_CAPABILITY_KEY,
|
|
53
|
+
strategy: { symbol },
|
|
54
|
+
autoMounted: true
|
|
55
|
+
},
|
|
56
|
+
...resolved.fundingStrategy === void 0 ? [] : [{
|
|
57
|
+
kind: "strategy-contributor",
|
|
58
|
+
capabilityKey: coinFundingCapabilityKey(resolved.fullCoinType),
|
|
59
|
+
strategy: resolved.fundingStrategy,
|
|
60
|
+
autoMounted: true
|
|
61
|
+
}]
|
|
62
|
+
];
|
|
63
|
+
};
|
|
64
|
+
/** Resolve a coin by `(publishing package member, witness)`. Forces
|
|
65
|
+
* a dep edge on the publishing package's resource — the substrate ensures
|
|
66
|
+
* the publish has completed before this resolves.
|
|
67
|
+
*
|
|
68
|
+
* Resource identity includes both the package's symbolic name and the
|
|
69
|
+
* witness name, so two packages can expose the same witness without
|
|
70
|
+
* colliding in the substrate graph.
|
|
71
|
+
*
|
|
72
|
+
* Pass the package MEMBER (the value returned by `localPackage(...)`
|
|
73
|
+
* / `knownPackage(...)`). The factory
|
|
74
|
+
* projects it to a dependency resource and receives the package value
|
|
75
|
+
* in `start`. */
|
|
76
|
+
const fromPackage = (pkg, witnessName) => {
|
|
77
|
+
const packageName = packageNameFromMember(pkg);
|
|
78
|
+
const symbol = witnessName.toLowerCase();
|
|
79
|
+
return definePlugin({
|
|
80
|
+
id: resource(coinResourceId(`${packageName}/${symbol}`)).id,
|
|
81
|
+
dependsOn: {
|
|
82
|
+
pkg,
|
|
83
|
+
sui: suiResource
|
|
84
|
+
},
|
|
85
|
+
role: "task",
|
|
86
|
+
start: ({ pkg: resolved, sui }) => Effect.gen(function* () {
|
|
87
|
+
const artifactPublisher = yield* ArtifactPublisherService;
|
|
88
|
+
const registry = yield* CoinRegistryService;
|
|
89
|
+
return yield* acquireCoin({
|
|
90
|
+
kind: "witness",
|
|
91
|
+
publishingPackageName: resolved.name,
|
|
92
|
+
witness: witnessName,
|
|
93
|
+
...resolved.publisher === void 0 ? {} : { fundingSigner: resolved.publisher }
|
|
94
|
+
}, {
|
|
95
|
+
registry,
|
|
96
|
+
sdk: projectCoinSdk(sui),
|
|
97
|
+
chain: sui.chain,
|
|
98
|
+
publisher: artifactPublisher
|
|
99
|
+
});
|
|
100
|
+
}),
|
|
101
|
+
errorContributions: coinErrorContributions,
|
|
102
|
+
capabilities: ({ value }) => buildCapabilities(symbol, value)
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
/** Resolve a coin by bare on-chain type via `getCoinMetadata`.
|
|
106
|
+
* Used for live-net coins (mainnet DEEP, USDC etc.) that no local
|
|
107
|
+
* `Package(...)` publishes.
|
|
108
|
+
*
|
|
109
|
+
* Soft-degrades to `decimals: 0` on RPC failure — distilled-doc
|
|
110
|
+
* invariant. Resource id uses a deterministic-but-readable derivation of
|
|
111
|
+
* the coin type so collisions surface at compose time. */
|
|
112
|
+
const known = (fullCoinType) => {
|
|
113
|
+
const id = fullCoinType.replace(/^0x/, "").replace(/::/g, "_").slice(0, 60);
|
|
114
|
+
return definePlugin({
|
|
115
|
+
id: resource(coinResourceId(id)).id,
|
|
116
|
+
dependsOn: { sui: suiResource },
|
|
117
|
+
role: "task",
|
|
118
|
+
start: ({ sui }) => Effect.gen(function* () {
|
|
119
|
+
const publisher = yield* ArtifactPublisherService;
|
|
120
|
+
const registry = yield* CoinRegistryService;
|
|
121
|
+
return yield* acquireCoin({
|
|
122
|
+
kind: "known",
|
|
123
|
+
fullCoinType
|
|
124
|
+
}, {
|
|
125
|
+
registry,
|
|
126
|
+
sdk: projectCoinSdk(sui),
|
|
127
|
+
chain: sui.chain,
|
|
128
|
+
publisher
|
|
129
|
+
});
|
|
130
|
+
}),
|
|
131
|
+
errorContributions: coinErrorContributions,
|
|
132
|
+
capabilities: ({ value }) => buildCapabilities(id, value)
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
/** Resolve a protocol-defined builtin coin. Currently `'sui'` only —
|
|
136
|
+
* distilled-doc 13-coin.md Invariant 4: SUI is `0x2::sui::SUI`,
|
|
137
|
+
* decimals=9. No RPC, no registry. */
|
|
138
|
+
const builtin = (name) => {
|
|
139
|
+
const symbol = name;
|
|
140
|
+
return definePlugin({
|
|
141
|
+
id: resource(coinResourceId(name)).id,
|
|
142
|
+
dependsOn: { sui: suiResource },
|
|
143
|
+
role: "task",
|
|
144
|
+
start: ({ sui }) => Effect.gen(function* () {
|
|
145
|
+
const publisher = yield* ArtifactPublisherService;
|
|
146
|
+
const registry = yield* CoinRegistryService;
|
|
147
|
+
return yield* acquireCoin({
|
|
148
|
+
kind: "builtin",
|
|
149
|
+
name
|
|
150
|
+
}, {
|
|
151
|
+
registry,
|
|
152
|
+
sdk: projectCoinSdk(sui),
|
|
153
|
+
chain: sui.chain,
|
|
154
|
+
publisher
|
|
155
|
+
});
|
|
156
|
+
}),
|
|
157
|
+
errorContributions: coinErrorContributions,
|
|
158
|
+
capabilities: ({ value }) => buildCapabilities(symbol, value)
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
/** User-facing factory namespace. Three variants — see file header for
|
|
162
|
+
* the rationale on not exposing a `coin(identifier)` form-guessing
|
|
163
|
+
* entry. */
|
|
164
|
+
const coin = {
|
|
165
|
+
fromPackage,
|
|
166
|
+
known,
|
|
167
|
+
builtin
|
|
168
|
+
};
|
|
169
|
+
//#endregion
|
|
170
|
+
export { coin, coinResourceId };
|
|
171
|
+
|
|
172
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/coin/index.ts"],"sourcesContent":["// Coin plugin — barrel + `coin(...)` factory family.\n//\n// Architecture (13-coin.md): Coin is the user-facing primitive family\n// for *addressing* custom Move coin types. It does NOT publish Move\n// modules itself — the Package plugin publishes; coin auto-discovery\n// (in `discovery.ts`) folds the publish output into the per-stack\n// `CoinRegistry`; this factory resolves user-supplied addresses\n// (witness / bare-type / builtin) against that registry plus the live RPC.\n//\n// User-facing factory shape — three variants mirroring the address\n// forms:\n//\n// coin.fromPackage(pkg, 'MOCK_USDC') // package member → registry\n// coin.known('0x...::deep::DEEP') // bare → live RPC\n// coin.builtin('sui') // protocol-defined constant\n//\n// (A `coin(identifier)` convenience entry is intentionally NOT\n// exposed — distilled-doc 13-coin.md Pain point #6 documents how the\n// \"guess the form from the string\" path is a footgun. The three-form\n// surface forces the user to make the disambiguation explicit at the\n// call site.)\n//\n// Resource id: `'coin:<package>/<witness>'` for package-scoped coins and\n// `'coin:<identifier>'` for known/builtin coins — one tag per declared\n// coin instance, so the substrate's compose-time dedup detects collisions\n// cleanly. Mirrors the Package plugin's per-instance resource identity.\n\nimport { Effect } from 'effect';\n\nimport { definePlugin, resource, type ResourceRef } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { SnapshotableDecl } from '../../contracts/snapshotable.ts';\nimport type { StrategyContributorDecl } from '../../contracts/strategy-contributor.ts';\nimport { ArtifactPublisherService } from '../../substrate/runtime/artifact-publisher/index.ts';\nimport { suiResource } from '../sui/index.ts';\nimport type { SuiClient } from '../sui/index.ts';\nimport type { AccountFundingStrategy } from '../account/funding.ts';\n\nimport { makeCoinCodegen, type CoinBindings } from './codegen.ts';\nimport { makeCoinSnapshotable } from './snapshot.ts';\nimport { COIN_REGISTRY_CAPABILITY_KEY, CoinRegistryService } from './registry.ts';\nimport { COIN_ERROR_TAGS } from './errors.ts';\nimport { acquireCoin, type CoinAddressForm, type CoinValue } from './service.ts';\nimport { BUILTIN_COINS } from './address-resolution.ts';\nimport type { MetadataSdkShim } from './metadata.ts';\nimport type { MintSdkShim } from './mint.ts';\n\nconst coinErrorContributions = pluginErrorContributions(COIN_ERROR_TAGS);\n\nexport const coinFundingCapabilityKey = <FullType extends string>(\n\tfullCoinType: FullType,\n): `coinType:${FullType}` => `coinType:${fullCoinType}` as const;\n\n// ---------------------------------------------------------------------------\n// Resource — one per declared coin instance, keyed by explicit address form.\n// ---------------------------------------------------------------------------\n\n/** Resource id constructor. The symbolic name is part of the resource identity\n * so the substrate's compose-time dedup catches collisions. */\nexport const coinResourceId = <Sym extends string>(symbol: Sym): `coin:${Sym}` => `coin:${symbol}`;\n\nexport type CoinResourceId<Sym extends string> = `coin:${Sym}`;\n\ntype PackageNameOf<Pkg extends PackageMember> =\n\tPkg extends ResourceRef<`package:${infer Name}`, PackageMemberValue> ? Name : string;\n\ntype PackageCoinResourceKey<\n\tPkg extends PackageMember,\n\tWit extends string,\n> = `${PackageNameOf<Pkg>}/${Lowercase<Wit>}`;\n\nconst packageNameFromMember = <Pkg extends PackageMember>(pkg: Pkg): PackageNameOf<Pkg> =>\n\tpkg.id.slice('package:'.length) as PackageNameOf<Pkg>;\n\n// ---------------------------------------------------------------------------\n// SDK shim projection\n// ---------------------------------------------------------------------------\n//\n// The coin plugin's resolvers need three Sui surfaces: `core.getObject`\n// (mint verify probe), `core.getCoinMetadata` (bare-type address form),\n// and the opaque `client` (`Transaction.build({client})` in the mint\n// produce body).\n//\n// `sui.sdk.core.getObject` is on the typed `SuiSdkShim`; `getCoinMetadata`\n// lives on the underlying `SuiGrpcClient` reached via the opaque\n// `sui.sdk.client`. We project both onto a single `MetadataSdkShim &\n// MintSdkShim` here at the boundary — the cast mirrors STYLE_GUIDE §14\n// (localized cast through an opaque SDK surface), kept narrow to one\n// method projection.\n\nconst projectCoinSdk = (sui: SuiClient): MetadataSdkShim & MintSdkShim => {\n\tconst grpcClient = sui.sdk.client as {\n\t\treadonly core: {\n\t\t\treadonly getCoinMetadata: (args: { readonly coinType: string }) => Promise<unknown>;\n\t\t};\n\t};\n\treturn {\n\t\tcore: {\n\t\t\tgetObject: sui.sdk.core.getObject,\n\t\t\tgetCoinMetadata: (args) => grpcClient.core.getCoinMetadata(args),\n\t\t},\n\t\tclient: sui.sdk.client,\n\t};\n};\n\n// ---------------------------------------------------------------------------\n// Per-form capability builders — dynamic (POST-acquire). Receive the\n// resolved `CoinValue` so codegen bindings stamp the REAL fullCoinType\n// + decimals instead of placeholder values.\n// ---------------------------------------------------------------------------\n\nconst buildCapabilities = (symbol: string, resolved: CoinValue) => {\n\tconst bindings: CoinBindings = {\n\t\tsymbol: resolved.symbol ?? symbol,\n\t\tfullCoinType: resolved.fullCoinType,\n\t\tdecimals: resolved.decimals,\n\t\tsource: resolved.source,\n\t\t...(resolved.displayName !== undefined ? { displayName: resolved.displayName } : {}),\n\t\t...(resolved.iconUrl !== undefined ? { iconUrl: resolved.iconUrl } : {}),\n\t\t...(resolved.treasuryCapId !== undefined ? { treasuryCapId: resolved.treasuryCapId } : {}),\n\t\t...(resolved.metadataId !== undefined ? { metadataId: resolved.metadataId } : {}),\n\t\t...(resolved.packageId !== undefined ? { packageId: resolved.packageId } : {}),\n\t};\n\tconst snap: SnapshotableDecl = makeCoinSnapshotable({ symbol });\n\tconst codegen: CodegenableDecl<`coin/${string}`> = makeCoinCodegen({\n\t\tsymbol,\n\t\tresolved: bindings,\n\t});\n\t// Auto-mounted strategy contribution — siblings (Wallet, Faucet's\n\t// treasury-cap mint, Deepbook market-maker) read the per-stack\n\t// registry via this seam. The actual `CoinRegistry` instance is\n\t// wired at compose time (one registry per stack); each coin\n\t// contributes its `register(record)` call as a side effect at\n\t// acquire.\n\tconst registryContribution: StrategyContributorDecl<\n\t\ttypeof COIN_REGISTRY_CAPABILITY_KEY,\n\t\t{ readonly symbol: string }\n\t> = {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: COIN_REGISTRY_CAPABILITY_KEY,\n\t\tstrategy: { symbol },\n\t\tautoMounted: true,\n\t};\n\tconst fundingContribution =\n\t\tresolved.fundingStrategy === undefined\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tkind: 'strategy-contributor',\n\t\t\t\t\t\tcapabilityKey: coinFundingCapabilityKey(resolved.fullCoinType),\n\t\t\t\t\t\tstrategy: resolved.fundingStrategy,\n\t\t\t\t\t\tautoMounted: true,\n\t\t\t\t\t} satisfies StrategyContributorDecl<`coinType:${string}`, AccountFundingStrategy>,\n\t\t\t\t];\n\treturn [snap, codegen, registryContribution, ...fundingContribution] as const;\n};\n\n// ---------------------------------------------------------------------------\n// Form 1: coin.fromPackage(pkg, witness) — package-scoped registry lookup\n// ---------------------------------------------------------------------------\n\n/** A user-supplied package ref. The user passes the result of\n * `localPackage('foo', …)` / `knownPackage('foo', …)` — NOT a bare string\n * value. Generic over the literal package name so the witness-form\n * coin's dependency preserves the per-package resource id. */\nexport interface PackageMemberValue {\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly publisher?: import('./mint.ts').MintSigner;\n}\n\nexport type PackageMember<Name extends string = string> = ResourceRef<\n\t`package:${Name}`,\n\tPackageMemberValue\n>;\n\n/** Resolve a coin by `(publishing package member, witness)`. Forces\n * a dep edge on the publishing package's resource — the substrate ensures\n * the publish has completed before this resolves.\n *\n * Resource identity includes both the package's symbolic name and the\n * witness name, so two packages can expose the same witness without\n * colliding in the substrate graph.\n *\n * Pass the package MEMBER (the value returned by `localPackage(...)`\n * / `knownPackage(...)`). The factory\n * projects it to a dependency resource and receives the package value\n * in `start`. */\nexport const fromPackage = <const Pkg extends PackageMember, Wit extends string>(\n\tpkg: Pkg,\n\twitnessName: Wit,\n) => {\n\tconst packageName = packageNameFromMember(pkg);\n\tconst symbol = witnessName.toLowerCase() as Lowercase<Wit>;\n\tconst resourceKey = `${packageName}/${symbol}` as PackageCoinResourceKey<Pkg, Wit>;\n\tconst coinRef = resource<CoinResourceId<typeof resourceKey>, CoinValue>(\n\t\tcoinResourceId(resourceKey),\n\t);\n\treturn definePlugin({\n\t\tid: coinRef.id,\n\t\tdependsOn: { pkg, sui: suiResource },\n\t\trole: 'task',\n\t\tstart: ({ pkg: resolved, sui }) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst artifactPublisher = yield* ArtifactPublisherService;\n\t\t\t\tconst registry = yield* CoinRegistryService;\n\t\t\t\tconst form: CoinAddressForm = {\n\t\t\t\t\tkind: 'witness',\n\t\t\t\t\tpublishingPackageName: resolved.name,\n\t\t\t\t\twitness: witnessName,\n\t\t\t\t\t...(resolved.publisher === undefined ? {} : { fundingSigner: resolved.publisher }),\n\t\t\t\t};\n\t\t\t\treturn yield* acquireCoin(form, {\n\t\t\t\t\tregistry,\n\t\t\t\t\tsdk: projectCoinSdk(sui),\n\t\t\t\t\tchain: sui.chain,\n\t\t\t\t\tpublisher: artifactPublisher,\n\t\t\t\t});\n\t\t\t}),\n\t\terrorContributions: coinErrorContributions,\n\t\tcapabilities: ({ value }) => buildCapabilities(symbol, value),\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// Form 2: coin.known(fullCoinType) — bare on-chain type\n// ---------------------------------------------------------------------------\n\n/** Resolve a coin by bare on-chain type via `getCoinMetadata`.\n * Used for live-net coins (mainnet DEEP, USDC etc.) that no local\n * `Package(...)` publishes.\n *\n * Soft-degrades to `decimals: 0` on RPC failure — distilled-doc\n * invariant. Resource id uses a deterministic-but-readable derivation of\n * the coin type so collisions surface at compose time. */\nexport const known = <FullType extends string>(fullCoinType: FullType) => {\n\t// Derive a resource id from the type: keep it readable but unique. The\n\t// substrate's compose-time dedup uses string equality on the id.\n\tconst id = fullCoinType.replace(/^0x/, '').replace(/::/g, '_').slice(0, 60);\n\tconst coinRef = resource<CoinResourceId<typeof id>, CoinValue>(\n\t\tcoinResourceId(id) as CoinResourceId<typeof id>,\n\t);\n\treturn definePlugin({\n\t\tid: coinRef.id,\n\t\tdependsOn: { sui: suiResource },\n\t\trole: 'task',\n\t\tstart: ({ sui }) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst registry = yield* CoinRegistryService;\n\t\t\t\tconst form: CoinAddressForm = { kind: 'known', fullCoinType };\n\t\t\t\treturn yield* acquireCoin(form, {\n\t\t\t\t\tregistry,\n\t\t\t\t\tsdk: projectCoinSdk(sui),\n\t\t\t\t\tchain: sui.chain,\n\t\t\t\t\tpublisher,\n\t\t\t\t});\n\t\t\t}),\n\t\terrorContributions: coinErrorContributions,\n\t\tcapabilities: ({ value }) => buildCapabilities(id, value),\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// Form 3: coin.builtin('sui') — protocol-defined constant\n// ---------------------------------------------------------------------------\n\n/** Resolve a protocol-defined builtin coin. Currently `'sui'` only —\n * distilled-doc 13-coin.md Invariant 4: SUI is `0x2::sui::SUI`,\n * decimals=9. No RPC, no registry. */\nexport const builtin = <Name extends keyof typeof BUILTIN_COINS>(name: Name) => {\n\tconst symbol = name; // 'sui' today\n\tconst coinRef = resource<CoinResourceId<Name>, CoinValue>(coinResourceId(name));\n\treturn definePlugin({\n\t\tid: coinRef.id,\n\t\tdependsOn: { sui: suiResource },\n\t\trole: 'task',\n\t\tstart: ({ sui }) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst registry = yield* CoinRegistryService;\n\t\t\t\tconst form: CoinAddressForm = { kind: 'builtin', name };\n\t\t\t\treturn yield* acquireCoin(form, {\n\t\t\t\t\tregistry,\n\t\t\t\t\tsdk: projectCoinSdk(sui),\n\t\t\t\t\tchain: sui.chain,\n\t\t\t\t\tpublisher,\n\t\t\t\t});\n\t\t\t}),\n\t\terrorContributions: coinErrorContributions,\n\t\tcapabilities: ({ value }) => buildCapabilities(symbol, value),\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// Public `coin` namespace\n// ---------------------------------------------------------------------------\n\n/** User-facing factory namespace. Three variants — see file header for\n * the rationale on not exposing a `coin(identifier)` form-guessing\n * entry. */\nexport const coin = {\n\tfromPackage,\n\tknown,\n\tbuiltin,\n} as const;\n\n// ---------------------------------------------------------------------------\n// Re-exports — advanced callers (Wallet, Faucet, Deepbook, examples)\n// ---------------------------------------------------------------------------\n\nexport type { CoinValue, CoinAddressForm } from './service.ts';\nexport type { ResolvedCoin, BuiltinCoinName } from './address-resolution.ts';\nexport { BUILTIN_COINS } from './address-resolution.ts';\n\nexport type { CoinRecord, CoinRegistry, CoinKey } from './registry.ts';\nexport {\n\tCOIN_REGISTRY_CAPABILITY_KEY,\n\tCoinRegistryService,\n\tcoinRegistryLayer,\n} from './registry.ts';\n\nexport type { CoinBindings } from './codegen.ts';\n\nexport type { DiscoveredCoin } from './discovery.ts';\nexport { discoverCoinsFromPublish } from './discovery.ts';\n\nexport type { MetadataSdkShim, OnchainCoinMetadata, CoinMetadataCache } from './metadata.ts';\nexport {\n\tOnchainCoinMetadataShape,\n\tMETADATA_FETCH_TIMEOUT_MS,\n\tMETADATA_RETRY_SCHEDULE,\n\tfetchCoinMetadataOnce,\n\tfetchCoinMetadataMany,\n\tmakeCoinMetadataCache,\n\tisBareCoinType,\n\tvalidateBareCoinType,\n} from './metadata.ts';\n\nexport type { MintInputs, MintResult, MintSigner, MintSdkShim, CachedMint } from './mint.ts';\nexport { performMint, MintedCoinVerifyShape, mintTxError, mintParseError } from './mint.ts';\n\nexport type { CoinError, CoinPhase } from './errors.ts';\nexport { coinError, COIN_ERROR_TAGS } from './errors.ts';\n"],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CoinError } from "./errors.mjs";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
//#region src/plugins/coin/metadata.d.ts
|
|
4
|
+
/** Bare-coin-type heuristic — distilled-doc 13-coin.md Invariant 3.
|
|
5
|
+
*
|
|
6
|
+
* MUST agree with what `getCoinMetadata` accepts as a coin-type
|
|
7
|
+
* argument: `0xHEX::module::Witness`. Anything else (symbol, witness
|
|
8
|
+
* alone) falls through to the registry path. */
|
|
9
|
+
declare const isBareCoinType: (s: string) => boolean;
|
|
10
|
+
/** Project a coin-type validation failure to `CoinError`. Surfaces
|
|
11
|
+
* the nested-generic case at the user-facing factory boundary. */
|
|
12
|
+
declare const validateBareCoinType: (identifier: string) => CoinError | null;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isBareCoinType, validateBareCoinType };
|
|
15
|
+
//# sourceMappingURL=metadata.d.mts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { decodeUnknown } from "../../substrate/runtime/runtime-decode.mjs";
|
|
2
|
+
import { SpanAttr } from "../../substrate/runtime/observability/spans.mjs";
|
|
3
|
+
import { makeSpacedRetrySchedule } from "../../substrate/runtime/retry-policy.mjs";
|
|
4
|
+
import { coinError } from "./errors.mjs";
|
|
5
|
+
import { Effect, Schema } from "effect";
|
|
6
|
+
//#region src/plugins/coin/metadata.ts
|
|
7
|
+
/** Per-attempt timeout (5 seconds) — distilled-doc invariant. */
|
|
8
|
+
const METADATA_FETCH_TIMEOUT_MS = 5e3;
|
|
9
|
+
/** Retry schedule — ONE retry at 250ms backoff. Matches the v3
|
|
10
|
+
* `RETRY_SCHEDULE` (250ms spaced, bounded to one retry). */
|
|
11
|
+
const METADATA_RETRY_SCHEDULE = makeSpacedRetrySchedule(250, 1);
|
|
12
|
+
/** On-chain CoinMetadata projection — narrowed to the columns the
|
|
13
|
+
* registry needs. The SDK's full shape carries more (description,
|
|
14
|
+
* raw bytes); we don't.
|
|
15
|
+
*
|
|
16
|
+
* IMPORTANT (chain-probe schema constraint from the last sweep):
|
|
17
|
+
* this Schema MUST NOT depend on any services. `Schema.Schema<T>` is
|
|
18
|
+
* parameterized `<Type, Encoded, R, RD>`; we constrain `R` and `RD`
|
|
19
|
+
* to `never` via `Schema.Codec<T, unknown, never, never>` at the
|
|
20
|
+
* consumer boundary, but the schema literal itself uses ONLY
|
|
21
|
+
* service-free combinators (`Schema.String`, `Schema.Number`,
|
|
22
|
+
* `Schema.optional`). */
|
|
23
|
+
const OnchainCoinMetadataShape = Schema.Struct({
|
|
24
|
+
id: Schema.String,
|
|
25
|
+
decimals: Schema.Number,
|
|
26
|
+
name: Schema.String,
|
|
27
|
+
symbol: Schema.String,
|
|
28
|
+
description: Schema.optional(Schema.String),
|
|
29
|
+
iconUrl: Schema.optional(Schema.String)
|
|
30
|
+
});
|
|
31
|
+
/** Fetch CoinMetadata for one coin type. Soft-degrades on RPC
|
|
32
|
+
* failure / timeout: returns `null` after the retry budget is
|
|
33
|
+
* exhausted, AND logs a warning.
|
|
34
|
+
*
|
|
35
|
+
* Distilled-doc 13-coin.md Invariant 8: this is intentional. The
|
|
36
|
+
* publish-discovery pass must not fail the whole supervisor cycle on
|
|
37
|
+
* a flaky RPC blip. */
|
|
38
|
+
const fetchCoinMetadataOnce = (sdk, fullCoinType) => Effect.gen(function* () {
|
|
39
|
+
const raw = yield* Effect.tryPromise({
|
|
40
|
+
try: () => sdk.core.getCoinMetadata({ coinType: fullCoinType }),
|
|
41
|
+
catch: (cause) => ({
|
|
42
|
+
_tag: "rpc",
|
|
43
|
+
cause
|
|
44
|
+
})
|
|
45
|
+
}).pipe(Effect.timeoutOrElse({
|
|
46
|
+
duration: `${METADATA_FETCH_TIMEOUT_MS} millis`,
|
|
47
|
+
orElse: () => Effect.fail({
|
|
48
|
+
_tag: "rpc",
|
|
49
|
+
cause: "timeout"
|
|
50
|
+
})
|
|
51
|
+
}), Effect.retry(METADATA_RETRY_SCHEDULE), Effect.catch((err) => {
|
|
52
|
+
return Effect.logWarning("coin metadata fetch failed; soft-degrading to null").pipe(Effect.annotateLogs({
|
|
53
|
+
[SpanAttr.coinType]: fullCoinType,
|
|
54
|
+
[SpanAttr.errorCause]: stringifyCause(err.cause)
|
|
55
|
+
}), Effect.as(null));
|
|
56
|
+
}));
|
|
57
|
+
if (raw === null || raw === void 0) return null;
|
|
58
|
+
return yield* decodeUnknown(OnchainCoinMetadataShape, raw, {
|
|
59
|
+
source: "coin metadata RPC response",
|
|
60
|
+
mkError: (issue) => issue
|
|
61
|
+
}).pipe(Effect.catch((issue) => Effect.logWarning("coin metadata response had non-conforming shape; degrading to null").pipe(Effect.annotateLogs({
|
|
62
|
+
[SpanAttr.coinType]: fullCoinType,
|
|
63
|
+
[SpanAttr.errorCause]: stringifyCause(issue.cause ?? issue)
|
|
64
|
+
}), Effect.as(null))));
|
|
65
|
+
}).pipe(Effect.withSpan("coin.metadata.fetch", { attributes: { fullCoinType } }));
|
|
66
|
+
/** Bare-coin-type heuristic — distilled-doc 13-coin.md Invariant 3.
|
|
67
|
+
*
|
|
68
|
+
* MUST agree with what `getCoinMetadata` accepts as a coin-type
|
|
69
|
+
* argument: `0xHEX::module::Witness`. Anything else (symbol, witness
|
|
70
|
+
* alone) falls through to the registry path. */
|
|
71
|
+
const isBareCoinType = (s) => {
|
|
72
|
+
if (!s.startsWith("0x")) return false;
|
|
73
|
+
if (!s.includes("::")) return false;
|
|
74
|
+
if (s.split("::").length !== 3) return false;
|
|
75
|
+
if (s.includes("<") || s.includes(">")) return false;
|
|
76
|
+
return true;
|
|
77
|
+
};
|
|
78
|
+
/** Project a coin-type validation failure to `CoinError`. Surfaces
|
|
79
|
+
* the nested-generic case at the user-facing factory boundary. */
|
|
80
|
+
const validateBareCoinType = (identifier) => {
|
|
81
|
+
if (identifier.includes("<") || identifier.includes(">")) return coinError("nested-generic", {
|
|
82
|
+
identifier,
|
|
83
|
+
message: `coin('${identifier}'): nested generics not supported.`
|
|
84
|
+
});
|
|
85
|
+
return null;
|
|
86
|
+
};
|
|
87
|
+
const stringifyCause = (cause) => {
|
|
88
|
+
if (cause instanceof Error) return cause.message;
|
|
89
|
+
if (typeof cause === "string") return cause;
|
|
90
|
+
try {
|
|
91
|
+
return JSON.stringify(cause);
|
|
92
|
+
} catch {
|
|
93
|
+
return String(cause);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
97
|
+
export { METADATA_FETCH_TIMEOUT_MS, METADATA_RETRY_SCHEDULE, OnchainCoinMetadataShape, fetchCoinMetadataOnce, isBareCoinType, validateBareCoinType };
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=metadata.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.mjs","names":[],"sources":["../../../src/plugins/coin/metadata.ts"],"sourcesContent":["// CoinMetadata fetch + soft-degradation.\n//\n// Distilled-doc 13-coin.md Invariant 8: `getCoinMetadata` failures\n// degrade, do not throw. A timeout or RPC error after one retry\n// returns `null` (logged as a warning); the discovery pipeline keeps\n// going. The next supervisor cycle picks the missing record up.\n//\n// Per-attempt timeout 5s, ONE retry at 250ms backoff (matches the v3\n// `RETRY_SCHEDULE` exactly — distilled-doc 13-coin.md §Configuration).\n//\n// In-process per-Layer-invocation cache keyed by fullCoinType. The\n// fullCoinType folds the packageId, so a fresh chain (new genesis)\n// means new packageIds, which means the cache misses naturally —\n// persistence across restart is unnecessary.\n\nimport { Effect, Ref, Schema } from 'effect';\n\nimport { decodeUnknown } from '../../substrate/runtime/runtime-decode.ts';\nimport { SpanAttr } from '../../substrate/runtime/observability/spans.ts';\nimport { makeSpacedRetrySchedule } from '../../substrate/runtime/retry-policy.ts';\nimport { coinError, type CoinError } from './errors.ts';\n\n/** Per-attempt timeout (5 seconds) — distilled-doc invariant. */\nexport const METADATA_FETCH_TIMEOUT_MS = 5_000;\n\n/** Retry schedule — ONE retry at 250ms backoff. Matches the v3\n * `RETRY_SCHEDULE` (250ms spaced, bounded to one retry). */\nexport const METADATA_RETRY_SCHEDULE = makeSpacedRetrySchedule(250, 1);\n\n/** On-chain CoinMetadata projection — narrowed to the columns the\n * registry needs. The SDK's full shape carries more (description,\n * raw bytes); we don't.\n *\n * IMPORTANT (chain-probe schema constraint from the last sweep):\n * this Schema MUST NOT depend on any services. `Schema.Schema<T>` is\n * parameterized `<Type, Encoded, R, RD>`; we constrain `R` and `RD`\n * to `never` via `Schema.Codec<T, unknown, never, never>` at the\n * consumer boundary, but the schema literal itself uses ONLY\n * service-free combinators (`Schema.String`, `Schema.Number`,\n * `Schema.optional`). */\nexport const OnchainCoinMetadataShape = Schema.Struct({\n\tid: Schema.String,\n\tdecimals: Schema.Number,\n\tname: Schema.String,\n\tsymbol: Schema.String,\n\tdescription: Schema.optional(Schema.String),\n\ticonUrl: Schema.optional(Schema.String),\n});\n\nexport type OnchainCoinMetadata = typeof OnchainCoinMetadataShape.Type;\n\n/** SDK shim — the surface the discovery pass calls. The Sui plugin's\n * resolved client exposes this via `sdk.core.getCoinMetadata`. Kept\n * narrow (no `@mysten/sui` type import) so this module stays\n * layering-neutral; the consumer hands in the resolved client. */\nexport interface MetadataSdkShim {\n\treadonly core: {\n\t\treadonly getCoinMetadata: (args: { readonly coinType: string }) => Promise<unknown>;\n\t};\n}\n\n/** Per-Layer-invocation cache. `null` means \"we tried and the RPC\n * said the coin had no CoinMetadata\"; `undefined` means \"we haven't\n * asked yet\". */\nexport interface CoinMetadataCache {\n\treadonly get: (fullCoinType: string) => Effect.Effect<OnchainCoinMetadata | null | undefined>;\n\treadonly put: (fullCoinType: string, value: OnchainCoinMetadata | null) => Effect.Effect<void>;\n}\n\n/** Build an empty cache. */\nexport const makeCoinMetadataCache = (): Effect.Effect<CoinMetadataCache> =>\n\tEffect.gen(function* () {\n\t\tconst ref = yield* Ref.make<Record<string, OnchainCoinMetadata | null>>({});\n\t\treturn {\n\t\t\tget: (fullCoinType) =>\n\t\t\t\tRef.get(ref).pipe(Effect.map((m) => (fullCoinType in m ? m[fullCoinType] : undefined))),\n\t\t\tput: (fullCoinType, value) => Ref.update(ref, (m) => ({ ...m, [fullCoinType]: value })),\n\t\t};\n\t});\n\n/** Fetch CoinMetadata for one coin type. Soft-degrades on RPC\n * failure / timeout: returns `null` after the retry budget is\n * exhausted, AND logs a warning.\n *\n * Distilled-doc 13-coin.md Invariant 8: this is intentional. The\n * publish-discovery pass must not fail the whole supervisor cycle on\n * a flaky RPC blip. */\nexport const fetchCoinMetadataOnce = (\n\tsdk: MetadataSdkShim,\n\tfullCoinType: string,\n): Effect.Effect<OnchainCoinMetadata | null> =>\n\tEffect.gen(function* () {\n\t\tconst raw: unknown = yield* Effect.tryPromise({\n\t\t\ttry: () => sdk.core.getCoinMetadata({ coinType: fullCoinType }),\n\t\t\tcatch: (cause): { readonly _tag: 'rpc'; readonly cause: unknown } => ({\n\t\t\t\t_tag: 'rpc',\n\t\t\t\tcause,\n\t\t\t}),\n\t\t}).pipe(\n\t\t\t// Effect v4: `timeoutOrElse` (not `timeoutFail`). The\n\t\t\t// `orElse` branch is the new value (Effect), not just an\n\t\t\t// error constructor — we surface a tagged failure that the\n\t\t\t// downstream `Effect.catch` swallows into `null`.\n\t\t\tEffect.timeoutOrElse({\n\t\t\t\tduration: `${METADATA_FETCH_TIMEOUT_MS} millis`,\n\t\t\t\torElse: () => Effect.fail({ _tag: 'rpc' as const, cause: 'timeout' }),\n\t\t\t}),\n\t\t\tEffect.retry(METADATA_RETRY_SCHEDULE),\n\t\t\tEffect.catch((err): Effect.Effect<unknown> => {\n\t\t\t\treturn Effect.logWarning('coin metadata fetch failed; soft-degrading to null').pipe(\n\t\t\t\t\tEffect.annotateLogs({\n\t\t\t\t\t\t[SpanAttr.coinType]: fullCoinType,\n\t\t\t\t\t\t[SpanAttr.errorCause]: stringifyCause(err.cause),\n\t\t\t\t\t}),\n\t\t\t\t\tEffect.as(null),\n\t\t\t\t);\n\t\t\t}),\n\t\t);\n\t\tif (raw === null || raw === undefined) return null;\n\t\treturn yield* decodeUnknown(OnchainCoinMetadataShape, raw, {\n\t\t\tsource: 'coin metadata RPC response',\n\t\t\tmkError: (issue) => issue,\n\t\t}).pipe(\n\t\t\tEffect.catch((issue) =>\n\t\t\t\tEffect.logWarning(\n\t\t\t\t\t'coin metadata response had non-conforming shape; degrading to null',\n\t\t\t\t).pipe(\n\t\t\t\t\tEffect.annotateLogs({\n\t\t\t\t\t\t[SpanAttr.coinType]: fullCoinType,\n\t\t\t\t\t\t[SpanAttr.errorCause]: stringifyCause(issue.cause ?? issue),\n\t\t\t\t\t}),\n\t\t\t\t\tEffect.as(null as OnchainCoinMetadata | null),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t}).pipe(Effect.withSpan('coin.metadata.fetch', { attributes: { fullCoinType } }));\n\n/** Batch-fetch with cache. Each fullCoinType is asked at most once\n * per Layer-invocation. The fetches run concurrently — distilled-doc\n * opportunity (\"Coin discovery is naturally batchable\"). */\nexport const fetchCoinMetadataMany = (\n\tsdk: MetadataSdkShim,\n\tfullCoinTypes: ReadonlyArray<string>,\n\tcache: CoinMetadataCache,\n): Effect.Effect<ReadonlyMap<string, OnchainCoinMetadata | null>> =>\n\tEffect.gen(function* () {\n\t\tconst result = new Map<string, OnchainCoinMetadata | null>();\n\t\tyield* Effect.forEach(\n\t\t\tfullCoinTypes,\n\t\t\t(fullCoinType) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst cached = yield* cache.get(fullCoinType);\n\t\t\t\t\tif (cached !== undefined) {\n\t\t\t\t\t\tresult.set(fullCoinType, cached);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst fetched = yield* fetchCoinMetadataOnce(sdk, fullCoinType);\n\t\t\t\t\tyield* cache.put(fullCoinType, fetched);\n\t\t\t\t\tresult.set(fullCoinType, fetched);\n\t\t\t\t}),\n\t\t\t{ concurrency: 'unbounded' },\n\t\t);\n\t\treturn result;\n\t});\n\n/** Bare-coin-type heuristic — distilled-doc 13-coin.md Invariant 3.\n *\n * MUST agree with what `getCoinMetadata` accepts as a coin-type\n * argument: `0xHEX::module::Witness`. Anything else (symbol, witness\n * alone) falls through to the registry path. */\nexport const isBareCoinType = (s: string): boolean => {\n\tif (!s.startsWith('0x')) return false;\n\tif (!s.includes('::')) return false;\n\tif (s.split('::').length !== 3) return false;\n\t// Distilled-doc invariant 7: nested generics rejected at the\n\t// bare-string boundary too. The check fires before the RPC so\n\t// callers see a typed error rather than a downstream decode\n\t// failure.\n\tif (s.includes('<') || s.includes('>')) return false;\n\treturn true;\n};\n\n/** Project a coin-type validation failure to `CoinError`. Surfaces\n * the nested-generic case at the user-facing factory boundary. */\nexport const validateBareCoinType = (identifier: string): CoinError | null => {\n\tif (identifier.includes('<') || identifier.includes('>')) {\n\t\treturn coinError('nested-generic', {\n\t\t\tidentifier,\n\t\t\tmessage: `coin('${identifier}'): nested generics not supported.`,\n\t\t});\n\t}\n\treturn null;\n};\n\nconst stringifyCause = (cause: unknown): string => {\n\tif (cause instanceof Error) return cause.message;\n\tif (typeof cause === 'string') return cause;\n\ttry {\n\t\treturn JSON.stringify(cause);\n\t} catch {\n\t\treturn String(cause);\n\t}\n};\n"],"mappings":";;;;;;;AAuBA,MAAa,4BAA4B;;;AAIzC,MAAa,0BAA0B,wBAAwB,KAAK,EAAE;;;;;;;;;;;;AAatE,MAAa,2BAA2B,OAAO,OAAO;CACrD,IAAI,OAAO;CACX,UAAU,OAAO;CACjB,MAAM,OAAO;CACb,QAAQ,OAAO;CACf,aAAa,OAAO,SAAS,OAAO,OAAO;CAC3C,SAAS,OAAO,SAAS,OAAO,OAAO;CACvC,CAAC;;;;;;;;AAwCF,MAAa,yBACZ,KACA,iBAEA,OAAO,IAAI,aAAa;CACvB,MAAM,MAAe,OAAO,OAAO,WAAW;EAC7C,WAAW,IAAI,KAAK,gBAAgB,EAAE,UAAU,cAAc,CAAC;EAC/D,QAAQ,WAA8D;GACrE,MAAM;GACN;GACA;EACD,CAAC,CAAC,KAKF,OAAO,cAAc;EACpB,UAAU,GAAG,0BAA0B;EACvC,cAAc,OAAO,KAAK;GAAE,MAAM;GAAgB,OAAO;GAAW,CAAC;EACrE,CAAC,EACF,OAAO,MAAM,wBAAwB,EACrC,OAAO,OAAO,QAAgC;AAC7C,SAAO,OAAO,WAAW,qDAAqD,CAAC,KAC9E,OAAO,aAAa;IAClB,SAAS,WAAW;IACpB,SAAS,aAAa,eAAe,IAAI,MAAM;GAChD,CAAC,EACF,OAAO,GAAG,KAAK,CACf;GACA,CACF;AACD,KAAI,QAAQ,QAAQ,QAAQ,KAAA,EAAW,QAAO;AAC9C,QAAO,OAAO,cAAc,0BAA0B,KAAK;EAC1D,QAAQ;EACR,UAAU,UAAU;EACpB,CAAC,CAAC,KACF,OAAO,OAAO,UACb,OAAO,WACN,qEACA,CAAC,KACD,OAAO,aAAa;GAClB,SAAS,WAAW;GACpB,SAAS,aAAa,eAAe,MAAM,SAAS,MAAM;EAC3D,CAAC,EACF,OAAO,GAAG,KAAmC,CAC7C,CACD,CACD;EACA,CAAC,KAAK,OAAO,SAAS,uBAAuB,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC,CAAC;;;;;;AAmClF,MAAa,kBAAkB,MAAuB;AACrD,KAAI,CAAC,EAAE,WAAW,KAAK,CAAE,QAAO;AAChC,KAAI,CAAC,EAAE,SAAS,KAAK,CAAE,QAAO;AAC9B,KAAI,EAAE,MAAM,KAAK,CAAC,WAAW,EAAG,QAAO;AAKvC,KAAI,EAAE,SAAS,IAAI,IAAI,EAAE,SAAS,IAAI,CAAE,QAAO;AAC/C,QAAO;;;;AAKR,MAAa,wBAAwB,eAAyC;AAC7E,KAAI,WAAW,SAAS,IAAI,IAAI,WAAW,SAAS,IAAI,CACvD,QAAO,UAAU,kBAAkB;EAClC;EACA,SAAS,SAAS,WAAW;EAC7B,CAAC;AAEH,QAAO;;AAGR,MAAM,kBAAkB,UAA2B;AAClD,KAAI,iBAAiB,MAAO,QAAO,MAAM;AACzC,KAAI,OAAO,UAAU,SAAU,QAAO;AACtC,KAAI;AACH,SAAO,KAAK,UAAU,MAAM;SACrB;AACP,SAAO,OAAO,MAAM"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Effect, Schema, Scope } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/coin/mint.d.ts
|
|
4
|
+
/** Sign+execute surface narrowed from `AccountValue.signAndExecute`.
|
|
5
|
+
* We don't import `AccountValue` directly to avoid a layering cycle —
|
|
6
|
+
* the Account plugin imports nothing from coin, so coin re-publishes
|
|
7
|
+
* the structural shape. */
|
|
8
|
+
interface MintTransactionSigner {
|
|
9
|
+
readonly signAndExecute: (tx: Uint8Array) => Effect.Effect<{
|
|
10
|
+
readonly digest: string;
|
|
11
|
+
readonly objectChanges: ReadonlyArray<unknown>;
|
|
12
|
+
}, {
|
|
13
|
+
readonly _tag: 'AccountSignError';
|
|
14
|
+
readonly message: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
interface MintSigner extends MintTransactionSigner {
|
|
18
|
+
readonly address: string;
|
|
19
|
+
readonly withTransactionSigner: <A, E, R>(body: (signer: MintTransactionSigner) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
20
|
+
}
|
|
21
|
+
interface MintResult {
|
|
22
|
+
/** Tx digest of the producing mint. `null` on the verify-hit path:
|
|
23
|
+
* the artifact publisher's cache-hit verify returns the decoded probe shape
|
|
24
|
+
* (which doesn't carry the digest); callers that need the digest
|
|
25
|
+
* on cache hit consult the artifact publisher cache directly. */
|
|
26
|
+
readonly digest: string | null;
|
|
27
|
+
readonly mintedCoinId: string;
|
|
28
|
+
readonly recipient: string;
|
|
29
|
+
readonly amount: bigint;
|
|
30
|
+
readonly fullCoinType: string;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { MintResult, MintSigner };
|
|
34
|
+
//# sourceMappingURL=mint.d.mts.map
|