@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
package/src/crc.js CHANGED
@@ -9,11 +9,15 @@
9
9
  // @ts-check
10
10
  /* eslint-disable no-bitwise */
11
11
 
12
- /** @typedef {string | number | Uint8Array | ArrayBuffer} Data */
12
+ /**
13
+ * @typedef {string | number | Uint8Array | ArrayBuffer} Data
14
+ */
13
15
 
14
16
  const encoder = new TextEncoder();
15
17
 
16
- /** @param {Data} data */
18
+ /**
19
+ * @param {Data} data
20
+ */
17
21
  function convert(data) {
18
22
  if (typeof data === 'number') {
19
23
  const bytes = [];
@@ -73,7 +77,9 @@ export class CRC {
73
77
  this.table = table;
74
78
 
75
79
  if (this.width === 8 && !this.xorIn && !this.xorOut && !this.reflect) {
76
- /** @param {Data} data */
80
+ /**
81
+ * @param {Data} data
82
+ */
77
83
  this.calculate = function calculate(data) {
78
84
  const buffer = convert(data);
79
85
  let crc = 0;
@@ -85,7 +91,9 @@ export class CRC {
85
91
  }
86
92
  }
87
93
 
88
- /** @param {Data} data */
94
+ /**
95
+ * @param {Data} data
96
+ */
89
97
  calculate(data) {
90
98
  const buffer = convert(data);
91
99
  let crc;
@@ -110,7 +118,9 @@ export class CRC {
110
118
  return crc >>> 0;
111
119
  }
112
120
 
113
- /** @param {Data} data */
121
+ /**
122
+ * @param {Data} data
123
+ */
114
124
  calculateNoTable(data) {
115
125
  const buffer = convert(data);
116
126
  let crc = this.xorIn;
package/src/ibc.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- /** @typedef {import('./types.js').BridgeHandler} BridgeHandler */
1
+ /**
2
+ * @typedef {import('./types.js').BridgeHandler} BridgeHandler
3
+ */
2
4
  /**
3
5
  * @typedef {string} IBCPortID
4
- *
5
6
  * @typedef {string} IBCChannelID
6
- *
7
7
  * @typedef {string} IBCConnectionID
8
8
  */
9
9
  /**
@@ -15,8 +15,8 @@
15
15
  * @property {IBCPortID} destination_port
16
16
  */
17
17
  /**
18
- * Create a handler for the IBC protocol, both from the network and from the
19
- * bridge.
18
+ * Create a handler for the IBC protocol, both from the network
19
+ * and from the bridge.
20
20
  *
21
21
  * @param {typeof import('@endo/far').E} E
22
22
  * @param {(method: string, params: any) => Promise<any>} rawCallIBCDevice
package/src/ibc.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ibc.d.ts","sourceRoot":"","sources":["ibc.js"],"names":[],"mappings":"AAoBA,kEAAkE;AAElE;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,0CAJW,cAAc,WAAW,EAAE,CAAC,6BACnB,MAAM,UAAU,GAAG,KAAK,QAAQ,GAAG,CAAC,GAC3C,eAAe,GAAG,aAAa,CAugB3C;4BAhiBa,OAAO,YAAY,EAAE,aAAa;wBAGnC,MAAM;2BAEN,MAAM;8BAEN,MAAM;;;oBAML,YAAY;iBACZ,SAAS;yBACT,YAAY;sBACZ,SAAS"}
1
+ {"version":3,"file":"ibc.d.ts","sourceRoot":"","sources":["ibc.js"],"names":[],"mappings":"AAuBA;;GAEG;AAEH;;;;GAIG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,0CAJW,cAAc,WAAW,EAAE,CAAC,6BACnB,MAAM,UAAU,GAAG,KAAK,QAAQ,GAAG,CAAC,GAC3C,eAAe,GAAG,aAAa,CAwhB3C;4BAhjBY,OAAO,YAAY,EAAE,aAAa;wBAIlC,MAAM;2BACN,MAAM;8BACN,MAAM;;;oBAML,YAAY;iBACZ,SAAS;yBACT,YAAY;sBACZ,SAAS"}
package/src/ibc.js CHANGED
@@ -1,15 +1,18 @@
1
1
  // @ts-check
2
2
 
3
+ import {
4
+ dataToBase64,
5
+ base64ToBytes,
6
+ } from '@agoric/swingset-vat/src/vats/network/index.js';
3
7
  import { makeScalarMapStore, makeLegacyMap } from '@agoric/store';
4
8
  import { makePromiseKit } from '@endo/promise-kit';
5
9
  import { assert, details as X, Fail } from '@agoric/assert';
6
10
  import { Far } from '@endo/far';
7
11
 
8
- import { makeWithQueue } from '@agoric/internal/src/queue.js';
9
- import { dataToBase64, base64ToBytes } from '@agoric/network';
10
-
11
12
  import '@agoric/store/exported.js';
12
- import '@agoric/network/exported.js';
13
+ import '@agoric/swingset-vat/src/vats/network/types.js';
14
+
15
+ import { makeWithQueue } from '@agoric/internal/src/queue.js';
13
16
 
14
17
  // CAVEAT: IBC acks cannot be empty, as the Cosmos IAVL tree cannot represent
15
18
  // empty acknowledgements as distinct from unacknowledged packets.
@@ -18,13 +21,13 @@ const DEFAULT_ACKNOWLEDGEMENT = '\x00';
18
21
  // Default timeout after 10 minutes.
19
22
  const DEFAULT_PACKET_TIMEOUT_NS = 10n * 60n * 1_000_000_000n;
20
23
 
21
- /** @typedef {import('./types.js').BridgeHandler} BridgeHandler */
24
+ /**
25
+ * @typedef {import('./types.js').BridgeHandler} BridgeHandler
26
+ */
22
27
 
23
28
  /**
24
29
  * @typedef {string} IBCPortID
25
- *
26
30
  * @typedef {string} IBCChannelID
27
- *
28
31
  * @typedef {string} IBCConnectionID
29
32
  */
30
33
 
@@ -38,8 +41,8 @@ const DEFAULT_PACKET_TIMEOUT_NS = 10n * 60n * 1_000_000_000n;
38
41
  */
39
42
 
40
43
  /**
41
- * Create a handler for the IBC protocol, both from the network and from the
42
- * bridge.
44
+ * Create a handler for the IBC protocol, both from the network
45
+ * and from the bridge.
43
46
  *
44
47
  * @param {typeof import('@endo/far').E} E
45
48
  * @param {(method: string, params: any) => Promise<any>} rawCallIBCDevice
@@ -53,7 +56,9 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
53
56
  console.info('IBC downcall', method, params);
54
57
  return rawCallIBCDevice(method, params);
55
58
  };
56
- /** @type {MapStore<string, Promise<Connection>>} */
59
+ /**
60
+ * @type {MapStore<string, Promise<Connection>>}
61
+ */
57
62
  const channelKeyToConnP = makeScalarMapStore('CHANNEL:PORT');
58
63
 
59
64
  /**
@@ -62,7 +67,7 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
62
67
  * @property {string} channel_id
63
68
  *
64
69
  * @typedef {object} ConnectingInfo
65
- * @property {'ORDERED' | 'UNORDERED'} order
70
+ * @property {'ORDERED'|'UNORDERED'} order
66
71
  * @property {string[]} connectionHops
67
72
  * @property {string} portID
68
73
  * @property {string} channelID
@@ -70,25 +75,31 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
70
75
  * @property {string} version
71
76
  *
72
77
  * @typedef {PromiseRecord<AttemptDescription>} OnConnectP
73
- *
74
78
  * @typedef {Omit<ConnectingInfo, 'counterparty' | 'channelID'> & {
75
- * localAddr: Endpoint;
76
- * onConnectP: OnConnectP;
77
- * counterparty: { port_id: string };
79
+ * localAddr: Endpoint, onConnectP: OnConnectP
80
+ * counterparty: { port_id: string },
78
81
  * }} Outbound
79
82
  */
80
83
 
81
- /** @type {LegacyMap<string, Outbound[]>} */
84
+ /**
85
+ * @type {LegacyMap<string, Array<Outbound>>}
86
+ */
82
87
  // Legacy because it holds a mutable Javascript Array
83
88
  const srcPortToOutbounds = makeLegacyMap('SRC-PORT');
84
89
 
85
- /** @type {MapStore<string, ConnectingInfo>} */
90
+ /**
91
+ * @type {MapStore<string, ConnectingInfo>}
92
+ */
86
93
  const channelKeyToInfo = makeScalarMapStore('CHANNEL:PORT');
87
94
 
88
- /** @type {MapStore<string, Promise<InboundAttempt>>} */
95
+ /**
96
+ * @type {MapStore<string, Promise<InboundAttempt>>}
97
+ */
89
98
  const channelKeyToAttemptP = makeScalarMapStore('CHANNEL:PORT');
90
99
 
91
- /** @type {LegacyMap<string, LegacyMap<number, PromiseRecord<Bytes>>>} */
100
+ /**
101
+ * @type {LegacyMap<string, LegacyMap<number, PromiseRecord<Bytes>>>}
102
+ */
92
103
  // Legacy because it holds a LegacyMap
93
104
  const channelKeyToSeqAck = makeLegacyMap('CHANNEL:PORT');
94
105
 
@@ -113,7 +124,9 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
113
124
  // Extract the actual sequence number from the return.
114
125
  const { sequence } = fullPacket;
115
126
 
116
- /** @type {PromiseRecord<Bytes>} */
127
+ /**
128
+ * @type {PromiseRecord<Bytes>}
129
+ */
117
130
  const ackDeferred = makePromiseKit();
118
131
 
119
132
  // Register the ack resolver/rejector with this sequence number.
@@ -126,7 +139,7 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
126
139
  * @param {string} portID
127
140
  * @param {string} rChannelID
128
141
  * @param {string} rPortID
129
- * @param {'ORDERED' | 'UNORDERED'} order
142
+ * @param {'ORDERED'|'UNORDERED'} order
130
143
  * @returns {ConnectionHandler}
131
144
  */
132
145
  function makeIBCConnectionHandler(
@@ -200,7 +213,9 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
200
213
  });
201
214
  }
202
215
 
203
- /** @param {string} localAddr */
216
+ /**
217
+ * @param {string} localAddr
218
+ */
204
219
  const localAddrToPortID = localAddr => {
205
220
  const m = localAddr.match(/^\/ibc-port\/([-a-zA-Z0-9._+#[\]<>]+)$/);
206
221
  if (!m) {
@@ -211,23 +226,29 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
211
226
  return m[1];
212
227
  };
213
228
 
214
- /** @type {ProtocolImpl} */
229
+ /**
230
+ * @type {ProtocolImpl}
231
+ */
215
232
  let protocolImpl;
216
233
 
217
234
  /**
218
235
  * @typedef {object} OutboundCircuitRecord
219
236
  * @property {IBCConnectionID} dst
220
- * @property {'ORDERED' | 'UNORDERED'} order
237
+ * @property {'ORDERED'|'UNORDERED'} order
221
238
  * @property {string} version
222
239
  * @property {IBCPacket} packet
223
240
  * @property {PromiseRecord<ConnectionHandler>} deferredHandler
224
241
  */
225
242
 
226
- /** @type {LegacyMap<Port, Set<PromiseRecord<ConnectionHandler>>>} */
243
+ /**
244
+ * @type {LegacyMap<Port, Set<PromiseRecord<ConnectionHandler>>>}
245
+ */
227
246
  // Legacy because it holds a raw JavaScript Set
228
247
  const portToPendingConns = makeLegacyMap('Port');
229
248
 
230
- /** @type {ProtocolHandler} */
249
+ /**
250
+ * @type {ProtocolHandler}
251
+ */
231
252
  const protocol = Far('IBCProtocolHandler', {
232
253
  async onCreate(impl, _protocolHandler) {
233
254
  console.debug('IBC onCreate');
@@ -338,7 +359,6 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
338
359
  ...protocol,
339
360
  async fromBridge(obj) {
340
361
  console.info('IBC fromBridge', obj);
341
- await null;
342
362
  switch (obj.event) {
343
363
  case 'channelOpenTry': {
344
364
  // They're (more or less politely) asking if we are listening, so make an attempt.
@@ -1,6 +1,6 @@
1
1
  export const DEFAULT_CRC_DIGITS: 2;
2
2
  export const DEFAULT_PREFIX: "board0";
3
- export function prepareBoardKit(baggage: any): (args_0?: number | bigint | undefined, args_1?: {
3
+ export function prepareBoardKit(baggage: MapStore<string, unknown>): (args_0?: number | bigint | undefined, args_1?: {
4
4
  prefix?: string | undefined;
5
5
  crcDigits?: number | undefined;
6
6
  } | undefined) => {
@@ -8,13 +8,13 @@ export function prepareBoardKit(baggage: any): (args_0?: number | bigint | undef
8
8
  /**
9
9
  * Provide an ID for a value, generating one if not already present.
10
10
  *
11
- * Each board ID includes a CRC so that the last part is
12
- * well-distributed, which mitigates typo risks.
11
+ * Each board ID includes a CRC so that the last part is well-distributed,
12
+ * which mitigates typo risks.
13
13
  *
14
- * Scaling Consideration: since we cannot know when consumers are no
15
- * longer interested in an ID, a board holds a strong reference to
16
- * `value` for its entire lifetime. For a well-known board, this is
17
- * essentially forever.
14
+ * Scaling Consideration: since we cannot know when consumers
15
+ * are no longer interested in an ID, a board holds a strong reference
16
+ * to `value` for its entire lifetime. For a well-known board, this
17
+ * is essentially forever.
18
18
  *
19
19
  * @param {Key} value
20
20
  * @throws if `value` is not a Key in the @agoric/store sense
@@ -26,22 +26,22 @@ export function prepareBoardKit(baggage: any): (args_0?: number | bigint | undef
26
26
  */
27
27
  getValue(id: BoardId): any;
28
28
  /**
29
- * Convenience method for recursively traversing boards and board-like
30
- * remotables to get data associated with a sequence of ids
31
- * corresponding to each successive board. For example, `lookup("foo",
32
- * "bar")` gets the value associated with id "foo" and returns the
33
- * result of invoking `lookup("bar")` upon it to get the value it
34
- * associates with id "bar".
29
+ * Convenience method for recursively traversing boards and
30
+ * board-like remotables to get data associated with a sequence of ids
31
+ * corresponding to each successive board.
32
+ * For example, `lookup("foo", "bar")` gets the value associated with
33
+ * id "foo" and returns the result of invoking `lookup("bar")` upon it
34
+ * to get the value it associates with id "bar".
35
35
  *
36
- * @param {...string} path
36
+ * @param {...string} path
37
37
  */
38
38
  lookup(...path: string[]): Promise<any>;
39
39
  /** @param {Key} val */
40
40
  has(val: Key): boolean;
41
41
  ids(): string[];
42
42
  /**
43
- * Get a marshaller that implements the convertValToSlot hook using
44
- * getId(), "publishing" previously un-mapped objects.
43
+ * Get a marshaller that implements the convertValToSlot hook using getId(),
44
+ * "publishing" previously un-mapped objects.
45
45
  */
46
46
  getPublishingMarshaller(): {
47
47
  toCapData(val: any): import("@endo/marshal").CapData<string>;
@@ -50,12 +50,12 @@ export function prepareBoardKit(baggage: any): (args_0?: number | bigint | undef
50
50
  unserialize(data: any): any;
51
51
  };
52
52
  /**
53
- * Get a marshaller that implements the convertValToSlot hook using
54
- * getId(), only for objects that the board has().
53
+ * Get a marshaller that implements the convertValToSlot hook using getId(),
54
+ * only for objects that the board has().
55
55
  *
56
56
  * For other objects, we don't throw, but we emit a null slot.
57
- * Un-serializing a null slot always produces a fresh object rather than
58
- * preserving object identity.
57
+ * Un-serializing a null slot always produces a fresh object
58
+ * rather than preserving object identity.
59
59
  */
60
60
  getReadonlyMarshaller(): {
61
61
  toCapData(val: any): import("@endo/marshal").CapData<string | null>;
@@ -81,13 +81,13 @@ export function prepareBoardKit(baggage: any): (args_0?: number | bigint | undef
81
81
  /**
82
82
  * Provide an ID for a value, generating one if not already present.
83
83
  *
84
- * Each board ID includes a CRC so that the last part is
85
- * well-distributed, which mitigates typo risks.
84
+ * Each board ID includes a CRC so that the last part is well-distributed,
85
+ * which mitigates typo risks.
86
86
  *
87
- * Scaling Consideration: since we cannot know when consumers are no
88
- * longer interested in an ID, a board holds a strong reference to
89
- * `value` for its entire lifetime. For a well-known board, this is
90
- * essentially forever.
87
+ * Scaling Consideration: since we cannot know when consumers
88
+ * are no longer interested in an ID, a board holds a strong reference
89
+ * to `value` for its entire lifetime. For a well-known board, this
90
+ * is essentially forever.
91
91
  *
92
92
  * @param {Key} value
93
93
  * @throws if `value` is not a Key in the @agoric/store sense
@@ -99,22 +99,22 @@ export function prepareBoardKit(baggage: any): (args_0?: number | bigint | undef
99
99
  */
100
100
  getValue(id: BoardId): any;
101
101
  /**
102
- * Convenience method for recursively traversing boards and board-like
103
- * remotables to get data associated with a sequence of ids
104
- * corresponding to each successive board. For example, `lookup("foo",
105
- * "bar")` gets the value associated with id "foo" and returns the
106
- * result of invoking `lookup("bar")` upon it to get the value it
107
- * associates with id "bar".
102
+ * Convenience method for recursively traversing boards and
103
+ * board-like remotables to get data associated with a sequence of ids
104
+ * corresponding to each successive board.
105
+ * For example, `lookup("foo", "bar")` gets the value associated with
106
+ * id "foo" and returns the result of invoking `lookup("bar")` upon it
107
+ * to get the value it associates with id "bar".
108
108
  *
109
- * @param {...string} path
109
+ * @param {...string} path
110
110
  */
111
111
  lookup(...path: string[]): Promise<any>;
112
112
  /** @param {Key} val */
113
113
  has(val: Key): boolean;
114
114
  ids(): string[];
115
115
  /**
116
- * Get a marshaller that implements the convertValToSlot hook using
117
- * getId(), "publishing" previously un-mapped objects.
116
+ * Get a marshaller that implements the convertValToSlot hook using getId(),
117
+ * "publishing" previously un-mapped objects.
118
118
  */
119
119
  getPublishingMarshaller(): {
120
120
  toCapData(val: any): import("@endo/marshal").CapData<string>;
@@ -123,12 +123,12 @@ export function prepareBoardKit(baggage: any): (args_0?: number | bigint | undef
123
123
  unserialize(data: any): any;
124
124
  };
125
125
  /**
126
- * Get a marshaller that implements the convertValToSlot hook using
127
- * getId(), only for objects that the board has().
126
+ * Get a marshaller that implements the convertValToSlot hook using getId(),
127
+ * only for objects that the board has().
128
128
  *
129
129
  * For other objects, we don't throw, but we emit a null slot.
130
- * Un-serializing a null slot always produces a fresh object rather than
131
- * preserving object identity.
130
+ * Un-serializing a null slot always produces a fresh object
131
+ * rather than preserving object identity.
132
132
  */
133
133
  getReadonlyMarshaller(): {
134
134
  toCapData(val: any): import("@endo/marshal").CapData<string | null>;
@@ -152,27 +152,29 @@ export function prepareBoardKit(baggage: any): (args_0?: number | bigint | undef
152
152
  }>;
153
153
  export function prepareRecorderFactory(zone: import('@agoric/zone').Zone): (label: string, marshaller: Marshaller) => <T>(storageNode: StorageNode, valueShape?: import("@agoric/zoe/src/contractSupport/recorder.js").TypedMatcher<T> | undefined) => import("@agoric/zoe/src/contractSupport/recorder.js").RecorderKit<T>;
154
154
  /**
155
- * For a value with a known id in the board, we can use that board id as a slot
156
- * to preserve identity when marshaling.
155
+ * For a value with a known id in the board, we can use
156
+ * that board id as a slot to preserve identity when marshaling.
157
157
  *
158
158
  * The contents of the string depend on the `prefix` and `crcDigits` options:
159
- * `${prefix}${crc}${seq}`
159
+ * \`${prefix}${crc}${seq}\`
160
160
  *
161
161
  * For example, 'board0371' for prefix: 'board0', seq: 1, 2 digits crc.
162
162
  */
163
163
  export type BoardId = string;
164
164
  /**
165
- * // TODO: use
166
- * Key from
165
+ * // TODO: use Key from
167
166
  */
168
167
  export type BoardState = ReturnType<typeof initDurableBoardState>;
169
168
  export type Key = import('@endo/marshal').Passable;
170
169
  /**
171
- * @typedef {ReturnType<typeof initDurableBoardState>} BoardState // TODO: use
172
- * Key from @agoric/store when available
173
170
  * @see {prepareExoClassKit}
174
- * @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects} Hoisting this function makes defining the state type concise.
171
+ * @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects}
175
172
  *
173
+ * Hoisting this function makes defining the state type concise.
174
+ * @typedef {ReturnType<typeof initDurableBoardState>} BoardState
175
+ *
176
+ *
177
+ * // TODO: use Key from @agoric/store when available
176
178
  * @typedef {import('@endo/marshal').Passable} Key
177
179
  */
178
180
  /**
@@ -181,8 +183,7 @@ export type Key = import('@endo/marshal').Passable;
181
183
  * @param {bigint | number} [initSequence]
182
184
  * @param {object} [options]
183
185
  * @param {string} [options.prefix] prefix for all ids generated
184
- * @param {number} [options.crcDigits] count of digits to use in CRC at end of
185
- * the id
186
+ * @param {number} [options.crcDigits] count of digits to use in CRC at end of the id
186
187
  */
187
188
  declare function initDurableBoardState(initSequence?: number | bigint | undefined, { prefix, crcDigits }?: {
188
189
  prefix?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"lib-board.d.ts","sourceRoot":"","sources":["lib-board.js"],"names":[],"mappings":"AAkBA,mCAAoC;AACpC,sCAAuC;AAoOhC;;;;;QAQC;;;;;;;;;;;;;WAaG;qBAFQ,GAAG;QAMd;;;WAGG;qBAFQ,OAAO;QAMlB;;;;;;;;;WASG;wBADW,MAAM;QAgBpB,uBAAuB;iBAAX,GAAG;;QASf;;;WAGG;;;;;;;QAIH;;;;;;;WAOG;;;;;;;;;;;;;;;;;;;;;;QAvEH;;;;;;;;;;;;;WAaG;qBAFQ,GAAG;QAMd;;;WAGG;qBAFQ,OAAO;QAMlB;;;;;;;;;WASG;wBADW,MAAM;QAgBpB,uBAAuB;iBAAX,GAAG;;QASf;;;WAGG;;;;;;;QAIH;;;;;;;WAOG;;;;;;;;;;;;;;;;;;;;GAuCV;AAGM,6CADK,OAAO,cAAc,EAAE,IAAI,WAS1B,MAAM,cACN,UAAU,2MAYtB;;;;;;;;;;sBA5UY,MAAM;;;;;yBAmBN,WAAW,4BAA4B,CAAC;kBAKxC,OAAO,eAAe,EAAE,QAAQ;AAN7C;;;;;;;GAOG;AAGH;;;;;;;;GAQG;AACH;;;;;;;;;EA0BC"}
1
+ {"version":3,"file":"lib-board.d.ts","sourceRoot":"","sources":["lib-board.js"],"names":[],"mappings":"AAmBA,mCAAoC;AACpC,sCAAuC;AAwOhC;;;;;QAQC;;;;;;;;;;;;;WAaG;qBAFQ,GAAG;QAMd;;;WAGG;qBAFQ,OAAO;QAMlB;;;;;;;;;WASG;wBADY,MAAM;QAgBrB,uBAAuB;iBAAX,GAAG;;QASf;;;WAGG;;;;;;;QAIH;;;;;;;WAOG;;;;;;;;;;;;;;;;;;;;;;QAvEH;;;;;;;;;;;;;WAaG;qBAFQ,GAAG;QAMd;;;WAGG;qBAFQ,OAAO;QAMlB;;;;;;;;;WASG;wBADY,MAAM;QAgBrB,uBAAuB;iBAAX,GAAG;;QASf;;;WAGG;;;;;;;QAIH;;;;;;;WAOG;;;;;;;;;;;;;;;;;;;;GAuCV;AAKM,6CAFI,OAAO,cAAc,EAAE,IAAI,WAUzB,MAAM,cACN,UAAU,2MAYtB;;;;;;;;;;sBAlVY,MAAM;;;;yBAuBN,WAAW,4BAA4B,CAAC;kBAIxC,OAAO,eAAe,EAAE,QAAQ;AAT7C;;;;;;;;;;GAUG;AAGH;;;;;;;GAOG;AACH;;;;;;;;;EA0BC"}
package/src/lib-board.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // @ts-check
2
2
  /**
3
3
  * @file lib-board: share objects by way of plain-data ids
4
+ *
4
5
  * @see prepareBoardKit()
5
6
  */
6
7
 
@@ -47,11 +48,11 @@ const BoardKitIKit = {
47
48
  //#endregion
48
49
 
49
50
  /**
50
- * For a value with a known id in the board, we can use that board id as a slot
51
- * to preserve identity when marshaling.
51
+ * For a value with a known id in the board, we can use
52
+ * that board id as a slot to preserve identity when marshaling.
52
53
  *
53
54
  * The contents of the string depend on the `prefix` and `crcDigits` options:
54
- * `${prefix}${crc}${seq}`
55
+ * \`${prefix}${crc}${seq}\`
55
56
  *
56
57
  * For example, 'board0371' for prefix: 'board0', seq: 1, 2 digits crc.
57
58
  *
@@ -74,11 +75,14 @@ const calcCrc = (data, crcDigits) => {
74
75
  };
75
76
 
76
77
  /**
77
- * @typedef {ReturnType<typeof initDurableBoardState>} BoardState // TODO: use
78
- * Key from @agoric/store when available
79
78
  * @see {prepareExoClassKit}
80
- * @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects} Hoisting this function makes defining the state type concise.
79
+ * @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects}
80
+ *
81
+ * Hoisting this function makes defining the state type concise.
82
+ * @typedef {ReturnType<typeof initDurableBoardState>} BoardState
81
83
  *
84
+ *
85
+ * // TODO: use Key from @agoric/store when available
82
86
  * @typedef {import('@endo/marshal').Passable} Key
83
87
  */
84
88
 
@@ -89,8 +93,7 @@ const calcCrc = (data, crcDigits) => {
89
93
  * @param {bigint | number} [initSequence]
90
94
  * @param {object} [options]
91
95
  * @param {string} [options.prefix] prefix for all ids generated
92
- * @param {number} [options.crcDigits] count of digits to use in CRC at end of
93
- * the id
96
+ * @param {number} [options.crcDigits] count of digits to use in CRC at end of the id
94
97
  */
95
98
  const initDurableBoardState = (
96
99
  initSequence = 0,
@@ -177,7 +180,9 @@ const getValue = (id, { prefix, crcDigits, idToVal }) => {
177
180
  throw Fail`board does not have id: ${id}`;
178
181
  };
179
182
 
180
- /** @param {BoardState} state */
183
+ /**
184
+ * @param {BoardState} state
185
+ */
181
186
  const makeSlotToVal = state => {
182
187
  const ifaceAllegedPrefix = 'Alleged: ';
183
188
  const ifaceInaccessiblePrefix = 'SEVERED: ';
@@ -238,9 +243,9 @@ const makePublishingMarshaller = state => {
238
243
  //#endregion
239
244
 
240
245
  /**
241
- * A board is a two-way mapping between objects (such as issuers, brands,
242
- * installation handles) and plain-data string IDs. A well-known board allows
243
- * sharing objects by way of their ids.
246
+ * A board is a two-way mapping between objects (such as issuers,
247
+ * brands, installation handles) and plain-data string IDs.
248
+ * A well-known board allows sharing objects by way of their ids.
244
249
  *
245
250
  * @param {import('@agoric/vat-data').Baggage} baggage for upgrade successors
246
251
  * @see {@link packages/SwingSet/docs/vat-upgrade.md|Vat Upgrade}
@@ -256,13 +261,13 @@ export const prepareBoardKit = baggage => {
256
261
  /**
257
262
  * Provide an ID for a value, generating one if not already present.
258
263
  *
259
- * Each board ID includes a CRC so that the last part is
260
- * well-distributed, which mitigates typo risks.
264
+ * Each board ID includes a CRC so that the last part is well-distributed,
265
+ * which mitigates typo risks.
261
266
  *
262
- * Scaling Consideration: since we cannot know when consumers are no
263
- * longer interested in an ID, a board holds a strong reference to
264
- * `value` for its entire lifetime. For a well-known board, this is
265
- * essentially forever.
267
+ * Scaling Consideration: since we cannot know when consumers
268
+ * are no longer interested in an ID, a board holds a strong reference
269
+ * to `value` for its entire lifetime. For a well-known board, this
270
+ * is essentially forever.
266
271
  *
267
272
  * @param {Key} value
268
273
  * @throws if `value` is not a Key in the @agoric/store sense
@@ -278,14 +283,14 @@ export const prepareBoardKit = baggage => {
278
283
  return getValue(id, this.state);
279
284
  },
280
285
  /**
281
- * Convenience method for recursively traversing boards and board-like
282
- * remotables to get data associated with a sequence of ids
283
- * corresponding to each successive board. For example, `lookup("foo",
284
- * "bar")` gets the value associated with id "foo" and returns the
285
- * result of invoking `lookup("bar")` upon it to get the value it
286
- * associates with id "bar".
286
+ * Convenience method for recursively traversing boards and
287
+ * board-like remotables to get data associated with a sequence of ids
288
+ * corresponding to each successive board.
289
+ * For example, `lookup("foo", "bar")` gets the value associated with
290
+ * id "foo" and returns the result of invoking `lookup("bar")` upon it
291
+ * to get the value it associates with id "bar".
287
292
  *
288
- * @param {...string} path
293
+ * @param {...string} path
289
294
  */
290
295
  async lookup(...path) {
291
296
  const {
@@ -311,19 +316,19 @@ export const prepareBoardKit = baggage => {
311
316
  return harden([...state.idToVal.keys()]);
312
317
  },
313
318
  /**
314
- * Get a marshaller that implements the convertValToSlot hook using
315
- * getId(), "publishing" previously un-mapped objects.
319
+ * Get a marshaller that implements the convertValToSlot hook using getId(),
320
+ * "publishing" previously un-mapped objects.
316
321
  */
317
322
  getPublishingMarshaller() {
318
323
  return this.facets.publishingMarshaller;
319
324
  },
320
325
  /**
321
- * Get a marshaller that implements the convertValToSlot hook using
322
- * getId(), only for objects that the board has().
326
+ * Get a marshaller that implements the convertValToSlot hook using getId(),
327
+ * only for objects that the board has().
323
328
  *
324
329
  * For other objects, we don't throw, but we emit a null slot.
325
- * Un-serializing a null slot always produces a fresh object rather than
326
- * preserving object identity.
330
+ * Un-serializing a null slot always produces a fresh object
331
+ * rather than preserving object identity.
327
332
  */
328
333
  getReadonlyMarshaller() {
329
334
  return this.facets.readonlyMarshaller;
@@ -365,7 +370,9 @@ export const prepareBoardKit = baggage => {
365
370
  );
366
371
  };
367
372
 
368
- /** @param {import('@agoric/zone').Zone} zone */
373
+ /**
374
+ * @param {import('@agoric/zone').Zone} zone
375
+ */
369
376
  export const prepareRecorderFactory = zone => {
370
377
  const baggage = zone.mapStore(`Recorder Baggage`);
371
378
  const makeDurablePublishKit = prepareDurablePublishKit(
@@ -1,6 +1,4 @@
1
- /** @type {ContractMeta} */
2
- export const meta: ContractMeta;
3
- export function start<K extends AssetKind>(zcf: ZCF<IssuerInfo<K>>, _privateArgs: undefined, instanceBaggage: any): {
1
+ export function prepare<K extends AssetKind>(zcf: ZCF<IssuerInfo<K>>, _privateArgs: undefined, instanceBaggage: MapStore<string, unknown>): {
4
2
  publicFacet: Issuer<AssetKind>;
5
3
  creatorFacet: Mint<AssetKind>;
6
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mintHolder.d.ts","sourceRoot":"","sources":["mintHolder.js"],"names":[],"mappings":"AAkCA,2BAA2B;AAC3B,mBADW,YAAY,CAGrB;AAYK,kFAHI,SAAS;;;EAUnB;sBA/Ca,OAAO,kBAAkB,EAAE,OAAO;;;;8CAInC;IACZ,OAAW,EAAE,MAAM,CAAC;IACpB,SAAa,EAAE,CAAC,CAAC;IACjB,WAAe,EAAE,WAAW,CAAC;CAC1B"}
1
+ {"version":3,"file":"mintHolder.d.ts","sourceRoot":"","sources":["mintHolder.js"],"names":[],"mappings":"AA4CO,oFAHI,SAAS;;;EAUnB;sBA1Ca,OAAO,kBAAkB,EAAE,OAAO;;;;8CAInC;IACZ,OAAW,EAAE,MAAM,CAAC;IACpB,SAAa,EAAE,CAAC,CAAC;IACjB,WAAe,EAAE,WAAW,CAAC;CAC1B"}