• NB: To be used only in tests. An app with this may not survive a reboot.

    This helper makes Swingset controllers and automatically initializes the SwingSet if it isn't already. It will not work for use cases that need to configure devices.

    The official API does these as two separate steps because the two sometimes need to happen at different times. In particular, sometimes you need the host to be able to control whether or not to initialize independent of the SwingSet's history. Also sometimes you want different runtime options for the two stages; this can happen, for example, in some debugging cases.

    Parameters

    • config: SwingSetConfig
    • argv: string[] = []
    • runtimeOptions: {
          debugPrefix?: string;
          env?: Record<string, string>;
          kernelBundles?: Record<string, Bundle>;
          kernelStorage?: SwingStoreKernelStorage;
          slogCallbacks?: unknown;
          slogSender?: SlogSender;
          testTrackDecref?: unknown;
          verbose?: boolean;
          warehousePolicy?: VatWarehousePolicy;
      } = {}
      • OptionaldebugPrefix?: string
      • Optionalenv?: Record<string, string>
      • OptionalkernelBundles?: Record<string, Bundle>
      • OptionalkernelStorage?: SwingStoreKernelStorage
      • OptionalslogCallbacks?: unknown
      • OptionalslogSender?: SlogSender
      • OptionaltestTrackDecref?: unknown
      • Optionalverbose?: boolean
      • OptionalwarehousePolicy?: VatWarehousePolicy
    • deviceEndowments: Record<string, unknown> = {}

    Returns Promise<{
        bootstrapResult: undefined | string;
        debug: {
            addDeviceHook: ((deviceName: any, hookName: any, hook: any) => void);
        };
        injectQueuedUpgradeEvents: (() => void);
        shutdown: (() => Promise<void>);
        validateAndInstallBundle: ((bundle: EndoZipBase64Bundle, allegedBundleID??: string) => Promise<string>);
        writeSlogObject: ((obj: any) => void);
        changeKernelOptions(options: any): void;
        deviceNameToID(deviceName: any): undefined | string;
        dump(): {
            acceptanceQueue: any[];
            gcActions: any[];
            kernelTable: any[];
            log: string[];
            objects: (undefined | string | number)[][];
            promises: ({
                decider: undefined | string;
                id: string;
                policy: string;
                queue: string[];
                refCount: number;
                state: "unresolved";
                subscribers: string[];
            } | {
                data: SwingSetCapData;
                id: string;
                refCount: number;
                state: "rejected" | "fulfilled";
            })[];
            reapQueue: any;
            runQueue: any[];
            vatTables: {
                state: {
                    transcript: [number, TranscriptEntry][];
                };
                vatID: string;
            }[];
        };
        getActivityhash(): string;
        getStats(): {};
        getStatus(): {
            activeVats: {
                id: string;
                options: RecordedVatOptions;
            }[];
        };
        kpRegisterInterest(kpid: any): void;
        kpResolution(kpid: any, options: any): SwingSetCapData;
        kpStatus(kpid: any):
            | "rejected"
            | "fulfilled"
            | "unknown"
            | "unresolved";
        log(str: any): void;
        pinVatRoot(vatName: any): string;
        queueToVatObject(target: any, method: string | symbol, args?: unknown[], resultPolicy?: ResolutionPolicy): undefined | string;
        queueToVatRoot(vatName: string, method: string | symbol, args?: unknown[], resultPolicy?: ResolutionPolicy): undefined | string;
        reapAllVats(): void;
        run(policy?: RunPolicy): Promise<number>;
        step(): Promise<0 | 1>;
        terminateVat(vatID: string, reasonCD: SwingSetCapData): void;
        upgradeStaticVat(vatName: any, shouldPauseFirst: any, bundleID: any, options?: {}): undefined | string;
        vatNameToID(vatName: any): string;
        verboseDebugMode(flag: any): void;
    }>