diff --git a/packages/orchestration/src/facade.js b/packages/orchestration/src/facade.js index 8229c3583318..45feb3e1770a 100644 --- a/packages/orchestration/src/facade.js +++ b/packages/orchestration/src/facade.js @@ -52,8 +52,6 @@ export const makeOrchestrationFacade = ({ const { prepareEndowment, asyncFlow, adminAsyncFlow } = asyncFlowTools; - const { when } = vowTools; - /** * @template RT - return type * @template HC - host context @@ -66,7 +64,7 @@ export const makeOrchestrationFacade = ({ * guestCtx: GuestInterface, * ...args: GA * ) => Promise} guestFn - * @returns {(...args: HostArgs) => Promise} + * @returns {(...args: HostArgs) => Vow} */ const orchestrate = (durableName, hostCtx, guestFn) => { const subZone = zone.subZone(durableName); @@ -81,10 +79,8 @@ export const makeOrchestrationFacade = ({ const hostFn = asyncFlow(subZone, 'asyncFlow', guestFn); const orcFn = (...args) => - // TODO remove the `when` after fixing the return type - // to `Vow` // @ts-expect-error cast - when(hostFn(wrappedOrc, wrappedCtx, ...args)); + hostFn(wrappedOrc, wrappedCtx, ...args); // @ts-expect-error cast return harden(orcFn); diff --git a/packages/orchestration/test/examples/basic-flows.contract.test.ts b/packages/orchestration/test/examples/basic-flows.contract.test.ts index ae166c506a20..a7b975c1cd19 100644 --- a/packages/orchestration/test/examples/basic-flows.contract.test.ts +++ b/packages/orchestration/test/examples/basic-flows.contract.test.ts @@ -61,12 +61,17 @@ const orchestrationAccountScenario = test.macro({ return t.fail(`Unknown chain: ${chainName}`); } - const { zoe, instance } = t.context; + const { + bootstrap: { vowTools: vt }, + zoe, + instance, + } = t.context; const publicFacet = await E(zoe).getPublicFacet(instance); const inv = E(publicFacet).makeOrchAccountInvitation(); const userSeat = E(zoe).offer(inv, {}, undefined, { chainName }); - const { invitationMakers, publicSubscribers } = - await E(userSeat).getOfferResult(); + const { invitationMakers, publicSubscribers } = await vt.when( + E(userSeat).getOfferResult(), + ); t.regex(getInterfaceOf(invitationMakers)!, /invitationMakers/); diff --git a/packages/orchestration/test/examples/sendAnywhere.test.ts b/packages/orchestration/test/examples/sendAnywhere.test.ts index fb4007be4e14..d3536e73e8c9 100644 --- a/packages/orchestration/test/examples/sendAnywhere.test.ts +++ b/packages/orchestration/test/examples/sendAnywhere.test.ts @@ -60,6 +60,7 @@ test('send using arbitrary chain info', async t => { brands: { ist }, utils: { inspectLocalBridge, pourPayment }, } = await commonSetup(t); + const vt = bootstrap.vowTools; const { zoe, bundleAndInstall } = await setUpZoeForTest(); @@ -121,7 +122,7 @@ test('send using arbitrary chain info', async t => { { Send }, { destAddr: 'hot1destAddr', chainName }, ); - await E(userSeat).getOfferResult(); + await vt.when(E(userSeat).getOfferResult()); const history = inspectLocalBridge(); t.like(history, [ @@ -154,7 +155,7 @@ test('send using arbitrary chain info', async t => { { Send }, { destAddr: 'cosmos1destAddr', chainName: 'cosmoshub' }, ); - await E(userSeat).getOfferResult(); + await vt.when(E(userSeat).getOfferResult()); const history = inspectLocalBridge(); const { messages, address: execAddr } = history.at(-1); t.is(messages.length, 1); @@ -200,7 +201,7 @@ test('send using arbitrary chain info', async t => { { Send }, { destAddr: 'hot1destAddr', chainName: 'hot' }, ); - await E(userSeat).getOfferResult(); + await vt.when(E(userSeat).getOfferResult()); const history = inspectLocalBridge(); const { messages, address: execAddr } = history.at(-1); t.is(messages.length, 1); diff --git a/packages/orchestration/test/examples/swapExample.test.ts b/packages/orchestration/test/examples/swapExample.test.ts index 37de86dc079d..f87ab716969b 100644 --- a/packages/orchestration/test/examples/swapExample.test.ts +++ b/packages/orchestration/test/examples/swapExample.test.ts @@ -68,7 +68,8 @@ test.skip('start', async t => { } as const, }, ); - const result = await E(userSeat).getOfferResult(); + const vt = bootstrap.vowTools; + const result = await vt.when(E(userSeat).getOfferResult()); t.is(result, undefined); // bank purse now has the 10 IST diff --git a/packages/orchestration/test/examples/unbondExample.test.ts b/packages/orchestration/test/examples/unbondExample.test.ts index 8cda01ebb180..830353380f42 100644 --- a/packages/orchestration/test/examples/unbondExample.test.ts +++ b/packages/orchestration/test/examples/unbondExample.test.ts @@ -14,6 +14,7 @@ type StartFn = test('start', async t => { const { + bootstrap: { vowTools: vt }, brands: { ist }, commonPrivateArgs, } = await commonSetup(t); @@ -47,7 +48,7 @@ test('start', async t => { {}, { validator: 'agoric1valopsfufu' }, ); - const result = await E(userSeat).getOfferResult(); + const result = await vt.when(E(userSeat).getOfferResult()); t.is(result, undefined); const tree = inspectMapStore(contractBaggage); diff --git a/packages/orchestration/test/facade.test.ts b/packages/orchestration/test/facade.test.ts index 1e0e594f9645..5132770fa5a1 100644 --- a/packages/orchestration/test/facade.test.ts +++ b/packages/orchestration/test/facade.test.ts @@ -76,7 +76,7 @@ test.serial('chain info', async t => { return orc.getChain('mock'); }); - const result = (await handle()) as Chain; + const result = (await vt.when(handle())) as Chain; t.deepEqual(await vt.when(result.getChainInfo()), mockChainInfo); }); @@ -122,7 +122,7 @@ test.serial('faulty chain info', async t => { return account; }); - await t.throwsAsync(handle(), { + await t.throwsAsync(vt.when(handle()), { message: 'chain info lacks staking denom', }); });