import { storeJson } from '../fileModels/storeJson' import { actionGroups } from '../actionGroups' import { i18n } from '../i18n' import { sdk } from '../sdk' export const enableSubspaces = sdk.Action.withoutInput( // id 'enable-subspaces', // metadata async ({ effects }) => { const current = await storeJson.read((s) => s.enableSubspaces).once() return { name: i18n('Enable Subspaces'), description: i18n( 'Turn on the embedded Subspaces service (off-chain Bitcoin handles). Starts three prebuilt daemons — subs (Web UI), subs-prover, and registry-server — each on its own interface. Service restarts automatically. subs loads the existing `default` spaces wallet; create it first via the Space-CLI Web UI (`spaces createwallet`) if you have not already.', ), warning: null, allowedStatuses: 'any', group: actionGroups.subspaces, visibility: current === true ? 'hidden' : 'enabled', } }, // run async ({ effects }) => { await storeJson.merge(effects, { enableSubspaces: true }) return { version: '1', title: i18n('Success'), message: i18n( 'Subspaces enabled. The service is restarting; the Subspaces Web UI (7777), Prover (8888), and Registry (8081) interfaces come up once their daemons are healthy.', ), result: null, } }, )