@agoric/zoe 0.26.3-upgrade-14-dev-0169c7e.0 → 0.26.3-upgrade-16-dev-8879538.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 (269) hide show
  1. package/README.md +7 -7
  2. package/bundles/bundle-contractFacet-js-meta.json +622 -313
  3. package/bundles/bundle-contractFacet.d.ts +3 -3
  4. package/bundles/bundle-contractFacet.js +1 -1
  5. package/exported.js +1 -12
  6. package/package.json +75 -60
  7. package/src/cleanProposal.d.ts +2 -2
  8. package/src/cleanProposal.d.ts.map +1 -1
  9. package/src/cleanProposal.js +15 -12
  10. package/src/contractFacet/exit.d.ts.map +1 -1
  11. package/src/contractFacet/exit.js +1 -0
  12. package/src/contractFacet/internal-types.d.ts +2 -2
  13. package/src/contractFacet/internal-types.d.ts.map +1 -1
  14. package/src/contractFacet/internal-types.js +1 -1
  15. package/src/contractFacet/offerHandlerStorage.d.ts +4 -1
  16. package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -1
  17. package/src/contractFacet/offerHandlerStorage.js +11 -3
  18. package/src/contractFacet/reallocate.d.ts +3 -0
  19. package/src/contractFacet/reallocate.d.ts.map +1 -0
  20. package/src/contractFacet/reallocate.js +94 -0
  21. package/src/contractFacet/rightsConservation.d.ts.map +1 -1
  22. package/src/contractFacet/rightsConservation.js +3 -0
  23. package/src/contractFacet/types-ambient.d.ts +259 -0
  24. package/src/contractFacet/types-ambient.js +1 -0
  25. package/src/contractFacet/vatRoot.d.ts +4 -4
  26. package/src/contractFacet/vatRoot.d.ts.map +1 -1
  27. package/src/contractFacet/zcfMint.d.ts +5 -3
  28. package/src/contractFacet/zcfMint.d.ts.map +1 -1
  29. package/src/contractFacet/zcfMint.js +4 -4
  30. package/src/contractFacet/zcfSeat.d.ts +4 -2
  31. package/src/contractFacet/zcfSeat.d.ts.map +1 -1
  32. package/src/contractFacet/zcfSeat.js +125 -5
  33. package/src/contractFacet/zcfZygote.d.ts +1 -2
  34. package/src/contractFacet/zcfZygote.d.ts.map +1 -1
  35. package/src/contractFacet/zcfZygote.js +95 -42
  36. package/src/contractSupport/atomicTransfer.d.ts +0 -6
  37. package/src/contractSupport/atomicTransfer.d.ts.map +1 -1
  38. package/src/contractSupport/atomicTransfer.js +5 -90
  39. package/src/contractSupport/bondingCurves.js +2 -2
  40. package/src/contractSupport/durability.d.ts +3 -3
  41. package/src/contractSupport/durability.d.ts.map +1 -1
  42. package/src/contractSupport/durability.js +5 -5
  43. package/src/contractSupport/index.d.ts +1 -0
  44. package/src/contractSupport/index.js +1 -0
  45. package/src/contractSupport/prepare-ownable.d.ts +11 -0
  46. package/src/contractSupport/prepare-ownable.d.ts.map +1 -0
  47. package/src/contractSupport/prepare-ownable.js +100 -0
  48. package/src/contractSupport/priceAuthority.d.ts +23 -15
  49. package/src/contractSupport/priceAuthority.d.ts.map +1 -1
  50. package/src/contractSupport/priceAuthority.js +32 -17
  51. package/src/contractSupport/priceAuthorityInitial.d.ts +3 -2
  52. package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
  53. package/src/contractSupport/priceAuthorityInitial.js +5 -2
  54. package/src/contractSupport/priceAuthorityQuoteMint.d.ts +2 -1
  55. package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -1
  56. package/src/contractSupport/priceAuthorityQuoteMint.js +23 -27
  57. package/src/contractSupport/priceAuthorityTransform.d.ts +14 -12
  58. package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -1
  59. package/src/contractSupport/priceAuthorityTransform.js +10 -8
  60. package/src/contractSupport/priceQuote.d.ts +7 -5
  61. package/src/contractSupport/priceQuote.d.ts.map +1 -1
  62. package/src/contractSupport/priceQuote.js +5 -1
  63. package/src/contractSupport/ratio.d.ts +2 -2
  64. package/src/contractSupport/ratio.d.ts.map +1 -1
  65. package/src/contractSupport/ratio.js +19 -15
  66. package/src/contractSupport/recorder.d.ts +31 -117
  67. package/src/contractSupport/recorder.d.ts.map +1 -1
  68. package/src/contractSupport/recorder.js +21 -10
  69. package/src/contractSupport/safeMath.d.ts +7 -7
  70. package/src/contractSupport/safeMath.d.ts.map +1 -1
  71. package/src/contractSupport/statistics.d.ts +1 -1
  72. package/src/contractSupport/statistics.d.ts.map +1 -1
  73. package/src/contractSupport/topics.d.ts +1 -1
  74. package/src/contractSupport/topics.d.ts.map +1 -1
  75. package/src/contractSupport/{types.d.ts → types-ambient.d.ts} +4 -4
  76. package/src/contractSupport/types-ambient.d.ts.map +1 -0
  77. package/src/contractSupport/{types.js → types-ambient.js} +1 -1
  78. package/src/contractSupport/zoeHelpers.d.ts +1 -1
  79. package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
  80. package/src/contractSupport/zoeHelpers.js +5 -11
  81. package/src/contracts/auction/firstPriceLogic.d.ts.map +1 -1
  82. package/src/contracts/auction/firstPriceLogic.js +5 -8
  83. package/src/contracts/auction/index.d.ts +10 -10
  84. package/src/contracts/auction/index.d.ts.map +1 -1
  85. package/src/contracts/auction/index.js +2 -1
  86. package/src/contracts/auction/secondPriceLogic.d.ts.map +1 -1
  87. package/src/contracts/auction/secondPriceLogic.js +1 -4
  88. package/src/contracts/automaticRefund.d.ts +1 -1
  89. package/src/contracts/automaticRefund.d.ts.map +1 -1
  90. package/src/contracts/autoswap.d.ts.map +1 -1
  91. package/src/contracts/autoswap.js +8 -9
  92. package/src/contracts/barterExchange.d.ts +1 -1
  93. package/src/contracts/barterExchange.d.ts.map +1 -1
  94. package/src/contracts/barterExchange.js +2 -3
  95. package/src/contracts/callSpread/calculateShares.d.ts +1 -8
  96. package/src/contracts/callSpread/calculateShares.d.ts.map +1 -1
  97. package/src/contracts/callSpread/calculateShares.js +1 -1
  98. package/src/contracts/callSpread/fundedCallSpread.d.ts +4 -0
  99. package/src/contracts/callSpread/fundedCallSpread.d.ts.map +1 -1
  100. package/src/contracts/callSpread/fundedCallSpread.js +6 -4
  101. package/src/contracts/callSpread/payoffHandler.d.ts.map +1 -1
  102. package/src/contracts/callSpread/payoffHandler.js +2 -1
  103. package/src/contracts/callSpread/percent.d.ts +2 -4
  104. package/src/contracts/callSpread/percent.d.ts.map +1 -1
  105. package/src/contracts/callSpread/position.d.ts +2 -2
  106. package/src/contracts/callSpread/pricedCallSpread.d.ts +6 -5
  107. package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -1
  108. package/src/contracts/callSpread/pricedCallSpread.js +8 -4
  109. package/src/contracts/callSpread/{types.d.ts → types-ambient.d.ts} +3 -3
  110. package/src/contracts/callSpread/types-ambient.d.ts.map +1 -0
  111. package/src/contracts/coveredCall-durable.d.ts +2 -4
  112. package/src/contracts/coveredCall-durable.d.ts.map +1 -1
  113. package/src/contracts/exported.js +3 -3
  114. package/src/contracts/loan/borrow.d.ts.map +1 -1
  115. package/src/contracts/loan/borrow.js +7 -4
  116. package/src/contracts/loan/close.d.ts.map +1 -1
  117. package/src/contracts/loan/close.js +3 -7
  118. package/src/contracts/loan/index.d.ts +5 -1
  119. package/src/contracts/loan/index.d.ts.map +1 -1
  120. package/src/contracts/loan/index.js +4 -0
  121. package/src/contracts/loan/liquidate.d.ts +1 -12
  122. package/src/contracts/loan/liquidate.d.ts.map +1 -1
  123. package/src/contracts/loan/liquidate.js +4 -2
  124. package/src/contracts/loan/scheduleLiquidation.d.ts.map +1 -1
  125. package/src/contracts/loan/scheduleLiquidation.js +1 -0
  126. package/src/contracts/loan/{types.d.ts → types-ambient.d.ts} +16 -17
  127. package/src/contracts/loan/types-ambient.d.ts.map +1 -0
  128. package/src/contracts/loan/{types.js → types-ambient.js} +11 -18
  129. package/src/contracts/loan/updateDebt.js +1 -1
  130. package/src/contracts/mintAndSellNFT.d.ts.map +1 -1
  131. package/src/contracts/mintPayments.d.ts +14 -6
  132. package/src/contracts/mintPayments.d.ts.map +1 -1
  133. package/src/contracts/mintPayments.js +1 -1
  134. package/src/contracts/oracle.d.ts +25 -3
  135. package/src/contracts/oracle.d.ts.map +1 -1
  136. package/src/contracts/oracle.js +7 -0
  137. package/src/contracts/otcDesk.d.ts +3 -3
  138. package/src/contracts/otcDesk.d.ts.map +1 -1
  139. package/src/contracts/otcDesk.js +1 -1
  140. package/src/contracts/priceAggregator.d.ts +112 -18
  141. package/src/contracts/priceAggregator.d.ts.map +1 -1
  142. package/src/contracts/priceAggregator.js +16 -18
  143. package/src/contracts/priceAggregatorTypes.d.ts +2 -2
  144. package/src/contracts/priceAggregatorTypes.d.ts.map +1 -1
  145. package/src/contracts/scaledPriceAuthority.d.ts +4 -5
  146. package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
  147. package/src/contracts/scaledPriceAuthority.js +6 -0
  148. package/src/contracts/sellItems.d.ts +2 -2
  149. package/src/contracts/sellItems.d.ts.map +1 -1
  150. package/src/contracts/sellItems.js +2 -3
  151. package/src/contracts/simpleExchange.d.ts +3 -3
  152. package/src/contracts/{types.d.ts → types-ambient.d.ts} +1 -1
  153. package/src/contracts/types-ambient.d.ts.map +1 -0
  154. package/src/handleWarning.d.ts.map +1 -1
  155. package/src/instanceRecordStorage.d.ts +1 -1
  156. package/src/instanceRecordStorage.d.ts.map +1 -1
  157. package/src/internal-types.d.ts +20 -32
  158. package/src/internal-types.d.ts.map +1 -1
  159. package/src/internal-types.js +18 -58
  160. package/src/issuerRecord.d.ts +2 -2
  161. package/src/issuerRecord.d.ts.map +1 -1
  162. package/src/issuerStorage.d.ts +4 -4
  163. package/src/issuerStorage.d.ts.map +1 -1
  164. package/src/issuerStorage.js +12 -28
  165. package/src/makeHandle.d.ts +2 -2
  166. package/src/makeHandle.d.ts.map +1 -1
  167. package/src/makeHandle.js +1 -1
  168. package/src/typeGuards.d.ts +119 -20
  169. package/src/typeGuards.d.ts.map +1 -1
  170. package/src/typeGuards.js +18 -9
  171. package/src/types-ambient.d.ts +41 -0
  172. package/src/types-ambient.d.ts.map +1 -0
  173. package/src/{types.js → types-ambient.js} +6 -14
  174. package/src/zoeService/escrowStorage.d.ts +1 -1
  175. package/src/zoeService/escrowStorage.d.ts.map +1 -1
  176. package/src/zoeService/escrowStorage.js +20 -27
  177. package/src/zoeService/feeMint.d.ts +9 -16
  178. package/src/zoeService/feeMint.d.ts.map +1 -1
  179. package/src/zoeService/feeMint.js +21 -15
  180. package/src/zoeService/installationStorage.d.ts +5 -20
  181. package/src/zoeService/installationStorage.d.ts.map +1 -1
  182. package/src/zoeService/installationStorage.js +11 -7
  183. package/src/zoeService/instanceAdminStorage.d.ts +22 -42
  184. package/src/zoeService/instanceAdminStorage.d.ts.map +1 -1
  185. package/src/zoeService/instanceAdminStorage.js +1 -0
  186. package/src/zoeService/internal-types.d.ts +16 -16
  187. package/src/zoeService/internal-types.d.ts.map +1 -1
  188. package/src/zoeService/internal-types.js +6 -6
  189. package/src/zoeService/invitationQueries.d.ts.map +1 -1
  190. package/src/zoeService/invitationQueries.js +7 -5
  191. package/src/zoeService/makeInvitation.d.ts +3 -3
  192. package/src/zoeService/makeInvitation.d.ts.map +1 -1
  193. package/src/zoeService/makeInvitation.js +25 -21
  194. package/src/zoeService/offer/burnInvitation.d.ts.map +1 -1
  195. package/src/zoeService/offer/offer.d.ts.map +1 -1
  196. package/src/zoeService/offer/offer.js +2 -5
  197. package/src/zoeService/originalZoeSeat.d.ts +34 -0
  198. package/src/zoeService/originalZoeSeat.d.ts.map +1 -0
  199. package/src/zoeService/originalZoeSeat.js +353 -0
  200. package/src/zoeService/startInstance.d.ts +3 -3
  201. package/src/zoeService/startInstance.d.ts.map +1 -1
  202. package/src/zoeService/startInstance.js +17 -11
  203. package/src/zoeService/{types.d.ts → types-ambient.d.ts} +26 -31
  204. package/src/zoeService/types-ambient.d.ts.map +1 -0
  205. package/src/zoeService/{types.js → types-ambient.js} +19 -32
  206. package/src/zoeService/utils.d.ts +54 -58
  207. package/src/zoeService/utils.test-d.d.ts +2 -0
  208. package/src/zoeService/utils.test-d.d.ts.map +1 -0
  209. package/src/zoeService/utils.test-d.ts +33 -0
  210. package/src/zoeService/zoe.d.ts +9 -13
  211. package/src/zoeService/zoe.d.ts.map +1 -1
  212. package/src/zoeService/zoe.js +7 -7
  213. package/src/zoeService/zoeSeat.d.ts +15 -45
  214. package/src/zoeService/zoeSeat.d.ts.map +1 -1
  215. package/src/zoeService/zoeSeat.js +214 -114
  216. package/src/zoeService/zoeStorageManager.d.ts +9 -43
  217. package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
  218. package/src/zoeService/zoeStorageManager.js +8 -6
  219. package/tools/fakePriceAuthority.d.ts +9 -8
  220. package/tools/fakePriceAuthority.d.ts.map +1 -1
  221. package/tools/fakePriceAuthority.js +21 -17
  222. package/tools/fakeVatAdmin.d.ts +10 -10
  223. package/tools/manualPriceAuthority.d.ts +11 -6
  224. package/tools/manualPriceAuthority.d.ts.map +1 -1
  225. package/tools/manualPriceAuthority.js +15 -2
  226. package/tools/manualTimer.d.ts +21 -40
  227. package/tools/manualTimer.d.ts.map +1 -1
  228. package/tools/manualTimer.js +30 -16
  229. package/tools/prepare-test-env.js +1 -1
  230. package/tools/scriptedOracle.d.ts +3 -3
  231. package/tools/scriptedOracle.d.ts.map +1 -1
  232. package/tools/scriptedOracle.js +1 -1
  233. package/tools/scriptedPriceAuthority.d.ts +4 -0
  234. package/tools/scriptedPriceAuthority.d.ts.map +1 -1
  235. package/tools/scriptedPriceAuthority.js +6 -1
  236. package/tools/setup-zoe.d.ts +8 -9
  237. package/tools/setup-zoe.d.ts.map +1 -1
  238. package/tools/setup-zoe.js +16 -1
  239. package/tools/test-utils.d.ts +20 -0
  240. package/tools/test-utils.d.ts.map +1 -0
  241. package/tools/test-utils.js +26 -0
  242. package/tools/types.d.ts +21 -21
  243. package/tools/types.d.ts.map +1 -1
  244. package/tools/types.js +10 -10
  245. package/CHANGELOG.md +0 -1203
  246. package/src/contractFacet/types.d.ts +0 -191
  247. package/src/contractFacet/types.d.ts.map +0 -1
  248. package/src/contractFacet/types.js +0 -256
  249. package/src/contractSupport/types.d.ts.map +0 -1
  250. package/src/contracts/callSpread/types.d.ts.map +0 -1
  251. package/src/contracts/loan/types.d.ts.map +0 -1
  252. package/src/contracts/types.d.ts.map +0 -1
  253. package/src/objArrayConversion.d.ts +0 -5
  254. package/src/objArrayConversion.d.ts.map +0 -1
  255. package/src/objArrayConversion.js +0 -35
  256. package/src/types.d.ts +0 -45
  257. package/src/types.d.ts.map +0 -1
  258. package/src/zoeService/types.d.ts.map +0 -1
  259. package/tools/internal-types.d.ts +0 -12
  260. package/tools/internal-types.d.ts.map +0 -1
  261. package/tools/internal-types.js +0 -14
  262. package/tools/priceAuthorityRegistry.d.ts +0 -20
  263. package/tools/priceAuthorityRegistry.d.ts.map +0 -1
  264. package/tools/priceAuthorityRegistry.js +0 -209
  265. package/tools/types-ambient.d.ts +0 -142
  266. package/tools/types-ambient.d.ts.map +0 -1
  267. package/tools/types-ambient.js +0 -160
  268. /package/src/contracts/callSpread/{types.js → types-ambient.js} +0 -0
  269. /package/src/contracts/{types.js → types-ambient.js} +0 -0
@@ -0,0 +1,353 @@
1
+ /* eslint @typescript-eslint/no-floating-promises: "warn" */
2
+ import { SubscriberShape } from '@agoric/notifier';
3
+ import { E } from '@endo/eventual-send';
4
+ import { M, prepareExoClassKit } from '@agoric/vat-data';
5
+ import { deeplyFulfilled } from '@endo/marshal';
6
+ import { makePromiseKit } from '@endo/promise-kit';
7
+
8
+ import { satisfiesWant } from '../contractFacet/offerSafety.js';
9
+ import '../types-ambient.js';
10
+ import '../internal-types.js';
11
+ import {
12
+ AmountKeywordRecordShape,
13
+ KeywordShape,
14
+ ExitObjectShape,
15
+ PaymentPKeywordRecordShape,
16
+ } from '../typeGuards.js';
17
+
18
+ const { Fail } = assert;
19
+
20
+ export const coreUserSeatMethods = harden({
21
+ getProposal: M.call().returns(M.promise()),
22
+ getPayouts: M.call().returns(M.promise()),
23
+ getPayout: M.call(KeywordShape).returns(M.promise()),
24
+ getOfferResult: M.call().returns(M.promise()),
25
+ hasExited: M.call().returns(M.promise()),
26
+ numWantsSatisfied: M.call().returns(M.promise()),
27
+ getFinalAllocation: M.call().returns(M.promise()),
28
+ getExitSubscriber: M.call().returns(M.any()),
29
+ });
30
+
31
+ export const ZoeUserSeatShape = M.interface('UserSeat', {
32
+ ...coreUserSeatMethods,
33
+ tryExit: M.call().returns(M.promise()),
34
+ });
35
+
36
+ export const OriginalZoeSeatIKit = harden({
37
+ zoeSeatAdmin: M.interface('ZoeSeatAdmin', {
38
+ replaceAllocation: M.call(AmountKeywordRecordShape).returns(),
39
+ exit: M.call(M.any()).returns(),
40
+ fail: M.call(M.any()).returns(),
41
+ resolveExitAndResult: M.call({
42
+ offerResultPromise: M.promise(),
43
+ exitObj: ExitObjectShape,
44
+ }).returns(),
45
+ getExitSubscriber: M.call().returns(SubscriberShape),
46
+ // The return promise is empty, but doExit relies on settlement as a signal
47
+ // that the payouts have settled. The exit publisher is notified after that.
48
+ finalPayouts: M.call(M.eref(PaymentPKeywordRecordShape)).returns(
49
+ M.promise(),
50
+ ),
51
+ }),
52
+ userSeat: ZoeUserSeatShape,
53
+ });
54
+
55
+ const assertHasNotExited = (c, msg) => {
56
+ !c.state.instanceAdminHelper.hasExited(c.facets.zoeSeatAdmin) ||
57
+ assert(!c.state.instanceAdminHelper.hasExited(c.facets.zoeSeatAdmin), msg);
58
+ };
59
+
60
+ /**
61
+ * declareOldZoeSeatAdminKind declares an exo for the original kind of ZoeSeatKit.
62
+ * This version creates a reference cycle that garbage collection can't remove
63
+ * because it goes through weakMaps in two different Vats. We've defined a new
64
+ * Kind that doesn't have this problem, but we won't upgrade the existing
65
+ * objects, so the Kind must continue to be defined, but we don't return the
66
+ * maker function.
67
+ *
68
+ * The original ZoeSeatKit is an object that manages the state
69
+ * of a seat participating in a Zoe contract and return its two facets.
70
+ *
71
+ * The UserSeat is suitable to be handed to an agent outside zoe and the
72
+ * contract and allows them to query or monitor the current state, access the
73
+ * payouts and result, and call exit() if that's allowed for this seat.
74
+ *
75
+ * The zoeSeatAdmin is passed by Zoe to the ContractFacet (zcf), to allow zcf to
76
+ * query or update the allocation or exit the seat cleanly.
77
+ *
78
+ * @param {import('@agoric/vat-data').Baggage} baggage
79
+ * @param {() => PublishKit<any>} makeDurablePublishKit
80
+ */
81
+ export const declareOldZoeSeatAdminKind = (baggage, makeDurablePublishKit) => {
82
+ const doExit = (
83
+ zoeSeatAdmin,
84
+ currentAllocation,
85
+ withdrawFacet,
86
+ instanceAdminHelper,
87
+ ) => {
88
+ /** @type {PaymentPKeywordRecord} */
89
+ const payouts = withdrawFacet.withdrawPayments(currentAllocation);
90
+ return E.when(
91
+ zoeSeatAdmin.finalPayouts(payouts),
92
+ () => instanceAdminHelper.exitZoeSeatAdmin(zoeSeatAdmin),
93
+ () => instanceAdminHelper.exitZoeSeatAdmin(zoeSeatAdmin),
94
+ );
95
+ };
96
+
97
+ // There is a race between resolveExitAndResult() and getOfferResult() that
98
+ // can be limited to when the adminFactory is paged in. If state.offerResult
99
+ // is defined, getOfferResult will return it. If it's not defined when
100
+ // getOfferResult is called, create a promiseKit, return the promise and store
101
+ // the kit here. When resolveExitAndResult() is called, it saves
102
+ // state.offerResult and resolves the promise if it exists, then removes the
103
+ // table entry.
104
+ /**
105
+ * @typedef {WeakMap<ZCFSeat, unknown>}
106
+ */
107
+ const ephemeralOfferResultStore = new WeakMap();
108
+
109
+ // notice that this returns a maker function which we drop on the floor.
110
+ prepareExoClassKit(
111
+ baggage,
112
+ 'ZoeSeatKit',
113
+ OriginalZoeSeatIKit,
114
+ /**
115
+ *
116
+ * @param {Allocation} initialAllocation
117
+ * @param {ProposalRecord} proposal
118
+ * @param {InstanceAdminHelper} instanceAdminHelper
119
+ * @param {WithdrawFacet} withdrawFacet
120
+ * @param {ERef<ExitObj>} [exitObj]
121
+ * @param {boolean} [offerResultIsUndefined]
122
+ */
123
+ (
124
+ initialAllocation,
125
+ proposal,
126
+ instanceAdminHelper,
127
+ withdrawFacet,
128
+ exitObj = undefined,
129
+ // emptySeatKits start with offerResult validly undefined; others can set
130
+ // it to anything (including undefined) in resolveExitAndResult()
131
+ offerResultIsUndefined = false,
132
+ ) => {
133
+ const { publisher, subscriber } = makeDurablePublishKit();
134
+ return {
135
+ currentAllocation: initialAllocation,
136
+ proposal,
137
+ exitObj,
138
+ offerResult: /** @type {any} */ (undefined),
139
+ offerResultStored: offerResultIsUndefined,
140
+ instanceAdminHelper,
141
+ withdrawFacet,
142
+ publisher,
143
+ subscriber,
144
+ payouts: harden({}),
145
+ exiting: false,
146
+ };
147
+ },
148
+ {
149
+ zoeSeatAdmin: {
150
+ replaceAllocation(replacementAllocation) {
151
+ const { state } = this;
152
+ assertHasNotExited(
153
+ this,
154
+ 'Cannot replace allocation. Seat has already exited',
155
+ );
156
+ harden(replacementAllocation);
157
+ // Merging happens in ZCF, so replacementAllocation can
158
+ // replace the old allocation entirely.
159
+
160
+ state.currentAllocation = replacementAllocation;
161
+ },
162
+ exit(completion) {
163
+ const { state, facets } = this;
164
+ // Since this method doesn't wait, we could re-enter via exitAllSeats.
165
+ // If that happens, we shouldn't re-do any of the work.
166
+ if (state.exiting) {
167
+ return;
168
+ }
169
+ assertHasNotExited(this, 'Cannot exit seat. Seat has already exited');
170
+
171
+ state.exiting = true;
172
+ E.when(
173
+ doExit(
174
+ facets.zoeSeatAdmin,
175
+ state.currentAllocation,
176
+ state.withdrawFacet,
177
+ state.instanceAdminHelper,
178
+ ),
179
+ () => state.publisher.finish(completion),
180
+ );
181
+ },
182
+ fail(reason) {
183
+ const { state, facets } = this;
184
+ // Since this method doesn't wait, we could re-enter via failAllSeats.
185
+ // If that happens, we shouldn't re-do any of the work.
186
+ if (state.exiting) {
187
+ return;
188
+ }
189
+
190
+ assertHasNotExited(this, 'Cannot fail seat. Seat has already exited');
191
+
192
+ state.exiting = true;
193
+ E.when(
194
+ doExit(
195
+ facets.zoeSeatAdmin,
196
+ state.currentAllocation,
197
+ state.withdrawFacet,
198
+ state.instanceAdminHelper,
199
+ ),
200
+ () => state.publisher.fail(reason),
201
+ () => state.publisher.fail(reason),
202
+ );
203
+ },
204
+ // called only for seats resulting from offers.
205
+ /** @param {HandleOfferResult} result */
206
+ resolveExitAndResult({ offerResultPromise, exitObj }) {
207
+ const { state, facets } = this;
208
+
209
+ !state.offerResultStored ||
210
+ Fail`offerResultStored before offerResultPromise`;
211
+
212
+ if (!ephemeralOfferResultStore.has(facets.userSeat)) {
213
+ // this was called before getOfferResult
214
+ const kit = makePromiseKit();
215
+ kit.resolve(offerResultPromise);
216
+ ephemeralOfferResultStore.set(facets.userSeat, kit);
217
+ }
218
+
219
+ const pKit = ephemeralOfferResultStore.get(facets.userSeat);
220
+ void E.when(
221
+ offerResultPromise,
222
+ offerResult => {
223
+ // Resolve the ephemeral promise for offerResult
224
+ pKit.resolve(offerResult);
225
+ // Now we want to store the offerResult in `state` to get it off the heap,
226
+ // but we need to handle three cases:
227
+ // 1. already durable. (This includes being a remote presence.)
228
+ // 2. has promises for durable objects.
229
+ // 3. not durable even after resolving promises.
230
+ // For #1 we can assign directly, but we deeply await to also handle #2.
231
+ void E.when(
232
+ deeplyFulfilled(offerResult),
233
+ fulfilledOfferResult => {
234
+ try {
235
+ // In cases 1-2 this assignment will succeed.
236
+ state.offerResult = fulfilledOfferResult;
237
+ // If it doesn't, then these lines won't be reached so the
238
+ // flag will stay false and the promise will stay in the heap
239
+ state.offerResultStored = true;
240
+ ephemeralOfferResultStore.delete(facets.userSeat);
241
+ } catch (err) {
242
+ console.warn(
243
+ 'non-durable offer result will be lost upon zoe vat termination:',
244
+ offerResult,
245
+ );
246
+ }
247
+ },
248
+ // no rejection handler because an offer result containing promises that reject
249
+ // is within spec
250
+ );
251
+ },
252
+ e => {
253
+ pKit.reject(e);
254
+ // NB: leave the rejected promise in the ephemeralOfferResultStore
255
+ // because it can't go in durable state
256
+ },
257
+ );
258
+
259
+ state.exitObj = exitObj;
260
+ },
261
+ getExitSubscriber() {
262
+ const { state } = this;
263
+ return state.subscriber;
264
+ },
265
+ async finalPayouts(payments) {
266
+ const { state } = this;
267
+
268
+ const settledPayouts = await deeplyFulfilled(payments);
269
+ state.payouts = settledPayouts;
270
+ },
271
+ },
272
+ userSeat: {
273
+ async getProposal() {
274
+ const { state } = this;
275
+ return state.proposal;
276
+ },
277
+ async getPayouts() {
278
+ const { state } = this;
279
+
280
+ return E.when(
281
+ state.subscriber.subscribeAfter(),
282
+ () => state.payouts,
283
+ () => state.payouts,
284
+ );
285
+ },
286
+ async getPayout(keyword) {
287
+ const { state } = this;
288
+
289
+ // subscriber.subscribeAfter() only triggers after publisher.finish()
290
+ // in exit() or publisher.fail() in fail(). Both of those wait for
291
+ // doExit(), which ensures that finalPayouts() has set state.payouts.
292
+ return E.when(
293
+ state.subscriber.subscribeAfter(),
294
+ () => state.payouts[keyword],
295
+ () => state.payouts[keyword],
296
+ );
297
+ },
298
+
299
+ async getOfferResult() {
300
+ const { state, facets } = this;
301
+
302
+ if (state.offerResultStored) {
303
+ return state.offerResult;
304
+ }
305
+
306
+ if (ephemeralOfferResultStore.has(facets.userSeat)) {
307
+ return ephemeralOfferResultStore.get(facets.userSeat).promise;
308
+ }
309
+
310
+ const kit = makePromiseKit();
311
+ ephemeralOfferResultStore.set(facets.userSeat, kit);
312
+ return kit.promise;
313
+ },
314
+ async hasExited() {
315
+ const { state, facets } = this;
316
+
317
+ return (
318
+ state.exiting ||
319
+ state.instanceAdminHelper.hasExited(facets.zoeSeatAdmin)
320
+ );
321
+ },
322
+ async tryExit() {
323
+ const { state } = this;
324
+ if (!state.exitObj)
325
+ throw Fail`exitObj must be initialized before use`;
326
+ assertHasNotExited(this, 'Cannot exit; seat has already exited');
327
+
328
+ return E(state.exitObj).exit();
329
+ },
330
+ async numWantsSatisfied() {
331
+ const { state } = this;
332
+ return E.when(
333
+ state.subscriber.subscribeAfter(),
334
+ () => satisfiesWant(state.proposal, state.currentAllocation),
335
+ () => satisfiesWant(state.proposal, state.currentAllocation),
336
+ );
337
+ },
338
+ getExitSubscriber() {
339
+ const { state } = this;
340
+ return state.subscriber;
341
+ },
342
+ getFinalAllocation() {
343
+ const { state } = this;
344
+ return E.when(
345
+ state.subscriber.subscribeAfter(),
346
+ () => state.currentAllocation,
347
+ () => state.currentAllocation,
348
+ );
349
+ },
350
+ },
351
+ },
352
+ );
353
+ };
@@ -1,4 +1,4 @@
1
- export function makeStartInstance(startInstanceAccess: Pick<ZoeStorageManager, 'makeZoeInstanceStorageManager' | 'unwrapInstallation'>, getZcfBundleCapP: () => ERef<BundleCap>, getBundleCapByIdNow: (id: string) => BundleCap, zoeBaggage: MapStore<string, unknown>): import('./utils').StartInstance;
2
- export type Baggage = import('@agoric/vat-data').Baggage;
3
- export type BundleCap = import('@agoric/swingset-vat').BundleCap;
1
+ export function makeStartInstance(startInstanceAccess: Pick<ZoeStorageManager, "makeZoeInstanceStorageManager" | "unwrapInstallation">, getZcfBundleCapP: () => ERef<BundleCap>, getBundleCapByIdNow: (id: string) => BundleCap, zoeBaggage: Baggage): import("./utils.js").StartInstance;
2
+ export type BundleCap = import("@agoric/swingset-vat").BundleCap;
3
+ import type { Baggage } from '@agoric/vat-data';
4
4
  //# sourceMappingURL=startInstance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"startInstance.d.ts","sourceRoot":"","sources":["startInstance.js"],"names":[],"mappings":"AAiCO,uDANI,KAAK,iBAAiB,EAAE,+BAA+B,GAAG,oBAAoB,CAAC,oBAC/E,MAAM,KAAK,SAAS,CAAC,4BAChB,MAAM,KAAK,SAAS,0CAEvB,OAAO,SAAS,EAAE,aAAa,CAmW3C;sBA7Wa,OAAO,kBAAkB,EAAE,OAAO;wBACjC,OAAO,sBAAsB,EAAE,SAAS"}
1
+ {"version":3,"file":"startInstance.d.ts","sourceRoot":"","sources":["startInstance.js"],"names":[],"mappings":"AAoCO,uDANI,IAAI,CAAC,iBAAiB,EAAE,+BAA+B,GAAG,oBAAoB,CAAC,oBAC/E,MAAM,IAAI,CAAC,SAAS,CAAC,uBACrB,CAAC,EAAE,EAAE,MAAM,KAAK,SAAS,wBAEvB,OAAO,YAAY,EAAE,aAAa,CAsW9C;wBA/Wc,OAAO,sBAAsB,EAAE,SAAS;6BAD5B,kBAAkB"}
@@ -1,3 +1,4 @@
1
+ /* eslint @typescript-eslint/no-floating-promises: "warn" */
1
2
  import { E } from '@endo/eventual-send';
2
3
  import { passStyleOf } from '@endo/marshal';
3
4
  import {
@@ -19,7 +20,9 @@ import {
19
20
  InstanceAdminShape,
20
21
  } from '../typeGuards.js';
21
22
 
22
- /** @typedef {import('@agoric/vat-data').Baggage} Baggage */
23
+ // import '../internal-types.js';
24
+
25
+ /** @import {Baggage} from '@agoric/vat-data' */
23
26
  /** @typedef { import('@agoric/swingset-vat').BundleCap} BundleCap */
24
27
 
25
28
  const { Fail, quote: q } = assert;
@@ -29,7 +32,7 @@ const { Fail, quote: q } = assert;
29
32
  * @param {() => ERef<BundleCap>} getZcfBundleCapP
30
33
  * @param {(id: string) => BundleCap} getBundleCapByIdNow
31
34
  * @param {Baggage} zoeBaggage
32
- * @returns {import('./utils').StartInstance}
35
+ * @returns {import('./utils.js').StartInstance}
33
36
  */
34
37
  export const makeStartInstance = (
35
38
  startInstanceAccess,
@@ -63,7 +66,7 @@ export const makeStartInstance = (
63
66
  adminNode: M.remotable('adminNode'),
64
67
  });
65
68
 
66
- /** @type {{ onFulfilled: (completion: any, instanceAdmin: InstanceAdmin) => void, onRejected: (reason: any, instanceAdmin: InstanceAdmin, adminNode: any) => void }} */
69
+ /** @type {import('@agoric/swingset-liveslots').PromiseWatcher<Completion, [InstanceAdmin, Handle<'adminNode'>]>} */
67
70
  const watcher = prepareExo(
68
71
  zoeBaggage,
69
72
  'InstanceCompletionWatcher',
@@ -95,7 +98,6 @@ export const makeStartInstance = (
95
98
  );
96
99
 
97
100
  const watchForAdminNodeDone = (adminNode, instAdmin) => {
98
- // @ts-expect-error XXX unknown type?
99
101
  watchPromise(E(adminNode).done(), watcher, instAdmin, adminNode);
100
102
  };
101
103
 
@@ -258,13 +260,13 @@ export const makeStartInstance = (
258
260
  async upgradeContract(contractBundleId, newPrivateArgs = undefined) {
259
261
  const { state } = this;
260
262
 
261
- const newContractBundleCap = await getBundleCapByIdNow(
262
- contractBundleId,
263
- );
263
+ const newContractBundleCap =
264
+ await getBundleCapByIdNow(contractBundleId);
264
265
  const vatParameters = {
265
266
  contractBundleCap: newContractBundleCap,
266
267
  privateArgs: newPrivateArgs,
267
268
  };
269
+ state.contractBundleCap = newContractBundleCap;
268
270
  return E.when(getFreshZcfBundleCap(), bCap =>
269
271
  E(state.adminNode).upgrade(bCap, { vatParameters }),
270
272
  );
@@ -272,16 +274,19 @@ export const makeStartInstance = (
272
274
  },
273
275
  );
274
276
 
277
+ /**
278
+ * @type {import('./utils.js').StartInstance}
279
+ */
275
280
  const startInstance = async (
276
281
  installationP,
277
282
  uncleanIssuerKeywordRecord = harden({}),
283
+ // @ts-expect-error FIXME may not match the expected terms of SF
278
284
  customTerms = harden({}),
279
285
  privateArgs = undefined,
280
286
  instanceLabel = '',
281
287
  ) => {
282
- const { installation, bundle, bundleCap } = await E(
283
- startInstanceAccess,
284
- ).unwrapInstallation(installationP);
288
+ const { installation, bundle, bundleCap } =
289
+ await E(startInstanceAccess).unwrapInstallation(installationP);
285
290
  // AWAIT ///
286
291
 
287
292
  const contractBundleCap = bundle || bundleCap;
@@ -329,6 +334,7 @@ export const makeStartInstance = (
329
334
  void watchForAdminNodeDone(adminNode, instanceAdmin);
330
335
 
331
336
  /** @type {ZoeInstanceAdmin} */
337
+ // @ts-expect-error XXX saveIssuer
332
338
  const zoeInstanceAdminForZcf = makeZoeInstanceAdmin(
333
339
  zoeInstanceStorageManager,
334
340
  instanceAdmin,
@@ -354,6 +360,7 @@ export const makeStartInstance = (
354
360
 
355
361
  // creatorInvitation can be undefined, but if it is defined,
356
362
  // let's make sure it is an invitation.
363
+ // @ts-expect-error cast
357
364
  return E.when(
358
365
  Promise.all([
359
366
  creatorInvitationP,
@@ -382,6 +389,5 @@ export const makeStartInstance = (
382
389
  },
383
390
  );
384
391
  };
385
- // @ts-expect-error cast
386
392
  return harden(startInstance);
387
393
  };
@@ -23,12 +23,12 @@ type ZoeService = {
23
23
  getInvitationIssuer: GetInvitationIssuer;
24
24
  install: InstallBundle;
25
25
  installBundleID: InstallBundleID;
26
- startInstance: import('./utils').StartInstance;
26
+ startInstance: import("./utils.js").StartInstance;
27
27
  offer: Offer;
28
- getPublicFacet: import('./utils').GetPublicFacet;
28
+ getPublicFacet: import("./utils.js").GetPublicFacet;
29
29
  getIssuers: GetIssuers;
30
30
  getBrands: GetBrands;
31
- getTerms: import('./utils').GetTerms;
31
+ getTerms: import("./utils.js").GetTerms;
32
32
  getOfferFilter: GetOfferFilter;
33
33
  getInstallationForInstance: GetInstallationForInstance;
34
34
  getInstance: GetInstance;
@@ -43,19 +43,19 @@ type ZoeService = {
43
43
  getBundleIDFromInstallation: GetBundleIDFromInstallation;
44
44
  getProposalShapeForInvitation: (invitationHandle: InvitationHandle) => Pattern | undefined;
45
45
  };
46
- type GetInvitationIssuer = () => Promise<Issuer<'set'>>;
47
- type GetFeeIssuer = () => Promise<Issuer<'nat'>>;
46
+ type GetInvitationIssuer = () => Promise<Issuer<"set", InvitationDetails>>;
47
+ type GetFeeIssuer = () => Promise<Issuer<"nat">>;
48
48
  type GetConfiguration = () => {
49
49
  feeIssuerConfig: FeeIssuerConfig;
50
50
  };
51
- type GetIssuers = (instance: import('./utils').Instance<any>) => Promise<IssuerKeywordRecord>;
52
- type GetBrands = (instance: import('./utils').Instance<any>) => Promise<BrandKeywordRecord>;
53
- type GetOfferFilter = (instance: import('./utils').Instance<any>) => string[];
51
+ type GetIssuers = (instance: import("./utils.js").Instance<any>) => Promise<IssuerKeywordRecord>;
52
+ type GetBrands = (instance: import("./utils.js").Instance<any>) => Promise<BrandKeywordRecord>;
53
+ type GetOfferFilter = (instance: import("./utils.js").Instance<any>) => string[];
54
54
  type SetOfferFilter = (instance: Instance, strings: string[]) => any;
55
- type GetInstallationForInstance = (instance: import('./utils').Instance<any>) => Promise<Installation>;
56
- type GetInstance = (invitation: ERef<Invitation>) => Promise<import('./utils').Instance<any>>;
55
+ type GetInstallationForInstance = (instance: import("./utils.js").Instance<any>) => Promise<Installation>;
56
+ type GetInstance = (invitation: ERef<Invitation>) => Promise<import("./utils.js").Instance<any>>;
57
57
  type GetInstallation = (invitation: ERef<Invitation>) => Promise<Installation>;
58
- type GetInvitationDetails = (invitation: ERef<Invitation>) => Promise<InvitationDetails>;
58
+ type GetInvitationDetails = (invitation: ERef<Invitation<any, any>>) => Promise<InvitationDetails>;
59
59
  /**
60
60
  * Create an installation by safely evaluating the code and
61
61
  * registering it with Zoe. Returns an installation.
@@ -64,12 +64,12 @@ type InstallBundle = (bundle: Bundle | SourceBundle, bundleLabel?: string | unde
64
64
  /**
65
65
  * Create an installation from a Bundle ID. Returns an installation.
66
66
  */
67
- type InstallBundleID = (bundleID: BundleID, bundleLabel?: string | undefined) => Promise<Installation>;
67
+ type InstallBundleID = (bundleID: string, bundleLabel?: string | undefined) => Promise<Installation>;
68
68
  /**
69
69
  * Verify that an alleged Installation is real, and return the Bundle ID it
70
70
  * will use for contract code.
71
71
  */
72
- type GetBundleIDFromInstallation = (allegedInstallation: ERef<Installation>) => Promise<BundleID>;
72
+ type GetBundleIDFromInstallation = (allegedInstallation: ERef<Installation>) => Promise<string>;
73
73
  /**
74
74
  * To redeem an invitation, the user normally provides a proposal (their
75
75
  * rules for the offer) as well as payments to be escrowed by Zoe. If
@@ -85,7 +85,7 @@ type GetBundleIDFromInstallation = (allegedInstallation: ERef<Installation>) =>
85
85
  * values are the actual payments to be escrowed. A payment is
86
86
  * expected for every rule under `give`.
87
87
  */
88
- type Offer = <Args, Result>(invitation: ERef<Invitation<Result, Args>>, proposal?: Proposal, paymentKeywordRecord?: PaymentPKeywordRecord, offerArgs?: Args | undefined) => Promise<UserSeat<Result>>;
88
+ type Offer = <Result, Args = undefined>(invitation: ERef<Invitation<Result, Args>>, proposal?: Proposal, paymentKeywordRecord?: PaymentPKeywordRecord, offerArgs?: Args) => Promise<UserSeat<Result>>;
89
89
  /**
90
90
  * Zoe uses seats to access or manipulate offers. They let contracts and users
91
91
  * interact with them. Zoe has two kinds of seats. ZCFSeats are used within
@@ -161,14 +161,10 @@ type ProposalRecord = {
161
161
  * { Asset: AmountMath.make(assetBrand, 5n), Price:
162
162
  * AmountMath.make(priceBrand, 9n) }
163
163
  */
164
- type AmountKeywordRecord = Record<Keyword, Amount<any>>;
164
+ type AmountKeywordRecord = Record<Keyword, import("@agoric/ertp/src/types.js").AnyAmount>;
165
165
  type Waker = {
166
166
  wake: () => void;
167
167
  };
168
- type Deadline = import('@agoric/time/src/types').Timestamp;
169
- type Timer = {
170
- setWakeup: (deadline: Deadline, wakerP: ERef<Waker>) => void;
171
- };
172
168
  type OnDemandExitRule = {
173
169
  onDemand: null;
174
170
  };
@@ -177,8 +173,8 @@ type WaivedExitRule = {
177
173
  };
178
174
  type AfterDeadlineExitRule = {
179
175
  afterDeadline: {
180
- timer: Timer;
181
- deadline: Deadline;
176
+ timer: import("@agoric/time").TimerService;
177
+ deadline: import("@agoric/time").Timestamp;
182
178
  };
183
179
  };
184
180
  /**
@@ -187,17 +183,16 @@ type AfterDeadlineExitRule = {
187
183
  * The possible records are:
188
184
  * `{ waived: null }`
189
185
  * `{ onDemand: null }`
190
- * `{ afterDeadline: { timer :Timer<Deadline>, deadline :Deadline } }
186
+ * `{ afterDeadline: { timer :Timer<Deadline>, deadline :Deadline } }`
191
187
  */
192
188
  type ExitRule = OnDemandExitRule | WaivedExitRule | AfterDeadlineExitRule;
193
- type Instance = import('./utils').Instance<any>;
194
- type VatAdminSvc = import('@agoric/swingset-vat').VatAdminSvc;
189
+ type Instance = import("./utils.js").Instance<any>;
195
190
  type ZCFSpec = {
196
- bundleCap: import('@agoric/swingset-vat').BundleCap;
191
+ bundleCap: import("@agoric/swingset-vat").BundleCap;
197
192
  } | {
198
193
  name: string;
199
194
  } | {
200
- id: BundleID;
195
+ id: string;
201
196
  };
202
197
  /**
203
198
  * Opaque type for a JSONable source bundle
@@ -207,13 +202,13 @@ type PaymentPKeywordRecord = Record<Keyword, ERef<Payment<any>>>;
207
202
  type PaymentKeywordRecord = Record<Keyword, Payment<any>>;
208
203
  type InvitationDetails = {
209
204
  installation: Installation;
210
- instance: import('./utils').Instance<any>;
205
+ instance: import("./utils.js").Instance<any>;
211
206
  handle: InvitationHandle;
212
207
  description: string;
213
208
  customDetails?: Record<string, any> | undefined;
214
209
  };
215
- type Installation<SF = any> = import('./utils').Installation<SF>;
216
- type InstallationStart<I extends Installation<any>> = import('./utils').InstallationStart<I>;
210
+ type Installation<SF = any> = import("./utils.js").Installation<SF>;
211
+ type InstallationStart<I extends Installation<any>> = import("./utils.js").InstallationStart<I>;
217
212
  type FeeIssuerConfig = {
218
213
  name: string;
219
214
  assetKind: AssetKind;
@@ -222,5 +217,5 @@ type FeeIssuerConfig = {
222
217
  type ZoeFeesConfig = {
223
218
  getPublicFacetFee: NatValue;
224
219
  };
225
- type FeeMintAccess = Handle<'feeMintAccess'>;
226
- //# sourceMappingURL=types.d.ts.map
220
+ type FeeMintAccess = Handle<"feeMintAccess">;
221
+ //# sourceMappingURL=types-ambient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-ambient.d.ts","sourceRoot":"","sources":["types-ambient.js"],"names":[],"mappings":"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"}