@agoric/zoe 0.27.0-u19.2 → 0.27.0-u20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/bundles/bundle-contractFacet-js-meta.json +322 -327
  2. package/bundles/bundle-contractFacet.js +1 -1
  3. package/package.json +29 -29
  4. package/src/cleanProposal.d.ts +2 -0
  5. package/src/cleanProposal.d.ts.map +1 -1
  6. package/src/cleanProposal.js +4 -2
  7. package/src/contractFacet/exit.d.ts +1 -1
  8. package/src/contractFacet/exit.d.ts.map +1 -1
  9. package/src/contractFacet/offerHandlerStorage.d.ts +1 -1
  10. package/src/contractFacet/rightsConservation.d.ts.map +1 -1
  11. package/src/contractFacet/rightsConservation.js +0 -1
  12. package/src/contractFacet/types.d.ts +184 -0
  13. package/src/contractFacet/types.d.ts.map +1 -0
  14. package/src/contractFacet/{types-ambient.d.ts → types.ts} +66 -29
  15. package/src/contractFacet/vatRoot.d.ts +8 -2
  16. package/src/contractFacet/vatRoot.d.ts.map +1 -1
  17. package/src/contractFacet/vatRoot.js +5 -4
  18. package/src/contractFacet/zcfMint.d.ts +3 -2
  19. package/src/contractFacet/zcfMint.d.ts.map +1 -1
  20. package/src/contractFacet/zcfMint.js +7 -7
  21. package/src/contractFacet/zcfSeat.js +2 -2
  22. package/src/contractFacet/zcfZygote.d.ts +9 -1
  23. package/src/contractFacet/zcfZygote.d.ts.map +1 -1
  24. package/src/contractFacet/zcfZygote.js +17 -5
  25. package/src/contractSupport/atomicTransfer.d.ts +6 -0
  26. package/src/contractSupport/atomicTransfer.d.ts.map +1 -1
  27. package/src/contractSupport/atomicTransfer.js +4 -0
  28. package/src/contractSupport/bondingCurves.js +1 -1
  29. package/src/contractSupport/index.d.ts +2 -2
  30. package/src/contractSupport/index.js +2 -19
  31. package/src/contractSupport/priceAuthorityInitial.d.ts +2 -0
  32. package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
  33. package/src/contractSupport/priceAuthorityInitial.js +3 -1
  34. package/src/contractSupport/types-ambient.d.ts.map +1 -1
  35. package/src/contractSupport/types-ambient.js +1 -0
  36. package/src/contractSupport/zoeHelpers.d.ts +6 -1
  37. package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
  38. package/src/contractSupport/zoeHelpers.js +1 -0
  39. package/src/contracts/atomicSwap.d.ts +1 -1
  40. package/src/contracts/auction/index.d.ts +3 -3
  41. package/src/contracts/automaticRefund.d.ts +3 -3
  42. package/src/contracts/autoswap.d.ts +4 -0
  43. package/src/contracts/autoswap.d.ts.map +1 -1
  44. package/src/contracts/autoswap.js +4 -0
  45. package/src/contracts/barterExchange.d.ts +2 -2
  46. package/src/contracts/callSpread/fundedCallSpread.d.ts +1 -1
  47. package/src/contracts/callSpread/pricedCallSpread.d.ts +4 -4
  48. package/src/contracts/coveredCall-durable.d.ts +1 -1
  49. package/src/contracts/coveredCall.d.ts +1 -1
  50. package/src/contracts/loan/index.d.ts +1 -1
  51. package/src/contracts/loan/types-ambient.d.ts +13 -13
  52. package/src/contracts/loan/types-ambient.d.ts.map +1 -1
  53. package/src/contracts/loan/types-ambient.js +17 -17
  54. package/src/contracts/mintPayments.d.ts +2 -2
  55. package/src/contracts/oracle.d.ts +3 -0
  56. package/src/contracts/oracle.d.ts.map +1 -1
  57. package/src/contracts/oracle.js +1 -0
  58. package/src/contracts/priceAggregator.d.ts +2 -0
  59. package/src/contracts/priceAggregator.d.ts.map +1 -1
  60. package/src/contracts/priceAggregator.js +10 -8
  61. package/src/contracts/scaledPriceAuthority.d.ts +1 -0
  62. package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
  63. package/src/contracts/scaledPriceAuthority.js +1 -0
  64. package/src/contracts/sellItems.d.ts +1 -1
  65. package/src/contracts/simpleExchange.d.ts +5 -0
  66. package/src/contracts/simpleExchange.d.ts.map +1 -1
  67. package/src/contracts/simpleExchange.js +4 -0
  68. package/src/contracts/types-ambient.d.ts +7 -7
  69. package/src/contracts/types-ambient.d.ts.map +1 -1
  70. package/src/contracts/types-ambient.js +7 -7
  71. package/src/contracts/valueVow.contract.d.ts +5 -2
  72. package/src/contracts/valueVow.contract.d.ts.map +1 -1
  73. package/src/contracts/valueVow.contract.js +1 -0
  74. package/src/instanceRecordStorage.d.ts.map +1 -1
  75. package/src/instanceRecordStorage.js +3 -1
  76. package/src/internal-types.d.ts +15 -5
  77. package/src/internal-types.d.ts.map +1 -1
  78. package/src/internal-types.js +9 -4
  79. package/src/issuerRecord.d.ts +3 -2
  80. package/src/issuerRecord.d.ts.map +1 -1
  81. package/src/issuerRecord.js +6 -2
  82. package/src/issuerStorage.d.ts +3 -2
  83. package/src/issuerStorage.d.ts.map +1 -1
  84. package/src/issuerStorage.js +6 -5
  85. package/src/typeGuards.d.ts +10 -6
  86. package/src/typeGuards.d.ts.map +1 -1
  87. package/src/typeGuards.js +7 -5
  88. package/src/types-ambient.d.ts +0 -40
  89. package/src/types-ambient.d.ts.map +1 -1
  90. package/src/types-ambient.js +4 -42
  91. package/src/types-index.d.ts +4 -0
  92. package/src/types-index.js +2 -0
  93. package/src/types.d.ts +29 -0
  94. package/src/types.d.ts.map +1 -0
  95. package/src/types.ts +44 -0
  96. package/src/zoeService/feeMint.d.ts +1 -0
  97. package/src/zoeService/feeMint.d.ts.map +1 -1
  98. package/src/zoeService/feeMint.js +4 -0
  99. package/src/zoeService/installationStorage.d.ts +3 -2
  100. package/src/zoeService/installationStorage.d.ts.map +1 -1
  101. package/src/zoeService/installationStorage.js +2 -5
  102. package/src/zoeService/internal-types.d.ts +11 -3
  103. package/src/zoeService/internal-types.d.ts.map +1 -1
  104. package/src/zoeService/internal-types.js +9 -3
  105. package/src/zoeService/invitationQueries.d.ts +3 -3
  106. package/src/zoeService/invitationQueries.js +3 -3
  107. package/src/zoeService/makeInvitation.d.ts +1 -0
  108. package/src/zoeService/makeInvitation.d.ts.map +1 -1
  109. package/src/zoeService/makeInvitation.js +3 -0
  110. package/src/zoeService/offer/offer.d.ts +1 -0
  111. package/src/zoeService/offer/offer.d.ts.map +1 -1
  112. package/src/zoeService/offer/offer.js +3 -1
  113. package/src/zoeService/originalZoeSeat.d.ts.map +1 -1
  114. package/src/zoeService/originalZoeSeat.js +0 -1
  115. package/src/zoeService/startInstance.d.ts.map +1 -1
  116. package/src/zoeService/startInstance.js +0 -2
  117. package/src/zoeService/types-ambient.d.ts +0 -226
  118. package/src/zoeService/types-ambient.d.ts.map +1 -1
  119. package/src/zoeService/types-ambient.js +4 -327
  120. package/src/zoeService/types.d.ts +238 -0
  121. package/src/zoeService/types.d.ts.map +1 -0
  122. package/src/zoeService/types.ts +307 -0
  123. package/src/zoeService/utils.d.ts +13 -5
  124. package/src/zoeService/utils.test-d.ts +1 -0
  125. package/src/zoeService/zoe.d.ts +11 -1
  126. package/src/zoeService/zoe.d.ts.map +1 -1
  127. package/src/zoeService/zoe.js +8 -1
  128. package/src/zoeService/zoeSeat.d.ts.map +1 -1
  129. package/src/zoeService/zoeSeat.js +1 -2
  130. package/src/zoeService/zoeStorageManager.d.ts +5 -5
  131. package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
  132. package/src/zoeService/zoeStorageManager.js +4 -3
  133. package/tools/fakeVatAdmin.d.ts +9 -2
  134. package/tools/fakeVatAdmin.d.ts.map +1 -1
  135. package/tools/fakeVatAdmin.js +18 -10
  136. package/tools/manualPriceAuthority.d.ts +4 -1
  137. package/tools/manualPriceAuthority.d.ts.map +1 -1
  138. package/tools/manualPriceAuthority.js +1 -0
  139. package/tools/scriptedOracle.d.ts +6 -2
  140. package/tools/scriptedOracle.d.ts.map +1 -1
  141. package/tools/scriptedOracle.js +4 -0
  142. package/tools/setup-zoe.d.ts +12 -6
  143. package/tools/setup-zoe.d.ts.map +1 -1
  144. package/tools/setup-zoe.js +38 -5
  145. package/tools/test-utils.d.ts +1 -1
  146. package/tools/test-utils.js +1 -1
  147. package/tools/types.d.ts +1 -0
  148. package/tools/types.d.ts.map +1 -1
  149. package/tools/types.js +1 -0
  150. package/src/contractFacet/internal-types.d.ts +0 -8
  151. package/src/contractFacet/internal-types.d.ts.map +0 -1
  152. package/src/contractFacet/internal-types.js +0 -15
  153. package/src/contractFacet/types-ambient.js +0 -1
  154. package/src/contractSupport/ratio.d.ts +0 -37
  155. package/src/contractSupport/ratio.d.ts.map +0 -1
  156. package/src/contractSupport/ratio.js +0 -419
  157. package/src/contractSupport/safeMath.d.ts +0 -11
  158. package/src/contractSupport/safeMath.d.ts.map +0 -1
  159. package/src/contractSupport/safeMath.js +0 -49
@@ -0,0 +1,238 @@
1
+ import type { AnyAmount, AssetKind, DisplayInfo, Issuer, NatValue, Payment } from '@agoric/ertp';
2
+ import type { Subscriber } from '@agoric/notifier';
3
+ import type { ERef, EReturn } from '@endo/eventual-send';
4
+ import type { Bundle, BundleID } from '@agoric/swingset-vat';
5
+ import type { ContractStartFunction, StartParams } from './utils.js';
6
+ import type { Keyword, InvitationHandle, BrandKeywordRecord, Handle, IssuerKeywordRecord } from '../types.js';
7
+ import type { Allocation } from '../types-index.js';
8
+ /**
9
+ * @see {@link https://github.com/sindresorhus/type-fest/blob/main/source/is-any.d.ts}
10
+ */
11
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
12
+ /**
13
+ * Zoe provides a framework for deploying and working with smart
14
+ * contracts. It is accessed as a long-lived and well-trusted service
15
+ * that enforces offer safety for the contracts that use it. Zoe has a
16
+ * single `invitationIssuer` for the entirety of its lifetime. By
17
+ * having a reference to Zoe, a user can get the `invitationIssuer`
18
+ * and thus validate any `invitation` they receive from someone else.
19
+ *
20
+ * Zoe has two different facets: the public Zoe service and the
21
+ * contract facet (ZCF). Each contract instance has a copy of ZCF
22
+ * within its vat. The contract and ZCF never have direct access to
23
+ * the users' payments or the Zoe purses.
24
+ */
25
+ export type ZoeService = {
26
+ /**
27
+ * Zoe has a single `invitationIssuer` for the entirety of its
28
+ * lifetime. By having a reference to Zoe, a user can get the
29
+ * `invitationIssuer` and thus validate any `invitation` they receive
30
+ * from someone else. The mint associated with the invitationIssuer
31
+ * creates the ERTP payments that represent the right to interact with
32
+ * a smart contract in particular ways.
33
+ */
34
+ getInvitationIssuer: GetInvitationIssuer;
35
+ install: InstallBundle;
36
+ installBundleID: InstallBundleID;
37
+ startInstance: import('./utils.js').StartInstance;
38
+ offer: Offer;
39
+ getPublicFacet: <I extends Instance>(instance: ERef<I>) => Promise<IsAny<I> extends true ? any : I extends import('./utils.js').Instance<infer SF extends ContractStartFunction> ? IsAny<SF> extends true ? unknown : EReturn<SF>['publicFacet'] : never>;
40
+ getIssuers: GetIssuers;
41
+ getBrands: GetBrands;
42
+ getTerms: <I extends ERef<Instance>>(instance: I) => IsAny<I> extends true ? Promise<any> : I extends ERef<import('./utils.js').Instance<infer SF extends ContractStartFunction>> ? IsAny<SF> extends true ? Promise<unknown> : Promise<StartParams<SF>['terms']> : never;
43
+ getOfferFilter: (instance: ERef<Instance>) => Promise<string[]>;
44
+ getInstallationForInstance: GetInstallationForInstance;
45
+ getInstance: GetInstance;
46
+ getInstallation: GetInstallation;
47
+ /**
48
+ * Return an object with the instance, installation, description, invitation
49
+ * handle, and any custom properties specific to the contract.
50
+ */
51
+ getInvitationDetails: GetInvitationDetails;
52
+ getFeeIssuer: GetFeeIssuer;
53
+ getConfiguration: GetConfiguration;
54
+ getBundleIDFromInstallation: GetBundleIDFromInstallation;
55
+ /**
56
+ * Return the pattern (if any) associated with the invitationHandle that a
57
+ * proposal is required to match to be accepted by zoe.offer().
58
+ */
59
+ getProposalShapeForInvitation: (invitationHandle: InvitationHandle) => import('@endo/patterns').Pattern | undefined;
60
+ };
61
+ type GetInvitationIssuer = () => Promise<Issuer<'set', InvitationDetails>>;
62
+ type GetFeeIssuer = () => Promise<Issuer<'nat'>>;
63
+ type GetConfiguration = () => {
64
+ feeIssuerConfig: FeeIssuerConfig;
65
+ };
66
+ export type GetIssuers = (instance: import('./utils.js').Instance<any>) => Promise<IssuerKeywordRecord>;
67
+ export type GetBrands = (instance: import('./utils.js').Instance<any>) => Promise<BrandKeywordRecord>;
68
+ type GetInstallationForInstance = (instance: import('./utils.js').Instance<any>) => Promise<Installation>;
69
+ export type GetInstance = (invitation: ERef<import('../types-index.js').Invitation>) => Promise<import('./utils.js').Instance<any>>;
70
+ export type GetInstallation = (invitation: ERef<import('../types-index.js').Invitation>) => Promise<Installation>;
71
+ export type GetInvitationDetails = (invitation: ERef<import('../types-index.js').Invitation<any, any>>) => Promise<InvitationDetails>;
72
+ /**
73
+ * Create an installation by safely evaluating the code and
74
+ * registering it with Zoe. Returns an installation.
75
+ */
76
+ export type InstallBundle = (bundle: Bundle | SourceBundle, bundleLabel?: string | undefined) => Promise<Installation>;
77
+ /**
78
+ * Create an installation from a Bundle ID. Returns an installation.
79
+ */
80
+ export type InstallBundleID = (bundleID: BundleID, bundleLabel?: string | undefined) => Promise<Installation>;
81
+ /**
82
+ * Verify that an alleged Installation is real, and return the Bundle ID it
83
+ * will use for contract code.
84
+ */
85
+ export type GetBundleIDFromInstallation = (allegedInstallation: ERef<Installation>) => Promise<string>;
86
+ /**
87
+ * To redeem an invitation, the user normally provides a proposal (their
88
+ * rules for the offer) as well as payments to be escrowed by Zoe. If
89
+ * either the proposal or payments would be empty, indicate this by
90
+ * omitting that argument or passing undefined, rather than passing an
91
+ * empty record.
92
+ *
93
+ * The proposal has three parts: `want` and `give` are used by Zoe to
94
+ * enforce offer safety, and `exit` is used to specify the particular
95
+ * payout-liveness policy that Zoe can guarantee. `want` and `give`
96
+ * are objects with keywords as keys and amounts as values.
97
+ * `paymentKeywordRecord` is a record with keywords as keys, and the
98
+ * values are the actual payments to be escrowed. A payment is
99
+ * expected for every rule under `give`.
100
+ */
101
+ export type Offer = <Result, Args = undefined>(invitation: ERef<import('../types-index.js').Invitation<Result, Args>>, proposal?: Proposal, paymentKeywordRecord?: PaymentPKeywordRecord, offerArgs?: Args) => Promise<UserSeat<Result>>;
102
+ /**
103
+ * Zoe uses seats to access or manipulate offers. They let contracts and users
104
+ * interact with them. Zoe has two kinds of seats. ZCFSeats are used within
105
+ * contracts and with zcf methods. UserSeats represent offers external to Zoe
106
+ * and the contract. The party who exercises an invitation and sends the offer()
107
+ * message to Zoe gets a UserSeat that can check payouts' status or retrieve the
108
+ * result of processing the offer in the contract. This varies, but examples are
109
+ * a string and an invitation for another seat.
110
+ *
111
+ * Also, a UserSeat can be handed to an agent outside Zoe and the contract,
112
+ * letting them query or monitor the current state, access the payouts and
113
+ * result, and, if it's allowed for this seat, call tryExit().
114
+ *
115
+ * Since anyone can attempt to exit the seat if they have a reference to it, you
116
+ * should only share a UserSeat with trusted parties.
117
+ *
118
+ * UserSeat includes queries for the associated offer's current state and an
119
+ * operation to request that the offer exit, as follows:
120
+ */
121
+ export type UserSeat<OR = unknown> = {
122
+ getProposal: () => Promise<ProposalRecord>;
123
+ /**
124
+ * returns a promise for a KeywordPaymentRecord containing all the payouts from
125
+ * this seat. The promise will resolve after the seat has exited.
126
+ */
127
+ getPayouts: () => Promise<PaymentPKeywordRecord>;
128
+ /**
129
+ * returns a promise for the Payment corresponding to the indicated keyword.
130
+ * The promise will resolve after the seat has exited. If there is no payment
131
+ * corresponding to the keyword, an error will be thrown. (It used to return
132
+ * undefined.)
133
+ */
134
+ getPayout: (keyword: Keyword) => Promise<Payment<any, any>>;
135
+ getOfferResult: () => Promise<OR>;
136
+ /**
137
+ * Note: Only works if the seat's `proposal` has an `OnDemand` `exit` clause. Zoe's
138
+ * offer-safety guarantee applies no matter how a seat's interaction with a
139
+ * contract ends. Under normal circumstances, the participant might be able to
140
+ * call `tryExit()`, or the contract might do something explicitly. On exiting,
141
+ * the seat holder gets its current `allocation` and the `seat` can no longer
142
+ * interact with the contract.
143
+ */
144
+ tryExit?: (() => void) | undefined;
145
+ /**
146
+ * Returns true if the seat has exited, false if it is still active.
147
+ */
148
+ hasExited: () => Promise<boolean>;
149
+ /**
150
+ * returns 1 if the proposal's
151
+ * want clause was satisfied by the final allocation, otherwise 0. This is
152
+ * numeric to support a planned enhancement called "multiples" which will allow
153
+ * the return value to be any non-negative number. The promise will resolve
154
+ * after the seat has exited.
155
+ */
156
+ numWantsSatisfied: () => Promise<0 | 1>;
157
+ /**
158
+ * return a promise for the final allocation. The promise will resolve after the
159
+ * seat has exited.
160
+ */
161
+ getFinalAllocation: () => Promise<Allocation>;
162
+ /**
163
+ * returns a subscriber that
164
+ * will be notified when the seat has exited or failed.
165
+ */
166
+ getExitSubscriber: () => Subscriber<import('../types-index.js').Completion>;
167
+ };
168
+ export type Proposal = Partial<ProposalRecord>;
169
+ export type ProposalRecord = {
170
+ give: AmountKeywordRecord;
171
+ want: AmountKeywordRecord;
172
+ exit: ExitRule;
173
+ };
174
+ /**
175
+ * The keys are keywords, and the values are amounts. For example:
176
+ * { Asset: AmountMath.make(assetBrand, 5n), Price:
177
+ * AmountMath.make(priceBrand, 9n) }
178
+ */
179
+ export type AmountKeywordRecord = Record<Keyword, AnyAmount>;
180
+ export type Waker = {
181
+ wake: () => void;
182
+ };
183
+ export type OnDemandExitRule = {
184
+ onDemand: null;
185
+ };
186
+ export type WaivedExitRule = {
187
+ waived: null;
188
+ };
189
+ export type AfterDeadlineExitRule = {
190
+ afterDeadline: {
191
+ timer: import('@agoric/time').TimerService;
192
+ deadline: import('@agoric/time').Timestamp;
193
+ };
194
+ };
195
+ /**
196
+ * The possible keys are 'waived', 'onDemand', and 'afterDeadline'.
197
+ * `timer` and `deadline` only are used for the `afterDeadline` key.
198
+ * The possible records are:
199
+ * `{ waived: null }`
200
+ * `{ onDemand: null }`
201
+ * `{ afterDeadline: { timer :Timer<Deadline>, deadline :Deadline } }`
202
+ */
203
+ export type ExitRule = OnDemandExitRule | WaivedExitRule | AfterDeadlineExitRule;
204
+ export type Instance<SF = any> = import('./utils.js').Instance<SF>;
205
+ export type ZCFSpec = {
206
+ bundleCap: import('@agoric/swingset-vat').BundleCap;
207
+ } | {
208
+ name: string;
209
+ } | {
210
+ /** Bundle ID */
211
+ id: string;
212
+ };
213
+ /**
214
+ * Opaque type for a JSONable source bundle
215
+ */
216
+ export type SourceBundle = Record<string, any>;
217
+ export type PaymentPKeywordRecord = Record<Keyword, ERef<Payment<any>>>;
218
+ export type PaymentKeywordRecord = Record<Keyword, Payment<any>>;
219
+ export type InvitationDetails = {
220
+ installation: Installation;
221
+ instance: import('./utils.js').Instance<any>;
222
+ handle: InvitationHandle;
223
+ description: string;
224
+ customDetails?: Record<string, any> | undefined;
225
+ };
226
+ export type Installation<SF = any> = import('./utils.js').Installation<SF>;
227
+ export type InstallationStart<I extends Installation> = import('./utils.js').InstallationStart<I>;
228
+ export type FeeIssuerConfig = {
229
+ name: string;
230
+ assetKind: AssetKind;
231
+ displayInfo: DisplayInfo;
232
+ };
233
+ export type ZoeFeesConfig = {
234
+ getPublicFacetFee: NatValue;
235
+ };
236
+ export type FeeMintAccess = Handle<'feeMintAccess'>;
237
+ export {};
238
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,MAAM,EACN,QAAQ,EACR,OAAO,EACR,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EACV,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,MAAM,EACN,mBAAmB,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,KAAK,KAAK,CAAC,CAAC,I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C;AAC5C,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,iBAAiB,EAAE,QAAQ,CAAC;CAC7B,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC"}
@@ -0,0 +1,307 @@
1
+ import type {
2
+ AnyAmount,
3
+ AssetKind,
4
+ DisplayInfo,
5
+ Issuer,
6
+ NatValue,
7
+ Payment,
8
+ } from '@agoric/ertp';
9
+ import type { Subscriber } from '@agoric/notifier';
10
+ import type { ERef, EReturn } from '@endo/eventual-send';
11
+ import type { Bundle, BundleID } from '@agoric/swingset-vat';
12
+ import type { ContractStartFunction, StartParams } from './utils.js';
13
+ import type {
14
+ Keyword,
15
+ InvitationHandle,
16
+ BrandKeywordRecord,
17
+ Handle,
18
+ IssuerKeywordRecord,
19
+ } from '../types.js';
20
+ import type { Allocation } from '../types-index.js';
21
+
22
+ /**
23
+ * @see {@link https://github.com/sindresorhus/type-fest/blob/main/source/is-any.d.ts}
24
+ */
25
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
26
+
27
+ /**
28
+ * Zoe provides a framework for deploying and working with smart
29
+ * contracts. It is accessed as a long-lived and well-trusted service
30
+ * that enforces offer safety for the contracts that use it. Zoe has a
31
+ * single `invitationIssuer` for the entirety of its lifetime. By
32
+ * having a reference to Zoe, a user can get the `invitationIssuer`
33
+ * and thus validate any `invitation` they receive from someone else.
34
+ *
35
+ * Zoe has two different facets: the public Zoe service and the
36
+ * contract facet (ZCF). Each contract instance has a copy of ZCF
37
+ * within its vat. The contract and ZCF never have direct access to
38
+ * the users' payments or the Zoe purses.
39
+ */
40
+ export type ZoeService = {
41
+ /**
42
+ * Zoe has a single `invitationIssuer` for the entirety of its
43
+ * lifetime. By having a reference to Zoe, a user can get the
44
+ * `invitationIssuer` and thus validate any `invitation` they receive
45
+ * from someone else. The mint associated with the invitationIssuer
46
+ * creates the ERTP payments that represent the right to interact with
47
+ * a smart contract in particular ways.
48
+ */
49
+ getInvitationIssuer: GetInvitationIssuer;
50
+ install: InstallBundle;
51
+ installBundleID: InstallBundleID;
52
+ startInstance: import('./utils.js').StartInstance;
53
+ offer: Offer;
54
+ getPublicFacet: <I extends Instance>(
55
+ instance: ERef<I>,
56
+ ) => Promise<
57
+ IsAny<I> extends true
58
+ ? any
59
+ : I extends import('./utils.js').Instance<
60
+ infer SF extends ContractStartFunction
61
+ >
62
+ ? IsAny<SF> extends true
63
+ ? unknown
64
+ : EReturn<SF>['publicFacet']
65
+ : never
66
+ >;
67
+ getIssuers: GetIssuers;
68
+ getBrands: GetBrands;
69
+ getTerms: <I extends ERef<Instance>>(
70
+ instance: I,
71
+ ) => IsAny<I> extends true
72
+ ? Promise<any>
73
+ : I extends ERef<
74
+ import('./utils.js').Instance<infer SF extends ContractStartFunction>
75
+ >
76
+ ? IsAny<SF> extends true
77
+ ? Promise<unknown>
78
+ : Promise<StartParams<SF>['terms']>
79
+ : never;
80
+ getOfferFilter: (instance: ERef<Instance>) => Promise<string[]>;
81
+ getInstallationForInstance: GetInstallationForInstance;
82
+ getInstance: GetInstance;
83
+ getInstallation: GetInstallation;
84
+ /**
85
+ * Return an object with the instance, installation, description, invitation
86
+ * handle, and any custom properties specific to the contract.
87
+ */
88
+ getInvitationDetails: GetInvitationDetails;
89
+ getFeeIssuer: GetFeeIssuer;
90
+ getConfiguration: GetConfiguration;
91
+ getBundleIDFromInstallation: GetBundleIDFromInstallation;
92
+ /**
93
+ * Return the pattern (if any) associated with the invitationHandle that a
94
+ * proposal is required to match to be accepted by zoe.offer().
95
+ */
96
+ getProposalShapeForInvitation: (
97
+ invitationHandle: InvitationHandle,
98
+ ) => import('@endo/patterns').Pattern | undefined;
99
+ };
100
+ type GetInvitationIssuer = () => Promise<Issuer<'set', InvitationDetails>>;
101
+ type GetFeeIssuer = () => Promise<Issuer<'nat'>>;
102
+ type GetConfiguration = () => {
103
+ feeIssuerConfig: FeeIssuerConfig;
104
+ };
105
+ export type GetIssuers = (
106
+ instance: import('./utils.js').Instance<any>,
107
+ ) => Promise<IssuerKeywordRecord>;
108
+ export type GetBrands = (
109
+ instance: import('./utils.js').Instance<any>,
110
+ ) => Promise<BrandKeywordRecord>;
111
+ type GetInstallationForInstance = (
112
+ instance: import('./utils.js').Instance<any>,
113
+ ) => Promise<Installation>;
114
+ export type GetInstance = (
115
+ invitation: ERef<import('../types-index.js').Invitation>,
116
+ ) => Promise<import('./utils.js').Instance<any>>;
117
+ export type GetInstallation = (
118
+ invitation: ERef<import('../types-index.js').Invitation>,
119
+ ) => Promise<Installation>;
120
+ export type GetInvitationDetails = (
121
+ invitation: ERef<import('../types-index.js').Invitation<any, any>>,
122
+ ) => Promise<InvitationDetails>;
123
+ /**
124
+ * Create an installation by safely evaluating the code and
125
+ * registering it with Zoe. Returns an installation.
126
+ */
127
+ export type InstallBundle = (
128
+ bundle: Bundle | SourceBundle,
129
+ bundleLabel?: string | undefined,
130
+ ) => Promise<Installation>;
131
+ /**
132
+ * Create an installation from a Bundle ID. Returns an installation.
133
+ */
134
+ export type InstallBundleID = (
135
+ bundleID: BundleID,
136
+ bundleLabel?: string | undefined,
137
+ ) => Promise<Installation>;
138
+ /**
139
+ * Verify that an alleged Installation is real, and return the Bundle ID it
140
+ * will use for contract code.
141
+ */
142
+ export type GetBundleIDFromInstallation = (
143
+ allegedInstallation: ERef<Installation>,
144
+ ) => Promise<string>;
145
+ /**
146
+ * To redeem an invitation, the user normally provides a proposal (their
147
+ * rules for the offer) as well as payments to be escrowed by Zoe. If
148
+ * either the proposal or payments would be empty, indicate this by
149
+ * omitting that argument or passing undefined, rather than passing an
150
+ * empty record.
151
+ *
152
+ * The proposal has three parts: `want` and `give` are used by Zoe to
153
+ * enforce offer safety, and `exit` is used to specify the particular
154
+ * payout-liveness policy that Zoe can guarantee. `want` and `give`
155
+ * are objects with keywords as keys and amounts as values.
156
+ * `paymentKeywordRecord` is a record with keywords as keys, and the
157
+ * values are the actual payments to be escrowed. A payment is
158
+ * expected for every rule under `give`.
159
+ */
160
+ export type Offer = <Result, Args = undefined>(
161
+ invitation: ERef<import('../types-index.js').Invitation<Result, Args>>,
162
+ proposal?: Proposal,
163
+ paymentKeywordRecord?: PaymentPKeywordRecord,
164
+ offerArgs?: Args,
165
+ ) => Promise<UserSeat<Result>>;
166
+ /**
167
+ * Zoe uses seats to access or manipulate offers. They let contracts and users
168
+ * interact with them. Zoe has two kinds of seats. ZCFSeats are used within
169
+ * contracts and with zcf methods. UserSeats represent offers external to Zoe
170
+ * and the contract. The party who exercises an invitation and sends the offer()
171
+ * message to Zoe gets a UserSeat that can check payouts' status or retrieve the
172
+ * result of processing the offer in the contract. This varies, but examples are
173
+ * a string and an invitation for another seat.
174
+ *
175
+ * Also, a UserSeat can be handed to an agent outside Zoe and the contract,
176
+ * letting them query or monitor the current state, access the payouts and
177
+ * result, and, if it's allowed for this seat, call tryExit().
178
+ *
179
+ * Since anyone can attempt to exit the seat if they have a reference to it, you
180
+ * should only share a UserSeat with trusted parties.
181
+ *
182
+ * UserSeat includes queries for the associated offer's current state and an
183
+ * operation to request that the offer exit, as follows:
184
+ */
185
+ export type UserSeat<OR = unknown> = {
186
+ getProposal: () => Promise<ProposalRecord>;
187
+ /**
188
+ * returns a promise for a KeywordPaymentRecord containing all the payouts from
189
+ * this seat. The promise will resolve after the seat has exited.
190
+ */
191
+ getPayouts: () => Promise<PaymentPKeywordRecord>;
192
+ /**
193
+ * returns a promise for the Payment corresponding to the indicated keyword.
194
+ * The promise will resolve after the seat has exited. If there is no payment
195
+ * corresponding to the keyword, an error will be thrown. (It used to return
196
+ * undefined.)
197
+ */
198
+ getPayout: (keyword: Keyword) => Promise<Payment<any, any>>;
199
+ getOfferResult: () => Promise<OR>;
200
+ /**
201
+ * Note: Only works if the seat's `proposal` has an `OnDemand` `exit` clause. Zoe's
202
+ * offer-safety guarantee applies no matter how a seat's interaction with a
203
+ * contract ends. Under normal circumstances, the participant might be able to
204
+ * call `tryExit()`, or the contract might do something explicitly. On exiting,
205
+ * the seat holder gets its current `allocation` and the `seat` can no longer
206
+ * interact with the contract.
207
+ */
208
+ tryExit?: (() => void) | undefined;
209
+ /**
210
+ * Returns true if the seat has exited, false if it is still active.
211
+ */
212
+ hasExited: () => Promise<boolean>;
213
+ /**
214
+ * returns 1 if the proposal's
215
+ * want clause was satisfied by the final allocation, otherwise 0. This is
216
+ * numeric to support a planned enhancement called "multiples" which will allow
217
+ * the return value to be any non-negative number. The promise will resolve
218
+ * after the seat has exited.
219
+ */
220
+ numWantsSatisfied: () => Promise<0 | 1>;
221
+ /**
222
+ * return a promise for the final allocation. The promise will resolve after the
223
+ * seat has exited.
224
+ */
225
+ getFinalAllocation: () => Promise<Allocation>;
226
+ /**
227
+ * returns a subscriber that
228
+ * will be notified when the seat has exited or failed.
229
+ */
230
+ getExitSubscriber: () => Subscriber<import('../types-index.js').Completion>;
231
+ };
232
+ export type Proposal = Partial<ProposalRecord>;
233
+ export type ProposalRecord = {
234
+ give: AmountKeywordRecord;
235
+ want: AmountKeywordRecord;
236
+ exit: ExitRule;
237
+ };
238
+ /**
239
+ * The keys are keywords, and the values are amounts. For example:
240
+ * { Asset: AmountMath.make(assetBrand, 5n), Price:
241
+ * AmountMath.make(priceBrand, 9n) }
242
+ */
243
+ export type AmountKeywordRecord = Record<Keyword, AnyAmount>;
244
+ export type Waker = {
245
+ wake: () => void;
246
+ };
247
+ export type OnDemandExitRule = {
248
+ onDemand: null;
249
+ };
250
+ export type WaivedExitRule = {
251
+ waived: null;
252
+ };
253
+ export type AfterDeadlineExitRule = {
254
+ afterDeadline: {
255
+ timer: import('@agoric/time').TimerService;
256
+ deadline: import('@agoric/time').Timestamp;
257
+ };
258
+ };
259
+ /**
260
+ * The possible keys are 'waived', 'onDemand', and 'afterDeadline'.
261
+ * `timer` and `deadline` only are used for the `afterDeadline` key.
262
+ * The possible records are:
263
+ * `{ waived: null }`
264
+ * `{ onDemand: null }`
265
+ * `{ afterDeadline: { timer :Timer<Deadline>, deadline :Deadline } }`
266
+ */
267
+ export type ExitRule =
268
+ | OnDemandExitRule
269
+ | WaivedExitRule
270
+ | AfterDeadlineExitRule;
271
+ export type Instance<SF = any> = import('./utils.js').Instance<SF>;
272
+ export type ZCFSpec =
273
+ | {
274
+ bundleCap: import('@agoric/swingset-vat').BundleCap;
275
+ }
276
+ | {
277
+ name: string;
278
+ }
279
+ | {
280
+ /** Bundle ID */
281
+ id: string;
282
+ };
283
+ /**
284
+ * Opaque type for a JSONable source bundle
285
+ */
286
+ export type SourceBundle = Record<string, any>;
287
+ export type PaymentPKeywordRecord = Record<Keyword, ERef<Payment<any>>>;
288
+ export type PaymentKeywordRecord = Record<Keyword, Payment<any>>;
289
+ export type InvitationDetails = {
290
+ installation: Installation;
291
+ instance: import('./utils.js').Instance<any>;
292
+ handle: InvitationHandle;
293
+ description: string;
294
+ customDetails?: Record<string, any> | undefined;
295
+ };
296
+ export type Installation<SF = any> = import('./utils.js').Installation<SF>;
297
+ export type InstallationStart<I extends Installation> =
298
+ import('./utils.js').InstallationStart<I>;
299
+ export type FeeIssuerConfig = {
300
+ name: string;
301
+ assetKind: AssetKind;
302
+ displayInfo: DisplayInfo;
303
+ };
304
+ export type ZoeFeesConfig = {
305
+ getPublicFacetFee: NatValue;
306
+ };
307
+ export type FeeMintAccess = Handle<'feeMintAccess'>;
@@ -1,13 +1,10 @@
1
- // Ambient types
2
- import '../types-ambient.js';
3
- import '../contractFacet/types-ambient.js';
4
-
5
1
  import type { Issuer } from '@agoric/ertp/src/types.js';
6
2
  import type { TagContainer } from '@agoric/internal/src/tagged.js';
7
3
  import type { Baggage } from '@agoric/swingset-liveslots';
8
4
  import type { VatUpgradeResults } from '@agoric/swingset-vat';
9
5
  import type { RemotableObject } from '@endo/marshal';
10
6
  import type { FarRef } from '@endo/far';
7
+ import type { AnyTerms, Handle, Keyword, ZCF } from '../types-index.js';
11
8
 
12
9
  // XXX https://github.com/Agoric/agoric-sdk/issues/4565
13
10
  type SourceBundle = Record<string, any>;
@@ -29,7 +26,7 @@ export type InstallationStart<I> =
29
26
  I extends Installation<infer SF> ? SF : never;
30
27
 
31
28
  export type ContractStartFunction = (
32
- zcf?: ZCF,
29
+ zcf?: ZCF<any>,
33
30
  privateArgs?: object,
34
31
  baggage?: Baggage,
35
32
  ) => ERef<{ creatorFacet?: object; publicFacet?: object }>;
@@ -66,6 +63,8 @@ type ZcfOf<SF extends ContractStartFunction> = Parameters<SF>[0] extends ZCF
66
63
  : ZCF<any>;
67
64
 
68
65
  /**
66
+ * @deprecated use the SF to pass the type
67
+ *
69
68
  * Convenience record for contract start function, merging its result with params.
70
69
  */
71
70
  export type ContractOf<S extends (...args: any) => any> = StartParams<S> &
@@ -125,3 +124,12 @@ export type GetTerms = <SF>(instance: Instance<SF>) => Promise<
125
124
  : // XXX returning `any` in this case
126
125
  any
127
126
  >;
127
+
128
+ export type InstanceRecord = {
129
+ installation: Installation<any>;
130
+ instance: Instance<any>;
131
+ /**
132
+ * - contract parameters
133
+ */
134
+ terms: AnyTerms;
135
+ };
@@ -1,5 +1,6 @@
1
1
  import { E } from '@endo/far';
2
2
  import type { StartedInstanceKit } from './utils.js';
3
+ import type { ZCF } from '../types-index.js';
3
4
 
4
5
  const someContractStartFn = (
5
6
  zcf: ZCF,
@@ -1,5 +1,10 @@
1
+ export * from "../types-index.js";
1
2
  export type ZoeKit = ReturnType<typeof makeDurableZoeKit>;
2
- /** @import {Baggage} from '@agoric/vat-data' */
3
+ /**
4
+ * @import {VatAdminSvc} from '@agoric/swingset-vat';
5
+ * @import {Baggage} from '@agoric/vat-data';
6
+ * @import {FeeIssuerConfig, FeeMintAccess, ZCFSpec, ZoeService} from './types.js';
7
+ */
3
8
  /**
4
9
  * Create a durable instance of Zoe.
5
10
  *
@@ -55,4 +60,9 @@ export function makeZoeKit(vatAdminSvc?: Promise<VatAdminSvc> | VatAdminSvc, shu
55
60
  setVatAdminService: ((lateVatAdminSvc: any) => void) & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, (lateVatAdminSvc: any) => void>;
56
61
  };
57
62
  import type { Baggage } from '@agoric/vat-data';
63
+ import type { VatAdminSvc } from '@agoric/swingset-vat';
64
+ import type { FeeIssuerConfig } from './types.js';
65
+ import type { ZCFSpec } from './types.js';
66
+ import type { ZoeService } from './types.js';
67
+ import type { FeeMintAccess } from './types.js';
58
68
  //# sourceMappingURL=zoe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zoe.d.ts","sourceRoot":"","sources":["zoe.js"],"names":[],"mappings":"qBAiSa,UAAU,CAAC,OAAO,iBAAiB,CAAC;AAnQjD,gDAAgD;AAEhD;;;;;;;;;;;;;GAaG;AACH,0GAVG;IAAyB,UAAU,EAA3B,OAAO;IACsC,WAAW;IAGK,cAAc;IAGjD,eAAe;IACvB,OAAO;CACnC;;;;;IAgNG,4BAA4B;mBAAjB,aAAa;;EAK3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,yCATW,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,mBAGlC,OAAO,sBAAsB,EAAE,mBAAmB,oBAGlD,eAAe,YACf,OAAO;;;;;IArBd,4BAA4B;mBAAjB,aAAa;;EA8BxB;6BA7PuB,kBAAkB"}
1
+ {"version":3,"file":"zoe.d.ts","sourceRoot":"","sources":["zoe.js"],"names":[],"mappings":";qBAqSa,UAAU,CAAC,OAAO,iBAAiB,CAAC;AAvQjD;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AACH,0GAVG;IAAyB,UAAU,EAA3B,OAAO;IACsC,WAAW;IAGK,cAAc;IAGjD,eAAe;IACvB,OAAO;CACnC;;;;;IAgNG,4BAA4B;mBAAjB,aAAa;;EAK3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,yCATW,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,mBAGlC,OAAO,sBAAsB,EAAE,mBAAmB,oBAGlD,eAAe,YACf,OAAO;;;;;IArBd,4BAA4B;mBAAjB,aAAa;;EA8BxB;6BA/PsB,kBAAkB;iCADd,sBAAsB;qCAEkB,YAAY;6BAAZ,YAAY;gCAAZ,YAAY;mCAAZ,YAAY"}
@@ -28,7 +28,11 @@ import { getZcfBundleCap } from './createZCFVat.js';
28
28
  import { defaultFeeIssuerConfig, prepareFeeMint } from './feeMint.js';
29
29
  import { ZoeServiceI } from '../typeGuards.js';
30
30
 
31
- /** @import {Baggage} from '@agoric/vat-data' */
31
+ /**
32
+ * @import {VatAdminSvc} from '@agoric/swingset-vat';
33
+ * @import {Baggage} from '@agoric/vat-data';
34
+ * @import {FeeIssuerConfig, FeeMintAccess, ZCFSpec, ZoeService} from './types.js';
35
+ */
32
36
 
33
37
  /**
34
38
  * Create a durable instance of Zoe.
@@ -289,3 +293,6 @@ export { makeDurableZoeKit, makeZoeKit };
289
293
  /**
290
294
  * @typedef {ReturnType<typeof makeDurableZoeKit>} ZoeKit
291
295
  */
296
+
297
+ // eslint-disable-next-line import/export -- no named value exports; only types
298
+ export * from '../types-index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"zoeSeat.d.ts","sourceRoot":"","sources":["zoeSeat.js"],"names":[],"mappings":"AAmDO,iDAFI,OAAO,kBAAkB,EAAE,OAAO,uBA0WhC,UAAU,YACV,cAAc,uBACd,mBAAmB,iBACnB,aAAa,YACb,IAAI,CAAC,OAAO,CAAC,2BACb,OAAO;;;;;;;;;;;;;;;;QA3IZ,wCAAwC;8DAA5B,iBAAiB;;;;EAoKpC"}
1
+ {"version":3,"file":"zoeSeat.d.ts","sourceRoot":"","sources":["zoeSeat.js"],"names":[],"mappings":"AAkDO,iDAFI,OAAO,kBAAkB,EAAE,OAAO,uBA0WhC,UAAU,YACV,cAAc,uBACd,mBAAmB,iBACnB,aAAa,YACb,IAAI,CAAC,OAAO,CAAC,2BACb,OAAO;;;;;;;;;;;;;;;;QA3IZ,wCAAwC;8DAA5B,iBAAiB;;;;EAoKpC"}
@@ -7,8 +7,7 @@ import { makePromiseKit } from '@endo/promise-kit';
7
7
  import { NonNullish } from '@agoric/internal';
8
8
 
9
9
  import { satisfiesWant } from '../contractFacet/offerSafety.js';
10
- import '../types-ambient.js';
11
- import '../internal-types.js';
10
+
12
11
  import {
13
12
  declareOldZoeSeatAdminKind,
14
13
  OriginalZoeSeatIKit,