Helper that a contract start function can use to set up the objects needed for orchestration.

TODO strip problematic operations from ZCF (e.g., getPayouts)

  • Parameters

    • zcf: ZCF<Record<string, unknown>>
    • baggage: Baggage
    • remotePowers: OrchestrationPowers
    • marshaller: {
          fromCapData: FromCapData<unknown>;
          serialize: ToCapData<unknown>;
          toCapData: ToCapData<unknown>;
          unserialize: FromCapData<unknown>;
      }
      • fromCapData: FromCapData<unknown>
      • serialize: ToCapData<unknown>

        use toCapData

      • toCapData: ToCapData<unknown>
      • unserialize: FromCapData<unknown>

        use fromCapData

    Returns {
        asyncFlowTools: {
            adminAsyncFlow: Guarded<{
                getFailures(): CopyMap<any, Passable>;
                getFlowForOutcomeVow(outcomeVow: any): any;
                wakeAll(): void;
            }>;
            allWokenP: Promise<void>;
            asyncFlow: (<F>(zone: Zone, tag: string, guestFunc: F, options??: {
                startEager?: boolean;
            }) => HostOf<F>);
            prepareAsyncFlowKit: ((zone: Zone, tag: string, guestAsyncFunc: GuestAsyncFunc, options??: {
                startEager?: boolean;
            }) => ((activationArgs: any) => GuardedKit<{
                admin: {
                    complete(): void;
                    panic(fatalProblem: any): never;
                    reset(): void;
                };
                flow: {
                    dump(): (
                        | [op: "doFulfill", vow: Vow<(...)>, fulfillment: Passable]
                        | [op: "doReject", vow: Vow<(...)>, reason: Passable]
                        | [op: "doReturn", callIndex: number, result: Passable]
                        | [op: "doThrow", callIndex: number, problem: Passable]
                        | [op: "checkCall", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                        | [op: "checkSendOnly", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                        | [op: "checkSend", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number])[];
                    getFlowState(): FlowState;
                    getOptFatalProblem(): any;
                    getOutcome(): Vow<any>;
                    restart(eager??: boolean): void;
                    wake(): void;
                };
                wakeWatcher: {
                    onFulfilled(_fulfillment: any): void;
                    onRejected(_fulfillment: any): void;
                };
            }>));
            prepareEndowment: ((zone: Zone, tag: string, e: unknown) => any);
        };
        baggage: Baggage;
        chainHub: Guarded<{
            getAsset(denom: string, srcChainName: string): undefined | DenomDetail;
            getChainInfo<K>(chainName: K): Vow<ActualChainInfo<K>>;
            getChainsAndConnection<C1, C2>(primaryName: C1, counterName: C2): Vow<[ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]>;
            getConnectionInfo(primary: string | {
                chainId: string;
            }, counter: string | {
                chainId: string;
            }): Vow<IBCConnectionInfo>;
            getDenom(brand: Brand): undefined | string;
            makeChainAddress(address: string): ChainAddress;
            makeTransferRoute(destination: ChainAddress, denomAmount: DenomAmount, srcChainName: string, forwardOpts?: {
                retries?: number;
                timeout?:
                    | `${number}s`
                    | `${number}m`
                    | `${number}h`
                    | `${number}ms`
                    | `${number}us`
                    | `${number}ns`;
            }): TransferRoute;
            registerAsset(denom: string, detail: DenomDetail): void;
            registerChain(name: string, chainInfo: Readonly<{
                bech32Prefix?: string;
                chainId: string;
                connections?: Record<string, IBCConnectionInfo>;
                icqEnabled?: boolean;
                pfmEnabled?: boolean;
                stakingTokens?: readonly {
                    denom: string;
                }[];
            }>): void;
            registerConnection(primaryChainId: string, counterpartyChainId: string, connectionInfo: IBCConnectionInfo): void;
        }>;
        makeOrchestrateKit: ((zone: Zone) => {
            orchestrate: (<HC, GF>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>);
            orchestrateAll: (<HC, GFM>(guestFns: GFM, hostCtx: HC) => {
                [N in string | number | symbol]: HostForGuest<GFM[N]>
            });
        });
        orchestrate: (<HC, GF>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>);
        orchestrateAll: (<HC, GFM>(guestFns: GFM, hostCtx: HC) => {
            [N in string | number | symbol]: HostForGuest<GFM[N]>
        });
        vowTools: VowTools;
        zcfTools: HostInterface<ZcfTools>;
        zoeTools: {
            localTransfer: ((...args: [srcSeat: ZCFSeat, localAccount: LocalAccountMethods, amounts: AmountKeywordRecord]) => Vow<void>);
            withdrawToSeat: ((...args: [localAccount: LocalAccountMethods, destSeat: ZCFSeat, amounts: AmountKeywordRecord]) => Vow<void>);
        };
        zone: Zone;
    }

    • asyncFlowTools: {
          adminAsyncFlow: Guarded<{
              getFailures(): CopyMap<any, Passable>;
              getFlowForOutcomeVow(outcomeVow: any): any;
              wakeAll(): void;
          }>;
          allWokenP: Promise<void>;
          asyncFlow: (<F>(zone: Zone, tag: string, guestFunc: F, options??: {
              startEager?: boolean;
          }) => HostOf<F>);
          prepareAsyncFlowKit: ((zone: Zone, tag: string, guestAsyncFunc: GuestAsyncFunc, options??: {
              startEager?: boolean;
          }) => ((activationArgs: any) => GuardedKit<{
              admin: {
                  complete(): void;
                  panic(fatalProblem: any): never;
                  reset(): void;
              };
              flow: {
                  dump(): (
                      | [op: "doFulfill", vow: Vow<(...)>, fulfillment: Passable]
                      | [op: "doReject", vow: Vow<(...)>, reason: Passable]
                      | [op: "doReturn", callIndex: number, result: Passable]
                      | [op: "doThrow", callIndex: number, problem: Passable]
                      | [op: "checkCall", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                      | [op: "checkSendOnly", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                      | [op: "checkSend", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number])[];
                  getFlowState(): FlowState;
                  getOptFatalProblem(): any;
                  getOutcome(): Vow<any>;
                  restart(eager??: boolean): void;
                  wake(): void;
              };
              wakeWatcher: {
                  onFulfilled(_fulfillment: any): void;
                  onRejected(_fulfillment: any): void;
              };
          }>));
          prepareEndowment: ((zone: Zone, tag: string, e: unknown) => any);
      }
      • adminAsyncFlow: Guarded<{
            getFailures(): CopyMap<any, Passable>;
            getFlowForOutcomeVow(outcomeVow: any): any;
            wakeAll(): void;
        }>
      • allWokenP: Promise<void>
      • asyncFlow: (<F>(zone: Zone, tag: string, guestFunc: F, options??: {
            startEager?: boolean;
        }) => HostOf<F>)
          • <F>(zone, tag, guestFunc, options?): HostOf<F>
          • Type Parameters

            Parameters

            • zone: Zone
            • tag: string
            • guestFunc: F
            • Optionaloptions: {
                  startEager?: boolean;
              } = undefined
              • OptionalstartEager?: boolean

            Returns HostOf<F>

      • prepareAsyncFlowKit: ((zone: Zone, tag: string, guestAsyncFunc: GuestAsyncFunc, options??: {
            startEager?: boolean;
        }) => ((activationArgs: any) => GuardedKit<{
            admin: {
                complete(): void;
                panic(fatalProblem: any): never;
                reset(): void;
            };
            flow: {
                dump(): (
                    | [op: "doFulfill", vow: Vow<(...)>, fulfillment: Passable]
                    | [op: "doReject", vow: Vow<(...)>, reason: Passable]
                    | [op: "doReturn", callIndex: number, result: Passable]
                    | [op: "doThrow", callIndex: number, problem: Passable]
                    | [op: "checkCall", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                    | [op: "checkSendOnly", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                    | [op: "checkSend", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number])[];
                getFlowState(): FlowState;
                getOptFatalProblem(): any;
                getOutcome(): Vow<any>;
                restart(eager??: boolean): void;
                wake(): void;
            };
            wakeWatcher: {
                onFulfilled(_fulfillment: any): void;
                onRejected(_fulfillment: any): void;
            };
        }>))
          • (zone, tag, guestAsyncFunc, options?): ((activationArgs: any) => GuardedKit<{
                admin: {
                    complete(): void;
                    panic(fatalProblem: any): never;
                    reset(): void;
                };
                flow: {
                    dump(): (
                        | [op: "doFulfill", vow: Vow<(...)>, fulfillment: Passable]
                        | [op: "doReject", vow: Vow<(...)>, reason: Passable]
                        | [op: "doReturn", callIndex: number, result: Passable]
                        | [op: "doThrow", callIndex: number, problem: Passable]
                        | [op: "checkCall", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                        | [op: "checkSendOnly", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                        | [op: "checkSend", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number])[];
                    getFlowState(): FlowState;
                    getOptFatalProblem(): any;
                    getOutcome(): Vow<any>;
                    restart(eager??: boolean): void;
                    wake(): void;
                };
                wakeWatcher: {
                    onFulfilled(_fulfillment: any): void;
                    onRejected(_fulfillment: any): void;
                };
            }>)
          • Parameters

            • zone: Zone
            • tag: string
            • guestAsyncFunc: GuestAsyncFunc
            • Optionaloptions: {
                  startEager?: boolean;
              } = {}
              • OptionalstartEager?: boolean

            Returns ((activationArgs: any) => GuardedKit<{
                admin: {
                    complete(): void;
                    panic(fatalProblem: any): never;
                    reset(): void;
                };
                flow: {
                    dump(): (
                        | [op: "doFulfill", vow: Vow<(...)>, fulfillment: Passable]
                        | [op: "doReject", vow: Vow<(...)>, reason: Passable]
                        | [op: "doReturn", callIndex: number, result: Passable]
                        | [op: "doThrow", callIndex: number, problem: Passable]
                        | [op: "checkCall", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                        | [op: "checkSendOnly", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                        | [op: "checkSend", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number])[];
                    getFlowState(): FlowState;
                    getOptFatalProblem(): any;
                    getOutcome(): Vow<any>;
                    restart(eager??: boolean): void;
                    wake(): void;
                };
                wakeWatcher: {
                    onFulfilled(_fulfillment: any): void;
                    onRejected(_fulfillment: any): void;
                };
            }>)

              • (activationArgs): GuardedKit<{
                    admin: {
                        complete(): void;
                        panic(fatalProblem: any): never;
                        reset(): void;
                    };
                    flow: {
                        dump(): (
                            | [op: "doFulfill", vow: Vow<(...)>, fulfillment: Passable]
                            | [op: "doReject", vow: Vow<(...)>, reason: Passable]
                            | [op: "doReturn", callIndex: number, result: Passable]
                            | [op: "doThrow", callIndex: number, problem: Passable]
                            | [op: "checkCall", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                            | [op: "checkSendOnly", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                            | [op: "checkSend", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number])[];
                        getFlowState(): FlowState;
                        getOptFatalProblem(): any;
                        getOutcome(): Vow<any>;
                        restart(eager??: boolean): void;
                        wake(): void;
                    };
                    wakeWatcher: {
                        onFulfilled(_fulfillment: any): void;
                        onRejected(_fulfillment: any): void;
                    };
                }>
              • Parameters

                • activationArgs: any

                Returns GuardedKit<{
                    admin: {
                        complete(): void;
                        panic(fatalProblem: any): never;
                        reset(): void;
                    };
                    flow: {
                        dump(): (
                            | [op: "doFulfill", vow: Vow<(...)>, fulfillment: Passable]
                            | [op: "doReject", vow: Vow<(...)>, reason: Passable]
                            | [op: "doReturn", callIndex: number, result: Passable]
                            | [op: "doThrow", callIndex: number, problem: Passable]
                            | [op: "checkCall", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                            | [op: "checkSendOnly", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number]
                            | [op: "checkSend", target: Passable, optVerb: (...) | (...), args: (...)[], callIndex: number])[];
                        getFlowState(): FlowState;
                        getOptFatalProblem(): any;
                        getOutcome(): Vow<any>;
                        restart(eager??: boolean): void;
                        wake(): void;
                    };
                    wakeWatcher: {
                        onFulfilled(_fulfillment: any): void;
                        onRejected(_fulfillment: any): void;
                    };
                }>

      • prepareEndowment: ((zone: Zone, tag: string, e: unknown) => any)
          • (zone, tag, e): any
          • Parameters

            • zone: Zone
            • tag: string
            • e: unknown

            Returns any

    • baggage: Baggage
    • chainHub: Guarded<{
          getAsset(denom: string, srcChainName: string): undefined | DenomDetail;
          getChainInfo<K>(chainName: K): Vow<ActualChainInfo<K>>;
          getChainsAndConnection<C1, C2>(primaryName: C1, counterName: C2): Vow<[ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]>;
          getConnectionInfo(primary: string | {
              chainId: string;
          }, counter: string | {
              chainId: string;
          }): Vow<IBCConnectionInfo>;
          getDenom(brand: Brand): undefined | string;
          makeChainAddress(address: string): ChainAddress;
          makeTransferRoute(destination: ChainAddress, denomAmount: DenomAmount, srcChainName: string, forwardOpts?: {
              retries?: number;
              timeout?:
                  | `${number}s`
                  | `${number}m`
                  | `${number}h`
                  | `${number}ms`
                  | `${number}us`
                  | `${number}ns`;
          }): TransferRoute;
          registerAsset(denom: string, detail: DenomDetail): void;
          registerChain(name: string, chainInfo: Readonly<{
              bech32Prefix?: string;
              chainId: string;
              connections?: Record<string, IBCConnectionInfo>;
              icqEnabled?: boolean;
              pfmEnabled?: boolean;
              stakingTokens?: readonly {
                  denom: string;
              }[];
          }>): void;
          registerConnection(primaryChainId: string, counterpartyChainId: string, connectionInfo: IBCConnectionInfo): void;
      }>
    • makeOrchestrateKit: ((zone: Zone) => {
          orchestrate: (<HC, GF>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>);
          orchestrateAll: (<HC, GFM>(guestFns: GFM, hostCtx: HC) => {
              [N in string | number | symbol]: HostForGuest<GFM[N]>
          });
      })
        • (zone): {
              orchestrate: (<HC, GF>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>);
              orchestrateAll: (<HC, GFM>(guestFns: GFM, hostCtx: HC) => {
                  [N in string | number | symbol]: HostForGuest<GFM[N]>
              });
          }
        • Create orchestrate functions in a specific zone, instead of the default contract.orchestration zone. This is used for modules that add their own orchestration functions (e.g., a Portfolio with orchestration flows for continuing offers)

          Parameters

          Returns {
              orchestrate: (<HC, GF>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>);
              orchestrateAll: (<HC, GFM>(guestFns: GFM, hostCtx: HC) => {
                  [N in string | number | symbol]: HostForGuest<GFM[N]>
              });
          }

          • orchestrate: (<HC, GF>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>)
              • <HC, GF>(durableName, hostCtx, guestFn): HostForGuest<GF>
              • Type Parameters

                Parameters

                • durableName: string

                  the orchestration flow identity in the zone (to resume across upgrades)

                • hostCtx: HC

                  values to pass through the async flow membrane

                • guestFn: GF

                Returns HostForGuest<GF>

          • orchestrateAll: (<HC, GFM>(guestFns: GFM, hostCtx: HC) => {
                [N in string | number | symbol]: HostForGuest<GFM[N]>
            })
              • <HC, GFM>(guestFns, hostCtx): {
                    [N in string | number | symbol]: HostForGuest<GFM[N]>
                }
              • Orchestrate all the guest functions.

                If the guestFns object is provided as a property of hostCtx the functions will be available within the other guests.

                NOTE multiple calls to this with the same guestFn name will fail

                Type Parameters

                Parameters

                Returns {
                    [N in string | number | symbol]: HostForGuest<GFM[N]>
                }

    • orchestrate: (<HC, GF>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>)
        • <HC, GF>(durableName, hostCtx, guestFn): HostForGuest<GF>
        • Type Parameters

          Parameters

          • durableName: string

            the orchestration flow identity in the zone (to resume across upgrades)

          • hostCtx: HC

            values to pass through the async flow membrane

          • guestFn: GF

          Returns HostForGuest<GF>

    • orchestrateAll: (<HC, GFM>(guestFns: GFM, hostCtx: HC) => {
          [N in string | number | symbol]: HostForGuest<GFM[N]>
      })
        • <HC, GFM>(guestFns, hostCtx): {
              [N in string | number | symbol]: HostForGuest<GFM[N]>
          }
        • Orchestrate all the guest functions.

          If the guestFns object is provided as a property of hostCtx the functions will be available within the other guests.

          NOTE multiple calls to this with the same guestFn name will fail

          Type Parameters

          Parameters

          Returns {
              [N in string | number | symbol]: HostForGuest<GFM[N]>
          }

    • vowTools: VowTools
    • zcfTools: HostInterface<ZcfTools>
    • zoeTools: {
          localTransfer: ((...args: [srcSeat: ZCFSeat, localAccount: LocalAccountMethods, amounts: AmountKeywordRecord]) => Vow<void>);
          withdrawToSeat: ((...args: [localAccount: LocalAccountMethods, destSeat: ZCFSeat, amounts: AmountKeywordRecord]) => Vow<void>);
      }
    • zone: Zone