@agoric/zoe 0.26.3-upgrade-18a-dev-4ee0508.0 → 0.26.3-upgrade-20-dev-086463b.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 (191) hide show
  1. package/bundles/bundle-contractFacet-js-meta.json +288 -288
  2. package/bundles/bundle-contractFacet.js +1 -1
  3. package/package.json +30 -30
  4. package/src/cleanProposal.d.ts +2 -0
  5. package/src/cleanProposal.d.ts.map +1 -1
  6. package/src/cleanProposal.js +4 -2
  7. package/src/contractFacet/exit.d.ts +1 -1
  8. package/src/contractFacet/exit.d.ts.map +1 -1
  9. package/src/contractFacet/offerHandlerStorage.d.ts +1 -1
  10. package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -1
  11. package/src/contractFacet/offerHandlerStorage.js +5 -0
  12. package/src/contractFacet/reallocate.d.ts.map +1 -1
  13. package/src/contractFacet/reallocate.js +4 -0
  14. package/src/contractFacet/rightsConservation.d.ts.map +1 -1
  15. package/src/contractFacet/rightsConservation.js +0 -1
  16. package/src/contractFacet/types.d.ts +184 -0
  17. package/src/contractFacet/types.d.ts.map +1 -0
  18. package/src/contractFacet/{types-ambient.d.ts → types.ts} +66 -91
  19. package/src/contractFacet/vatRoot.d.ts +8 -2
  20. package/src/contractFacet/vatRoot.d.ts.map +1 -1
  21. package/src/contractFacet/vatRoot.js +5 -4
  22. package/src/contractFacet/zcfMint.d.ts +4 -3
  23. package/src/contractFacet/zcfMint.d.ts.map +1 -1
  24. package/src/contractFacet/zcfMint.js +9 -21
  25. package/src/contractFacet/zcfSeat.d.ts.map +1 -1
  26. package/src/contractFacet/zcfSeat.js +12 -188
  27. package/src/contractFacet/zcfZygote.d.ts +9 -1
  28. package/src/contractFacet/zcfZygote.d.ts.map +1 -1
  29. package/src/contractFacet/zcfZygote.js +27 -9
  30. package/src/contractSupport/atomicTransfer.d.ts +6 -0
  31. package/src/contractSupport/atomicTransfer.d.ts.map +1 -1
  32. package/src/contractSupport/atomicTransfer.js +4 -0
  33. package/src/contractSupport/bondingCurves.js +1 -1
  34. package/src/contractSupport/durability.d.ts +1 -0
  35. package/src/contractSupport/durability.d.ts.map +1 -1
  36. package/src/contractSupport/durability.js +4 -0
  37. package/src/contractSupport/index.d.ts +2 -2
  38. package/src/contractSupport/index.js +2 -19
  39. package/src/contractSupport/priceAuthorityInitial.d.ts +2 -0
  40. package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
  41. package/src/contractSupport/priceAuthorityInitial.js +3 -1
  42. package/src/contractSupport/priceQuote.d.ts +1 -0
  43. package/src/contractSupport/priceQuote.d.ts.map +1 -1
  44. package/src/contractSupport/priceQuote.js +6 -1
  45. package/src/contractSupport/recorder.d.ts +8 -24
  46. package/src/contractSupport/recorder.d.ts.map +1 -1
  47. package/src/contractSupport/recorder.js +6 -0
  48. package/src/contractSupport/types-ambient.d.ts.map +1 -1
  49. package/src/contractSupport/types-ambient.js +1 -0
  50. package/src/contractSupport/zoeHelpers.d.ts +11 -2
  51. package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
  52. package/src/contractSupport/zoeHelpers.js +7 -2
  53. package/src/contracts/atomicSwap.d.ts +1 -1
  54. package/src/contracts/auction/index.d.ts +3 -3
  55. package/src/contracts/automaticRefund.d.ts +3 -3
  56. package/src/contracts/autoswap.d.ts +4 -0
  57. package/src/contracts/autoswap.d.ts.map +1 -1
  58. package/src/contracts/autoswap.js +4 -0
  59. package/src/contracts/barterExchange.d.ts +2 -2
  60. package/src/contracts/callSpread/fundedCallSpread.d.ts +1 -1
  61. package/src/contracts/callSpread/pricedCallSpread.d.ts +4 -4
  62. package/src/contracts/coveredCall-durable.d.ts +1 -1
  63. package/src/contracts/coveredCall.d.ts +1 -1
  64. package/src/contracts/coveredCall.d.ts.map +1 -1
  65. package/src/contracts/coveredCall.js +1 -6
  66. package/src/contracts/loan/index.d.ts +1 -1
  67. package/src/contracts/loan/types-ambient.d.ts +13 -13
  68. package/src/contracts/loan/types-ambient.d.ts.map +1 -1
  69. package/src/contracts/loan/types-ambient.js +17 -17
  70. package/src/contracts/mintPayments.d.ts +2 -2
  71. package/src/contracts/oracle.d.ts +3 -0
  72. package/src/contracts/oracle.d.ts.map +1 -1
  73. package/src/contracts/oracle.js +1 -0
  74. package/src/contracts/priceAggregator.d.ts +2 -0
  75. package/src/contracts/priceAggregator.d.ts.map +1 -1
  76. package/src/contracts/priceAggregator.js +14 -11
  77. package/src/contracts/scaledPriceAuthority.d.ts +1 -0
  78. package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
  79. package/src/contracts/scaledPriceAuthority.js +1 -0
  80. package/src/contracts/sellItems.d.ts +1 -1
  81. package/src/contracts/simpleExchange.d.ts +5 -0
  82. package/src/contracts/simpleExchange.d.ts.map +1 -1
  83. package/src/contracts/simpleExchange.js +4 -0
  84. package/src/contracts/types-ambient.d.ts +7 -7
  85. package/src/contracts/types-ambient.d.ts.map +1 -1
  86. package/src/contracts/types-ambient.js +7 -7
  87. package/src/contracts/valueVow.contract.d.ts +5 -2
  88. package/src/contracts/valueVow.contract.d.ts.map +1 -1
  89. package/src/contracts/valueVow.contract.js +1 -0
  90. package/src/instanceRecordStorage.d.ts.map +1 -1
  91. package/src/instanceRecordStorage.js +3 -1
  92. package/src/internal-types.d.ts +15 -6
  93. package/src/internal-types.d.ts.map +1 -1
  94. package/src/internal-types.js +9 -5
  95. package/src/issuerRecord.d.ts +3 -2
  96. package/src/issuerRecord.d.ts.map +1 -1
  97. package/src/issuerRecord.js +6 -2
  98. package/src/issuerStorage.d.ts +3 -2
  99. package/src/issuerStorage.d.ts.map +1 -1
  100. package/src/issuerStorage.js +10 -5
  101. package/src/typeGuards.d.ts +10 -5
  102. package/src/typeGuards.d.ts.map +1 -1
  103. package/src/typeGuards.js +9 -6
  104. package/src/types-ambient.d.ts +0 -40
  105. package/src/types-ambient.d.ts.map +1 -1
  106. package/src/types-ambient.js +4 -42
  107. package/src/types-index.d.ts +4 -0
  108. package/src/types-index.js +2 -0
  109. package/src/types.d.ts +29 -0
  110. package/src/types.d.ts.map +1 -0
  111. package/src/types.ts +44 -0
  112. package/src/zoeService/escrowStorage.d.ts.map +1 -1
  113. package/src/zoeService/escrowStorage.js +4 -0
  114. package/src/zoeService/feeMint.d.ts +1 -0
  115. package/src/zoeService/feeMint.d.ts.map +1 -1
  116. package/src/zoeService/feeMint.js +4 -0
  117. package/src/zoeService/installationStorage.d.ts +4 -5
  118. package/src/zoeService/installationStorage.d.ts.map +1 -1
  119. package/src/zoeService/installationStorage.js +8 -8
  120. package/src/zoeService/instanceAdminStorage.d.ts +1 -0
  121. package/src/zoeService/instanceAdminStorage.d.ts.map +1 -1
  122. package/src/zoeService/instanceAdminStorage.js +4 -0
  123. package/src/zoeService/internal-types.d.ts +12 -5
  124. package/src/zoeService/internal-types.d.ts.map +1 -1
  125. package/src/zoeService/internal-types.js +10 -10
  126. package/src/zoeService/invitationQueries.d.ts +3 -3
  127. package/src/zoeService/invitationQueries.js +3 -3
  128. package/src/zoeService/makeInvitation.d.ts +1 -0
  129. package/src/zoeService/makeInvitation.d.ts.map +1 -1
  130. package/src/zoeService/makeInvitation.js +3 -1
  131. package/src/zoeService/offer/burnInvitation.d.ts +1 -1
  132. package/src/zoeService/offer/burnInvitation.d.ts.map +1 -1
  133. package/src/zoeService/offer/burnInvitation.js +3 -2
  134. package/src/zoeService/offer/offer.d.ts +1 -0
  135. package/src/zoeService/offer/offer.d.ts.map +1 -1
  136. package/src/zoeService/offer/offer.js +3 -1
  137. package/src/zoeService/originalZoeSeat.d.ts.map +1 -1
  138. package/src/zoeService/originalZoeSeat.js +6 -4
  139. package/src/zoeService/startInstance.d.ts +1 -1
  140. package/src/zoeService/startInstance.d.ts.map +1 -1
  141. package/src/zoeService/startInstance.js +5 -4
  142. package/src/zoeService/types-ambient.d.ts +0 -220
  143. package/src/zoeService/types-ambient.d.ts.map +1 -1
  144. package/src/zoeService/types-ambient.js +4 -323
  145. package/src/zoeService/types.d.ts +238 -0
  146. package/src/zoeService/types.d.ts.map +1 -0
  147. package/src/zoeService/types.ts +307 -0
  148. package/src/zoeService/utils.d.ts +18 -10
  149. package/src/zoeService/utils.test-d.ts +1 -0
  150. package/src/zoeService/zoe.d.ts +11 -1
  151. package/src/zoeService/zoe.d.ts.map +1 -1
  152. package/src/zoeService/zoe.js +8 -1
  153. package/src/zoeService/zoeSeat.d.ts +1 -4
  154. package/src/zoeService/zoeSeat.d.ts.map +1 -1
  155. package/src/zoeService/zoeSeat.js +6 -4
  156. package/src/zoeService/zoeStorageManager.d.ts +5 -5
  157. package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
  158. package/src/zoeService/zoeStorageManager.js +4 -3
  159. package/tools/fakePriceAuthority.d.ts +3 -2
  160. package/tools/fakePriceAuthority.d.ts.map +1 -1
  161. package/tools/fakePriceAuthority.js +9 -6
  162. package/tools/fakeVatAdmin.d.ts +10 -4
  163. package/tools/fakeVatAdmin.d.ts.map +1 -1
  164. package/tools/fakeVatAdmin.js +21 -10
  165. package/tools/manualPriceAuthority.d.ts +6 -2
  166. package/tools/manualPriceAuthority.d.ts.map +1 -1
  167. package/tools/manualPriceAuthority.js +8 -6
  168. package/tools/scriptedOracle.d.ts +7 -3
  169. package/tools/scriptedOracle.d.ts.map +1 -1
  170. package/tools/scriptedOracle.js +4 -0
  171. package/tools/scriptedPriceAuthority.d.ts.map +1 -1
  172. package/tools/scriptedPriceAuthority.js +6 -5
  173. package/tools/setup-zoe.d.ts +12 -6
  174. package/tools/setup-zoe.d.ts.map +1 -1
  175. package/tools/setup-zoe.js +38 -5
  176. package/tools/test-utils.d.ts +10 -6
  177. package/tools/test-utils.d.ts.map +1 -1
  178. package/tools/test-utils.js +6 -2
  179. package/tools/types.d.ts +5 -0
  180. package/tools/types.d.ts.map +1 -1
  181. package/tools/types.js +5 -0
  182. package/src/contractFacet/internal-types.d.ts +0 -8
  183. package/src/contractFacet/internal-types.d.ts.map +0 -1
  184. package/src/contractFacet/internal-types.js +0 -15
  185. package/src/contractFacet/types-ambient.js +0 -1
  186. package/src/contractSupport/ratio.d.ts +0 -37
  187. package/src/contractSupport/ratio.d.ts.map +0 -1
  188. package/src/contractSupport/ratio.js +0 -419
  189. package/src/contractSupport/safeMath.d.ts +0 -11
  190. package/src/contractSupport/safeMath.d.ts.map +0 -1
  191. package/src/contractSupport/safeMath.js +0 -49
@@ -28,7 +28,11 @@ import { getZcfBundleCap } from './createZCFVat.js';
28
28
  import { defaultFeeIssuerConfig, prepareFeeMint } from './feeMint.js';
29
29
  import { ZoeServiceI } from '../typeGuards.js';
30
30
 
31
- /** @import {Baggage} from '@agoric/vat-data' */
31
+ /**
32
+ * @import {VatAdminSvc} from '@agoric/swingset-vat';
33
+ * @import {Baggage} from '@agoric/vat-data';
34
+ * @import {FeeIssuerConfig, FeeMintAccess, ZCFSpec, ZoeService} from './types.js';
35
+ */
32
36
 
33
37
  /**
34
38
  * Create a durable instance of Zoe.
@@ -289,3 +293,6 @@ export { makeDurableZoeKit, makeZoeKit };
289
293
  /**
290
294
  * @typedef {ReturnType<typeof makeDurableZoeKit>} ZoeKit
291
295
  */
296
+
297
+ // eslint-disable-next-line import/export -- no named value exports; only types
298
+ export * from '../types-index.js';
@@ -16,10 +16,7 @@ export function makeZoeSeatAdminFactory(baggage: import("@agoric/vat-data").Bagg
16
16
  fail(reason: any): void;
17
17
  /** @param {HandleOfferResult} result */
18
18
  resolveExitAndResult({ offerResultPromise, exitObj }: HandleOfferResult): void;
19
- getExitSubscriber(): import("@endo/exo").Guarded<{
20
- subscribeAfter(publishCount?: bigint): Promise<any>;
21
- getUpdateSince(updateCount: any): any;
22
- }>;
19
+ getExitSubscriber(): globalThis.Subscriber<any>;
23
20
  finalPayouts(payments: any): Promise<void>;
24
21
  }>;
25
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"zoeSeat.d.ts","sourceRoot":"","sources":["zoeSeat.js"],"names":[],"mappings":"AAkDO,iDAFI,OAAO,kBAAkB,EAAE,OAAO,uBAwWhC,UAAU,YACV,cAAc,uBACd,mBAAmB,iBACnB,aAAa,YACb,IAAI,CAAC,OAAO,CAAC,2BACb,OAAO;;;;;;;;;;;;;;;;QA3IZ,wCAAwC;8DAA5B,iBAAiB;;;;;;;EAoKpC"}
1
+ {"version":3,"file":"zoeSeat.d.ts","sourceRoot":"","sources":["zoeSeat.js"],"names":[],"mappings":"AAkDO,iDAFI,OAAO,kBAAkB,EAAE,OAAO,uBA0WhC,UAAU,YACV,cAAc,uBACd,mBAAmB,iBACnB,aAAa,YACb,IAAI,CAAC,OAAO,CAAC,2BACb,OAAO;;;;;;;;;;;;;;;;QA3IZ,wCAAwC;8DAA5B,iBAAiB;;;;EAoKpC"}
@@ -4,10 +4,10 @@ import { E } from '@endo/eventual-send';
4
4
  import { M, prepareExoClassKit } from '@agoric/vat-data';
5
5
  import { deeplyFulfilled } from '@endo/marshal';
6
6
  import { makePromiseKit } from '@endo/promise-kit';
7
+ import { NonNullish } from '@agoric/internal';
7
8
 
8
9
  import { satisfiesWant } from '../contractFacet/offerSafety.js';
9
- import '../types-ambient.js';
10
- import '../internal-types.js';
10
+
11
11
  import {
12
12
  declareOldZoeSeatAdminKind,
13
13
  OriginalZoeSeatIKit,
@@ -143,8 +143,10 @@ export const makeZoeSeatAdminFactory = baggage => {
143
143
  // doExit(), which ensures that finalPayouts() has set state.payouts.
144
144
  return E.when(
145
145
  state.subscriber.subscribeAfter(),
146
- () => state.payouts[keyword],
147
- () => state.payouts[keyword],
146
+ () =>
147
+ NonNullish(state.payouts[keyword], `No payout for "${keyword}"`),
148
+ () =>
149
+ NonNullish(state.payouts[keyword], `No payout for "${keyword}"`),
148
150
  );
149
151
  },
150
152
 
@@ -4,7 +4,7 @@ export function makeZoeStorageManager(createZCFVat: CreateZCFVat, getBundleCapFo
4
4
  getFeeBrand: () => Brand;
5
5
  }, zoeBaggage: Baggage): import("@endo/exo").GuardedKit<{
6
6
  zoeServiceDataAccess: {
7
- getInvitationIssuer: () => globalThis.Issuer<"set", InvitationDetails>;
7
+ getInvitationIssuer: () => globalThis.Issuer<"set", import("@agoric/zoe").InvitationDetails>;
8
8
  getBundleIDFromInstallation(allegedInstallation: any): Promise<string | undefined>;
9
9
  getPublicFacet(instance: any): any;
10
10
  getBrands(instance: any): any;
@@ -13,14 +13,14 @@ export function makeZoeStorageManager(createZCFVat: CreateZCFVat, getBundleCapFo
13
13
  getTerms(instance: any): any;
14
14
  getInstallation(instance: any): any;
15
15
  getProposalShapeForInvitation: (invitationHandle: any) => any;
16
- installBundle: (allegedBundle: any, bundleLabel: any) => Promise<Installation<any>>;
17
- installBundleID(bundleID: any, bundleLabel: any): Promise<Installation<unknown>>;
16
+ installBundle: (allegedBundle: any, bundleLabel: any) => Promise<globalThis.Installation>;
17
+ installBundleID(bundleID: any, bundleLabel: any): Promise<globalThis.Installation<unknown>>;
18
18
  };
19
19
  makeOfferAccess: {
20
20
  getAssetKindByBrand: GetAssetKindByBrand;
21
21
  getInstanceAdmin(instance: any): any;
22
22
  getProposalShapeForInvitation: (invitationHandle: any) => any;
23
- getInvitationIssuer: () => globalThis.Issuer<"set", InvitationDetails>;
23
+ getInvitationIssuer: () => globalThis.Issuer<"set", import("@agoric/zoe").InvitationDetails>;
24
24
  depositPayments(proposal: any, payments: any): Promise<Allocation>;
25
25
  };
26
26
  startInstanceAccess: {
@@ -33,7 +33,7 @@ export function makeZoeStorageManager(createZCFVat: CreateZCFVat, getBundleCapFo
33
33
  }>;
34
34
  };
35
35
  invitationIssuerAccess: {
36
- getInvitationIssuer: () => globalThis.Issuer<"set", InvitationDetails>;
36
+ getInvitationIssuer: () => globalThis.Issuer<"set", import("@agoric/zoe").InvitationDetails>;
37
37
  };
38
38
  }>;
39
39
  import type { Baggage } from '@agoric/vat-data';
@@ -1 +1 @@
1
- {"version":3,"file":"zoeStorageManager.d.ts","sourceRoot":"","sources":["zoeStorageManager.js"],"names":[],"mappings":"AAwDO,oDAXI,YAAY,qBAEZ,iBAAiB,kBACjB,OAAO,sBAAsB,EAAE,mBAAmB,WAClD;IACL,eAAe,EAAE,eAAe,CAAC;IACjC,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,KAAK,CAAC;CAC3B,cACO,OAAO;;;;;;;;;;;;;;;;;;;;;;;;kBAZkC,CAAC;qBAC3B,CAAC;oBAA0B,CAAC;;;;;;;GAsbrD;6BAlc0B,kBAAkB"}
1
+ {"version":3,"file":"zoeStorageManager.d.ts","sourceRoot":"","sources":["zoeStorageManager.js"],"names":[],"mappings":"AAyDO,oDAXI,YAAY,qBAEZ,iBAAiB,kBACjB,OAAO,sBAAsB,EAAE,mBAAmB,WAClD;IACL,eAAe,EAAE,eAAe,CAAC;IACjC,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,KAAK,CAAC;CAC3B,cACO,OAAO;;;;;;;;;;;;;;;;;;;;;;;;kBANgC,CAAC;qBAChD,CAAC;oBACa,CAAC;;;;;;;GA+ajB;6BApcyB,kBAAkB"}
@@ -21,15 +21,16 @@ import { prepareInvitationKit } from './makeInvitation.js';
21
21
  import { makeInstanceAdminStorage } from './instanceAdminStorage.js';
22
22
  import { makeInstallationStorage } from './installationStorage.js';
23
23
 
24
- /// <reference path="./types.js" />
25
- import './internal-types.js';
26
24
  import {
27
25
  InstanceStorageManagerIKit,
28
26
  ZoeMintI,
29
27
  ZoeStorageManagerIKit,
30
28
  } from '../typeGuards.js';
31
29
 
32
- /** @import {Baggage} from '@agoric/vat-data' */
30
+ /**
31
+ * @import {Baggage} from '@agoric/vat-data';
32
+ * @import {InvitationAmount} from '@agoric/zoe';
33
+ */
33
34
 
34
35
  const { ownKeys } = Reflect;
35
36
 
@@ -6,7 +6,7 @@
6
6
  * @property {Array<[number, number]>} [tradeList]
7
7
  * @property {import('@agoric/time').TimerService} timer
8
8
  * @property {import('@agoric/time').RelativeTime} [quoteInterval]
9
- * @property {ERef<Mint<'set'>>} [quoteMint]
9
+ * @property {ERef<Mint<'set', PriceDescription>>} [quoteMint]
10
10
  * @property {Amount<'nat'>} [unitAmountIn]
11
11
  */
12
12
  /**
@@ -24,8 +24,9 @@ export type FakePriceAuthorityOptions = {
24
24
  tradeList?: [number, number][] | undefined;
25
25
  timer: import("@agoric/time").TimerService;
26
26
  quoteInterval?: import("@agoric/time").RelativeTime | undefined;
27
- quoteMint?: globalThis.ERef<globalThis.Mint<"set">> | undefined;
27
+ quoteMint?: globalThis.ERef<globalThis.Mint<"set", PriceDescription>> | undefined;
28
28
  unitAmountIn?: import("@agoric/ertp").NatAmount | undefined;
29
29
  };
30
30
  import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
31
+ import type { PriceDescription } from '@agoric/zoe/tools/types.js';
31
32
  //# sourceMappingURL=fakePriceAuthority.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fakePriceAuthority.d.ts","sourceRoot":"","sources":["fakePriceAuthority.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,gDAHW,yBAAyB,GACvB,OAAO,CAAC,cAAc,CAAC,CAwSnC;;mBAvTa,KAAK,CAAC,KAAK,CAAC;oBACZ,KAAK,CAAC,KAAK,CAAC;;;WAGZ,OAAO,cAAc,EAAE,YAAY;;;;;oCAhB4C,4BAA4B"}
1
+ {"version":3,"file":"fakePriceAuthority.d.ts","sourceRoot":"","sources":["fakePriceAuthority.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,gDAHW,yBAAyB,GACvB,OAAO,CAAC,cAAc,CAAC,CAwSnC;;mBAvTa,KAAK,CAAC,KAAK,CAAC;oBACZ,KAAK,CAAC,KAAK,CAAC;;;WAGZ,OAAO,cAAc,EAAE,YAAY;;;;;oCAhB4C,4BAA4B;sCAA5B,4BAA4B"}
@@ -1,16 +1,19 @@
1
1
  import { Fail } from '@endo/errors';
2
- import { makePromiseKit } from '@endo/promise-kit';
3
2
  import { E } from '@endo/eventual-send';
4
3
  import { Far } from '@endo/marshal';
4
+ import { makePromiseKit } from '@endo/promise-kit';
5
5
 
6
- import { makeIssuerKit, AssetKind, AmountMath } from '@agoric/ertp';
6
+ import { AmountMath } from '@agoric/ertp';
7
7
  import {
8
- makeNotifierKit,
9
8
  makeNotifierFromAsyncIterable,
9
+ makeNotifierKit,
10
10
  } from '@agoric/notifier';
11
11
  import { TimeMath } from '@agoric/time';
12
12
 
13
- import { natSafeMath } from '../src/contractSupport/index.js';
13
+ import {
14
+ makePriceQuoteIssuer,
15
+ natSafeMath,
16
+ } from '../src/contractSupport/index.js';
14
17
 
15
18
  /**
16
19
  * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
@@ -31,7 +34,7 @@ const timestampLTE = (a, b) => TimeMath.compareAbs(a, b) <= 0;
31
34
  * @property {Array<[number, number]>} [tradeList]
32
35
  * @property {import('@agoric/time').TimerService} timer
33
36
  * @property {import('@agoric/time').RelativeTime} [quoteInterval]
34
- * @property {ERef<Mint<'set'>>} [quoteMint]
37
+ * @property {ERef<Mint<'set', PriceDescription>>} [quoteMint]
35
38
  * @property {Amount<'nat'>} [unitAmountIn]
36
39
  */
37
40
 
@@ -51,7 +54,7 @@ export async function makeFakePriceAuthority(options) {
51
54
  timer,
52
55
  unitAmountIn = AmountMath.make(actualBrandIn, 1n),
53
56
  quoteInterval = 1n,
54
- quoteMint = makeIssuerKit('quote', AssetKind.SET).mint,
57
+ quoteMint = makePriceQuoteIssuer().mint,
55
58
  } = options;
56
59
 
57
60
  tradeList ||
@@ -1,7 +1,5 @@
1
1
  export const zcfBundleCap: any;
2
2
  export default fakeVatAdmin;
3
- export type BundleID = import("@agoric/swingset-vat").BundleID;
4
- export type EndoZipBase64Bundle = import("@agoric/swingset-vat").EndoZipBase64Bundle;
5
3
  export type BundleCap = import("@agoric/swingset-vat").BundleCap;
6
4
  declare const fakeVatAdmin: {
7
5
  getBundleCap: (bundleID: any) => Promise<any>;
@@ -90,14 +88,22 @@ export function makeFakeVatAdmin(testContextSetter?: (...args: any) => unknown,
90
88
  getExitMessage: () => any;
91
89
  getHasExited: () => boolean;
92
90
  getExitWithFailure: () => any;
93
- installBundle: (id: any, bundle: any) => any;
91
+ /**
92
+ * @param {string} id
93
+ * @param {EndoZipBase64Bundle | TestBundle} bundle
94
+ */
95
+ installBundle: (id: string, bundle: EndoZipBase64Bundle | TestBundle) => any;
94
96
  installNamedBundle: (name: any, id: any, bundle: any) => any;
95
97
  getCriticalVatKey: () => {};
96
98
  getVatPowers: () => {
97
99
  D: (bcap: any) => {
98
- getBundle: () => globalThis.EndoZipBase64Bundle;
100
+ getBundle: () => EndoZipBase64Bundle | {
101
+ moduleFormat: "test";
102
+ } | undefined;
99
103
  };
100
104
  };
101
105
  };
102
106
  };
107
+ import type { EndoZipBase64Bundle } from '@agoric/swingset-vat';
108
+ import type { TestBundle } from '@agoric/swingset-vat';
103
109
  //# sourceMappingURL=fakeVatAdmin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fakeVatAdmin.d.ts","sourceRoot":"","sources":["fakeVatAdmin.js"],"names":[],"mappings":"AAsBA,+BAA4C;;uBAR7B,OAAO,sBAAsB,EAAE,QAAQ;kCACvC,OAAO,sBAAsB,EAAE,mBAAmB;wBAGlD,OAAO,sBAAsB,EAAE,SAAS;AAoJvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA8C;AA9I9C;;;GAGG;AACH,qDAHW,CAAC,GAAG,IAAI,KAAA,KAAK,OAAO,eACpB,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqIjC"}
1
+ {"version":3,"file":"fakeVatAdmin.d.ts","sourceRoot":"","sources":["fakeVatAdmin.js"],"names":[],"mappings":"AAyBA,+BAA4C;;wBAJ7B,OAAO,sBAAsB,EAAE,SAAS;AA4JvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA8C;AAtJ9C;;;GAGG;AACH,qDAHW,CAAC,GAAG,IAAI,KAAA,KAAK,OAAO,eACpB,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgH9B;;;WAGG;4BAFQ,MAAM,UACN,mBAAmB,GAAG,UAAU;;;;;;kCAxGkB,MAAM;;;;;EAmItE;yCAzJ2D,sBAAsB;gCAAtB,sBAAsB"}
@@ -1,4 +1,5 @@
1
- // @jessie-check
1
+ // no jessie-check because this code runs only in Node for testing
2
+ /* eslint-env node */
2
3
 
3
4
  import { Fail } from '@endo/errors';
4
5
  import { E } from '@endo/eventual-send';
@@ -12,8 +13,10 @@ import { handlePKitWarning } from '../src/handleWarning.js';
12
13
  import { makeHandle } from '../src/makeHandle.js';
13
14
  import zcfBundle from '../bundles/bundle-contractFacet.js';
14
15
 
15
- /** @typedef { import('@agoric/swingset-vat').BundleID} BundleID */
16
- /** @typedef { import('@agoric/swingset-vat').EndoZipBase64Bundle} EndoZipBase64Bundle */
16
+ /**
17
+ * @import {MapStore} from '@agoric/swingset-liveslots';
18
+ * @import {BundleID, EndoZipBase64Bundle, TestBundle} from '@agoric/swingset-vat';
19
+ */
17
20
 
18
21
  // this simulates a bundlecap, which is normally a swingset "device node"
19
22
  /** @typedef { import('@agoric/swingset-vat').BundleCap } BundleCap */
@@ -34,8 +37,8 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
34
37
  let exitWithFailure;
35
38
  /** @type {MapStore<BundleID, BundleCap>} */
36
39
  const idToBundleCap = makeScalarMapStore('idToBundleCap');
37
- /** @type {MapStore<BundleCap, EndoZipBase64Bundle>} */
38
- const bundleCapToBundle = makeScalarMapStore('bundleCapToBundle');
40
+ /** @type {Map<BundleCap, EndoZipBase64Bundle | {moduleFormat: 'test'}>} */
41
+ const bundleCapToBundle = new Map();
39
42
  /** @type {MapStore<string, BundleID>} */
40
43
  const nameToBundleID = makeScalarMapStore('nameToBundleID');
41
44
  const fakeVatPowers = {
@@ -136,17 +139,25 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
136
139
  getExitMessage: () => exitMessage,
137
140
  getHasExited: () => hasExited,
138
141
  getExitWithFailure: () => exitWithFailure,
142
+ /**
143
+ * @param {string} id
144
+ * @param {EndoZipBase64Bundle | TestBundle} bundle
145
+ */
139
146
  installBundle: (id, bundle) => {
140
147
  if (idToBundleCap.has(id)) {
141
- assert.equal(
142
- bundle.endoZipBase64,
143
- bundleCapToBundle.get(idToBundleCap.get(id)).endoZipBase64,
144
- );
148
+ const extant = bundleCapToBundle.get(idToBundleCap.get(id));
149
+ assert(extant);
150
+ assert.equal(bundle.moduleFormat, extant.moduleFormat);
151
+ if (extant.moduleFormat === 'endoZipBase64') {
152
+ // Narrow bundle.moduleFormat now that extant.moduleFormat is narrowed
153
+ assert.equal(bundle.moduleFormat, extant.moduleFormat);
154
+ assert.equal(bundle.endoZipBase64, extant.endoZipBase64);
155
+ }
145
156
  return idToBundleCap.get(id);
146
157
  }
147
158
  const bundleCap = fakeBundleCap();
148
159
  idToBundleCap.init(id, bundleCap);
149
- bundleCapToBundle.init(bundleCap, bundle);
160
+ bundleCapToBundle.set(bundleCap, bundle);
150
161
  return bundleCap;
151
162
  },
152
163
  installNamedBundle: (name, id, bundle) => {
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * @import {Amount, Brand, Issuer, IssuerKit, Payment, Purse} from '@agoric/ertp';
2
3
  * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
3
4
  */
4
5
  /**
@@ -7,7 +8,7 @@
7
8
  * @param {Brand<'nat'>} options.actualBrandOut
8
9
  * @param {Ratio} options.initialPrice
9
10
  * @param {import('@agoric/time').TimerService} options.timer
10
- * @param {IssuerKit<'set'>} [options.quoteIssuerKit]
11
+ * @param {IssuerKit<'set', PriceDescription>} [options.quoteIssuerKit]
11
12
  * @returns {PriceAuthority & { setPrice: (Ratio) => void; disable: () => void }}
12
13
  */
13
14
  export function makeManualPriceAuthority(options: {
@@ -15,11 +16,14 @@ export function makeManualPriceAuthority(options: {
15
16
  actualBrandOut: Brand<"nat">;
16
17
  initialPrice: Ratio;
17
18
  timer: import("@agoric/time").TimerService;
18
- quoteIssuerKit?: globalThis.IssuerKit<"set"> | undefined;
19
+ quoteIssuerKit?: IssuerKit<"set", PriceDescription> | undefined;
19
20
  }): PriceAuthority & {
20
21
  setPrice: (Ratio: any) => void;
21
22
  disable: () => void;
22
23
  };
23
24
  export type ManualPriceAuthority = ReturnType<typeof makeManualPriceAuthority>;
25
+ import type { Brand } from '@agoric/ertp';
26
+ import type { PriceDescription } from '@agoric/zoe/tools/types.js';
27
+ import type { IssuerKit } from '@agoric/ertp';
24
28
  import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
25
29
  //# sourceMappingURL=manualPriceAuthority.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manualPriceAuthority.d.ts","sourceRoot":"","sources":["manualPriceAuthority.js"],"names":[],"mappings":"AAYA;;GAEG;AAEH;;;;;;;;GAQG;AACH,kDAPG;IAA8B,aAAa,EAAnC,KAAK,CAAC,KAAK,CAAC;IACU,cAAc,EAApC,KAAK,CAAC,KAAK,CAAC;IACG,YAAY,EAA3B,KAAK;IACwC,KAAK,EAAlD,OAAO,cAAc,EAAE,YAAY;IACR,cAAc;CACjD,GAAU,cAAc,GAAG;IAAE,QAAQ,EAAE,CAAC,KAAK,KAAA,KAAK,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CA8E/E;mCACa,UAAU,CAAC,OAAO,wBAAwB,CAAC;oCAzFoC,4BAA4B"}
1
+ {"version":3,"file":"manualPriceAuthority.d.ts","sourceRoot":"","sources":["manualPriceAuthority.js"],"names":[],"mappings":"AAaA;;;GAGG;AAEH;;;;;;;;GAQG;AACH,kDAPG;IAA8B,aAAa,EAAnC,MAAM,KAAK,CAAC;IACU,cAAc,EAApC,MAAM,KAAK,CAAC;IACG,YAAY,EAA3B,KAAK;IACwC,KAAK,EAAlD,OAAO,cAAc,EAAE,YAAY;IACU,cAAc;CACnE,GAAU,cAAc,GAAG;IAAE,QAAQ,EAAE,CAAC,KAAK,KAAA,KAAK,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CA8E/E;mCACa,UAAU,CAAC,OAAO,wBAAwB,CAAC;2BA1FU,cAAc;sCACY,4BAA4B;+BADtD,cAAc;oCACY,4BAA4B"}
@@ -1,16 +1,18 @@
1
1
  // @jessie-check
2
2
 
3
- import { AmountMath, makeIssuerKit, AssetKind } from '@agoric/ertp';
3
+ import { AmountMath } from '@agoric/ertp';
4
+ import { makeNotifierKit } from '@agoric/notifier';
4
5
  import { E } from '@endo/eventual-send';
5
6
  import { Far } from '@endo/marshal';
6
- import { makeNotifierKit } from '@agoric/notifier';
7
7
  import {
8
- makeOnewayPriceAuthorityKit,
9
- floorMultiplyBy,
10
8
  floorDivideBy,
9
+ floorMultiplyBy,
10
+ makeOnewayPriceAuthorityKit,
11
+ makePriceQuoteIssuer,
11
12
  } from '../src/contractSupport/index.js';
12
13
 
13
14
  /**
15
+ * @import {Amount, Brand, Issuer, IssuerKit, Payment, Purse} from '@agoric/ertp';
14
16
  * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
15
17
  */
16
18
 
@@ -20,7 +22,7 @@ import {
20
22
  * @param {Brand<'nat'>} options.actualBrandOut
21
23
  * @param {Ratio} options.initialPrice
22
24
  * @param {import('@agoric/time').TimerService} options.timer
23
- * @param {IssuerKit<'set'>} [options.quoteIssuerKit]
25
+ * @param {IssuerKit<'set', PriceDescription>} [options.quoteIssuerKit]
24
26
  * @returns {PriceAuthority & { setPrice: (Ratio) => void; disable: () => void }}
25
27
  */
26
28
  export function makeManualPriceAuthority(options) {
@@ -29,7 +31,7 @@ export function makeManualPriceAuthority(options) {
29
31
  actualBrandOut,
30
32
  initialPrice, // brandOut / brandIn
31
33
  timer,
32
- quoteIssuerKit = makeIssuerKit('quote', AssetKind.SET),
34
+ quoteIssuerKit = makePriceQuoteIssuer(),
33
35
  } = options;
34
36
  const { brand, issuer: quoteIssuer, mint: quoteMint } = quoteIssuerKit;
35
37
 
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import {ZoeService} from '../src/types-index.js';
3
+ */
1
4
  /**
2
5
  * Start an instance of an Oracle that follows a script. The Oracle has access
3
6
  * to a timer, and looks in the script for events indexed by the current time.
@@ -15,13 +18,14 @@
15
18
  * @param {Issuer} feeIssuer
16
19
  */
17
20
  export function makeScriptedOracle(script: Record<string, any>, oracleInstallation: Installation<import("../src/contracts/oracle.js").OracleStart>, timer: import("@agoric/time").TimerService, zoe: ZoeService, feeIssuer: Issuer): Promise<{
18
- publicFacet: {
21
+ publicFacet: object & {
19
22
  query(query: OracleQuery): Promise<unknown>;
20
- makeQueryInvitation(query: OracleQuery): Promise<Invitation<unknown, never>>;
23
+ makeQueryInvitation(query: OracleQuery): Promise<globalThis.Invitation<unknown, never>>;
21
24
  } & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
22
25
  query(query: OracleQuery): Promise<unknown>;
23
- makeQueryInvitation(query: OracleQuery): Promise<Invitation<unknown, never>>;
26
+ makeQueryInvitation(query: OracleQuery): Promise<globalThis.Invitation<unknown, never>>;
24
27
  }>;
25
28
  creatorFacet: OracleCreatorFacet;
26
29
  }>;
30
+ import type { ZoeService } from '../src/types-index.js';
27
31
  //# sourceMappingURL=scriptedOracle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scriptedOracle.d.ts","sourceRoot":"","sources":["scriptedOracle.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,2CANW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBACnB,YAAY,CAAC,OAAO,4BAA4B,EAAE,WAAW,CAAC,SAC9D,OAAO,cAAc,EAAE,YAAY,OACnC,UAAU,aACV,MAAM;;;;;;;;;GAqChB"}
1
+ {"version":3,"file":"scriptedOracle.d.ts","sourceRoot":"","sources":["scriptedOracle.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,2CANW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBACnB,YAAY,CAAC,OAAO,4BAA4B,EAAE,WAAW,CAAC,SAC9D,OAAO,cAAc,EAAE,YAAY,OACnC,UAAU,aACV,MAAM;;;;;;;;;GAqChB;gCAtD4B,uBAAuB"}
@@ -2,6 +2,10 @@ import { TimeMath } from '@agoric/time';
2
2
  import { E } from '@endo/eventual-send';
3
3
  import { Far } from '@endo/marshal';
4
4
 
5
+ /**
6
+ * @import {ZoeService} from '../src/types-index.js';
7
+ */
8
+
5
9
  /**
6
10
  * Start an instance of an Oracle that follows a script. The Oracle has access
7
11
  * to a timer, and looks in the script for events indexed by the current time.
@@ -1 +1 @@
1
- {"version":3,"file":"scriptedPriceAuthority.d.ts","sourceRoot":"","sources":["scriptedPriceAuthority.js"],"names":[],"mappings":"AAUA;;GAEG;AAEH,yEAoFC;oCAvF4F,4BAA4B"}
1
+ {"version":3,"file":"scriptedPriceAuthority.d.ts","sourceRoot":"","sources":["scriptedPriceAuthority.js"],"names":[],"mappings":"AAWA;;GAEG;AAEH,yEAoFC;oCAvF4F,4BAA4B"}
@@ -1,11 +1,12 @@
1
- import { AmountMath, makeIssuerKit, AssetKind } from '@agoric/ertp';
2
- import { E } from '@endo/eventual-send';
3
- import { Far } from '@endo/marshal';
1
+ import { AmountMath } from '@agoric/ertp';
4
2
  import { observeNotifier } from '@agoric/notifier';
5
3
  import { TimeMath } from '@agoric/time';
4
+ import { E } from '@endo/eventual-send';
5
+ import { Far } from '@endo/marshal';
6
6
  import {
7
- natSafeMath,
8
7
  makeOnewayPriceAuthorityKit,
8
+ makePriceQuoteIssuer,
9
+ natSafeMath,
9
10
  } from '../src/contractSupport/index.js';
10
11
 
11
12
  /**
@@ -20,7 +21,7 @@ export function makeScriptedPriceAuthority(options) {
20
21
  timer,
21
22
  unitAmountIn = AmountMath.make(actualBrandIn, 1n),
22
23
  quoteInterval = 1n,
23
- quoteIssuerKit = makeIssuerKit('quote', AssetKind.SET),
24
+ quoteIssuerKit = makePriceQuoteIssuer(),
24
25
  } = options;
25
26
  const { brand, issuer: quoteIssuer, mint: quoteMint } = quoteIssuerKit;
26
27
  let currentPrice = priceList[0];
@@ -1,34 +1,40 @@
1
1
  export function makeZoeKitForTest(vatAdminSvc?: VatAdminSvc): {
2
- zoeService: import("@endo/exo").Guarded<ZoeService>;
2
+ zoeService: import("@endo/exo").Guarded<globalThis.ZoeService>;
3
3
  zoeConfigFacet: import("@endo/exo").Guarded<{
4
4
  updateZcfBundleId(bundleId: any): void;
5
5
  }>;
6
6
  feeMintAccess: FeeMintAccess;
7
7
  setVatAdminService: ((lateVatAdminSvc: any) => void) & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, (lateVatAdminSvc: any) => void>;
8
8
  };
9
- export function makeZoeForTest(vatAdminSvc?: VatAdminSvc): import("@endo/exo").Guarded<ZoeService>;
9
+ export function makeZoeForTest(vatAdminSvc?: VatAdminSvc): import("@endo/exo").Guarded<globalThis.ZoeService>;
10
10
  export function setUpZoeForTest<T extends unknown = any>({ setJig, feeIssuerConfig, vatAdminSvc, useNearRemote, }?: {
11
11
  setJig?: ((jig: T) => void) | undefined;
12
12
  feeIssuerConfig?: FeeIssuerConfig | undefined;
13
13
  vatAdminSvc?: VatAdminSvc | undefined;
14
14
  useNearRemote?: boolean | undefined;
15
15
  }): Promise<{
16
- zoe: import("@endo/exo").Guarded<ZoeService>;
16
+ zoe: import("@endo/exo").Guarded<globalThis.ZoeService>;
17
17
  feeMintAccessP: FeeMintAccess;
18
- bundleAndInstall: (path: string) => Promise<Installation>;
18
+ bundleAndInstall: (pathOrExports: object) => Promise<Installation>;
19
19
  vatAdminSvc: VatAdminSvc;
20
20
  vatAdminState: {
21
21
  getExitMessage: () => any;
22
22
  getHasExited: () => boolean;
23
23
  getExitWithFailure: () => any;
24
- installBundle: (id: any, bundle: any) => any;
24
+ installBundle: (id: string, bundle: EndoZipBase64Bundle | TestBundle) => any;
25
25
  installNamedBundle: (name: any, id: any, bundle: any) => any;
26
26
  getCriticalVatKey: () => {};
27
27
  getVatPowers: () => {
28
28
  D: (bcap: any) => {
29
- getBundle: () => EndoZipBase64Bundle;
29
+ getBundle: () => EndoZipBase64Bundle | {
30
+ moduleFormat: "test";
31
+ } | undefined;
30
32
  };
31
33
  };
32
34
  } | undefined;
33
35
  }>;
36
+ import type { FeeIssuerConfig } from '../src/types-index.js';
37
+ import type { Installation } from '../src/types-index.js';
38
+ import type { EndoZipBase64Bundle } from '@agoric/swingset-vat';
39
+ import type { TestBundle } from '@agoric/swingset-vat';
34
40
  //# sourceMappingURL=setup-zoe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup-zoe.d.ts","sourceRoot":"","sources":["setup-zoe.js"],"names":[],"mappings":"AAUO,gDAFI,WAAW;;;;;;;EAOrB;AAKM,6CAFI,WAAW,2CAGqB;AAapC,gCAPgB,CAAC,mFAErB;IAAmC,MAAM,UAA3B,CAAC,KAAK,IAAI;IACU,eAAe;IACnB,WAAW;IACf,aAAa;CAAC;;;6BA2B9B,MAAM,KACJ,OAAO,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;GAiBnC"}
1
+ {"version":3,"file":"setup-zoe.d.ts","sourceRoot":"","sources":["setup-zoe.js"],"names":[],"mappings":"AAgBO,gDAFI,WAAW;;;;;;;EAOrB;AAKM,6CAFI,WAAW,sDAGqB;AAapC,gCAPgB,CAAC,mFAErB;IAAmC,MAAM,UAA3B,CAAC,KAAK,IAAI;IACU,eAAe;IACnB,WAAW;IACf,aAAa;CAAC;;;sCAmD9B,MAAM,KACJ,OAAO,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;GAoBnC;qCApG+C,uBAAuB;kCAAvB,uBAAuB;yCADrB,sBAAsB;gCAAtB,sBAAsB"}
@@ -2,9 +2,15 @@ import { E, makeLoopback } from '@endo/captp';
2
2
 
3
3
  import { makeScalarBigMapStore } from '@agoric/vat-data';
4
4
  import bundleSource from '@endo/bundle-source';
5
+ import { bundleTestExports } from '@endo/import-bundle';
5
6
  import { makeDurableZoeKit } from '../src/zoeService/zoe.js';
6
7
  import fakeVatAdmin, { makeFakeVatAdmin } from './fakeVatAdmin.js';
7
8
 
9
+ /**
10
+ * @import {EndoZipBase64Bundle, TestBundle} from '@agoric/swingset-vat';
11
+ * @import {FeeIssuerConfig, Installation} from '../src/types-index.js';
12
+ */
13
+
8
14
  /**
9
15
  * @param {VatAdminSvc} [vatAdminSvc]
10
16
  */
@@ -57,13 +63,40 @@ export const setUpZoeForTest = async ({
57
63
  );
58
64
 
59
65
  /**
60
- * @param {string} path
66
+ * @param {object} pathOrExports
67
+ * @returns {Promise<EndoZipBase64Bundle | TestBundle>}
68
+ */
69
+ const bundleModule = async pathOrExports => {
70
+ if (typeof pathOrExports === 'string') {
71
+ const path = pathOrExports;
72
+ return bundleSource(path);
73
+ } else {
74
+ assert.equal(
75
+ Object.getOwnPropertyDescriptor(pathOrExports, Symbol.toStringTag)
76
+ ?.value,
77
+ 'Module',
78
+ );
79
+ // Copy all the properties so this object can be hardened.
80
+ const exports = { ...pathOrExports };
81
+ return bundleTestExports(exports);
82
+ }
83
+ };
84
+
85
+ /**
86
+ * Bundle the source module (either as file system path or a Module object)
87
+ * and return an Installation. The bundleID is random and should not be relied
88
+ * upon in tests of this variety.
89
+ *
90
+ * @param {object} pathOrExports
61
91
  * @returns {Promise<Installation>}
62
92
  */
63
- const bundleAndInstall = async path => {
64
- const bundle = await bundleSource(path);
65
- const id = `b1-${path}`;
66
- assert(vatAdminState, 'installBundle called before vatAdminState defined');
93
+ const bundleAndInstall = async pathOrExports => {
94
+ const bundle = await bundleModule(pathOrExports);
95
+ assert(
96
+ vatAdminState,
97
+ 'bundleAndInstall called before vatAdminState defined',
98
+ );
99
+ const id = `b1-zoe-test-${Math.random()}`;
67
100
  vatAdminState.installBundle(id, bundle);
68
101
  return E(zoeService).installBundleID(id);
69
102
  };
@@ -1,4 +1,4 @@
1
- export function withAmountUtils(kit: Pick<IssuerKit<"nat">, "brand" | "issuer" | "mint">): {
1
+ export function withAmountUtils(kit: Pick<IssuerKit<"nat", any>, "brand" | "issuer" | "mint">): {
2
2
  /** @param {NatValue} v */
3
3
  make: (v: NatValue) => import("@agoric/ertp").NatAmount;
4
4
  makeEmpty: () => import("@agoric/ertp").NatAmount;
@@ -6,15 +6,19 @@ export function withAmountUtils(kit: Pick<IssuerKit<"nat">, "brand" | "issuer" |
6
6
  * @param {NatValue} n
7
7
  * @param {NatValue} [d]
8
8
  */
9
- makeRatio: (n: NatValue, d?: NatValue) => Ratio;
9
+ makeRatio: (n: NatValue, d?: NatValue) => import("@agoric/ertp/src/ratio.js").Ratio;
10
10
  /** @param {number} n */
11
11
  units: (n: number) => import("@agoric/ertp").NatAmount;
12
12
  /** The intact Exo remotable */
13
- issuerKit: Pick<globalThis.IssuerKit<"nat">, "brand" | "issuer" | "mint">;
14
- brand: globalThis.Brand<"nat">;
15
- issuer: globalThis.Issuer<"nat", import("@endo/patterns").Key>;
16
- mint: globalThis.Mint<"nat", import("@endo/patterns").Key>;
13
+ issuerKit: Pick<IssuerKit<"nat", any>, "brand" | "issuer" | "mint">;
14
+ brand: Brand<"nat">;
15
+ issuer: Issuer<"nat", any>;
16
+ mint: globalThis.Mint<"nat", any>;
17
17
  };
18
18
  export { makeFakeStorageKit } from "@agoric/internal/src/storage-test-utils.js";
19
19
  export type AmountUtils = ReturnType<typeof withAmountUtils>;
20
+ import type { IssuerKit } from '@agoric/ertp';
21
+ import type { NatValue } from '@agoric/ertp';
22
+ import type { Brand } from '@agoric/ertp';
23
+ import type { Issuer } from '@agoric/ertp';
20
24
  //# sourceMappingURL=test-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["test-utils.js"],"names":[],"mappings":"AAIO,qCADK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAK3D,0BAA0B;cAAd,QAAQ;;IAGpB;;;OAGG;mBAFQ,QAAQ,MACR,QAAQ;IAGnB,wBAAwB;eAAZ,MAAM;IAGlB,+BAA+B;;;;;EAGlC;;0BACa,UAAU,CAAC,OAAO,eAAe,CAAC"}
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["test-utils.js"],"names":[],"mappings":"AAQO,qCADK,IAAI,CAAC,UAAU,KAAK,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAKhE,0BAA0B;cAAd,QAAQ;;IAGpB;;;OAGG;mBAFQ,QAAQ,MACR,QAAQ;IAGnB,wBAAwB;eAAZ,MAAM;IAGlB,+BAA+B;;;;;EAGlC;;0BACa,UAAU,CAAC,OAAO,eAAe,CAAC;+BAvB2B,cAAc;8BAAd,cAAc;2BAAd,cAAc;4BAAd,cAAc"}
@@ -1,7 +1,11 @@
1
1
  import { AmountMath } from '@agoric/ertp';
2
- import { makeRatio } from '../src/contractSupport/ratio.js';
2
+ import { makeRatio } from '../src/contractSupport/index.js';
3
3
 
4
- /** @param {Pick<IssuerKit<'nat'>, 'brand' | 'issuer' | 'mint'>} kit */
4
+ /**
5
+ * @import {Amount, Brand, DepositFacet, Issuer, IssuerKit, NatValue} from '@agoric/ertp';
6
+ */
7
+
8
+ /** @param {Pick<IssuerKit<'nat', any>, 'brand' | 'issuer' | 'mint'>} kit */
5
9
  export const withAmountUtils = kit => {
6
10
  const decimalPlaces = kit.issuer.getDisplayInfo?.()?.decimalPlaces ?? 6;
7
11
  return {
package/tools/types.d.ts CHANGED
@@ -139,4 +139,9 @@ export type PriceLevel = {
139
139
  */
140
140
  amountOut: Amount<"nat">;
141
141
  };
142
+ import type { Amount } from '@agoric/ertp';
143
+ import type { Payment } from '@agoric/ertp';
144
+ import type { Brand } from '@agoric/ertp';
145
+ import type { Issuer } from '@agoric/ertp';
146
+ import type { Notifier } from '@agoric/notifier';
142
147
  //# sourceMappingURL=types.d.ts.map