@agoric/inter-protocol 0.16.2-other-dev-8f8782b.0 → 0.16.2-other-dev-3eb1a1d.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/README.md +6 -6
  2. package/package.json +42 -36
  3. package/scripts/build-bundles.js +5 -21
  4. package/src/auction/auctionBook.d.ts +147 -0
  5. package/src/auction/auctionBook.d.ts.map +1 -0
  6. package/src/auction/auctionBook.js +156 -150
  7. package/src/auction/auctionMath.d.ts +17 -0
  8. package/src/auction/auctionMath.d.ts.map +1 -0
  9. package/src/auction/auctionMath.js +81 -0
  10. package/src/auction/auctioneer.d.ts +69 -0
  11. package/src/auction/auctioneer.d.ts.map +1 -0
  12. package/src/auction/auctioneer.js +70 -59
  13. package/src/auction/offerBook.d.ts +45 -0
  14. package/src/auction/offerBook.d.ts.map +1 -0
  15. package/src/auction/offerBook.js +13 -12
  16. package/src/auction/params.d.ts +144 -0
  17. package/src/auction/params.d.ts.map +1 -0
  18. package/src/auction/params.js +10 -9
  19. package/src/auction/scheduleMath.d.ts +5 -0
  20. package/src/auction/scheduleMath.d.ts.map +1 -0
  21. package/src/auction/scheduleMath.js +18 -16
  22. package/src/auction/scheduler.d.ts +50 -0
  23. package/src/auction/scheduler.d.ts.map +1 -0
  24. package/src/auction/scheduler.js +53 -47
  25. package/src/auction/sortedOffers.d.ts +8 -0
  26. package/src/auction/sortedOffers.d.ts.map +1 -0
  27. package/src/auction/sortedOffers.js +10 -9
  28. package/src/auction/util.d.ts +30 -0
  29. package/src/auction/util.d.ts.map +1 -0
  30. package/src/auction/util.js +9 -6
  31. package/src/clientSupport.d.ts +167 -0
  32. package/src/clientSupport.d.ts.map +1 -0
  33. package/src/clientSupport.js +155 -97
  34. package/src/collectFees.d.ts +2 -0
  35. package/src/collectFees.d.ts.map +1 -0
  36. package/src/contractSupport.d.ts +28 -0
  37. package/src/contractSupport.d.ts.map +1 -0
  38. package/src/contractSupport.js +19 -13
  39. package/src/econCommitteeCharter.d.ts +40 -0
  40. package/src/econCommitteeCharter.d.ts.map +1 -0
  41. package/src/econCommitteeCharter.js +21 -20
  42. package/src/feeDistributor.d.ts +224 -0
  43. package/src/feeDistributor.d.ts.map +1 -0
  44. package/src/feeDistributor.js +37 -33
  45. package/src/index.d.ts +2 -0
  46. package/src/index.d.ts.map +1 -0
  47. package/src/index.js +1 -0
  48. package/src/interest-math.d.ts +3 -0
  49. package/src/interest-math.d.ts.map +1 -0
  50. package/src/interest.d.ts +28 -0
  51. package/src/interest.d.ts.map +1 -0
  52. package/src/interest.js +23 -18
  53. package/src/price/README.md +13 -0
  54. package/src/price/fluxAggregatorContract.d.ts +71 -0
  55. package/src/price/fluxAggregatorContract.d.ts.map +1 -0
  56. package/src/price/fluxAggregatorContract.js +64 -55
  57. package/src/price/fluxAggregatorKit.d.ts +103 -0
  58. package/src/price/fluxAggregatorKit.d.ts.map +1 -0
  59. package/src/price/fluxAggregatorKit.js +52 -40
  60. package/src/price/priceOracleKit.d.ts +38 -0
  61. package/src/price/priceOracleKit.d.ts.map +1 -0
  62. package/src/price/priceOracleKit.js +12 -14
  63. package/src/price/roundsManager.d.ts +204 -0
  64. package/src/price/roundsManager.d.ts.map +1 -0
  65. package/src/price/roundsManager.js +131 -85
  66. package/src/proposals/README.md +2 -3
  67. package/src/proposals/add-auction.d.ts +109 -0
  68. package/src/proposals/add-auction.d.ts.map +1 -0
  69. package/src/proposals/add-auction.js +256 -0
  70. package/src/proposals/addAssetToVault.d.ts +173 -0
  71. package/src/proposals/addAssetToVault.d.ts.map +1 -0
  72. package/src/proposals/addAssetToVault.js +192 -40
  73. package/src/proposals/committee-proposal.d.ts +113 -0
  74. package/src/proposals/committee-proposal.d.ts.map +1 -0
  75. package/src/proposals/committee-proposal.js +25 -31
  76. package/src/proposals/core-proposal.d.ts +149 -0
  77. package/src/proposals/core-proposal.d.ts.map +1 -0
  78. package/src/proposals/core-proposal.js +9 -11
  79. package/src/proposals/deploy-price-feeds.d.ts +76 -0
  80. package/src/proposals/deploy-price-feeds.d.ts.map +1 -0
  81. package/src/proposals/deploy-price-feeds.js +316 -0
  82. package/src/proposals/econ-behaviors.d.ts +541 -0
  83. package/src/proposals/econ-behaviors.d.ts.map +1 -0
  84. package/src/proposals/econ-behaviors.js +64 -45
  85. package/src/proposals/price-feed-proposal.d.ts +84 -0
  86. package/src/proposals/price-feed-proposal.d.ts.map +1 -0
  87. package/src/proposals/price-feed-proposal.js +109 -51
  88. package/src/proposals/replace-fee-distributor.d.ts +48 -0
  89. package/src/proposals/replace-fee-distributor.d.ts.map +1 -0
  90. package/src/proposals/replace-fee-distributor.js +195 -0
  91. package/src/proposals/replace-scaledPriceAuthorities.d.ts +30 -0
  92. package/src/proposals/replace-scaledPriceAuthorities.d.ts.map +1 -0
  93. package/src/proposals/replace-scaledPriceAuthorities.js +124 -0
  94. package/src/proposals/replaceElectorate.d.ts +55 -0
  95. package/src/proposals/replaceElectorate.d.ts.map +1 -0
  96. package/src/proposals/replaceElectorate.js +521 -0
  97. package/src/proposals/startEconCommittee.d.ts +34 -0
  98. package/src/proposals/startEconCommittee.d.ts.map +1 -0
  99. package/src/proposals/startEconCommittee.js +2 -2
  100. package/src/proposals/startPSM.d.ts +59 -0
  101. package/src/proposals/startPSM.d.ts.map +1 -0
  102. package/src/proposals/startPSM.js +44 -29
  103. package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +24 -0
  104. package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +1 -0
  105. package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
  106. package/src/proposals/upgrade-vaults.d.ts +41 -0
  107. package/src/proposals/upgrade-vaults.d.ts.map +1 -0
  108. package/src/proposals/upgrade-vaults.js +202 -0
  109. package/src/proposals/utils.d.ts +19 -0
  110. package/src/proposals/utils.d.ts.map +1 -0
  111. package/src/proposals/utils.js +43 -9
  112. package/src/provisionPool.d.ts +163 -0
  113. package/src/provisionPool.d.ts.map +1 -0
  114. package/src/provisionPool.js +122 -0
  115. package/src/provisionPoolKit.d.ts +359 -0
  116. package/src/provisionPoolKit.d.ts.map +1 -0
  117. package/src/provisionPoolKit.js +522 -0
  118. package/src/psm/psm.d.ts +125 -0
  119. package/src/psm/psm.d.ts.map +1 -0
  120. package/src/psm/psm.js +80 -79
  121. package/src/psm/types-ambient.d.ts +2 -0
  122. package/src/psm/types-ambient.d.ts.map +1 -0
  123. package/src/psm/types-ambient.js +3 -0
  124. package/src/reserve/assetReserve.d.ts +47 -0
  125. package/src/reserve/assetReserve.d.ts.map +1 -0
  126. package/src/reserve/assetReserve.js +28 -19
  127. package/src/reserve/assetReserveKit.d.ts +74 -0
  128. package/src/reserve/assetReserveKit.d.ts.map +1 -0
  129. package/src/reserve/assetReserveKit.js +24 -30
  130. package/src/reserve/params.d.ts +10 -0
  131. package/src/reserve/params.d.ts.map +1 -0
  132. package/src/tokens.d.ts +3 -0
  133. package/src/tokens.d.ts.map +1 -0
  134. package/src/tokens.js +5 -0
  135. package/src/vaultFactory/burn.d.ts +2 -0
  136. package/src/vaultFactory/burn.d.ts.map +1 -0
  137. package/src/vaultFactory/burn.js +1 -1
  138. package/src/vaultFactory/liquidation.d.ts +23 -0
  139. package/src/vaultFactory/liquidation.d.ts.map +1 -0
  140. package/src/vaultFactory/liquidation.js +37 -24
  141. package/src/vaultFactory/math.d.ts +11 -0
  142. package/src/vaultFactory/math.d.ts.map +1 -0
  143. package/src/vaultFactory/math.js +10 -9
  144. package/src/vaultFactory/orderedVaultStore.d.ts +93 -0
  145. package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
  146. package/src/vaultFactory/orderedVaultStore.js +8 -11
  147. package/src/vaultFactory/params.d.ts +140 -0
  148. package/src/vaultFactory/params.d.ts.map +1 -0
  149. package/src/vaultFactory/params.js +52 -24
  150. package/src/vaultFactory/prioritizedVaults.d.ts +279 -0
  151. package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
  152. package/src/vaultFactory/prioritizedVaults.js +4 -4
  153. package/src/vaultFactory/proceeds.d.ts +35 -0
  154. package/src/vaultFactory/proceeds.d.ts.map +1 -0
  155. package/src/vaultFactory/proceeds.js +26 -18
  156. package/src/vaultFactory/storeUtils.d.ts +25 -0
  157. package/src/vaultFactory/storeUtils.d.ts.map +1 -0
  158. package/src/vaultFactory/storeUtils.js +10 -12
  159. package/src/vaultFactory/types-ambient.d.ts +137 -0
  160. package/src/vaultFactory/types-ambient.d.ts.map +1 -0
  161. package/src/vaultFactory/{types.js → types-ambient.js} +42 -42
  162. package/src/vaultFactory/vault.d.ts +343 -0
  163. package/src/vaultFactory/vault.d.ts.map +1 -0
  164. package/src/vaultFactory/vault.js +105 -99
  165. package/src/vaultFactory/vaultDirector.d.ts +341 -0
  166. package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
  167. package/src/vaultFactory/vaultDirector.js +86 -64
  168. package/src/vaultFactory/vaultFactory.d.ts +202 -0
  169. package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
  170. package/src/vaultFactory/vaultFactory.js +52 -33
  171. package/src/vaultFactory/vaultHolder.d.ts +126 -0
  172. package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
  173. package/src/vaultFactory/vaultHolder.js +11 -16
  174. package/src/vaultFactory/vaultKit.d.ts +32 -0
  175. package/src/vaultFactory/vaultKit.d.ts.map +1 -0
  176. package/src/vaultFactory/vaultKit.js +5 -4
  177. package/src/vaultFactory/vaultManager.d.ts +674 -0
  178. package/src/vaultFactory/vaultManager.d.ts.map +1 -0
  179. package/src/vaultFactory/vaultManager.js +257 -158
  180. package/CHANGELOG.md +0 -1041
  181. package/exported.js +0 -2
  182. package/scripts/add-collateral-core.js +0 -112
  183. package/scripts/deploy-contracts.js +0 -100
  184. package/scripts/init-core.js +0 -198
  185. package/scripts/invite-committee-core.js +0 -42
  186. package/scripts/manual-price-feed.js +0 -117
  187. package/scripts/price-feed-core.js +0 -104
  188. package/scripts/start-local-chain.sh +0 -84
  189. package/src/psm/types.js +0 -3
  190. package/src/typeGuards.js +0 -13
  191. package/src/vaultFactory/type-imports.js +0 -4
@@ -1,8 +1,6 @@
1
1
  // @jessie-check
2
-
3
- import '@agoric/governance/exported.js';
4
- import '@agoric/zoe/exported.js';
5
- import '@agoric/zoe/src/contracts/exported.js';
2
+ /// <reference types="@agoric/governance/exported" />
3
+ /// <reference types="@agoric/zoe/exported" />
6
4
 
7
5
  // The vaultFactory owns a number of VaultManagers and a mint for Minted.
8
6
  //
@@ -31,49 +29,65 @@ import { InvitationShape } from '../auction/params.js';
31
29
  import { SHORTFALL_INVITATION_KEY, vaultDirectorParamTypes } from './params.js';
32
30
  import { provideDirector } from './vaultDirector.js';
33
31
 
32
+ /** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
33
+
34
34
  const trace = makeTracer('VF', true);
35
35
 
36
36
  /**
37
- * @typedef {ZCF<GovernanceTerms<import('./params').VaultDirectorParams> & {
38
- * auctioneerPublicFacet: import('../auction/auctioneer.js').AuctioneerPublicFacet,
39
- * priceAuthority: ERef<PriceAuthority>,
40
- * reservePublicFacet: AssetReservePublicFacet,
41
- * timerService: import('@agoric/time/src/types').TimerService,
42
- * }>} VaultFactoryZCF
37
+ * @typedef {ZCF<
38
+ * GovernanceTerms<import('./params').VaultDirectorParams> & {
39
+ * priceAuthority: ERef<PriceAuthority>;
40
+ * reservePublicFacet: AssetReservePublicFacet;
41
+ * timerService: import('@agoric/time').TimerService;
42
+ * }
43
+ * >} VaultFactoryZCF
43
44
  */
44
45
 
45
- export const privateArgsShape = M.splitRecord(
46
- harden({
47
- marshaller: M.remotable('Marshaller'),
48
- storageNode: StorageNodeShape,
49
- }),
50
- harden({
51
- // only necessary on first invocation, not subsequent
52
- feeMintAccess: FeeMintAccessShape,
53
- initialPoserInvitation: InvitationShape,
54
- initialShortfallInvitation: InvitationShape,
55
- }),
56
- );
57
- harden(privateArgsShape);
46
+ /** @type {ContractMeta} */
47
+ export const meta = {
48
+ privateArgsShape: M.splitRecord(
49
+ {
50
+ marshaller: M.remotable('Marshaller'),
51
+ storageNode: StorageNodeShape,
52
+ },
53
+ {
54
+ // only necessary on first invocation, not subsequent
55
+ feeMintAccess: FeeMintAccessShape,
56
+ initialPoserInvitation: InvitationShape,
57
+ initialShortfallInvitation: InvitationShape,
58
+ },
59
+ ),
60
+ upgradability: 'canUpgrade',
61
+ };
62
+ harden(meta);
58
63
 
59
64
  /**
60
65
  * @param {VaultFactoryZCF} zcf
61
66
  * @param {{
62
- * feeMintAccess: FeeMintAccess,
63
- * initialPoserInvitation: Invitation,
64
- * initialShortfallInvitation: Invitation,
65
- * storageNode: ERef<StorageNode>,
66
- * marshaller: ERef<Marshaller>,
67
+ * feeMintAccess: FeeMintAccess;
68
+ * initialPoserInvitation: Invitation;
69
+ * initialShortfallInvitation: Invitation;
70
+ * storageNode: ERef<StorageNode>;
71
+ * marshaller: ERef<Marshaller>;
72
+ * auctioneerInstance: Instance;
73
+ * managerParams: Record<
74
+ * string,
75
+ * import('./params.js').VaultManagerParamOverrides
76
+ * >;
77
+ * directorParamOverrides: [object];
67
78
  * }} privateArgs
68
- * @param {import('@agoric/ertp').Baggage} baggage
79
+ * @param {import('@agoric/swingset-liveslots').Baggage} baggage
69
80
  */
70
- export const prepare = async (zcf, privateArgs, baggage) => {
81
+ export const start = async (zcf, privateArgs, baggage) => {
71
82
  trace('prepare start', privateArgs, [...baggage.keys()]);
72
83
  const {
73
84
  initialPoserInvitation,
74
85
  initialShortfallInvitation,
75
86
  marshaller,
76
87
  storageNode,
88
+ auctioneerInstance,
89
+ managerParams,
90
+ directorParamOverrides,
77
91
  } = privateArgs;
78
92
 
79
93
  trace('awaiting debtMint');
@@ -85,7 +99,10 @@ export const prepare = async (zcf, privateArgs, baggage) => {
85
99
  mintedIssuerRecord: debtMint.getIssuerRecord(),
86
100
  }));
87
101
 
88
- const { timerService, auctioneerPublicFacet } = zcf.getTerms();
102
+ const { timerService } = zcf.getTerms();
103
+
104
+ const zoe = zcf.getZoeService();
105
+ const auctioneerPublicFacet = E(zoe).getPublicFacet(auctioneerInstance);
89
106
 
90
107
  const { makeRecorderKit, makeERecorderKit } = prepareRecorderKitMakers(
91
108
  baggage,
@@ -102,7 +119,6 @@ export const prepare = async (zcf, privateArgs, baggage) => {
102
119
  marshaller,
103
120
  );
104
121
  /** a powerful object; can modify the invitation */
105
- trace('awaiting makeParamManagerFromTerms');
106
122
  const vaultDirectorParamManager = await makeParamManagerFromTerms(
107
123
  {
108
124
  publisher: governanceSubscriptionKit.publication,
@@ -114,6 +130,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
114
130
  [SHORTFALL_INVITATION_KEY]: initialShortfallInvitation,
115
131
  },
116
132
  vaultDirectorParamTypes,
133
+ directorParamOverrides,
117
134
  );
118
135
 
119
136
  const director = provideDirector(
@@ -128,6 +145,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
128
145
  marshaller,
129
146
  makeRecorderKit,
130
147
  makeERecorderKit,
148
+ managerParams,
131
149
  );
132
150
 
133
151
  // cannot await because it would make remote calls during vat restart
@@ -145,5 +163,6 @@ export const prepare = async (zcf, privateArgs, baggage) => {
145
163
  publicFacet: director.public,
146
164
  });
147
165
  };
166
+ harden(start);
148
167
 
149
- /** @typedef {ContractOf<typeof prepare>} VaultFactoryContract */
168
+ /** @typedef {ContractOf<typeof start>} VaultFactoryContract */
@@ -0,0 +1,126 @@
1
+ export function prepareVaultHolder(baggage: import("@agoric/swingset-liveslots").Baggage, makeRecorderKit: import("@agoric/zoe/src/contractSupport/recorder.js").MakeRecorderKit): (vault: import("@endo/exo").Guarded<{
2
+ getVaultSeat(): ZCFSeat;
3
+ initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
4
+ publicSubscribers: {
5
+ vault: {
6
+ description: string;
7
+ subscriber: globalThis.Subscriber<VaultNotification>;
8
+ storagePath: Promise<string>;
9
+ };
10
+ };
11
+ invitationMakers: import("@endo/exo").Guarded<{
12
+ AdjustBalances(): Promise<Invitation<string, undefined>>;
13
+ CloseVault(): Promise<Invitation<string, undefined>>;
14
+ TransferVault(): Promise<Invitation<any, undefined>>;
15
+ }>;
16
+ vault: import("@endo/exo").Guarded<{
17
+ getPublicTopics(): {
18
+ vault: {
19
+ description: string;
20
+ subscriber: globalThis.Subscriber<VaultNotification>;
21
+ storagePath: Promise<string>;
22
+ };
23
+ };
24
+ makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
25
+ makeCloseInvitation(): Promise<Invitation<string, undefined>>;
26
+ /**
27
+ * Starting a transfer revokes the vault holder. The associated updater
28
+ * will get a special notification that the vault is being transferred.
29
+ */
30
+ makeTransferInvitation(): Promise<Invitation<any, undefined>>;
31
+ getCollateralAmount(): import("@agoric/ertp").NatAmount;
32
+ getCurrentDebt(): import("@agoric/ertp").NatAmount;
33
+ getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
34
+ }>;
35
+ vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
36
+ }>;
37
+ liquidating(): void;
38
+ liquidated(): void;
39
+ abortLiquidation(): string;
40
+ makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
41
+ makeCloseInvitation(): Promise<Invitation<string, undefined>>;
42
+ makeTransferInvitation(): Promise<Invitation<VaultKit>>;
43
+ getCollateralAmount(): Amount<"nat">;
44
+ getCurrentDebt(): Amount<"nat">;
45
+ getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
46
+ }>, storageNode: globalThis.StorageNode) => import("@endo/exo").GuardedKit<{
47
+ helper: {
48
+ /** @throws if this holder no longer owns the vault */
49
+ owned(): import("@endo/exo").Guarded<{
50
+ getVaultSeat(): ZCFSeat;
51
+ initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
52
+ publicSubscribers: {
53
+ vault: {
54
+ description: string;
55
+ subscriber: globalThis.Subscriber<VaultNotification>;
56
+ storagePath: Promise<string>;
57
+ };
58
+ };
59
+ invitationMakers: import("@endo/exo").Guarded<{
60
+ AdjustBalances(): Promise<Invitation<string, undefined>>;
61
+ CloseVault(): Promise<Invitation<string, undefined>>;
62
+ TransferVault(): Promise<Invitation<any, undefined>>;
63
+ }>;
64
+ vault: import("@endo/exo").Guarded<{
65
+ getPublicTopics(): {
66
+ vault: {
67
+ description: string;
68
+ subscriber: globalThis.Subscriber<VaultNotification>;
69
+ storagePath: Promise<string>;
70
+ };
71
+ };
72
+ makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
73
+ makeCloseInvitation(): Promise<Invitation<string, undefined>>;
74
+ /**
75
+ * Starting a transfer revokes the vault holder. The associated updater
76
+ * will get a special notification that the vault is being transferred.
77
+ */
78
+ makeTransferInvitation(): Promise<Invitation<any, undefined>>;
79
+ getCollateralAmount(): import("@agoric/ertp").NatAmount;
80
+ getCurrentDebt(): import("@agoric/ertp").NatAmount;
81
+ getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
82
+ }>;
83
+ vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
84
+ }>;
85
+ liquidating(): void;
86
+ liquidated(): void;
87
+ abortLiquidation(): string;
88
+ makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
89
+ makeCloseInvitation(): Promise<Invitation<string, undefined>>;
90
+ makeTransferInvitation(): Promise<Invitation<VaultKit>>;
91
+ getCollateralAmount(): Amount<"nat">;
92
+ getCurrentDebt(): Amount<"nat">;
93
+ getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
94
+ }>;
95
+ getUpdater(): import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
96
+ };
97
+ invitationMakers: {
98
+ AdjustBalances(): Promise<Invitation<string, undefined>>;
99
+ CloseVault(): Promise<Invitation<string, undefined>>;
100
+ TransferVault(): Promise<Invitation<any, undefined>>;
101
+ };
102
+ holder: {
103
+ getPublicTopics(): {
104
+ vault: {
105
+ description: string;
106
+ subscriber: globalThis.Subscriber<VaultNotification>;
107
+ storagePath: Promise<string>;
108
+ };
109
+ };
110
+ makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
111
+ makeCloseInvitation(): Promise<Invitation<string, undefined>>;
112
+ /**
113
+ * Starting a transfer revokes the vault holder. The associated updater
114
+ * will get a special notification that the vault is being transferred.
115
+ */
116
+ makeTransferInvitation(): Promise<Invitation<any, undefined>>;
117
+ getCollateralAmount(): import("@agoric/ertp").NatAmount;
118
+ getCurrentDebt(): import("@agoric/ertp").NatAmount;
119
+ getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
120
+ };
121
+ }>;
122
+ export type State = {
123
+ topicKit: import("@agoric/zoe/src/contractSupport/recorder.js").RecorderKit<VaultNotification>;
124
+ vault: Vault | null;
125
+ };
126
+ //# sourceMappingURL=vaultHolder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vaultHolder.d.ts","sourceRoot":"","sources":["vaultHolder.js"],"names":[],"mappings":"AAiCO,4CAHI,OAAO,4BAA4B,EAAE,OAAO,mBAC5C,OAAO,6CAA6C,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;YAqExE;;;eAGG;;;;;;;;;;;;;;;;gCAqB4ywB,cAAiB;;;QAhEh0wB,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;oBAwCtD;;;uBAGG;;;;;;;;;;;;;;;;wCAqB4ywB,cAAiB;;;;;;;;;;;;;;;;;;;QAxBh0wB;;;WAGG;;;;;;GAoBV;oBAnHY;IACR,QAAQ,EAAE,OAAO,6CAA6C,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAC/F,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB"}
@@ -1,17 +1,14 @@
1
- /**
2
- * @file Use-object for the owner of a vault
3
- */
1
+ /** @file Use-object for the owner of a vault */
2
+ import { Fail } from '@endo/errors';
4
3
  import { AmountShape } from '@agoric/ertp';
5
4
  import { M, prepareExoClassKit } from '@agoric/vat-data';
6
5
  import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js';
7
- import { UnguardedHelperI } from '../typeGuards.js';
8
-
9
- const { Fail } = assert;
6
+ import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js';
10
7
 
11
8
  /**
12
9
  * @typedef {{
13
- * topicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<VaultNotification>,
14
- * vault: Vault | null,
10
+ * topicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<VaultNotification>;
11
+ * vault: Vault | null;
15
12
  * }} State
16
13
  */
17
14
 
@@ -25,13 +22,13 @@ const HolderI = M.interface('holder', {
25
22
  makeTransferInvitation: M.call().returns(M.promise()),
26
23
  });
27
24
 
28
- /** @type {{ [name: string]: [ description: string, valueShape: Pattern ] }} */
25
+ /** @type {{ [name: string]: [description: string, valueShape: Pattern] }} */
29
26
  const PUBLIC_TOPICS = {
30
27
  vault: ['Vault holder status', M.any()],
31
28
  };
32
29
 
33
30
  /**
34
- * @param {import('@agoric/ertp').Baggage} baggage
31
+ * @param {import('@agoric/swingset-liveslots').Baggage} baggage
35
32
  * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
36
33
  */
37
34
  export const prepareVaultHolder = (baggage, makeRecorderKit) => {
@@ -48,22 +45,20 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => {
48
45
  }),
49
46
  },
50
47
  /**
51
- *
52
48
  * @param {Vault} vault
53
49
  * @param {StorageNode} storageNode
54
50
  * @returns {State}
55
51
  */
56
52
  (vault, storageNode) => {
57
53
  // must be the fully synchronous maker because the kit is held in durable state
54
+ // @ts-expect-error XXX Patterns
58
55
  const topicKit = makeRecorderKit(storageNode, PUBLIC_TOPICS.vault[1]);
59
56
 
60
57
  return { topicKit, vault };
61
58
  },
62
59
  {
63
60
  helper: {
64
- /**
65
- * @throws if this holder no longer owns the vault
66
- */
61
+ /** @throws if this holder no longer owns the vault */
67
62
  owned() {
68
63
  const { vault } = this.state;
69
64
  if (!vault) {
@@ -104,8 +99,8 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => {
104
99
  return this.facets.helper.owned().makeCloseInvitation();
105
100
  },
106
101
  /**
107
- * Starting a transfer revokes the vault holder. The associated updater will
108
- * get a special notification that the vault is being transferred.
102
+ * Starting a transfer revokes the vault holder. The associated updater
103
+ * will get a special notification that the vault is being transferred.
109
104
  */
110
105
  makeTransferInvitation() {
111
106
  const vault = this.facets.helper.owned();
@@ -0,0 +1,32 @@
1
+ export function prepareVaultKit(baggage: import("@agoric/swingset-liveslots").Baggage, makeRecorderKit: import("@agoric/zoe/src/contractSupport/recorder.js").MakeRecorderKit): (vault: Vault, storageNode: StorageNode) => {
2
+ publicSubscribers: {
3
+ vault: {
4
+ description: string;
5
+ subscriber: globalThis.Subscriber<VaultNotification>;
6
+ storagePath: Promise<string>;
7
+ };
8
+ };
9
+ invitationMakers: import("@endo/exo").Guarded<{
10
+ AdjustBalances(): Promise<Invitation<string, undefined>>;
11
+ CloseVault(): Promise<Invitation<string, undefined>>;
12
+ TransferVault(): Promise<Invitation<any, undefined>>;
13
+ }>;
14
+ vault: import("@endo/exo").Guarded<{
15
+ getPublicTopics(): {
16
+ vault: {
17
+ description: string;
18
+ subscriber: globalThis.Subscriber<VaultNotification>;
19
+ storagePath: Promise<string>;
20
+ };
21
+ };
22
+ makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
23
+ makeCloseInvitation(): Promise<Invitation<string, undefined>>;
24
+ makeTransferInvitation(): Promise<Invitation<any, undefined>>;
25
+ getCollateralAmount(): import("@agoric/ertp").NatAmount;
26
+ getCurrentDebt(): import("@agoric/ertp").NatAmount;
27
+ getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
28
+ }>;
29
+ vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
30
+ };
31
+ export type VaultKit = ReturnType<ReturnType<typeof prepareVaultKit>>;
32
+ //# sourceMappingURL=vaultKit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vaultKit.d.ts","sourceRoot":"","sources":["vaultKit.js"],"names":[],"mappings":"AAgBO,yCAHI,OAAO,4BAA4B,EAAE,OAAO,mBAC5C,OAAO,6CAA6C,EAAE,eAAe,WASnE,KAAK,eACL,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBvB;uBAEa,UAAU,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  // @jessie-check
2
2
 
3
- import '@agoric/zoe/exported.js';
3
+ /// <reference types="@agoric/zoe/exported" />
4
4
 
5
5
  import { makeTracer } from '@agoric/internal';
6
6
  import { prepareVaultHolder } from './vaultHolder.js';
@@ -8,9 +8,10 @@ import { prepareVaultHolder } from './vaultHolder.js';
8
8
  const trace = makeTracer('VK', true);
9
9
 
10
10
  /**
11
- * Wrap the VaultHolder duration object in a record suitable for the result of an invitation.
11
+ * Wrap the VaultHolder duration object in a record suitable for the result of
12
+ * an invitation.
12
13
  *
13
- * @param {import('@agoric/ertp').Baggage} baggage
14
+ * @param {import('@agoric/swingset-liveslots').Baggage} baggage
14
15
  * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
15
16
  */
16
17
  export const prepareVaultKit = (baggage, makeRecorderKit) => {
@@ -43,4 +44,4 @@ export const prepareVaultKit = (baggage, makeRecorderKit) => {
43
44
  return makeVaultKit;
44
45
  };
45
46
 
46
- /** @typedef {(ReturnType<ReturnType<typeof prepareVaultKit>>)} VaultKit */
47
+ /** @typedef {ReturnType<ReturnType<typeof prepareVaultKit>>} VaultKit */