Skip to content

Commit

Permalink
fix(zoe): add terms to invite details
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Mar 14, 2023
1 parent 185d264 commit 1111e6c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 7 additions & 1 deletion packages/zoe/src/typeGuards.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,17 @@ export const isAfterDeadlineExitRule = exit => {
return exitKey === 'afterDeadline';
};

export const AnyTermsShape = M.splitRecord({
issuers: M.recordOf(KeywordShape, IssuerShape),
brands: M.recordOf(KeywordShape, BrandShape),
});

export const InvitationElementShape = M.splitRecord({
description: M.string(),
handle: InvitationHandleShape,
instance: InstanceHandleShape,
installation: InstallationShape,
terms: AnyTermsShape,
});

export const OfferHandlerI = M.interface('OfferHandler', {
Expand Down Expand Up @@ -312,7 +318,7 @@ export const ZoeServiceI = M.interface('ZoeService', {
install: M.call(M.any()).returns(M.promise()),
installBundleID: M.call(M.string()).returns(M.promise()),
startInstance: M.call(M.eref(InstallationShape))
.optional(IssuerPKeywordRecordShape, M.any(), M.any())
.optional(IssuerPKeywordRecordShape, M.key(), M.opt(M.record()))
.returns(M.promise()),
offer: M.call(M.eref(InvitationShape))
.optional(ProposalShape, PaymentPKeywordRecordShape, M.any())
Expand Down
1 change: 1 addition & 0 deletions packages/zoe/src/zoeService/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
* @typedef {object} InvitationDetails
* @property {Installation} installation
* @property {import('./utils').Instance<any>} instance
* @property {AnyTerms} terms
* @property {InvitationHandle} handle
* @property {string} description
* @property {Record<string, any>} [customDetails]
Expand Down
7 changes: 4 additions & 3 deletions packages/zoe/src/zoeService/zoeStorageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,17 @@ export const makeZoeStorageManager = (
ownKeys(customDetails).length >= 1
? harden({ customDetails })
: harden({});
const instanceRecord = state.instanceState.getInstanceRecord();
const invitationAmount = AmountMath.make(
invitationKit.brand,
harden([
{
...extraProperties,
description: desc,
handle,
instance: state.instanceState.getInstanceRecord().instance,
installation:
state.instanceState.getInstanceRecord().installation,
instance: instanceRecord.instance,
installation: instanceRecord.installation,
terms: instanceRecord.terms,
},
]),
);
Expand Down

0 comments on commit 1111e6c

Please sign in to comment.