@agoric/zoe 0.26.3-upgrade-14-dev-c8f9e7b.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
package/exported.js CHANGED
@@ -1,12 +1 @@
1
- // @jessie-check
2
-
3
- import './src/contractFacet/types.js';
4
- import './src/zoeService/types.js';
5
- import './src/contractSupport/types.js';
6
- import './src/contracts/exported.js';
7
- import './src/types.js';
8
- import './tools/types-ambient.js';
9
- import '@agoric/notifier/exported.js';
10
- import '@agoric/ertp/exported.js';
11
- import '@agoric/store/exported.js';
12
- import '@agoric/swingset-vat/exported.js';
1
+ // Dummy file for .d.ts twin to declare ambients
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
2
  "name": "@agoric/zoe",
3
- "version": "0.26.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
3
+ "version": "0.26.3-upgrade-16-dev-8879538.0+8879538",
4
4
  "description": "Zoe: the Smart Contract Framework for Offer Enforcement",
5
5
  "type": "module",
6
6
  "main": "./src/zoeService/zoe.js",
7
7
  "engines": {
8
- "node": ">=14.15.0"
8
+ "node": "^18.12 || ^20.9"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "yarn build:bundles",
12
12
  "build:bundles": "node scripts/build-bundles.js",
13
- "prepack": "echo \"export {}; \" | cat - tools/types-ambient.js > tools/types.js && tsc --build jsconfig.build.json",
14
- "postpack": "git clean -f '*.d.ts*' tools/types.js",
13
+ "prepack": "tsc --build tsconfig.build.json",
14
+ "postpack": "git clean -f '*.d.ts*'",
15
15
  "test": "ava --verbose",
16
16
  "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
17
- "test:unit": "ava 'test/unitTests/**/test-*.js' -T 1m --verbose",
18
- "test:swingset": "ava 'test/swingsetTests/**/test-*.js' -T 10m --verbose",
17
+ "test:unit": "ava 'test/unitTests' -T 1m --verbose",
18
+ "test:swingset": "ava 'test/swingsetTests' -T 10m --verbose",
19
19
  "test:xs": "yarn test:xs-unit",
20
20
  "test:xs-unit": "ava-xs --verbose",
21
- "test:xs-worker": "SWINGSET_WORKER_TYPE=xs-worker ava -c 2 'test/swingsetTests/**/test-*.js'",
21
+ "test:xs-worker": "SWINGSET_WORKER_TYPE=xs-worker ava -c 2 'test/swingsetTests'",
22
22
  "build-zcfBundle": "yarn build:bundles",
23
23
  "lint-fix": "yarn lint:eslint --fix",
24
24
  "lint": "run-s --continue-on-error lint:*",
25
25
  "lint:eslint": "eslint .",
26
- "lint:types": "tsc -p jsconfig.json"
26
+ "lint:types": "tsc"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",
@@ -43,30 +43,37 @@
43
43
  },
44
44
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
45
45
  "dependencies": {
46
- "@agoric/assert": "0.6.1-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
47
- "@agoric/ertp": "0.16.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
48
- "@agoric/internal": "0.4.0-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
49
- "@agoric/notifier": "0.6.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
50
- "@agoric/store": "0.9.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
51
- "@agoric/swingset-vat": "0.32.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
52
- "@agoric/time": "0.3.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
53
- "@agoric/vat-data": "0.5.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
54
- "@endo/bundle-source": "2.5.2-upstream-rollup",
55
- "@endo/captp": "3.1.1",
56
- "@endo/eventual-send": "0.17.2",
57
- "@endo/far": "0.2.18",
58
- "@endo/import-bundle": "0.3.4",
59
- "@endo/marshal": "0.8.5",
60
- "@endo/nat": "4.1.27",
61
- "@endo/patterns": "0.2.2",
62
- "@endo/promise-kit": "0.2.56"
46
+ "@agoric/assert": "0.6.1-upgrade-16-dev-8879538.0+8879538",
47
+ "@agoric/base-zone": "0.1.1-upgrade-16-dev-8879538.0+8879538",
48
+ "@agoric/ertp": "0.16.3-upgrade-16-dev-8879538.0+8879538",
49
+ "@agoric/internal": "0.3.3-upgrade-16-dev-8879538.0+8879538",
50
+ "@agoric/notifier": "0.6.3-upgrade-16-dev-8879538.0+8879538",
51
+ "@agoric/store": "0.9.3-upgrade-16-dev-8879538.0+8879538",
52
+ "@agoric/swingset-liveslots": "0.10.3-upgrade-16-dev-8879538.0+8879538",
53
+ "@agoric/swingset-vat": "0.32.3-upgrade-16-dev-8879538.0+8879538",
54
+ "@agoric/time": "0.3.3-upgrade-16-dev-8879538.0+8879538",
55
+ "@agoric/vat-data": "0.5.3-upgrade-16-dev-8879538.0+8879538",
56
+ "@agoric/zone": "0.2.3-upgrade-16-dev-8879538.0+8879538",
57
+ "@endo/bundle-source": "^3.2.3",
58
+ "@endo/captp": "^4.2.0",
59
+ "@endo/common": "^1.2.2",
60
+ "@endo/eventual-send": "^1.2.2",
61
+ "@endo/exo": "^1.5.0",
62
+ "@endo/far": "^1.1.2",
63
+ "@endo/import-bundle": "^1.1.2",
64
+ "@endo/marshal": "^1.5.0",
65
+ "@endo/nat": "^5.0.7",
66
+ "@endo/patterns": "^1.4.0",
67
+ "@endo/promise-kit": "^1.1.2",
68
+ "yargs-parser": "^21.1.1"
63
69
  },
64
70
  "devDependencies": {
65
- "@endo/init": "0.5.56",
66
- "ava": "^5.2.0",
67
- "c8": "^7.13.0",
71
+ "@agoric/kmarshal": "0.1.1-upgrade-16-dev-8879538.0+8879538",
72
+ "@endo/init": "^1.1.2",
73
+ "ava": "^5.3.0",
74
+ "c8": "^9.1.0",
68
75
  "import-meta-resolve": "^2.2.1",
69
- "tsd": "^0.28.1"
76
+ "tsd": "^0.30.7"
70
77
  },
71
78
  "files": [
72
79
  "bundles/",
@@ -80,51 +87,59 @@
80
87
  "exclude": [
81
88
  "# path/url/import.meta stuff",
82
89
  "unitTests/contracts/",
83
- "test/swingsetTests/privateArgs/test-privateArgs.js",
84
- "test/swingsetTests/brokenContracts/test-crashingContract.js",
85
- "test/swingsetTests/offerArgs/test-offerArgs.js",
86
- "test/swingsetTests/makeKind/test-makeKind.js",
87
- "test/swingsetTests/zoe/test-zoe.js",
88
- "test/swingsetTests/runMint/test-runMint.js",
89
- "test/unitTests/test-zoe.js",
90
- "test/unitTests/test-scriptedOracle.js",
91
- "test/unitTests/test-makeKind.js",
92
- "test/unitTests/test-instanceStorage.js",
93
- "test/unitTests/contractSupport/test-depositTo.js",
94
- "test/unitTests/contractSupport/test-withdrawFrom.js",
95
- "test/unitTests/contractSupport/test-offerTo.js",
96
- "test/unitTests/zcf/test-zcfSeat.js",
97
- "test/unitTests/zcf/test-zcfSeat-exit.js",
90
+ "test/swingsetTests/privateArgs/privateArgs.test.js",
91
+ "test/swingsetTests/brokenContracts/crashingContract.test.js",
92
+ "test/swingsetTests/offerArgs/offerArgs.test.js",
93
+ "test/swingsetTests/makeKind/makeKind.test.js",
94
+ "test/swingsetTests/zoe/zoe.test.js",
95
+ "test/swingsetTests/runMint/runMint.test.js",
96
+ "test/unitTests/zoe.test.js",
97
+ "test/unitTests/scriptedOracle.test.js",
98
+ "test/unitTests/makeKind.test.js",
99
+ "test/unitTests/instanceStorage.test.js",
100
+ "test/unitTests/contractSupport/depositTo.test.js",
101
+ "test/unitTests/contractSupport/withdrawFrom.test.js",
102
+ "test/unitTests/contractSupport/offerTo.test.js",
103
+ "test/unitTests/zcf/zcfSeat.test.js",
104
+ "test/unitTests/zcf/zcfSeat-exit.test.js",
98
105
  "test/unitTests/zcf/setupZcfTest.js",
99
- "test/unitTests/zcf/test-feeMintAccess.js",
106
+ "test/unitTests/zcf/feeMintAccess.test.js",
100
107
  "# import.meta.url by way of setupZcfTest",
101
- "test/unitTests/test-zoe.js",
102
- "test/unitTests/test-blockedOffers.js",
103
- "test/unitTests/zcf/test-reallocate-empty.js",
104
- "test/unitTests/zcf/test-zoeHelpersWZcf.js",
105
- "test/unitTests/zcf/test-reallocateForZCFMint.js",
106
- "test/unitTests/zcf/test-zcf.js",
107
- "test/unitTests/zcf/test-allStagedSeatsUsed.js",
108
+ "test/unitTests/zoe.test.js",
109
+ "test/unitTests/zoe-startInstance.test.js",
110
+ "test/unitTests/blockedOffers.test.js",
111
+ "test/unitTests/zcf/reallocate-empty.test.js",
112
+ "test/unitTests/zcf/zoeHelpersWZcf.test.js",
113
+ "test/unitTests/zcf/reallocateForZCFMint.test.js",
114
+ "test/unitTests/zcf/atomicRearrange.test.js",
115
+ "test/unitTests/zcf/zcf.test.js",
116
+ "test/unitTests/zcf/allStagedSeatsUsed.test.js",
108
117
  "# ManualTimer.setWakeup: no function",
109
- "test/unitTests/test-fakePriceAuthority.js",
110
- "test/unitTests/test-manualTimer.js",
118
+ "test/unitTests/fakePriceAuthority.test.js",
119
+ "test/unitTests/manualTimer.test.js",
111
120
  "# hangs",
112
- "test-makeKind.js",
113
- "test/unitTests/test-scriptedOracle.js",
114
- "test/unitTests/test-zoe.js",
115
- "test/unitTests/zcf/test-allStagedSeatsUsed.js",
121
+ "makeKind.test.js",
122
+ "test/unitTests/scriptedOracle.test.js",
123
+ "test/unitTests/zoe.test.js",
124
+ "test/unitTests/zcf/allStagedSeatsUsed.test.js",
116
125
  "# We use SWINGSET_WORKER_TYPE=xs ava to run these...",
117
126
  "swingsetTests"
118
127
  ]
119
128
  },
120
129
  "ava": {
121
130
  "files": [
122
- "test/**/test-*.js"
131
+ "test/**/*.test.*"
132
+ ],
133
+ "require": [
134
+ "@endo/init/debug.js"
123
135
  ],
124
136
  "timeout": "20m"
125
137
  },
126
138
  "publishConfig": {
127
139
  "access": "public"
128
140
  },
129
- "gitHead": "c8f9e7be1645e0be23f47de197409a7d4874add5"
141
+ "typeCoverage": {
142
+ "atLeast": 84.92
143
+ },
144
+ "gitHead": "8879538cd1d125a08346f02dd5701d0d70c90bb8"
130
145
  }
@@ -3,7 +3,7 @@ export function assertKeywordName(keyword: any): void;
3
3
  export function cleanKeywords(uncleanKeywordRecord: {
4
4
  [name: string]: any;
5
5
  }): string[];
6
- export function coerceAmountPatternKeywordRecord(allegedAmountKeywordRecord: any, getAssetKindByBrand: any): Record<string, any>;
7
- export function coerceAmountKeywordRecord(allegedAmountKeywordRecord: any, getAssetKindByBrand: any): Record<string, any>;
6
+ export function coerceAmountPatternKeywordRecord(allegedAmountKeywordRecord: any, getAssetKindByBrand: any): Record<string | number | symbol, any>;
7
+ export function coerceAmountKeywordRecord(allegedAmountKeywordRecord: unknown, getAssetKindByBrand: any): AmountKeywordRecord;
8
8
  export function cleanProposal(proposal: Proposal, getAssetKindByBrand: GetAssetKindByBrand): ProposalRecord;
9
9
  //# sourceMappingURL=cleanProposal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanProposal.d.ts","sourceRoot":"","sources":["cleanProposal.js"],"names":[],"mappings":"AAWA,qCAAsC;AAa/B,sDAYN;AAMM;;IAFM,MAAM,EAAE,CAYpB;AAEM,iIA0BN;AAEM,0HAUN;AA4CM,wCAJI,QAAQ,uBACR,mBAAmB,GACjB,cAAc,CA6B1B"}
1
+ {"version":3,"file":"cleanProposal.d.ts","sourceRoot":"","sources":["cleanProposal.js"],"names":[],"mappings":"AAWA,qCAAsC;AAa/B,sDAYN;AAMM,oDAHI;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,GACnB,MAAM,EAAE,CAYpB;AAEM,mJAsBN;AAQM,sEAJI,OAAO,6BAEL,mBAAmB,CAa/B;AA4CM,wCAJI,QAAQ,uBACR,mBAAmB,GACjB,cAAc,CA6B1B"}
@@ -1,9 +1,9 @@
1
1
  import { assert, q, Fail } from '@agoric/assert';
2
2
  import { AmountMath, getAssetKind } from '@agoric/ertp';
3
+ import { objectMap } from '@agoric/internal';
3
4
  import { assertRecord } from '@endo/marshal';
4
5
  import { assertKey, assertPattern, mustMatch, isKey } from '@agoric/store';
5
6
  import { FullProposalShape } from './typeGuards.js';
6
- import { arrayToObj } from './objArrayConversion.js';
7
7
 
8
8
  import './internal-types.js';
9
9
 
@@ -56,12 +56,11 @@ export const coerceAmountPatternKeywordRecord = (
56
56
  allegedAmountKeywordRecord,
57
57
  getAssetKindByBrand,
58
58
  ) => {
59
- const keywords = cleanKeywords(allegedAmountKeywordRecord);
60
-
61
- const amounts = Object.values(allegedAmountKeywordRecord);
62
- // Check that each value can be coerced using the AmountMath
63
- // indicated by brand. `AmountMath.coerce` throws if coercion fails.
64
- const coercedAmounts = amounts.map(amount => {
59
+ cleanKeywords(allegedAmountKeywordRecord);
60
+ // FIXME objectMap should constrain the mapping function by the record's type
61
+ return objectMap(allegedAmountKeywordRecord, amount => {
62
+ // Check that each value can be coerced using the AmountMath
63
+ // indicated by brand. `AmountMath.coerce` throws if coercion fails.
65
64
  if (isKey(amount)) {
66
65
  const brandAssetKind = getAssetKindByBrand(amount.brand);
67
66
  const assetKind = getAssetKind(amount);
@@ -75,11 +74,14 @@ export const coerceAmountPatternKeywordRecord = (
75
74
  return amount;
76
75
  }
77
76
  });
78
-
79
- // Recreate the amountKeywordRecord with coercedAmounts.
80
- return harden(arrayToObj(coercedAmounts, keywords));
81
77
  };
82
78
 
79
+ /**
80
+ *
81
+ * @param {unknown} allegedAmountKeywordRecord
82
+ * @param {*} getAssetKindByBrand
83
+ * @returns {AmountKeywordRecord}
84
+ */
83
85
  export const coerceAmountKeywordRecord = (
84
86
  allegedAmountKeywordRecord,
85
87
  getAssetKindByBrand,
@@ -89,6 +91,7 @@ export const coerceAmountKeywordRecord = (
89
91
  getAssetKindByBrand,
90
92
  );
91
93
  assertKey(result);
94
+ // @ts-expect-error checked cast
92
95
  return result;
93
96
  };
94
97
 
@@ -112,10 +115,10 @@ const assertKeywordNotInBoth = (want, give) => {
112
115
  const wantKeywordSet = new Set(ownKeys(want));
113
116
  const giveKeywords = ownKeys(give);
114
117
 
115
- giveKeywords.forEach(keyword => {
118
+ for (const keyword of giveKeywords) {
116
119
  !wantKeywordSet.has(keyword) ||
117
120
  Fail`a keyword cannot be in both 'want' and 'give'`;
118
- });
121
+ }
119
122
  };
120
123
 
121
124
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["exit.js"],"names":[],"mappings":"AAyBO,sGAuGN"}
1
+ {"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["exit.js"],"names":[],"mappings":"AAyBO,sGAwGN"}
@@ -35,6 +35,7 @@ export const makeMakeExiter = baggage => {
35
35
  exit() {
36
36
  const { state } = this;
37
37
  state.zcfSeat.exit();
38
+ state.zcfSeat = undefined;
38
39
  },
39
40
  },
40
41
  {
@@ -1,5 +1,5 @@
1
- type TestJigSetter = ({ zcf: ZCF }: {
2
- zcf: any;
1
+ type TestJigSetter = ({ zcf }: {
2
+ zcf: ZCF;
3
3
  }) => void;
4
4
  type ZCFZygote = {
5
5
  startContract: (instanceAdminFromZoe: ERef<ZoeInstanceAdmin>, instanceRecordFromZoe: InstanceRecord, issuerStorageFromZoe: IssuerRecords, privateArgs?: object) => Promise<ExecuteContractResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"internal-types.d.ts","sourceRoot":"","sources":["internal-types.js"],"names":[],"mappings":";;MAG+B,IAAI;;0CAKE,KAAK,gBAAgB,CAAC,yBAC7B,cAAc,qDAEvB,MAAM,KACnB,QAAQ,qBAAqB,CAAC;oCACT,MAAM,KAAK,IAAI"}
1
+ {"version":3,"file":"internal-types.d.ts","sourceRoot":"","sources":["internal-types.js"],"names":[],"mappings":"qBAGa,CAAE,EAAC,GAAG,EAAC,EAAE;IAAC,GAAG,EAAE,GAAG,CAAA;CAAC,KAAM,IAAI;;mBAK5B,CAAC,oBAAoB,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAC1D,qBAA2B,EAAE,cAAc,EAC3C,oBAA0B,EAAE,aAAa,EACzC,WAAiB,CAAC,EAAE,MAAM,KACnB,OAAO,CAAC,qBAAqB,CAAC;qBACxB,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI"}
@@ -1,7 +1,7 @@
1
1
  // @jessie-check
2
2
 
3
3
  /**
4
- * @typedef {( {zcf: ZCF} ) => void} TestJigSetter
4
+ * @typedef {( {zcf}: {zcf: ZCF} ) => void} TestJigSetter
5
5
  */
6
6
 
7
7
  /**
@@ -1,5 +1,8 @@
1
1
  export function makeOfferHandlerStorage(zcfBaggage: any): {
2
- storeOfferHandler: (offerHandler: OfferHandler) => InvitationHandle;
2
+ storeOfferHandler: (offerHandler: any) => Handle<"Invitation">;
3
3
  takeOfferHandler: (invitationHandle: InvitationHandle, details?: Details) => OfferHandler;
4
4
  };
5
+ export type PassableOfferHandler = RemotableBrand<any, any> & RemotableObject & OfferHandler<unknown, never>;
6
+ import type { RemotableBrand } from '@endo/eventual-send';
7
+ import type { RemotableObject } from '@endo/pass-style';
5
8
  //# sourceMappingURL=offerHandlerStorage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"offerHandlerStorage.d.ts","sourceRoot":"","sources":["offerHandlerStorage.js"],"names":[],"mappings":"AAQO;sCAkBqB,YAAY,KAAK,gBAAgB;yCAe9B,gBAAgB,YAAY,OAAO,KAAK,YAAY;EAsBlF"}
1
+ {"version":3,"file":"offerHandlerStorage.d.ts","sourceRoot":"","sources":["offerHandlerStorage.js"],"names":[],"mappings":"AAiBO;;yCAgCwB,gBAAgB,YAAY,OAAO,KAAK,YAAY;EAsBlF;;oCA9DgC,qBAAqB;qCACpB,kBAAkB"}
@@ -6,9 +6,18 @@ import { canBeDurable, provideDurableWeakMapStore } from '@agoric/vat-data';
6
6
 
7
7
  import { defineDurableHandle } from '../makeHandle.js';
8
8
 
9
+ /**
10
+ * @import {RemotableBrand} from '@endo/eventual-send';
11
+ * @import {RemotableObject} from '@endo/pass-style';
12
+ */
13
+
14
+ /**
15
+ * @typedef {RemotableBrand & RemotableObject & OfferHandler} PassableOfferHandler
16
+ */
17
+
9
18
  export const makeOfferHandlerStorage = zcfBaggage => {
10
19
  const makeInvitationHandle = defineDurableHandle(zcfBaggage, 'Invitation');
11
- /** @type {WeakMapStore<InvitationHandle, OfferHandler>} */
20
+ /** @type {WeakMapStore<InvitationHandle, PassableOfferHandler>} */
12
21
 
13
22
  // ZCF needs to ephemerally hold on to ephemeral handlers, and durably hold
14
23
  // onto handlers that are intended to be durable. We keep two stores and store
@@ -18,13 +27,12 @@ export const makeOfferHandlerStorage = zcfBaggage => {
18
27
  const invitationHandleToEphemeralHandler = makeScalarWeakMapStore(
19
28
  'invitationHandleToEphemeralHandler',
20
29
  );
21
- /** @type {WeakMapStore<InvitationHandle, OfferHandler>} */
30
+ /** @type {WeakMapStore<InvitationHandle, PassableOfferHandler>} */
22
31
  const invitationHandleToDurableHandler = provideDurableWeakMapStore(
23
32
  zcfBaggage,
24
33
  'invitationHandleToDurableHandler',
25
34
  );
26
35
 
27
- /** @type {(offerHandler: OfferHandler) => InvitationHandle} */
28
36
  const storeOfferHandler = offerHandler => {
29
37
  if (typeof offerHandler === 'function') {
30
38
  offerHandler = ToFarFunction('offerHandler', offerHandler);
@@ -0,0 +1,3 @@
1
+ export function makeAllocationMap(transfers: Array<TransferPart>): [ZCFSeat, AmountKeywordRecord][];
2
+ export type TransactionList = Array<AmountKeywordRecord>;
3
+ //# sourceMappingURL=reallocate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reallocate.d.ts","sourceRoot":"","sources":["reallocate.js"],"names":[],"mappings":"AAiBO,6CAHI,KAAK,CAAC,YAAY,CAAC,GACjB,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAAE,CA8E5C;8BAtFa,KAAK,CAAC,mBAAmB,CAAC"}
@@ -0,0 +1,94 @@
1
+ import { makeScalarMapStore } from '@agoric/vat-data';
2
+
3
+ import { assertRightsConserved } from './rightsConservation.js';
4
+ import { addToAllocation, subtractFromAllocation } from './allocationMath.js';
5
+
6
+ const { Fail } = assert;
7
+
8
+ /** @typedef {Array<AmountKeywordRecord>} TransactionList */
9
+
10
+ /**
11
+ * Convert from a list of transfer descriptions ([fromSeat, toSeat, fromAmount,
12
+ * toAmount], with many parts optional) to a list of resulting allocations for
13
+ * each of the seats mentioned.
14
+ *
15
+ * @param {Array<TransferPart>} transfers
16
+ * @returns {[ZCFSeat, AmountKeywordRecord][]}
17
+ */
18
+ export const makeAllocationMap = transfers => {
19
+ /** @type {MapStore<ZCFSeat, [TransactionList, TransactionList]>} */
20
+ const allocations = makeScalarMapStore();
21
+
22
+ const getAllocations = seat => {
23
+ if (allocations.has(seat)) {
24
+ return allocations.get(seat);
25
+ }
26
+
27
+ /** @type {[TransactionList, TransactionList]} */
28
+ const pair = [[], []];
29
+ allocations.init(seat, pair);
30
+ return pair;
31
+ };
32
+
33
+ const decrementAllocation = (seat, decrement) => {
34
+ const [incr, decr] = getAllocations(seat);
35
+
36
+ const newDecr = [...decr, decrement];
37
+ allocations.set(seat, [incr, newDecr]);
38
+ };
39
+
40
+ const incrementAllocation = (seat, increment) => {
41
+ const [incr, decr] = getAllocations(seat);
42
+
43
+ const newIncr = [...incr, increment];
44
+ allocations.set(seat, [newIncr, decr]);
45
+ };
46
+
47
+ for (const [fromSeat, toSeat, fromAmounts, toAmounts] of transfers) {
48
+ if (fromSeat) {
49
+ if (!fromAmounts) {
50
+ throw Fail`Transfer from ${fromSeat} must say how much`;
51
+ }
52
+ decrementAllocation(fromSeat, fromAmounts);
53
+ if (toSeat) {
54
+ // Conserved transfer between seats
55
+ if (toAmounts) {
56
+ // distinct amounts, so we check conservation.
57
+ assertRightsConserved(
58
+ Object.values(fromAmounts),
59
+ Object.values(toAmounts),
60
+ );
61
+ incrementAllocation(toSeat, toAmounts);
62
+ } else {
63
+ // fromAmounts will be used for toAmounts as well
64
+ incrementAllocation(toSeat, fromAmounts);
65
+ }
66
+ } else {
67
+ // Transfer only from fromSeat
68
+ !toAmounts ||
69
+ Fail`Transfer without toSeat cannot have toAmounts ${toAmounts}`;
70
+ }
71
+ } else {
72
+ toSeat || Fail`Transfer must have at least one of fromSeat or toSeat`;
73
+ // Transfer only to toSeat
74
+ !fromAmounts ||
75
+ Fail`Transfer without fromSeat cannot have fromAmounts ${fromAmounts}`;
76
+ toAmounts || Fail`Transfer to ${toSeat} must say how much`;
77
+ incrementAllocation(toSeat, toAmounts);
78
+ }
79
+ }
80
+
81
+ /** @type {[ZCFSeat,AmountKeywordRecord][]} */
82
+ const resultingAllocations = [];
83
+ for (const [seat, [incrList, decrList]] of allocations.entries()) {
84
+ let newAlloc = seat.getCurrentAllocation();
85
+ for (const incr of incrList) {
86
+ newAlloc = addToAllocation(newAlloc, incr);
87
+ }
88
+ for (const decr of decrList) {
89
+ newAlloc = subtractFromAllocation(newAlloc, decr);
90
+ }
91
+ resultingAllocations.push([seat, newAlloc]);
92
+ }
93
+ return resultingAllocations;
94
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"rightsConservation.d.ts","sourceRoot":"","sources":["rightsConservation.js"],"names":[],"mappings":"AAkFA;;;;;;;;;GASG;AACH,uDANW,MAAM,EAAE,cAER,MAAM,EAAE,GAEN,IAAI,CAMhB"}
1
+ {"version":3,"file":"rightsConservation.d.ts","sourceRoot":"","sources":["rightsConservation.js"],"names":[],"mappings":"AAqFA;;;;;;;;;GASG;AACH,uDANW,MAAM,EAAE,cAER,MAAM,EAAE,GAEN,IAAI,CAMhB"}
@@ -3,6 +3,9 @@ import { assert, Fail } from '@agoric/assert';
3
3
  import { AmountMath } from '@agoric/ertp';
4
4
 
5
5
  import '../internal-types.js';
6
+ /**
7
+ * @import {MapStore} from '@agoric/store';
8
+ */
6
9
 
7
10
  /**
8
11
  * Iterate over the amounts and sum, storing the sums in a