From 7443b4082dd1a21dc6a191d46eea750b9c6f3127 Mon Sep 17 00:00:00 2001 From: 0xPatrick Date: Thu, 19 Sep 2024 12:04:13 -0400 Subject: [PATCH] fixup! feat: zoeTools.withdrawToSeat --- packages/orchestration/src/utils/zoe-tools.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/orchestration/src/utils/zoe-tools.js b/packages/orchestration/src/utils/zoe-tools.js index f2053eb9abf..af55c2087f4 100644 --- a/packages/orchestration/src/utils/zoe-tools.js +++ b/packages/orchestration/src/utils/zoe-tools.js @@ -34,8 +34,8 @@ const { assign, keys, values } = Object; /** * @typedef {( - * srcLocalAccount: LocalAccountMethods, - * recipientSeat: ZCFSeat, + * localAccount: LocalAccountMethods, + * destSeat: ZCFSeat, * amounts: AmountKeywordRecord, * ) => Promise} WithdrawToSeat */ @@ -84,7 +84,7 @@ export const makeZoeTools = ( keys(amounts).map(kw => E(userSeat).getPayout(kw)), ); const settleDeposits = await when( - allSettled(payments.map(pmt => localAccount.deposit(pmt))), + allSettled(payments.map(pmt => E(localAccount).deposit(pmt))), ); // if any of the deposits to localAccount failed, unwind all of the allocations if (settleDeposits.find(x => x.status === 'rejected')) { @@ -96,7 +96,7 @@ export const makeZoeTools = ( errors.push(x.reason); return payments[i]; } - return localAccount.withdraw(amts[i]); + return E(localAccount).withdraw(amts[i]); }); // return all payments to the srcSeat @@ -130,12 +130,12 @@ export const makeZoeTools = ( zone, 'withdrawToSeat', /** @type {WithdrawToSeat} */ - async (srcLocalAccount, recipientSeat, amounts) => { + async (localAccount, destSeat, amounts) => { await null; - !recipientSeat.hasExited() || Fail`The seat cannot have exited.`; + !destSeat.hasExited() || Fail`The seat cannot have exited.`; const settledWithdrawals = await when( - allSettled(values(amounts).map(amt => srcLocalAccount.withdraw(amt))), + allSettled(values(amounts).map(amt => E(localAccount).withdraw(amt))), ); // if any of the withdrawals were rejected, unwind the successful ones @@ -144,7 +144,7 @@ export const makeZoeTools = ( const errors = []; for (const result of settledWithdrawals) { if (result.status === 'fulfilled') { - returnPaymentVs.push(srcLocalAccount.deposit(result.value)); + returnPaymentVs.push(E(localAccount).deposit(result.value)); } else { errors.push(result.reason); } @@ -165,7 +165,7 @@ export const makeZoeTools = ( ); const depositResponse = await depositToSeat( zcf, - recipientSeat, + destSeat, amounts, paymentKwr, );