@agoric/vats 0.15.2-dev-ecf2d8e.0 → 0.15.2-other-dev-70beeb7.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 (151) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/decentral-core-config.json +66 -0
  3. package/decentral-demo-config.json +155 -0
  4. package/decentral-devnet-config.json +216 -0
  5. package/decentral-itest-vaults-config.json +210 -0
  6. package/decentral-main-vaults-config.json +229 -0
  7. package/decentral-test-vaults-config.json +195 -0
  8. package/demo-proposals.json +5 -0
  9. package/exported.js +1 -1
  10. package/jsconfig.build.json +12 -0
  11. package/{tsconfig.json → jsconfig.json} +0 -3
  12. package/package.json +42 -32
  13. package/scripts/build-bundles.d.ts +3 -0
  14. package/scripts/build-bundles.d.ts.map +1 -0
  15. package/scripts/build-bundles.js +3 -8
  16. package/scripts/build-game1-start.d.ts +5 -0
  17. package/scripts/build-game1-start.d.ts.map +1 -0
  18. package/scripts/build-game1-start.js +34 -0
  19. package/scripts/build-walletFactory-upgrade.d.ts +5 -0
  20. package/scripts/build-walletFactory-upgrade.d.ts.map +1 -0
  21. package/scripts/build-walletFactory-upgrade.js +35 -0
  22. package/scripts/init-core.d.ts +5 -0
  23. package/scripts/init-core.d.ts.map +1 -0
  24. package/scripts/init-core.js +31 -0
  25. package/scripts/init-network.d.ts +5 -0
  26. package/scripts/init-network.d.ts.map +1 -0
  27. package/scripts/init-network.js +19 -0
  28. package/scripts/restart-vats.d.ts +5 -0
  29. package/scripts/restart-vats.d.ts.map +1 -0
  30. package/scripts/restart-vats.js +23 -0
  31. package/scripts/set-core-proposal-env.d.ts +3 -0
  32. package/scripts/set-core-proposal-env.d.ts.map +1 -0
  33. package/scripts/set-core-proposal-env.js +37 -0
  34. package/src/bridge.d.ts +3 -12
  35. package/src/bridge.d.ts.map +1 -1
  36. package/src/bridge.js +12 -24
  37. package/src/centralSupply.d.ts.map +1 -1
  38. package/src/centralSupply.js +3 -3
  39. package/src/core/basic-behaviors.d.ts +7 -7
  40. package/src/core/basic-behaviors.d.ts.map +1 -1
  41. package/src/core/basic-behaviors.js +50 -56
  42. package/src/core/boot-chain.d.ts +1 -1
  43. package/src/core/boot-chain.js +3 -3
  44. package/src/core/boot-sim.js +3 -3
  45. package/src/core/boot-solo.js +4 -4
  46. package/src/core/chain-behaviors.d.ts.map +1 -1
  47. package/src/core/chain-behaviors.js +23 -29
  48. package/src/core/client-behaviors.d.ts.map +1 -1
  49. package/src/core/client-behaviors.js +4 -5
  50. package/src/core/demoIssuers.d.ts +15 -17
  51. package/src/core/demoIssuers.d.ts.map +1 -1
  52. package/src/core/demoIssuers.js +36 -36
  53. package/src/core/lib-boot.d.ts +9 -11
  54. package/src/core/lib-boot.d.ts.map +1 -1
  55. package/src/core/lib-boot.js +22 -32
  56. package/src/core/promise-space.d.ts.map +1 -1
  57. package/src/core/promise-space.js +14 -14
  58. package/src/core/sim-behaviors.d.ts +1 -1
  59. package/src/core/sim-behaviors.d.ts.map +1 -1
  60. package/src/core/startWalletFactory.d.ts +62 -9
  61. package/src/core/startWalletFactory.d.ts.map +1 -1
  62. package/src/core/startWalletFactory.js +17 -26
  63. package/src/core/types.d.ts +820 -0
  64. package/src/core/types.d.ts.map +1 -0
  65. package/src/core/types.js +347 -0
  66. package/src/core/utils.d.ts +16 -18
  67. package/src/core/utils.d.ts.map +1 -1
  68. package/src/core/utils.js +30 -32
  69. package/src/crc.d.ts +6 -2
  70. package/src/crc.d.ts.map +1 -1
  71. package/src/crc.js +15 -5
  72. package/src/ibc.d.ts +5 -5
  73. package/src/ibc.d.ts.map +1 -1
  74. package/src/ibc.js +47 -27
  75. package/src/lib-board.d.ts +50 -49
  76. package/src/lib-board.d.ts.map +1 -1
  77. package/src/lib-board.js +39 -32
  78. package/src/mintHolder.d.ts +1 -3
  79. package/src/mintHolder.d.ts.map +1 -1
  80. package/src/mintHolder.js +8 -13
  81. package/src/nameHub.d.ts +2 -18
  82. package/src/nameHub.d.ts.map +1 -1
  83. package/src/nameHub.js +17 -26
  84. package/src/proposals/network-proposal.d.ts.map +1 -1
  85. package/src/proposals/network-proposal.js +12 -15
  86. package/src/proposals/restart-vats-proposal.d.ts +1 -1
  87. package/src/proposals/restart-vats-proposal.d.ts.map +1 -1
  88. package/src/proposals/restart-vats-proposal.js +5 -3
  89. package/src/provisionPool.d.ts +164 -0
  90. package/src/provisionPool.d.ts.map +1 -0
  91. package/src/provisionPool.js +113 -0
  92. package/src/provisionPoolKit.d.ts +408 -0
  93. package/src/provisionPoolKit.d.ts.map +1 -0
  94. package/src/provisionPoolKit.js +464 -0
  95. package/src/repl.js +1 -1
  96. package/src/tokens.d.ts +36 -0
  97. package/src/tokens.d.ts.map +1 -0
  98. package/src/tokens.js +37 -0
  99. package/src/types.d.ts +103 -84
  100. package/src/types.d.ts.map +1 -0
  101. package/src/types.js +97 -1
  102. package/src/vat-agoricNames.d.ts +1 -1
  103. package/src/vat-agoricNames.d.ts.map +1 -1
  104. package/src/vat-agoricNames.js +3 -2
  105. package/src/vat-bank.d.ts +58 -62
  106. package/src/vat-bank.d.ts.map +1 -1
  107. package/src/vat-bank.js +54 -62
  108. package/src/vat-board.d.ts +1 -1
  109. package/src/vat-bridge.d.ts +30 -2
  110. package/src/vat-bridge.d.ts.map +1 -1
  111. package/src/vat-mints.d.ts +12 -12
  112. package/src/vat-mints.d.ts.map +1 -1
  113. package/src/vat-mints.js +6 -6
  114. package/src/vat-network.d.ts +1 -1
  115. package/src/vat-network.d.ts.map +1 -1
  116. package/src/vat-network.js +1 -1
  117. package/src/vat-priceAuthority.d.ts +1 -1
  118. package/src/vat-provisioning.d.ts +1 -1
  119. package/src/vat-provisioning.d.ts.map +1 -1
  120. package/src/vat-provisioning.js +7 -11
  121. package/src/vat-sharing.d.ts +54 -0
  122. package/src/vat-sharing.d.ts.map +1 -0
  123. package/src/vat-sharing.js +14 -0
  124. package/src/vat-zoe.d.ts +0 -2
  125. package/src/vat-zoe.d.ts.map +1 -1
  126. package/src/vat-zoe.js +2 -8
  127. package/src/virtual-purse.d.ts +12 -37
  128. package/src/virtual-purse.d.ts.map +1 -1
  129. package/src/virtual-purse.js +36 -38
  130. package/src/walletFlags.d.ts +2 -2
  131. package/src/walletFlags.js +2 -1
  132. package/tools/authorityViz.d.ts +27 -0
  133. package/tools/authorityViz.d.ts.map +1 -0
  134. package/tools/authorityViz.js +272 -0
  135. package/tools/bank-utils.d.ts +1 -1
  136. package/tools/bank-utils.d.ts.map +1 -1
  137. package/tools/bank-utils.js +5 -12
  138. package/tools/board-utils.d.ts +19 -5
  139. package/tools/board-utils.d.ts.map +1 -1
  140. package/tools/board-utils.js +81 -29
  141. package/tools/boot-test-utils.d.ts +10 -9
  142. package/tools/boot-test-utils.d.ts.map +1 -1
  143. package/tools/boot-test-utils.js +16 -6
  144. package/tools/viz.mk +17 -0
  145. package/index.js +0 -11
  146. package/src/core/types-ambient.d.ts +0 -475
  147. package/src/core/types-ambient.js +0 -1
  148. package/src/proposals/zcf-proposal.d.ts +0 -30
  149. package/src/proposals/zcf-proposal.d.ts.map +0 -1
  150. package/src/proposals/zcf-proposal.js +0 -45
  151. package/tsconfig.build.json +0 -6
@@ -1,37 +1,12 @@
1
1
  export function makeVirtualPurseKitIKit(brandShape?: Pattern, amountShape?: Pattern): {
2
2
  VirtualPurseIKit: {
3
- depositFacet: import("@endo/patterns").InterfaceGuard<{
4
- receive: any;
5
- }>;
6
- purse: import("@endo/patterns").InterfaceGuard<{
7
- getAllegedBrand: import("@endo/patterns").MethodGuard;
8
- getCurrentAmount: import("@endo/patterns").MethodGuard;
9
- getCurrentAmountNotifier: import("@endo/patterns").MethodGuard;
10
- deposit: import("@endo/patterns").MethodGuard;
11
- getDepositFacet: import("@endo/patterns").MethodGuard;
12
- withdraw: import("@endo/patterns").MethodGuard;
13
- getRecoverySet: import("@endo/patterns").MethodGuard;
14
- recoverAll: import("@endo/patterns").MethodGuard;
15
- }>;
16
- escrower: import("@endo/patterns").InterfaceGuard<{
17
- retain: import("@endo/patterns").MethodGuard;
18
- redeem: import("@endo/patterns").MethodGuard;
19
- }>;
20
- minter: import("@endo/patterns").InterfaceGuard<{
21
- retain: import("@endo/patterns").MethodGuard;
22
- redeem: import("@endo/patterns").MethodGuard;
23
- }>;
24
- utils: import("@endo/patterns").InterfaceGuard<{
25
- retain: any;
26
- redeem: any;
27
- recoverableClaim: import("@endo/patterns").MethodGuard;
28
- }>;
3
+ depositFacet: import("@endo/patterns").InterfaceGuard;
4
+ purse: import("@endo/patterns").InterfaceGuard;
5
+ escrower: import("@endo/patterns").InterfaceGuard;
6
+ minter: import("@endo/patterns").InterfaceGuard;
7
+ utils: import("@endo/patterns").InterfaceGuard;
29
8
  };
30
- VirtualPurseControllerI: import("@endo/patterns").InterfaceGuard<{
31
- pushAmount: import("@endo/patterns").MethodGuard;
32
- pullAmount: import("@endo/patterns").MethodGuard;
33
- getBalances: import("@endo/patterns").MethodGuard;
34
- }>;
9
+ VirtualPurseControllerI: import("@endo/patterns").InterfaceGuard;
35
10
  };
36
11
  export function prepareVirtualPurse(zone: import('@agoric/zone').Zone): (vpc: ERef<VirtualPurseController>, { escrowPurse: defaultEscrowPurse, ...issuerKit }: {
37
12
  issuer: ERef<Issuer>;
@@ -44,20 +19,20 @@ export type Retain = (pmt: Payment, optAmountShape?: Pattern) => Promise<Amount>
44
19
  export type Redeem = (amt: Amount) => Promise<Payment>;
45
20
  /**
46
21
  * The object that determines the
47
- * remote behaviour of a virtual purse.
22
+ * remote behaviour of a virtual purse.
48
23
  */
49
24
  export type VirtualPurseController = {
50
25
  /**
51
26
  * Tell the controller
52
- * to send an amount from "us" to the "other side". This should resolve on
53
- * success and reject on failure. IT IS IMPORTANT NEVER TO FAIL in normal
54
- * operation. That will irrecoverably lose assets.
27
+ * to send an amount from "us" to the "other side". This should resolve on
28
+ * success and reject on failure. IT IS IMPORTANT NEVER TO FAIL in normal
29
+ * operation. That will irrecoverably lose assets.
55
30
  */
56
31
  pushAmount: (amount: Amount) => Promise<void>;
57
32
  /**
58
33
  * Tell the controller
59
- * to send an amount from the "other side" to "us". This should resolve on
60
- * success and reject on failure. We can still recover assets from failure to
34
+ * to send an amount from the "other side" to "us". This should resolve on
35
+ * success and reject on failure. We can still recover assets from failure to
61
36
  * pull.
62
37
  */
63
38
  pullAmount: (amount: Amount) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-purse.d.ts","sourceRoot":"","sources":["virtual-purse.js"],"names":[],"mappings":"AAuBO,qDAHI,OAAO,gBACP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DjB;AA2LM,0CADK,OAAO,cAAc,EAAE,IAAI,SAK1B,KAAK,sBAAsB,CAAC;YAG1B,KAAK,MAAM,CAAC;WACb,KAAK;;;MAWJ,QAAQ,QAAQ,MAAM,KAAK,CAAC,CAAC,CAAC,CAyB5C;uBAnOY,OAAO,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;2BAGrB,OAAO,mBAAmB,OAAO,KAAK,QAAQ,MAAM,CAAC;2BACrD,MAAM,KAAK,QAAQ,OAAO,CAAC;;;;;;;;;;;;yBAKxB,MAAM,KAAK,QAAQ,IAAI,CAAC;;;;;;;yBAIxB,MAAM,KAAK,QAAQ,IAAI,CAAC;;;;;yBAIzB,KAAK,KAAK,YAAY,MAAM,CAAC"}
1
+ {"version":3,"file":"virtual-purse.d.ts","sourceRoot":"","sources":["virtual-purse.js"],"names":[],"mappings":"AAsBO,qDAHI,OAAO,gBACP,OAAO;;;;;;;;;EA6DjB;AA+LM,0CAFI,OAAO,cAAc,EAAE,IAAI,SAMzB,KAAK,sBAAsB,CAAC;YAElB,KAAK,MAAM,CAAC;WAAS,KAAK;;;MASlC,QAAQ,QAAQ,MAAM,KAAK,CAAC,CAAC,CAAC,CAwB5C;uBAlOY,OAAO,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;2BAGrB,OAAO,mBAAmB,OAAO,KAAK,QAAQ,MAAM,CAAC;2BACrD,MAAM,KAAK,QAAQ,OAAO,CAAC;;;;;;;;;;;;yBAKxB,MAAM,KAAK,QAAQ,IAAI,CAAC;;;;;;;yBAIxB,MAAM,KAAK,QAAQ,IAAI,CAAC;;;;;yBAIzB,KAAK,KAAK,YAAY,MAAM,CAAC"}
@@ -13,7 +13,6 @@ import {
13
13
 
14
14
  import '@agoric/ertp/exported.js';
15
15
  import '@agoric/notifier/exported.js';
16
- import { getInterfaceGuardPayload } from '@endo/patterns';
17
16
 
18
17
  const { Fail } = assert;
19
18
 
@@ -49,7 +48,7 @@ export const makeVirtualPurseKitIKit = (
49
48
  });
50
49
 
51
50
  const DepositFacetI = M.interface('DepositFacet', {
52
- receive: getInterfaceGuardPayload(VirtualPurseI).methodGuards.deposit,
51
+ receive: VirtualPurseI.methodGuards.deposit,
53
52
  });
54
53
 
55
54
  const RetainRedeemI = M.interface('RetainRedeem', {
@@ -58,8 +57,8 @@ export const makeVirtualPurseKitIKit = (
58
57
  });
59
58
 
60
59
  const UtilsI = M.interface('Utils', {
61
- retain: getInterfaceGuardPayload(RetainRedeemI).methodGuards.retain,
62
- redeem: getInterfaceGuardPayload(RetainRedeemI).methodGuards.redeem,
60
+ retain: RetainRedeemI.methodGuards.retain,
61
+ redeem: RetainRedeemI.methodGuards.redeem,
63
62
  recoverableClaim: M.callWhen(M.await(PaymentShape))
64
63
  .optional(amountShape)
65
64
  .returns(PaymentShape),
@@ -92,28 +91,30 @@ export const makeVirtualPurseKitIKit = (
92
91
 
93
92
  /**
94
93
  * @typedef {object} VirtualPurseController The object that determines the
95
- * remote behaviour of a virtual purse.
94
+ * remote behaviour of a virtual purse.
96
95
  * @property {(amount: Amount) => Promise<void>} pushAmount Tell the controller
97
- * to send an amount from "us" to the "other side". This should resolve on
98
- * success and reject on failure. IT IS IMPORTANT NEVER TO FAIL in normal
99
- * operation. That will irrecoverably lose assets.
96
+ * to send an amount from "us" to the "other side". This should resolve on
97
+ * success and reject on failure. IT IS IMPORTANT NEVER TO FAIL in normal
98
+ * operation. That will irrecoverably lose assets.
100
99
  * @property {(amount: Amount) => Promise<void>} pullAmount Tell the controller
101
- * to send an amount from the "other side" to "us". This should resolve on
102
- * success and reject on failure. We can still recover assets from failure to
103
- * pull.
100
+ * to send an amount from the "other side" to "us". This should resolve on
101
+ * success and reject on failure. We can still recover assets from failure to
102
+ * pull.
104
103
  * @property {(brand: Brand) => LatestTopic<Amount>} getBalances Return the
105
- * current balance iterable for a given brand.
104
+ * current balance iterable for a given brand.
106
105
  */
107
106
 
108
- /** @param {import('@agoric/zone').Zone} zone */
107
+ /**
108
+ * @param {import('@agoric/zone').Zone} zone
109
+ */
109
110
  const prepareVirtualPurseKit = zone =>
110
111
  zone.exoClassKit(
111
112
  'VirtualPurseKit',
112
113
  makeVirtualPurseKitIKit().VirtualPurseIKit,
113
114
  /**
114
115
  * @param {ERef<VirtualPurseController>} vpc
115
- * @param {{ issuer: ERef<Issuer>; brand: Brand; mint?: ERef<Mint> }} issuerKit
116
- * @param {{ recoveryPurse: ERef<Purse>; escrowPurse?: ERef<Purse> }} purses
116
+ * @param {{ issuer: ERef<Issuer>, brand: Brand, mint?: ERef<Mint> }} issuerKit
117
+ * @param {{ recoveryPurse: ERef<Purse>, escrowPurse?: ERef<Purse> }} purses
117
118
  */
118
119
  (vpc, issuerKit, purses) => ({
119
120
  vpc,
@@ -126,9 +127,9 @@ const prepareVirtualPurseKit = zone =>
126
127
  {
127
128
  utils: {
128
129
  /**
129
- * Claim a payment for recovery via our `recoveryPurse`. No need for
130
- * this on the `retain` operations (since we are just burning the
131
- * payment or depositing it directly in the `escrowPurse`).
130
+ * Claim a payment for recovery via our `recoveryPurse`. No need for this on
131
+ * the `retain` operations (since we are just burning the payment or
132
+ * depositing it directly in the `escrowPurse`).
132
133
  *
133
134
  * @param {ERef<Payment>} payment
134
135
  * @param {Amount} [optAmountShape]
@@ -266,31 +267,28 @@ const prepareVirtualPurseKit = zone =>
266
267
  },
267
268
  );
268
269
 
269
- /** @param {import('@agoric/zone').Zone} zone */
270
+ /**
271
+ * @param {import('@agoric/zone').Zone} zone
272
+ */
270
273
  export const prepareVirtualPurse = zone => {
271
274
  const makeVirtualPurseKit = prepareVirtualPurseKit(zone);
272
275
 
273
276
  /**
274
- * @param {ERef<VirtualPurseController>} vpc the controller that represents
275
- * the "other side" of this purse.
276
- * @param {{
277
- * issuer: ERef<Issuer>;
278
- * brand: Brand;
279
- * mint?: ERef<Mint>;
280
- * escrowPurse?: ERef<Purse>;
281
- * }} params
282
- * the contents of the issuer kit for "us".
277
+ * @param {ERef<VirtualPurseController>} vpc the controller that represents the
278
+ * "other side" of this purse.
279
+ * @param {{ issuer: ERef<Issuer>, brand: Brand, mint?: ERef<Mint>,
280
+ * escrowPurse?: ERef<Purse> }} params
281
+ * the contents of the issuer kit for "us".
283
282
  *
284
- * If the mint is not specified, then the virtual purse will escrow local
285
- * assets instead of minting/burning them. That is a better option in
286
- * general, but escrow doesn't support the case where the "other side" is
287
- * also minting assets... our escrow purse may not have enough assets in it
288
- * to redeem the ones that are sent from the "other side".
289
- * @returns {Promise<Awaited<EOnly<Purse>>>} This is not just a Purse because
290
- * it plays fast-and-loose with the synchronous Purse interface. So, the
291
- * consumer of this result must only interact with the virtual purse via
292
- * eventual-send (to conceal the methods that are returning promises instead
293
- * of synchronously).
283
+ * If the mint is not specified, then the virtual purse will escrow local assets
284
+ * instead of minting/burning them. That is a better option in general, but
285
+ * escrow doesn't support the case where the "other side" is also minting
286
+ * assets... our escrow purse may not have enough assets in it to redeem the
287
+ * ones that are sent from the "other side".
288
+ * @returns {Promise<Awaited<EOnly<Purse>>>} This is not just a Purse because it plays
289
+ * fast-and-loose with the synchronous Purse interface. So, the consumer of
290
+ * this result must only interact with the virtual purse via eventual-send (to
291
+ * conceal the methods that are returning promises instead of synchronously).
294
292
  */
295
293
  const makeVirtualPurse = async (
296
294
  vpc,
@@ -1,5 +1,5 @@
1
1
  export namespace PowerFlags {
2
- let SMART_WALLET: "SMART_WALLET";
3
- let REMOTE_WALLET: "REMOTE_WALLET";
2
+ const SMART_WALLET: "SMART_WALLET";
3
+ const REMOTE_WALLET: "REMOTE_WALLET";
4
4
  }
5
5
  //# sourceMappingURL=walletFlags.d.ts.map
@@ -1,6 +1,7 @@
1
1
  // XXX domain of @agoric/cosmic-proto
2
2
  /**
3
- * non-exhaustive list of powerFlags REMOTE_WALLET is currently a default.
3
+ * non-exhaustive list of powerFlags
4
+ * REMOTE_WALLET is currently a default.
4
5
  *
5
6
  * See also MsgProvision in golang/cosmos/proto/agoric/swingset/msgs.proto
6
7
  */
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ export type GraphNode = {
3
+ id: string;
4
+ cluster?: string;
5
+ label: string;
6
+ style?: string;
7
+ };
8
+ export type Permit = true | ({
9
+ vatParameters?: Record<string, Permit>;
10
+ vatPowers?: Record<string, true>;
11
+ vats?: Record<string, Status>;
12
+ devices?: Record<string, true>;
13
+ home?: PowerSpace;
14
+ issuer?: PowerSpace;
15
+ brand?: PowerSpace;
16
+ oracleBrand?: PowerSpace;
17
+ installation?: PowerSpace;
18
+ instance?: PowerSpace;
19
+ } & PowerSpace);
20
+ export type PowerSpace = {
21
+ produce?: Record<string, Status>;
22
+ consume?: Record<string, Status>;
23
+ };
24
+ export type Status = boolean | VatName;
25
+ export type VatName = string;
26
+ export type Resolver = (specifier: string, parent: string) => Promise<string>;
27
+ //# sourceMappingURL=authorityViz.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorityViz.d.ts","sourceRoot":"","sources":["authorityViz.js"],"names":[],"mappings":";wBA6Ba;IACZ,EAAM,EAAE,MAAM,CAAC;IACf,OAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAS,EAAE,MAAM,CAAC;IAClB,KAAS,CAAC,EAAE,MAAM,CAAC;CAChB;qBAiCU,IAAI,IAAG;IACpB,aAAiB,CAAC,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,SAAa,CAAC,EAAE,OAAO,MAAM,EAAE,IAAI,CAAC,CAAA;IACpC,IAAQ,CAAC,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,OAAW,CAAC,EAAE,OAAO,MAAM,EAAE,IAAI,CAAC,CAAA;IAClC,IAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,MAAU,CAAC,EAAE,UAAU,CAAC;IACxB,KAAS,CAAC,EAAE,UAAU,CAAC;IACvB,WAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,YAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B,QAAY,CAAC,EAAE,UAAU,CAAC;CACvB,GAAG,UAAU,CAAA;yBACJ;IAAC,OAAO,CAAC,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAA;CAAC;qBACnE,OAAO,GAAG,OAAO;sBACjB,MAAM;mCA0IK,MAAM,UAAU,MAAM,KAAK,QAAQ,MAAM,CAAC"}
@@ -0,0 +1,272 @@
1
+ #!/usr/bin/env node
2
+ // @ts-check
3
+ import '@endo/init';
4
+ import process from 'process';
5
+
6
+ const { entries, keys, values } = Object;
7
+
8
+ const logged = label => x => {
9
+ console.error(label, x);
10
+ return x;
11
+ };
12
+
13
+ const styles = {
14
+ vatPowers: 'shape=star, style=filled, fillcolor=aqua',
15
+ vats: 'shape=doubleoctagon, style=filled, fillcolor=tomato',
16
+ vat: 'shape=doubleoctagon, style=filled, fillcolor=tomato3',
17
+ devices: 'shape=box, style=filled, fillcolor=gold',
18
+ space: 'shape=house, style=filled, fillcolor=khaki',
19
+ issuer: 'shape=trapezium, style=filled, fillcolor=chocolate',
20
+ brand: 'shape=Mcircle, style=filled, fillcolor=chocolate2',
21
+ installation: 'shape=cylinder',
22
+ instance: 'shape=component',
23
+ home: 'shape=folder',
24
+ };
25
+
26
+ /**
27
+ * @param {Set<GraphNode>} nodes
28
+ * @param {Map<string, Set<{ id: string, style?: string }>>} neighbors
29
+ * @yields { string }
30
+ * @typedef {{
31
+ * id: string,
32
+ * cluster?: string,
33
+ * label: string,
34
+ * style?: string,
35
+ * }} GraphNode
36
+ */
37
+ function* fmtGraph(nodes, neighbors) {
38
+ const q = txt => JSON.stringify(txt.replace(/\./g, '_'));
39
+ yield 'digraph G {\n';
40
+ yield 'rankdir = LR;\n';
41
+ const clusters = new Set(
42
+ [...nodes].map(({ cluster }) => cluster).filter(c => !!c),
43
+ );
44
+ for (const subgraph of [...clusters, undefined]) {
45
+ if (subgraph) {
46
+ assert.typeof(subgraph, 'string');
47
+ yield `subgraph cluster_${subgraph} {\n`;
48
+ yield `label = "${subgraph}"\n`;
49
+ }
50
+ for (const { id, cluster, label, style } of nodes) {
51
+ if (subgraph && cluster !== subgraph) continue;
52
+ yield `${q(id)} [label=${q(label)}${style ? `, ${style}` : ''}];\n`;
53
+ }
54
+ if (subgraph) {
55
+ yield `}\n`;
56
+ }
57
+ }
58
+ for (const [src, arcs] of neighbors.entries()) {
59
+ for (const { id, style } of arcs) {
60
+ yield `${q(src)} -> ${q(id)} [${style}]\n`;
61
+ }
62
+ }
63
+ yield '}\n';
64
+ }
65
+
66
+ /**
67
+ * @param {Record<string, Permit>} manifest
68
+ * @typedef { true | {
69
+ * vatParameters?: Record<string, Permit>,
70
+ * vatPowers?: Record<string, true>
71
+ * vats?: Record<string, Status>
72
+ * devices?: Record<string, true>
73
+ * home?: PowerSpace,
74
+ * issuer?: PowerSpace,
75
+ * brand?: PowerSpace,
76
+ * oracleBrand?: PowerSpace,
77
+ * installation?: PowerSpace,
78
+ * instance?: PowerSpace,
79
+ * } & PowerSpace } Permit
80
+ * @typedef {{produce?: Record<string, Status>, consume?: Record<string, Status>}} PowerSpace
81
+ * @typedef { boolean | VatName } Status
82
+ * @typedef { string } VatName
83
+ */
84
+ const manifest2graph = manifest => {
85
+ /** @type { Set<GraphNode> } */
86
+ const nodes = new Set();
87
+ const neighbors = new Map();
88
+
89
+ /**
90
+ * @param {string} src
91
+ * @param {string} dest
92
+ * @param {string} [style]
93
+ */
94
+ const addEdge = (src, dest, style = '') => {
95
+ logged('addEdge')({ src, dest });
96
+ if (!neighbors.has(src)) {
97
+ neighbors.set(src, new Set());
98
+ }
99
+ neighbors.get(src).add({ id: dest, style });
100
+ };
101
+
102
+ /**
103
+ * @param {string} src
104
+ * @param {string} ty
105
+ * @param {Permit} item
106
+ * @param {boolean} [reverse=false]
107
+ */
108
+ const level1 = (src, ty, item, reverse = false) => {
109
+ if (!item) return;
110
+ for (const [powerName, status] of entries(item)) {
111
+ // subsumed by permits for vat:, home:, ...
112
+ if (
113
+ [
114
+ 'loadVat',
115
+ 'loadCriticalVat',
116
+ 'client',
117
+ 'agoricNames',
118
+ 'nameHubs',
119
+ 'nameAdmins',
120
+ ].includes(powerName) &&
121
+ reverse
122
+ )
123
+ continue;
124
+ if (status) {
125
+ let cluster = {};
126
+ if (typeof status !== 'boolean') {
127
+ cluster = { cluster: status };
128
+ }
129
+
130
+ nodes.add({
131
+ id: `${ty}.${powerName}`,
132
+ label: powerName,
133
+ style: styles[ty],
134
+ ...cluster,
135
+ });
136
+ addEdge(src, `${ty}.${powerName}`, reverse ? 'dir=back' : '');
137
+ if (ty === 'home') {
138
+ nodes.add({ id: 'home', label: 'home', cluster: 'provisioning' });
139
+ addEdge('home', `${ty}.${powerName}`);
140
+ }
141
+ }
142
+ }
143
+ };
144
+
145
+ /** @type {<X>(xs: X[]) => X[]} */
146
+ const uniq = xs => [...new Set(xs)];
147
+ const spaces = uniq(
148
+ logged('vals')(values(manifest)).flatMap(permit =>
149
+ logged('keys?')(keys(permit)).flatMap(name => {
150
+ logged('name?')(name);
151
+
152
+ if (['produce', 'consume'].includes(name)) return [];
153
+ return [name];
154
+ }),
155
+ ),
156
+ );
157
+ console.error('@@@', { spaces });
158
+
159
+ for (const [fnName, permit] of entries(manifest)) {
160
+ if (permit === true) {
161
+ console.error('skipping wildcard permit:', fnName);
162
+ continue;
163
+ }
164
+ nodes.add({ id: logged('fn')(fnName), label: fnName });
165
+
166
+ permit.vatPowers && level1(fnName, 'vatPowers', permit.vatPowers, true);
167
+ permit.vats && level1(fnName, 'vats', permit.vats, true);
168
+ permit.devices && level1(fnName, 'devices', permit.devices, true);
169
+
170
+ const doPart = (name, part) => {
171
+ if (!part) return;
172
+ level1(fnName, name, part.produce || {});
173
+ level1(fnName, name, part.consume || {}, true);
174
+ };
175
+ doPart('space', permit);
176
+ spaces.forEach(s => doPart(s, permit[s]));
177
+
178
+ if ('runBehaviors' in permit) {
179
+ throw Error('not impl');
180
+ // nodes.add({
181
+ // id: `runBehaviors`,
182
+ // label: `runBehaviors`,
183
+ // style: '',
184
+ // });
185
+ // addEdge(fnName, `runBehaviors`);
186
+ }
187
+ }
188
+ return { nodes, neighbors };
189
+ };
190
+
191
+ const { Fail, quote: q } = assert;
192
+
193
+ /**
194
+ * @param {string} specifier
195
+ * @param {object} io
196
+ * @param {Resolver} io.resolve
197
+ * @param {typeof import('fs/promises').readFile} io.readFile
198
+ */
199
+ const loadConfig = async (specifier, { resolve, readFile }) => {
200
+ const fullPath = await resolve(specifier, import.meta.url).then(
201
+ u => new URL(u).pathname,
202
+ );
203
+ typeof fullPath === 'string' || Fail`${q(specifier)}`;
204
+ const txt = await readFile(fullPath, 'utf-8');
205
+ typeof txt === 'string' || Fail`readFile ${q(fullPath)}`;
206
+ return JSON.parse(txt);
207
+ };
208
+
209
+ /**
210
+ * @param {string[]} args
211
+ * @param {object} io
212
+ * @param {typeof import('process').stdout} io.stdout
213
+ * @param {typeof import('fs/promises')} io.fsp
214
+ * @param {{
215
+ * resolve: Resolver,
216
+ * url: string,
217
+ * load: (specifier: string) => Promise<Record<string, any>>,
218
+ * }} io.meta
219
+ *
220
+ * @typedef {(specifier: string, parent: string) => Promise<string>} Resolver
221
+ */
222
+ const main = async (args, { stdout, fsp, meta }) => {
223
+ const [specifier, ...opts] = args;
224
+ specifier || Fail`Usage: $0 @agoric/vats/decentral-...json`;
225
+
226
+ const config = await loadConfig(specifier, {
227
+ resolve: meta.resolve,
228
+ readFile: fsp.readFile,
229
+ });
230
+ // console.log(config);
231
+ const { bootstrap } = config.vats;
232
+
233
+ const { MANIFEST } = await meta
234
+ .resolve(bootstrap.sourceSpec, meta.url)
235
+ .then(p => meta.load(p));
236
+ // console.log('manifest keys:', Object.keys(MANIFEST));
237
+
238
+ const [gov] = ['--gov'].map(opt => opts.includes(opt));
239
+
240
+ if (gov) {
241
+ throw Error('not impl');
242
+ /*
243
+ const postBoot = sim
244
+ ? manifests.SIM_CHAIN_POST_BOOT_MANIFEST
245
+ : manifests.CHAIN_POST_BOOT_MANIFEST;
246
+ manifest = { ...postBoot, ...manifest };
247
+ */
248
+ }
249
+
250
+ const g = manifest2graph(MANIFEST);
251
+ for (const chunk of fmtGraph(g.nodes, g.neighbors)) {
252
+ stdout.write(chunk);
253
+ }
254
+ };
255
+
256
+ (async () => {
257
+ await Promise.all([
258
+ import('fs/promises'),
259
+ // eslint-disable-next-line import/no-extraneous-dependencies
260
+ import('import-meta-resolve'),
261
+ ]).then(([fsp, metaResolve]) => {
262
+ return main(process.argv.slice(2), {
263
+ stdout: process.stdout,
264
+ fsp,
265
+ meta: {
266
+ resolve: metaResolve.resolve,
267
+ url: import.meta.url,
268
+ load: specifier => import(specifier),
269
+ },
270
+ });
271
+ });
272
+ })().catch(console.error);
@@ -1,4 +1,4 @@
1
- export function makeFakeBankKit(issuerKits: Pick<IssuerKit, 'brand' | 'issuer'>[]): {
1
+ export function makeFakeBankKit(issuerKits: Array<Pick<IssuerKit, 'brand' | 'issuer'>>): {
2
2
  addAsset: (denom: string, issuerName: string, proposedName: string, kit: import('../src/vat-bank.js').AssetIssuerKit) => void;
3
3
  assetPublication: IterationObserver<import("../src/vat-bank.js").AssetDescriptor>;
4
4
  bank: import("../src/vat-bank.js").Bank;
@@ -1 +1 @@
1
- {"version":3,"file":"bank-utils.d.ts","sourceRoot":"","sources":["bank-utils.js"],"names":[],"mappings":"AAOO,4CADK,KAAK,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC,EAAE;sBA2BpC,MAAM,cACN,MAAM,gBACN,MAAM,OACN,OAAO,oBAAoB,EAAE,cAAc;;;EAqBvD"}
1
+ {"version":3,"file":"bank-utils.d.ts","sourceRoot":"","sources":["bank-utils.js"],"names":[],"mappings":"AASO,4CAFI,MAAM,KAAK,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;sBAmBxC,MAAM,cACN,MAAM,gBACN,MAAM,OACN,OAAO,oBAAoB,EAAE,cAAc;;;EAqBvD"}
@@ -4,16 +4,13 @@ import { makeScalarMapStore } from '@agoric/vat-data';
4
4
  import { E } from '@endo/far';
5
5
  import { Far } from '@endo/marshal';
6
6
 
7
- /** @param {Pick<IssuerKit, 'brand' | 'issuer'>[]} issuerKits */
7
+ /**
8
+ * @param {Array<Pick<IssuerKit, 'brand' | 'issuer'>>} issuerKits
9
+ */
8
10
  export const makeFakeBankKit = issuerKits => {
9
11
  /** @type {MapStore<Brand, ERef<Issuer>>} */
10
12
  const issuers = makeScalarMapStore();
11
- /**
12
- * @type {MapStore<
13
- * Brand,
14
- * ERef<import('../src/vat-bank.js').VirtualPurse>
15
- * >}
16
- */
13
+ /** @type {MapStore<Brand, ERef<import('../src/vat-bank.js').VirtualPurse>>} */
17
14
  const purses = makeScalarMapStore();
18
15
 
19
16
  // XXX setup purses without publishing
@@ -23,11 +20,7 @@ export const makeFakeBankKit = issuerKits => {
23
20
  purses.init(kit.brand, E(kit.issuer).makeEmptyPurse());
24
21
  });
25
22
 
26
- /**
27
- * @type {SubscriptionRecord<
28
- * import('../src/vat-bank.js').AssetDescriptor
29
- * >}
30
- */
23
+ /** @type {SubscriptionRecord<import('../src/vat-bank.js').AssetDescriptor>} */
31
24
  const { subscription, publication } = makeSubscriptionKit();
32
25
 
33
26
  /**
@@ -1,5 +1,13 @@
1
- export * from "@agoric/internal/src/marshal.js";
2
- export function makeAgoricNamesRemotesFromFakeStorage(fakeStorageKit: import('@agoric/internal/src/storage-test-utils.js').FakeStorageKit): AgoricNamesRemotes;
1
+ export function makeBoardRemote({ boardId, iface }: any): BoardRemote;
2
+ export function slotToBoardRemote(boardId: any, iface: any): BoardRemote;
3
+ export function boardValToSlot(val: any): any;
4
+ export function makeAgoricNamesRemotesFromFakeStorage(fakeStorageKit: import("@agoric/internal/src/storage-test-utils.js").FakeStorageKit): AgoricNamesRemotes;
5
+ export function boardSlottingMarshaller(slotToVal?: ((slot: string, iface: string) => any) | undefined): Omit<import('@endo/marshal').Marshal<string>, 'serialize' | 'unserialize'>;
6
+ export function makeHistoryReviver(entries: Array<[string, string]>, slotToVal?: ((slot: string, iface?: string) => any) | undefined): {
7
+ getItem: (key: any) => any;
8
+ children: (prefix: any) => string[];
9
+ has: (k: any) => boolean;
10
+ };
3
11
  export function makeFakeBoard(initSequence?: number | bigint | undefined, options?: {
4
12
  prefix?: string | undefined;
5
13
  crcDigits?: number | undefined;
@@ -22,16 +30,22 @@ export function makeFakeBoard(initSequence?: number | bigint | undefined, option
22
30
  unserialize(data: any): any;
23
31
  };
24
32
  };
33
+ /**
34
+ * Should be a union with Remotable, but that's `any`, making this type meaningless
35
+ */
36
+ export type BoardRemote = {
37
+ getBoardId: () => string;
38
+ };
25
39
  export type VBankAssetDetail = {
26
- brand: import('@agoric/internal/src/marshal.js').BoardRemote;
40
+ brand: BoardRemote & Brand;
27
41
  denom: string;
28
42
  displayInfo: DisplayInfo;
29
- issuer: import('@agoric/internal/src/marshal.js').BoardRemote;
43
+ issuer: BoardRemote & Issuer;
30
44
  issuerName: string;
31
45
  proposedName: string;
32
46
  };
33
47
  export type AgoricNamesRemotes = {
34
- brand: Record<string, import('@agoric/internal/src/marshal.js').BoardRemote>;
48
+ brand: Record<string, Brand>;
35
49
  instance: Record<string, Instance>;
36
50
  vbankAsset: Record<string, VBankAssetDetail>;
37
51
  reverse: Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"board-utils.d.ts","sourceRoot":"","sources":["board-utils.js"],"names":[],"mappings":";AAqCO,sEAHI,OAAO,4CAA4C,EAAE,cAAc,GACjE,kBAAkB,CA0C9B;AAYM;;;;;;;;;;;;;;;;;;;;;EAGN;+BA1FY;IACZ,KAAS,EAAE,OAAO,iCAAiC,EAAE,WAAW,CAAC;IACjE,KAAS,EAAE,MAAM,CAAC;IAClB,WAAe,EAAE,WAAW,CAAC;IAC7B,MAAU,EAAE,OAAO,iCAAiC,EAAE,WAAW,CAAC;IAClE,UAAc,EAAE,MAAM,CAAC;IACvB,YAAgB,EAAE,MAAM,CAAC;CACtB;iCAGS;IACZ,KAAS,EAAE,OACX,MAAY,EACZ,OAAa,iCAAiC,EAAE,WAAW,CACtD,CAAC;IACN,QAAY,EAAE,OAAO,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvC,UAAc,EAAE,OAAO,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACjD,OAAW,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC"}
1
+ {"version":3,"file":"board-utils.d.ts","sourceRoot":"","sources":["board-utils.js"],"names":[],"mappings":"AAoCO,0DAFM,WAAW,CAKvB;AAEM,yEAC8B;AAE9B,8CAKN;AAMM,sEAHI,OAAO,4CAA4C,EAAE,cAAc,GACjE,kBAAkB,CAmC9B;AAYM,4DAHW,MAAM,SAAS,MAAM,KAAK,GAAG,gBAClC,KAAK,OAAO,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,CAMtF;AAQM,4CAHI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,sBAChB,MAAM,UAAU,MAAM,KAAK,GAAG;;;;EAoB/C;AAWM;;;;;;;;;;;;;;;;;;;;;EAGN;;;;0BA5IY;IAAE,UAAU,EAAE,MAAM,MAAM,CAAA;CAAE;+BAG5B;IACZ,KAAS,EAAE,WAAW,GAAG,KAAK,CAAC;IAC/B,KAAS,EAAE,MAAM,CAAC;IAClB,WAAe,EAAE,WAAW,CAAC;IAC7B,MAAU,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC,UAAc,EAAE,MAAM,CAAC;IACvB,YAAgB,EAAE,MAAM,CAAC;CACtB;iCAGS;IACZ,KAAS,EAAE,OAAO,MAAM,EAAE,KAAK,CAAC,CAAC;IACjC,QAAY,EAAE,OAAO,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvC,UAAc,EAAE,OAAO,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACjD,OAAW,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC"}