@agoric/zoe 0.26.3-dev-ecf2d8e.0 → 0.26.3-other-dev-70beeb7.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 (164) hide show
  1. package/CHANGELOG.md +1179 -0
  2. package/README.md +7 -7
  3. package/bundles/bundle-contractFacet-js-meta.json +319 -543
  4. package/bundles/bundle-contractFacet.d.ts +3 -3
  5. package/bundles/bundle-contractFacet.js +1 -1
  6. package/exported.js +1 -1
  7. package/package.json +23 -30
  8. package/src/cleanProposal.js +2 -2
  9. package/src/contractFacet/internal-types.d.ts +2 -2
  10. package/src/contractFacet/internal-types.d.ts.map +1 -1
  11. package/src/contractFacet/internal-types.js +1 -1
  12. package/src/contractFacet/types.d.ts +191 -0
  13. package/src/contractFacet/types.d.ts.map +1 -0
  14. package/src/contractFacet/types.js +256 -0
  15. package/src/contractFacet/vatRoot.d.ts +1 -1
  16. package/src/contractFacet/vatRoot.d.ts.map +1 -1
  17. package/src/contractFacet/zcfMint.d.ts +1 -1
  18. package/src/contractFacet/zcfMint.d.ts.map +1 -1
  19. package/src/contractFacet/zcfMint.js +1 -2
  20. package/src/contractFacet/zcfSeat.d.ts.map +1 -1
  21. package/src/contractFacet/zcfSeat.js +3 -105
  22. package/src/contractFacet/zcfZygote.d.ts +1 -1
  23. package/src/contractFacet/zcfZygote.d.ts.map +1 -1
  24. package/src/contractFacet/zcfZygote.js +33 -78
  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 +90 -5
  28. package/src/contractSupport/bondingCurves.js +2 -2
  29. package/src/contractSupport/durability.d.ts +2 -2
  30. package/src/contractSupport/durability.d.ts.map +1 -1
  31. package/src/contractSupport/durability.js +3 -3
  32. package/src/contractSupport/priceAuthority.d.ts +1 -16
  33. package/src/contractSupport/priceAuthority.d.ts.map +1 -1
  34. package/src/contractSupport/priceAuthority.js +1 -3
  35. package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
  36. package/src/contractSupport/priceAuthorityInitial.js +0 -1
  37. package/src/contractSupport/priceAuthorityQuoteMint.d.ts +1 -1
  38. package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -1
  39. package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -1
  40. package/src/contractSupport/priceAuthorityTransform.js +3 -2
  41. package/src/contractSupport/recorder.d.ts +4 -4
  42. package/src/contractSupport/recorder.d.ts.map +1 -1
  43. package/src/contractSupport/safeMath.d.ts +7 -7
  44. package/src/contractSupport/safeMath.d.ts.map +1 -1
  45. package/src/contractSupport/topics.d.ts +1 -1
  46. package/src/contractSupport/topics.d.ts.map +1 -1
  47. package/src/contractSupport/zoeHelpers.d.ts +1 -1
  48. package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
  49. package/src/contractSupport/zoeHelpers.js +11 -5
  50. package/src/contracts/atomicSwap.d.ts +1 -1
  51. package/src/contracts/auction/firstPriceLogic.d.ts.map +1 -1
  52. package/src/contracts/auction/firstPriceLogic.js +7 -5
  53. package/src/contracts/auction/index.d.ts +23 -1
  54. package/src/contracts/auction/index.d.ts.map +1 -1
  55. package/src/contracts/auction/index.js +0 -1
  56. package/src/contracts/auction/secondPriceLogic.d.ts.map +1 -1
  57. package/src/contracts/auction/secondPriceLogic.js +3 -1
  58. package/src/contracts/automaticRefund.d.ts +3 -3
  59. package/src/contracts/autoswap.d.ts.map +1 -1
  60. package/src/contracts/autoswap.js +7 -4
  61. package/src/contracts/barterExchange.d.ts +2 -2
  62. package/src/contracts/barterExchange.d.ts.map +1 -1
  63. package/src/contracts/barterExchange.js +3 -2
  64. package/src/contracts/callSpread/calculateShares.d.ts +7 -0
  65. package/src/contracts/callSpread/calculateShares.d.ts.map +1 -1
  66. package/src/contracts/callSpread/fundedCallSpread.d.ts +1 -1
  67. package/src/contracts/callSpread/fundedCallSpread.d.ts.map +1 -1
  68. package/src/contracts/callSpread/fundedCallSpread.js +3 -1
  69. package/src/contracts/callSpread/payoffHandler.d.ts.map +1 -1
  70. package/src/contracts/callSpread/payoffHandler.js +0 -1
  71. package/src/contracts/callSpread/percent.d.ts +2 -0
  72. package/src/contracts/callSpread/percent.d.ts.map +1 -1
  73. package/src/contracts/callSpread/pricedCallSpread.d.ts +4 -4
  74. package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -1
  75. package/src/contracts/callSpread/pricedCallSpread.js +3 -2
  76. package/src/contracts/coveredCall-durable.d.ts +3 -3
  77. package/src/contracts/coveredCall.d.ts +1 -1
  78. package/src/contracts/loan/borrow.d.ts.map +1 -1
  79. package/src/contracts/loan/borrow.js +3 -1
  80. package/src/contracts/loan/close.d.ts.map +1 -1
  81. package/src/contracts/loan/close.js +6 -2
  82. package/src/contracts/loan/index.d.ts +1 -1
  83. package/src/contracts/loan/liquidate.d.ts +12 -1
  84. package/src/contracts/loan/liquidate.d.ts.map +1 -1
  85. package/src/contracts/loan/liquidate.js +1 -3
  86. package/src/contracts/loan/scheduleLiquidation.d.ts.map +1 -1
  87. package/src/contracts/loan/scheduleLiquidation.js +0 -1
  88. package/src/contracts/loan/types.d.ts +1 -0
  89. package/src/contracts/loan/types.d.ts.map +1 -1
  90. package/src/contracts/loan/types.js +7 -0
  91. package/src/contracts/mintPayments.d.ts +6 -14
  92. package/src/contracts/mintPayments.d.ts.map +1 -1
  93. package/src/contracts/mintPayments.js +1 -1
  94. package/src/contracts/oracle.d.ts +2 -2
  95. package/src/contracts/oracle.d.ts.map +1 -1
  96. package/src/contracts/oracle.js +0 -3
  97. package/src/contracts/priceAggregator.d.ts +12 -2
  98. package/src/contracts/priceAggregator.d.ts.map +1 -1
  99. package/src/contracts/priceAggregator.js +2 -3
  100. package/src/contracts/scaledPriceAuthority.d.ts +1 -1
  101. package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
  102. package/src/contracts/scaledPriceAuthority.js +0 -2
  103. package/src/contracts/sellItems.d.ts +1 -1
  104. package/src/contracts/sellItems.d.ts.map +1 -1
  105. package/src/contracts/sellItems.js +3 -2
  106. package/src/contracts/simpleExchange.d.ts +2 -2
  107. package/src/instanceRecordStorage.d.ts +1 -1
  108. package/src/instanceRecordStorage.d.ts.map +1 -1
  109. package/src/internal-types.d.ts +3 -3
  110. package/src/internal-types.d.ts.map +1 -1
  111. package/src/internal-types.js +1 -1
  112. package/src/issuerStorage.d.ts +1 -1
  113. package/src/makeHandle.d.ts +1 -1
  114. package/src/makeHandle.d.ts.map +1 -1
  115. package/src/typeGuards.d.ts +20 -118
  116. package/src/typeGuards.d.ts.map +1 -1
  117. package/src/typeGuards.js +1 -7
  118. package/src/zoeService/escrowStorage.d.ts +1 -1
  119. package/src/zoeService/feeMint.d.ts +5 -5
  120. package/src/zoeService/feeMint.d.ts.map +1 -1
  121. package/src/zoeService/installationStorage.d.ts +1 -1
  122. package/src/zoeService/instanceAdminStorage.d.ts +2 -2
  123. package/src/zoeService/instanceAdminStorage.d.ts.map +1 -1
  124. package/src/zoeService/instanceAdminStorage.js +0 -1
  125. package/src/zoeService/internal-types.d.ts +2 -2
  126. package/src/zoeService/internal-types.d.ts.map +1 -1
  127. package/src/zoeService/internal-types.js +1 -1
  128. package/src/zoeService/makeInvitation.d.ts +1 -1
  129. package/src/zoeService/makeInvitation.d.ts.map +1 -1
  130. package/src/zoeService/offer/offer.d.ts.map +1 -1
  131. package/src/zoeService/offer/offer.js +3 -2
  132. package/src/zoeService/startInstance.d.ts +1 -1
  133. package/src/zoeService/startInstance.d.ts.map +1 -1
  134. package/src/zoeService/startInstance.js +23 -20
  135. package/src/zoeService/types.d.ts +1 -1
  136. package/src/zoeService/types.d.ts.map +1 -1
  137. package/src/zoeService/utils.d.ts +2 -2
  138. package/src/zoeService/zoe.d.ts +1 -11
  139. package/src/zoeService/zoe.d.ts.map +1 -1
  140. package/src/zoeService/zoe.js +1 -24
  141. package/src/zoeService/zoeSeat.d.ts +1 -1
  142. package/src/zoeService/zoeSeat.d.ts.map +1 -1
  143. package/src/zoeService/zoeSeat.js +0 -1
  144. package/src/zoeService/zoeStorageManager.d.ts +1 -1
  145. package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
  146. package/src/zoeService/zoeStorageManager.js +2 -7
  147. package/tools/fakePriceAuthority.d.ts.map +1 -1
  148. package/tools/fakePriceAuthority.js +2 -0
  149. package/tools/manualPriceAuthority.d.ts.map +1 -1
  150. package/tools/manualPriceAuthority.js +0 -1
  151. package/tools/manualTimer.js +1 -1
  152. package/tools/prepare-test-env.js +1 -1
  153. package/tools/priceAuthorityRegistry.d.ts +1 -1
  154. package/tools/priceAuthorityRegistry.d.ts.map +1 -1
  155. package/tools/scriptedOracle.d.ts +2 -2
  156. package/tools/scriptedPriceAuthority.d.ts.map +1 -1
  157. package/tools/scriptedPriceAuthority.js +0 -1
  158. package/tools/setup-zoe.d.ts +0 -5
  159. package/tools/setup-zoe.d.ts.map +1 -1
  160. package/src/contractFacet/reallocate.d.ts +0 -3
  161. package/src/contractFacet/reallocate.d.ts.map +0 -1
  162. package/src/contractFacet/reallocate.js +0 -94
  163. package/src/contractFacet/types-ambient.d.ts +0 -247
  164. package/src/contractFacet/types-ambient.js +0 -1
@@ -1,247 +0,0 @@
1
- /* eslint-disable no-use-before-define */
2
-
3
- type CopyRecord<T> = import('@endo/pass-style').CopyRecord<T>;
4
- type IssuerOptionsRecord = import('@agoric/ertp').IssuerOptionsRecord;
5
- /**
6
- * Any passable non-thenable. Often an explanatory string.
7
- */
8
- type Completion = any;
9
- type ZCFMakeEmptySeatKit = (exit?: ExitRule | undefined) => ZcfSeatKit;
10
- /**
11
- * Zoe Contract Facet
12
- *
13
- * The Zoe interface specific to a contract instance. The Zoe Contract
14
- * Facet is an API object used by running contract instances to access
15
- * the Zoe state for that instance. The Zoe Contract Facet is accessed
16
- * synchronously from within the contract, and usually is referred to
17
- * in code as zcf.
18
- */
19
- type ZCF<CT extends unknown = Record<string, unknown>> = {
20
- /**
21
- * - atomically reallocate amounts among seats.
22
- */
23
- atomicRearrange: (transfers: TransferPart[]) => void;
24
- /**
25
- * - reallocate amounts among seats.
26
- * @deprecated Use atomicRearrange instead.
27
- */
28
- reallocate: Reallocate;
29
- /**
30
- * - check
31
- * whether a keyword is valid and unique and could be added in
32
- * `saveIssuer`
33
- */
34
- assertUniqueKeyword: (keyword: Keyword) => void;
35
- /**
36
- * Informs Zoe about an issuer and returns a promise for acknowledging
37
- * when the issuer is added and ready.
38
- *
39
- * @returns the AmountMath and brand synchronously accessible after
40
- * saving
41
- */
42
- saveIssuer: (
43
- issuerP: ERef<Issuer>,
44
- keyword: Keyword,
45
- ) => Promise<IssuerRecord<any>>;
46
-
47
- /**
48
- * Make a credible Zoe invitation for a particular smart contract
49
- * indicated by the `instance` in the details of the invitation. Zoe
50
- * also puts the `installation` and a unique `handle` in the details
51
- * of the invitation. The contract must provide a `description` for
52
- * the invitation and should include whatever information is necessary
53
- * for a potential buyer of the invitation to know what they are
54
- * getting in the `customDetails`. `customDetails` will be
55
- * placed in the details of the invitation.
56
- */
57
- makeInvitation: <Result>(
58
- offerHandler: OfferHandler<Result>,
59
- description: string,
60
- customDetails?: object,
61
- proposalShape?: Pattern,
62
- ) => Promise<Invitation<R, A>>;
63
- shutdown: (completion: Completion) => void;
64
- shutdownWithFailure: ShutdownWithFailure;
65
- getZoeService: () => ERef<ZoeService>;
66
- getInvitationIssuer: () => Issuer<'set'>;
67
- getTerms: () => StandardTerms & CT;
68
- getBrandForIssuer: <K extends AssetKind>(issuer: Issuer<K>) => Brand<K>;
69
- getIssuerForBrand: <K_1 extends AssetKind>(brand: Brand<K_1>) => Issuer<K_1>;
70
- getAssetKind: GetAssetKindByBrand;
71
- makeZCFMint: <K_2 extends AssetKind = 'nat'>(
72
- keyword: Keyword,
73
- assetKind?: K_2 | undefined,
74
- displayInfo?: AdditionalDisplayInfo,
75
- options?: IssuerOptionsRecord,
76
- ) => Promise<ZCFMint<K_2>>;
77
- registerFeeMint: ZCFRegisterFeeMint;
78
- makeEmptySeatKit: ZCFMakeEmptySeatKit;
79
- setTestJig: SetTestJig;
80
- stopAcceptingOffers: () => Promise<void>;
81
- setOfferFilter: (strings: Array<string>) => Promise<void>;
82
- getOfferFilter: () => Promise<Array<string>>;
83
- getInstance: () => Instance;
84
- };
85
- /**
86
- * The contract can reallocate over seats, which commits the staged
87
- * allocation for each seat. On commit, the staged allocation becomes
88
- * the current allocation and the staged allocation is deleted.
89
- *
90
- * The reallocation will only succeed if the reallocation 1) conserves
91
- * rights (the amounts specified have the same total value as the
92
- * current total amount), and 2) is 'offer-safe' for all parties
93
- * involved. All seats that have staged allocations must be included
94
- * as arguments to `reallocate`, or an error is thrown. Additionally,
95
- * an error is thrown if any seats included in `reallocate` do not
96
- * have a staged allocation.
97
- *
98
- * The reallocation is partial, meaning that it applies only to the
99
- * seats passed in as arguments. By induction, if rights conservation
100
- * and offer safety hold before, they will hold after a safe
101
- * reallocation, even though we only re-validate for the seats whose
102
- * allocations will change. Since rights are conserved for the change,
103
- * overall rights will be unchanged, and a reallocation can only
104
- * effect offer safety for seats whose allocations change.
105
- */
106
- type Reallocate = (
107
- seat1: ZCFSeat,
108
- seat2: ZCFSeat,
109
- ...seatRest: Array<ZCFSeat>
110
- ) => void;
111
- type TransferPart = [
112
- fromSeat?: ZCFSeat,
113
- toSeat?: ZCFSeat,
114
- fromAmounts?: AmountKeywordRecord,
115
- toAmounts?: AmountKeywordRecord,
116
- ];
117
-
118
- type ZCFRegisterFeeMint = (
119
- keyword: Keyword,
120
- allegedFeeMintAccess: FeeMintAccess,
121
- ) => Promise<ZCFMint<'nat'>>;
122
- /**
123
- * Provide a jig object for testing purposes only.
124
- *
125
- * The contract code provides a callback whose return result will
126
- * be made available to the test that started this contract. The
127
- * supplied callback will only be called in a testing context,
128
- * never in production; i.e., it is only called if `testJigSetter`
129
- * was supplied.
130
- *
131
- * If no, `testFn` is supplied, then an empty jig will be used.
132
- * An additional `zcf` property set to the current ContractFacet
133
- * will be appended to the returned jig object (overriding any
134
- * provided by the `testFn`).
135
- */
136
- type SetTestJig = (testFn: () => Record<string, unknown>) => void;
137
- type ZCFMint<K extends AssetKind = AssetKind> = {
138
- getIssuerRecord: () => IssuerRecord<K>;
139
- /**
140
- * All the amounts in gains must be of this ZCFMint's brand.
141
- * The gains' keywords are in the namespace of that seat.
142
- * Add the gains to that seat's allocation.
143
- * The resulting state must be offer safe. (Currently, increasing assets can
144
- * never violate offer safety anyway.)
145
- *
146
- * Mint that amount of assets into the pooled purse.
147
- * If a seat is provided, it is returned. Otherwise a new seat is
148
- * returned.
149
- */
150
- mintGains: (gains: AmountKeywordRecord, zcfSeat?: ZCFSeat) => ZCFSeat;
151
- /**
152
- * All the amounts in losses must be of this ZCFMint's brand.
153
- * The losses' keywords are in the namespace of that seat.
154
- * Subtract losses from that seat's allocation.
155
- * The resulting state must be offer safe.
156
- *
157
- * Burn that amount of assets from the pooled purse.
158
- */
159
- burnLosses: (losses: AmountKeywordRecord, zcfSeat: ZCFSeat) => void;
160
- };
161
- /**
162
- * fail called with the reason for this failure, where reason is
163
- * normally an instanceof Error.
164
- */
165
- type ZCFSeatFail = (reason: unknown) => Error;
166
- /**
167
- * The brand is used for filling in an empty amount if the `keyword`
168
- * is not present in the allocation
169
- */
170
- type ZCFGetAmountAllocated = (
171
- keyword: Keyword,
172
- brand?: Brand<AssetKind> | undefined,
173
- ) => Amount<any>;
174
- type ZCFSeat = {
175
- exit: (completion?: Completion) => void;
176
- fail: ZCFSeatFail;
177
- getSubscriber: () => Promise<Subscriber<Allocation>>;
178
- hasExited: () => boolean;
179
- getProposal: () => ProposalRecord;
180
- getAmountAllocated: ZCFGetAmountAllocated;
181
- getCurrentAllocation: () => Allocation;
182
- /**
183
- * @deprecated Use atomicRearrange instead
184
- */
185
- getStagedAllocation: () => Allocation;
186
- /**
187
- * @deprecated Use atomicRearrange instead
188
- */
189
- hasStagedAllocation: () => boolean;
190
- isOfferSafe: (newAllocation: Allocation) => boolean;
191
- /**
192
- * @deprecated Use atomicRearrange instead
193
- */
194
- incrementBy: (
195
- amountKeywordRecord: AmountKeywordRecord,
196
- ) => AmountKeywordRecord;
197
- /**
198
- * @deprecated Use atomicRearrange instead
199
- */
200
- decrementBy: (
201
- amountKeywordRecord: AmountKeywordRecord,
202
- ) => AmountKeywordRecord;
203
- /**
204
- * @deprecated Use atomicRearrange instead
205
- */
206
- clear: () => void;
207
- };
208
- type ZcfSeatKit = {
209
- zcfSeat: ZCFSeat;
210
- userSeat: ERef<UserSeat>;
211
- };
212
- type HandleOffer<OR extends unknown> = (
213
- seat: ZCFSeat,
214
- offerArgs?: object,
215
- ) => OR;
216
- type OfferHandler<OR extends unknown = unknown> =
217
- | HandleOffer<OR>
218
- | {
219
- handle: HandleOffer<OR>;
220
- };
221
- type ContractMeta = {
222
- customTermsShape?: CopyRecord<any> | undefined;
223
- privateArgsShape?: CopyRecord<any> | undefined;
224
- upgradability?: 'none' | 'canBeUpgraded' | 'canUpgrade' | undefined;
225
- };
226
- /**
227
- * API for a contract start function.
228
- *
229
- * CAVEAT: assumes synchronous
230
- */
231
- type ContractStartFn<
232
- PF extends unknown = any,
233
- CF extends unknown = any,
234
- CT extends unknown = any,
235
- PA extends unknown = any,
236
- > = (
237
- zcf: ZCF<CT>,
238
- privateArgs: PA,
239
- baggage?: MapStore<any, any> | undefined,
240
- ) => ContractStartFnResult<PF, CF>;
241
- type ContractStartFnResult<PF, CF> = {
242
- publicFacet: PF;
243
- creatorFacet: CF;
244
- creatorInvitation?: Promise<Invitation<R, A>> | undefined;
245
- };
246
- type ContractOf<S> = import('../zoeService/utils').ContractOf<S>;
247
- type AdminFacet = import('../zoeService/utils').AdminFacet;
@@ -1 +0,0 @@
1
- // Dummy file for .d.ts twin to declare ambients