Skip to content

Commit

Permalink
refactor: simplify ExtraInvitationMaker (#10044)
Browse files Browse the repository at this point in the history
refs: #10023

## Description
@0xpatrickdev points out it doesn't need to return a vow

### Security Considerations
n/a
### Scaling Considerations
n/a

### Documentation Considerations
n/a

### Testing Considerations
Should not affect tests

### Upgrade Considerations
undeployed
  • Loading branch information
mergify[bot] authored Sep 7, 2024
2 parents 0fbe81c + 0a4804e commit 67275c2
Showing 1 changed file with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* actions with an ICA account.
*/
import { AmountShape } from '@agoric/ertp';
import { VowShape } from '@agoric/vow';
import { M } from '@endo/patterns';
import { prepareCombineInvitationMakers } from '../exos/combine-invitation-makers.js';
import { CosmosOrchestrationInvitationMakersInterface } from '../exos/cosmos-orchestration-account.js';
Expand Down Expand Up @@ -50,15 +49,10 @@ const emptyOfferShape = harden({
* @param {Zone} zone
* @param {OrchestrationTools} tools
*/
const contract = async (
zcf,
privateArgs,
zone,
{ orchestrateAll, vowTools },
) => {
const contract = async (zcf, privateArgs, zone, { orchestrateAll }) => {
const ExtraInvitationMakerInterface = M.interface('', {
DepositAndDelegate: M.call(M.array()).returns(VowShape),
UndelegateAndTransfer: M.call(M.array()).returns(VowShape),
DepositAndDelegate: M.call(M.array()).returns(M.promise()),
UndelegateAndTransfer: M.call(M.array()).returns(M.promise()),
});
/** @type {any} XXX async membrane */
const makeExtraInvitationMaker = zone.exoClass(
Expand All @@ -72,7 +66,7 @@ const contract = async (
DepositAndDelegate() {
const { account } = this.state;

const invP = zcf.makeInvitation(
return zcf.makeInvitation(
(seat, validatorAddr, amountArg) =>
// eslint-disable-next-line no-use-before-define -- defined by orchestrateAll, necessarily after this
orchFns.depositAndDelegate(account, seat, validatorAddr, amountArg),
Expand All @@ -84,24 +78,20 @@ const contract = async (
},
},
);

return vowTools.watch(invP);
},
/**
* @param {Omit<Delegation, 'delegatorAddress'>[]} delegations
*/
UndelegateAndTransfer(delegations) {
const { account } = this.state;

const invP = zcf.makeInvitation(
return zcf.makeInvitation(
// eslint-disable-next-line no-use-before-define -- defined by orchestrateAll, necessarily after this
() => orchFns.undelegateAndTransfer(account, delegations),
'Undelegate and transfer',
undefined,
emptyOfferShape,
);

return vowTools.watch(invP);
},
},
);
Expand Down

0 comments on commit 67275c2

Please sign in to comment.