@agoric/zoe 0.27.0-upgrade-19-devnet-dev-5428c4d.0 → 0.27.0-upgrade-21-dev-16519b2.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 (170) hide show
  1. package/bundles/bundle-contractFacet-js-meta.json +305 -305
  2. package/bundles/bundle-contractFacet.js +1 -1
  3. package/package.json +36 -35
  4. package/src/cleanProposal.d.ts +2 -0
  5. package/src/cleanProposal.d.ts.map +1 -1
  6. package/src/cleanProposal.js +4 -2
  7. package/src/contractFacet/exit.d.ts +1 -1
  8. package/src/contractFacet/exit.d.ts.map +1 -1
  9. package/src/contractFacet/offerHandlerStorage.d.ts +1 -1
  10. package/src/contractFacet/rightsConservation.d.ts.map +1 -1
  11. package/src/contractFacet/rightsConservation.js +0 -1
  12. package/src/contractFacet/types.d.ts +184 -0
  13. package/src/contractFacet/types.d.ts.map +1 -0
  14. package/src/contractFacet/{types-ambient.d.ts → types.ts} +66 -29
  15. package/src/contractFacet/vatRoot.d.ts +9 -3
  16. package/src/contractFacet/vatRoot.d.ts.map +1 -1
  17. package/src/contractFacet/vatRoot.js +5 -4
  18. package/src/contractFacet/zcfMint.d.ts +3 -2
  19. package/src/contractFacet/zcfMint.d.ts.map +1 -1
  20. package/src/contractFacet/zcfMint.js +7 -7
  21. package/src/contractFacet/zcfSeat.d.ts +3 -1
  22. package/src/contractFacet/zcfSeat.d.ts.map +1 -1
  23. package/src/contractFacet/zcfSeat.js +6 -4
  24. package/src/contractFacet/zcfZygote.d.ts +8 -1
  25. package/src/contractFacet/zcfZygote.d.ts.map +1 -1
  26. package/src/contractFacet/zcfZygote.js +20 -8
  27. package/src/contractSupport/atomicTransfer.d.ts +6 -0
  28. package/src/contractSupport/atomicTransfer.d.ts.map +1 -1
  29. package/src/contractSupport/atomicTransfer.js +4 -0
  30. package/src/contractSupport/bondingCurves.js +1 -1
  31. package/src/contractSupport/index.d.ts +2 -2
  32. package/src/contractSupport/index.js +2 -19
  33. package/src/contractSupport/prepare-ownable.d.ts +1 -1
  34. package/src/contractSupport/prepare-ownable.d.ts.map +1 -1
  35. package/src/contractSupport/prepare-ownable.js +5 -1
  36. package/src/contractSupport/priceAuthorityInitial.d.ts +2 -0
  37. package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
  38. package/src/contractSupport/priceAuthorityInitial.js +3 -1
  39. package/src/contractSupport/types-ambient.d.ts.map +1 -1
  40. package/src/contractSupport/types-ambient.js +1 -0
  41. package/src/contractSupport/zoeHelpers.d.ts +6 -1
  42. package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
  43. package/src/contractSupport/zoeHelpers.js +1 -0
  44. package/src/contracts/atomicSwap.d.ts +1 -1
  45. package/src/contracts/auction/index.d.ts +5 -5
  46. package/src/contracts/automaticRefund.d.ts +4 -4
  47. package/src/contracts/autoswap.d.ts +4 -0
  48. package/src/contracts/autoswap.d.ts.map +1 -1
  49. package/src/contracts/autoswap.js +4 -0
  50. package/src/contracts/barterExchange.d.ts +3 -3
  51. package/src/contracts/callSpread/fundedCallSpread.d.ts +1 -1
  52. package/src/contracts/callSpread/pricedCallSpread.d.ts +5 -5
  53. package/src/contracts/coveredCall-durable.d.ts +1 -1
  54. package/src/contracts/coveredCall.d.ts +1 -1
  55. package/src/contracts/loan/index.d.ts +1 -1
  56. package/src/contracts/loan/liquidate.d.ts.map +1 -1
  57. package/src/contracts/loan/liquidate.js +5 -1
  58. package/src/contracts/loan/types-ambient.d.ts +13 -13
  59. package/src/contracts/loan/types-ambient.d.ts.map +1 -1
  60. package/src/contracts/loan/types-ambient.js +17 -17
  61. package/src/contracts/mintPayments.d.ts +4 -4
  62. package/src/contracts/oracle.d.ts +5 -2
  63. package/src/contracts/oracle.d.ts.map +1 -1
  64. package/src/contracts/oracle.js +1 -0
  65. package/src/contracts/otcDesk.d.ts +1 -1
  66. package/src/contracts/priceAggregator.d.ts +4 -2
  67. package/src/contracts/priceAggregator.d.ts.map +1 -1
  68. package/src/contracts/priceAggregator.js +10 -8
  69. package/src/contracts/scaledPriceAuthority.d.ts +1 -0
  70. package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
  71. package/src/contracts/scaledPriceAuthority.js +1 -0
  72. package/src/contracts/sellItems.d.ts +1 -1
  73. package/src/contracts/simpleExchange.d.ts +6 -1
  74. package/src/contracts/simpleExchange.d.ts.map +1 -1
  75. package/src/contracts/simpleExchange.js +4 -0
  76. package/src/contracts/types-ambient.d.ts +7 -7
  77. package/src/contracts/types-ambient.d.ts.map +1 -1
  78. package/src/contracts/types-ambient.js +7 -7
  79. package/src/contracts/valueVow.contract.d.ts +5 -2
  80. package/src/contracts/valueVow.contract.d.ts.map +1 -1
  81. package/src/contracts/valueVow.contract.js +1 -0
  82. package/src/instanceRecordStorage.d.ts +3 -1
  83. package/src/instanceRecordStorage.d.ts.map +1 -1
  84. package/src/instanceRecordStorage.js +9 -2
  85. package/src/internal-types.d.ts +25 -10
  86. package/src/internal-types.d.ts.map +1 -1
  87. package/src/internal-types.js +21 -11
  88. package/src/issuerRecord.d.ts +3 -2
  89. package/src/issuerRecord.d.ts.map +1 -1
  90. package/src/issuerRecord.js +6 -2
  91. package/src/issuerStorage.d.ts +3 -2
  92. package/src/issuerStorage.d.ts.map +1 -1
  93. package/src/issuerStorage.js +6 -5
  94. package/src/typeGuards.d.ts +10 -6
  95. package/src/typeGuards.d.ts.map +1 -1
  96. package/src/typeGuards.js +7 -5
  97. package/src/types-ambient.d.ts +0 -40
  98. package/src/types-ambient.d.ts.map +1 -1
  99. package/src/types-ambient.js +4 -42
  100. package/src/types-index.d.ts +4 -0
  101. package/src/types-index.js +2 -0
  102. package/src/types.d.ts +29 -0
  103. package/src/types.d.ts.map +1 -0
  104. package/src/types.ts +37 -0
  105. package/src/zoeService/escrowStorage.d.ts.map +1 -1
  106. package/src/zoeService/escrowStorage.js +1 -2
  107. package/src/zoeService/feeMint.d.ts +6 -3
  108. package/src/zoeService/feeMint.d.ts.map +1 -1
  109. package/src/zoeService/feeMint.js +8 -2
  110. package/src/zoeService/installationStorage.d.ts +3 -2
  111. package/src/zoeService/installationStorage.d.ts.map +1 -1
  112. package/src/zoeService/installationStorage.js +3 -7
  113. package/src/zoeService/internal-types.d.ts +11 -3
  114. package/src/zoeService/internal-types.d.ts.map +1 -1
  115. package/src/zoeService/internal-types.js +9 -3
  116. package/src/zoeService/invitationQueries.d.ts +3 -3
  117. package/src/zoeService/invitationQueries.js +3 -3
  118. package/src/zoeService/makeInvitation.d.ts +4 -1
  119. package/src/zoeService/makeInvitation.d.ts.map +1 -1
  120. package/src/zoeService/makeInvitation.js +8 -2
  121. package/src/zoeService/offer/offer.d.ts +1 -0
  122. package/src/zoeService/offer/offer.d.ts.map +1 -1
  123. package/src/zoeService/offer/offer.js +3 -1
  124. package/src/zoeService/originalZoeSeat.d.ts.map +1 -1
  125. package/src/zoeService/originalZoeSeat.js +0 -2
  126. package/src/zoeService/startInstance.d.ts.map +1 -1
  127. package/src/zoeService/startInstance.js +2 -4
  128. package/src/zoeService/types-ambient.d.ts +0 -226
  129. package/src/zoeService/types-ambient.d.ts.map +1 -1
  130. package/src/zoeService/types-ambient.js +4 -327
  131. package/src/zoeService/types.d.ts +238 -0
  132. package/src/zoeService/types.d.ts.map +1 -0
  133. package/src/zoeService/types.ts +307 -0
  134. package/src/zoeService/utils.d.ts +13 -5
  135. package/src/zoeService/utils.test-d.ts +1 -0
  136. package/src/zoeService/zoe.d.ts +18 -7
  137. package/src/zoeService/zoe.d.ts.map +1 -1
  138. package/src/zoeService/zoe.js +12 -5
  139. package/src/zoeService/zoeSeat.d.ts.map +1 -1
  140. package/src/zoeService/zoeSeat.js +1 -2
  141. package/src/zoeService/zoeStorageManager.d.ts +6 -6
  142. package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
  143. package/src/zoeService/zoeStorageManager.js +13 -4
  144. package/tools/fakeVatAdmin.d.ts +15 -8
  145. package/tools/fakeVatAdmin.d.ts.map +1 -1
  146. package/tools/fakeVatAdmin.js +18 -10
  147. package/tools/manualPriceAuthority.d.ts +4 -1
  148. package/tools/manualPriceAuthority.d.ts.map +1 -1
  149. package/tools/manualPriceAuthority.js +1 -0
  150. package/tools/scriptedOracle.d.ts +7 -3
  151. package/tools/scriptedOracle.d.ts.map +1 -1
  152. package/tools/scriptedOracle.js +4 -0
  153. package/tools/setup-zoe.d.ts +13 -7
  154. package/tools/setup-zoe.d.ts.map +1 -1
  155. package/tools/setup-zoe.js +38 -5
  156. package/tools/test-utils.d.ts +1 -1
  157. package/tools/test-utils.js +1 -1
  158. package/tools/types.d.ts +1 -0
  159. package/tools/types.d.ts.map +1 -1
  160. package/tools/types.js +1 -0
  161. package/src/contractFacet/internal-types.d.ts +0 -8
  162. package/src/contractFacet/internal-types.d.ts.map +0 -1
  163. package/src/contractFacet/internal-types.js +0 -15
  164. package/src/contractFacet/types-ambient.js +0 -1
  165. package/src/contractSupport/ratio.d.ts +0 -37
  166. package/src/contractSupport/ratio.d.ts.map +0 -1
  167. package/src/contractSupport/ratio.js +0 -419
  168. package/src/contractSupport/safeMath.d.ts +0 -11
  169. package/src/contractSupport/safeMath.d.ts.map +0 -1
  170. package/src/contractSupport/safeMath.js +0 -49
@@ -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';
@@ -13,9 +14,8 @@ import { makeHandle } from '../src/makeHandle.js';
13
14
  import zcfBundle from '../bundles/bundle-contractFacet.js';
14
15
 
15
16
  /**
16
- * @import {LegacyWeakMap, WeakMapStore} from '@agoric/store';
17
17
  * @import {MapStore} from '@agoric/swingset-liveslots';
18
- * @import {BundleID, EndoZipBase64Bundle} from '@agoric/swingset-vat';
18
+ * @import {BundleID, EndoZipBase64Bundle, TestBundle} from '@agoric/swingset-vat';
19
19
  */
20
20
 
21
21
  // this simulates a bundlecap, which is normally a swingset "device node"
@@ -37,8 +37,8 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
37
37
  let exitWithFailure;
38
38
  /** @type {MapStore<BundleID, BundleCap>} */
39
39
  const idToBundleCap = makeScalarMapStore('idToBundleCap');
40
- /** @type {MapStore<BundleCap, EndoZipBase64Bundle>} */
41
- const bundleCapToBundle = makeScalarMapStore('bundleCapToBundle');
40
+ /** @type {Map<BundleCap, EndoZipBase64Bundle | {moduleFormat: 'test'}>} */
41
+ const bundleCapToBundle = new Map();
42
42
  /** @type {MapStore<string, BundleID>} */
43
43
  const nameToBundleID = makeScalarMapStore('nameToBundleID');
44
44
  const fakeVatPowers = {
@@ -139,17 +139,25 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
139
139
  getExitMessage: () => exitMessage,
140
140
  getHasExited: () => hasExited,
141
141
  getExitWithFailure: () => exitWithFailure,
142
+ /**
143
+ * @param {string} id
144
+ * @param {EndoZipBase64Bundle | TestBundle} bundle
145
+ */
142
146
  installBundle: (id, bundle) => {
143
147
  if (idToBundleCap.has(id)) {
144
- assert.equal(
145
- bundle.endoZipBase64,
146
- bundleCapToBundle.get(idToBundleCap.get(id)).endoZipBase64,
147
- );
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
+ }
148
156
  return idToBundleCap.get(id);
149
157
  }
150
158
  const bundleCap = fakeBundleCap();
151
159
  idToBundleCap.init(id, bundleCap);
152
- bundleCapToBundle.init(bundleCap, bundle);
160
+ bundleCapToBundle.set(bundleCap, bundle);
153
161
  return bundleCap;
154
162
  },
155
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
  /**
@@ -15,12 +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", PriceDescription> | 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';
24
26
  import type { PriceDescription } from '@agoric/zoe/tools/types.js';
27
+ import type { IssuerKit } from '@agoric/ertp';
25
28
  import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
26
29
  //# sourceMappingURL=manualPriceAuthority.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manualPriceAuthority.d.ts","sourceRoot":"","sources":["manualPriceAuthority.js"],"names":[],"mappings":"AAaA;;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;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;sCAzFoC,4BAA4B;oCAA5B,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"}
@@ -12,6 +12,7 @@ import {
12
12
  } from '../src/contractSupport/index.js';
13
13
 
14
14
  /**
15
+ * @import {Amount, Brand, Issuer, IssuerKit, Payment, Purse} from '@agoric/ertp';
15
16
  * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
16
17
  */
17
18
 
@@ -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.
@@ -17,11 +20,12 @@
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
21
  publicFacet: object & {
19
22
  query(query: OracleQuery): Promise<unknown>;
20
- makeQueryInvitation(query: OracleQuery): Promise<Invitation<unknown, never>>;
21
- } & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
23
+ makeQueryInvitation(query: OracleQuery): Promise<globalThis.Invitation<unknown, never>>;
24
+ } & 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,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
- setVatAdminService: ((lateVatAdminSvc: any) => void) & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, (lateVatAdminSvc: any) => void>;
7
+ setVatAdminService: ((lateVatAdminSvc: any) => void) & 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
  };
@@ -6,7 +6,7 @@ export function withAmountUtils(kit: Pick<IssuerKit<"nat", any>, "brand" | "issu
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 */
@@ -1,5 +1,5 @@
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
4
  /**
5
5
  * @import {Amount, Brand, DepositFacet, Issuer, IssuerKit, NatValue} from '@agoric/ertp';
package/tools/types.d.ts CHANGED
@@ -143,4 +143,5 @@ import type { Amount } from '@agoric/ertp';
143
143
  import type { Payment } from '@agoric/ertp';
144
144
  import type { Brand } from '@agoric/ertp';
145
145
  import type { Issuer } from '@agoric/ertp';
146
+ import type { Notifier } from '@agoric/notifier';
146
147
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;;iBASc,OAAO,KAAK,EAAE,gBAAgB,CAAC;;;;kBAE/B,IAAI,CAAC,QAAQ,KAAK,EAAE,gBAAgB,CAAC,CAAC;;;;;;8BAKvC,CAAC,gBAAgB,CAAC;;;;;;;;cAQjB,OAAO,KAAK,CAAC;;;;eAEb,OAAO,KAAK,CAAC;;;;WAEb,OAAO,kBAAkB,EAAE,eAAe,GAAG,OAAO,cAAc,EAAE,YAAY;;;;eAEhF,OAAO,cAAc,EAAE,eAAe;;;;iBAEtC,GAAG;;4CAMN,UAAU,KACR,IAAI,CAAC,UAAU,CAAC,GAAG,SAAS;8CAK9B,gBAAgB;;kBAKb,CAAC,WAAW,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC;;;oBAKhD,cAAc;gBACd,mBAAmB;;;YAKnB,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI;iBACtB,CAAC,QAAQ,EAAE,OAAO,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,KAAK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UAAU,CAAC;;;;;kBAGb,CAAC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,KAC7B,OAAO,CAAC,UAAU,CAAC;;;;iBAIb,CAAC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,KAC7B,OAAO,CAAC,UAAU,CAAC;;;;wBAGb,CAAC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,KAC7B,IAAI,CAAC,YAAY,CAAC;;;;;yBAGZ,CAAC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,KAC7B,IAAI,CAAC,YAAY,CAAC;;;;;yBAIZ,CAAC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,KAC7B,IAAI,CAAC,YAAY,CAAC;;;;wBAIZ,CAAC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,KAC7B,IAAI,CAAC,YAAY,CAAC;;8BAKb,CAAC,MAAM,EAAE,OAAO,KAAK,CAAC,KAAK,OAAO,KAAK,CAAC;wCAK1C,eAAe,iBACf,eAAe,KACb;IAAE,QAAQ,EAAE,OAAO,KAAK,CAAC,CAAC;IAAC,SAAS,EAAE,OAAO,KAAK,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,cAAc,EAAE,eAAe,CAAA;CAAE,GAAG,SAAS;;;;;;;;cAOpH,OAAO,KAAK,CAAC;;;;eAEb,OAAO,KAAK,CAAC;;4BA/J+C,cAAc;6BAAd,cAAc;2BAAd,cAAc;4BAAd,cAAc;8BAC7D,kBAAkB"}
package/tools/types.js CHANGED
@@ -3,6 +3,7 @@ export {};
3
3
 
4
4
  /**
5
5
  * @import {Amount, Brand, DepositFacet, Issuer, IssuerKit, Payment} from '@agoric/ertp';
6
+ * @import {Notifier} from '@agoric/notifier';
6
7
  */
7
8
 
8
9
  /**
@@ -1,8 +0,0 @@
1
- type TestJigSetter = ({ zcf }: {
2
- zcf: ZCF;
3
- }) => void;
4
- type ZCFZygote = {
5
- startContract: (instanceAdminFromZoe: ERef<ZoeInstanceAdmin>, instanceRecordFromZoe: InstanceRecord, issuerStorageFromZoe: IssuerRecords, privateArgs?: object) => Promise<ExecuteContractResult>;
6
- restartContract: (privateArgs?: object) => void;
7
- };
8
- //# sourceMappingURL=internal-types.d.ts.map
@@ -1 +0,0 @@
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,EACpD,qBAAqB,EAAE,cAAc,EACrC,oBAAoB,EAAE,aAAa,EACnC,WAAW,CAAC,EAAE,MAAM,KACnB,OAAO,CAAC,qBAAqB,CAAC;qBACxB,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI"}
@@ -1,15 +0,0 @@
1
- // @jessie-check
2
-
3
- /**
4
- * @typedef {( {zcf}: {zcf: ZCF} ) => void} TestJigSetter
5
- */
6
-
7
- /**
8
- * @typedef ZCFZygote
9
- * @property {(instanceAdminFromZoe: ERef<ZoeInstanceAdmin>,
10
- * instanceRecordFromZoe: InstanceRecord,
11
- * issuerStorageFromZoe: IssuerRecords,
12
- * privateArgs?: object,
13
- * ) => Promise<ExecuteContractResult>} startContract
14
- * @property {(privateArgs?: object) => void} restartContract
15
- */
@@ -1 +0,0 @@
1
- // Dummy file for .d.ts twin to declare ambients
@@ -1,37 +0,0 @@
1
- export function assertIsRatio(ratio: any): void;
2
- export function makeRatio(numerator: bigint, numeratorBrand: Brand, denominator?: bigint, denominatorBrand?: Brand): Ratio;
3
- export function makeRatioFromAmounts(numeratorAmount: Amount, denominatorAmount: Amount): Ratio;
4
- /** @type {ScaleAmount} */
5
- export const floorMultiplyBy: ScaleAmount;
6
- /** @type {ScaleAmount} */
7
- export const ceilMultiplyBy: ScaleAmount;
8
- /** @type {ScaleAmount} */
9
- export const multiplyBy: ScaleAmount;
10
- /**
11
- * Divide the amount by the ratio, truncating the remainder.
12
- * @type {ScaleAmount}
13
- */
14
- export const floorDivideBy: ScaleAmount;
15
- /**
16
- * Divide the amount by the ratio, rounding up the remainder.
17
- * @type {ScaleAmount}
18
- */
19
- export const ceilDivideBy: ScaleAmount;
20
- /**
21
- * Divide the amount by the ratio, rounding to nearest with ties to even (aka Banker's Rounding) as in IEEE 754 default rounding.
22
- * @type {ScaleAmount}
23
- */
24
- export const divideBy: ScaleAmount;
25
- export function invertRatio(ratio: Ratio): Ratio;
26
- export function addRatios(left: Ratio, right: Ratio): Ratio;
27
- export function subtractRatios(left: Ratio, right: Ratio): Ratio;
28
- export function multiplyRatios(left: Ratio, right: Ratio): Ratio;
29
- export function oneMinus(ratio: Ratio): Ratio;
30
- export function ratioGTE(left: Ratio, right: Ratio): boolean;
31
- export function ratiosSame(left: Ratio, right: Ratio): boolean;
32
- export function quantize(ratio: Ratio, newDen: bigint): Ratio;
33
- export function parseRatio(numeric: ParsableNumber, numeratorBrand: Brand, denominatorBrand?: Brand): Ratio;
34
- export function assertParsableNumber(specimen: unknown): asserts specimen is ParsableNumber;
35
- export function ratioToNumber(ratio: Ratio): number;
36
- export type ParsableNumber = bigint | number | string;
37
- //# sourceMappingURL=ratio.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ratio.d.ts","sourceRoot":"","sources":["ratio.js"],"names":[],"mappings":"AAwCO,gDAcN;AASM,qCANI,MAAM,kBACN,KAAK,gBACL,MAAM,qBACN,KAAK,GACH,KAAK,CAejB;AAOM,sDAJI,MAAM,qBACN,MAAM,GACJ,KAAK,CAYjB;AA2BD,0BAA0B;AAC1B,8BADW,WAAW,CAGpB;AAEF,0BAA0B;AAC1B,6BADW,WAAW,CAGpB;AAEF,0BAA0B;AAC1B,yBADW,WAAW,CAGpB;AA2BF;;;GAGG;AACH,4BAFU,WAAW,CAInB;AAEF;;;GAGG;AACH,2BAFU,WAAW,CAInB;AAEF;;;GAGG;AACH,uBAFU,WAAW,CAInB;AAMK,mCAHI,KAAK,GACH,KAAK,CAWjB;AAOM,gCAJI,KAAK,SACL,KAAK,GACH,KAAK,CAwBjB;AAOM,qCAJI,KAAK,SACL,KAAK,GACH,KAAK,CAmBjB;AAOM,qCAJI,KAAK,SACL,KAAK,GACH,KAAK,CA8BjB;AAQM,gCAHI,KAAK,GACH,KAAK,CAcjB;AAOM,+BAJI,KAAK,SACL,KAAK,GACH,OAAO,CAkBnB;AASM,iCAJI,KAAK,SACL,KAAK,GACH,OAAO,CAOnB;AAUM,gCAJI,KAAK,UACL,MAAM,GACJ,KAAK,CAiBjB;AAaM,oCALI,cAAc,kBACd,KAAK,qBACL,KAAK,GACH,KAAK,CAmBjB;AAMM,+CAHI,OAAO,GACL,QAAQ,QAAQ,IAAI,cAAc,CAK9C;AAQM,qCAHI,KAAK,GACH,MAAM,CAMlB;6BAhDa,MAAM,GAAG,MAAM,GAAG,MAAM"}