@agoric/vats 0.16.0-upgrade-16-dev-0df76a7.0 → 0.16.0-upgrade-17-dev-a61cdab.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 (93) hide show
  1. package/CHANGELOG.md +21 -23
  2. package/package.json +27 -26
  3. package/src/bridge-target.d.ts +4 -0
  4. package/src/bridge-target.d.ts.map +1 -1
  5. package/src/bridge-target.js +5 -8
  6. package/src/bridge.d.ts +1 -0
  7. package/src/bridge.d.ts.map +1 -1
  8. package/src/bridge.js +21 -1
  9. package/src/core/basic-behaviors.d.ts +10 -22
  10. package/src/core/basic-behaviors.d.ts.map +1 -1
  11. package/src/core/basic-behaviors.js +17 -26
  12. package/src/core/boot-chain.d.ts +22 -50
  13. package/src/core/boot-chain.d.ts.map +1 -1
  14. package/src/core/boot-sim.d.ts +4 -4
  15. package/src/core/boot-solo.d.ts +4 -4
  16. package/src/core/chain-behaviors.d.ts +4 -20
  17. package/src/core/chain-behaviors.d.ts.map +1 -1
  18. package/src/core/chain-behaviors.js +22 -30
  19. package/src/core/client-behaviors.d.ts.map +1 -1
  20. package/src/core/client-behaviors.js +7 -3
  21. package/src/core/demoIssuers.d.ts +1 -5
  22. package/src/core/demoIssuers.d.ts.map +1 -1
  23. package/src/core/demoIssuers.js +6 -6
  24. package/src/core/lib-boot.d.ts +8 -4
  25. package/src/core/lib-boot.d.ts.map +1 -1
  26. package/src/core/lib-boot.js +3 -2
  27. package/src/core/types-ambient.d.ts +39 -5
  28. package/src/core/utils.d.ts +4 -4
  29. package/src/core/utils.d.ts.map +1 -1
  30. package/src/core/utils.js +1 -2
  31. package/src/ibc.d.ts.map +1 -1
  32. package/src/ibc.js +31 -17
  33. package/src/lib-board.d.ts +2 -5
  34. package/src/lib-board.d.ts.map +1 -1
  35. package/src/lib-board.js +2 -5
  36. package/src/localchain.d.ts +46 -22
  37. package/src/localchain.d.ts.map +1 -1
  38. package/src/localchain.js +39 -22
  39. package/src/nameHub.d.ts.map +1 -1
  40. package/src/nameHub.js +2 -4
  41. package/src/priceAuthorityRegistry.d.ts.map +1 -1
  42. package/src/priceAuthorityRegistry.js +4 -4
  43. package/src/proposals/localchain-proposal.d.ts +0 -1
  44. package/src/proposals/localchain-proposal.d.ts.map +1 -1
  45. package/src/proposals/localchain-proposal.js +5 -4
  46. package/src/proposals/localchain-test.js +3 -3
  47. package/src/proposals/network-proposal.d.ts +0 -20
  48. package/src/proposals/network-proposal.d.ts.map +1 -1
  49. package/src/proposals/network-proposal.js +2 -8
  50. package/src/proposals/restart-vats-proposal.js +1 -1
  51. package/src/proposals/transfer-proposal.d.ts +0 -4
  52. package/src/proposals/transfer-proposal.d.ts.map +1 -1
  53. package/src/proposals/transfer-proposal.js +2 -7
  54. package/src/proposals/upgrade-bank-proposal.d.ts +27 -0
  55. package/src/proposals/upgrade-bank-proposal.d.ts.map +1 -0
  56. package/src/proposals/upgrade-bank-proposal.js +42 -0
  57. package/src/proposals/upgrade-orch-core-proposal.d.ts +29 -0
  58. package/src/proposals/upgrade-orch-core-proposal.d.ts.map +1 -0
  59. package/src/proposals/upgrade-orch-core-proposal.js +43 -0
  60. package/src/proposals/upgrade-provisionPool-proposal.d.ts +27 -0
  61. package/src/proposals/upgrade-provisionPool-proposal.d.ts.map +1 -0
  62. package/src/proposals/upgrade-provisionPool-proposal.js +69 -0
  63. package/src/proposals/upgrade-zoe-proposal.d.ts +0 -1
  64. package/src/proposals/upgrade-zoe-proposal.d.ts.map +1 -1
  65. package/src/proposals/upgrade-zoe-proposal.js +1 -1
  66. package/src/transfer.d.ts +7 -3
  67. package/src/transfer.d.ts.map +1 -1
  68. package/src/transfer.js +4 -3
  69. package/src/types.d.ts +49 -10
  70. package/src/vat-bank.d.ts.map +1 -1
  71. package/src/vat-bank.js +7 -7
  72. package/src/vat-board.d.ts +4 -4
  73. package/src/vat-board.d.ts.map +1 -1
  74. package/src/vat-bridge.d.ts.map +1 -1
  75. package/src/vat-bridge.js +1 -1
  76. package/src/vat-localchain.d.ts +16 -4
  77. package/src/vat-localchain.d.ts.map +1 -1
  78. package/src/vat-network.d.ts +4 -4
  79. package/src/vat-network.d.ts.map +1 -1
  80. package/src/vat-network.js +3 -1
  81. package/src/vat-transfer.d.ts +2 -2
  82. package/src/vat-transfer.d.ts.map +1 -1
  83. package/src/vat-zoe.d.ts +3 -2
  84. package/src/vat-zoe.d.ts.map +1 -1
  85. package/src/vat-zoe.js +2 -0
  86. package/src/virtual-purse.d.ts.map +1 -1
  87. package/src/virtual-purse.js +28 -9
  88. package/tools/bank-utils.d.ts.map +1 -1
  89. package/tools/boot-test-utils.d.ts.map +1 -1
  90. package/tools/boot-test-utils.js +6 -4
  91. package/tools/fake-bridge.d.ts +10 -0
  92. package/tools/fake-bridge.d.ts.map +1 -1
  93. package/tools/fake-bridge.js +145 -31
package/src/core/utils.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { Fail, q } from '@endo/errors';
1
2
  import { Stable, Stake } from '@agoric/internal/src/tokens.js';
2
3
  import { WalletName } from '@agoric/internal';
3
4
  import { E, Far } from '@endo/far';
@@ -10,7 +11,6 @@ import { makeLogHooks, makePromiseSpace } from './promise-space.js';
10
11
  import './types-ambient.js';
11
12
 
12
13
  const { entries, fromEntries, keys } = Object;
13
- const { Fail, quote: q } = assert;
14
14
 
15
15
  /**
16
16
  * Used in bootstrap to reserve names in the agoricNames namespace before any
@@ -363,7 +363,6 @@ export const makeVatSpace = (
363
363
  {
364
364
  get: (_target, name, _rx) => {
365
365
  assert.typeof(name, 'string');
366
- // @ts-expect-error XXX
367
366
  return provideAsync(name, createVatByName).then(vat => {
368
367
  if (!durableStore.has(name)) {
369
368
  durableStore.init(name, vat);
package/src/ibc.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ibc.d.ts","sourceRoot":"","sources":["ibc.js"],"names":[],"mappings":"AAmDO,kDAHI,IAAI,GACF,GAAG,CAmHf;AAMM,yCAHI,IAAI,UACJ,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Aa;oCAFyH,YAAY;8BADtG,iBAAiB"}
package/src/ibc.js CHANGED
@@ -1,10 +1,11 @@
1
1
  // @ts-check
2
2
 
3
- import { assert, details as X, Fail } from '@agoric/assert';
3
+ import { assert, X, Fail } from '@endo/errors';
4
4
  import { E } from '@endo/far';
5
5
 
6
6
  import { byteSourceToBase64, base64ToBytes } from '@agoric/network';
7
7
 
8
+ import { makeTracer } from '@agoric/internal';
8
9
  import {
9
10
  localAddrToPortID,
10
11
  decodeRemoteIbcAddress,
@@ -12,6 +13,8 @@ import {
12
13
  encodeRemoteIbcAddress,
13
14
  } from '../tools/ibc-utils.js';
14
15
 
16
+ const trace = makeTracer('IBC', false);
17
+
15
18
  /**
16
19
  * @import {LocalIbcAddress, RemoteIbcAddress} from '../tools/ibc-utils.js';
17
20
  * @import {AttemptDescription} from '@agoric/network';
@@ -105,7 +108,7 @@ export const prepareIBCConnectionHandler = zone => {
105
108
  async onOpen(conn, localAddr, remoteAddr, _handler) {
106
109
  const { channelID, portID, channelKeyToConnP } = this.state;
107
110
 
108
- console.debug(
111
+ trace(
109
112
  'onOpen Remote IBC Connection',
110
113
  channelID,
111
114
  portID,
@@ -137,26 +140,32 @@ export const prepareIBCConnectionHandler = zone => {
137
140
  return protocolUtils.ibcSendPacket(packet, relativeTimeoutNs);
138
141
  },
139
142
  /** @type {Required<ConnectionHandler>['onClose']} */
140
- async onClose() {
143
+ onClose(_conn, _reason) {
141
144
  const { portID, channelID } = this.state;
142
- const { protocolUtils, channelKeyToSeqAck } = this.state;
145
+ const { protocolUtils, channelKeyToSeqAck, channelKeyToConnP } =
146
+ this.state;
143
147
 
144
148
  const packet = {
145
149
  source_port: portID,
146
150
  source_channel: channelID,
147
151
  };
148
- await protocolUtils.downcall('startChannelCloseInit', {
149
- packet,
150
- });
151
- const rejectReason = Error('Connection closed');
152
152
  const channelKey = `${channelID}:${portID}`;
153
-
153
+ const rejectReason = Error('Connection closed');
154
154
  const seqToAck = channelKeyToSeqAck.get(channelKey);
155
155
 
156
156
  for (const ackKit of seqToAck.values()) {
157
157
  ackKit.resolver.reject(rejectReason);
158
158
  }
159
159
  channelKeyToSeqAck.delete(channelKey);
160
+
161
+ // This Connection object is initiating the close event
162
+ if (channelKeyToConnP.has(channelKey)) {
163
+ channelKeyToConnP.delete(channelKey);
164
+ return protocolUtils.downcall('startChannelCloseInit', {
165
+ packet,
166
+ });
167
+ }
168
+ return Promise.resolve();
160
169
  },
161
170
  },
162
171
  );
@@ -236,7 +245,7 @@ export const prepareIBCProtocol = (zone, powers) => {
236
245
  protocolHandler: {
237
246
  /** @type {Required<ProtocolHandler>['onCreate']} */
238
247
  async onCreate(impl) {
239
- console.debug('IBC onCreate');
248
+ trace('onCreate');
240
249
  this.state.protocolImpl = impl;
241
250
  },
242
251
  /** @type {Required<ProtocolHandler>['onInstantiate']} */
@@ -267,7 +276,7 @@ export const prepareIBCProtocol = (zone, powers) => {
267
276
  const { util } = this.facets;
268
277
  const { portToPendingConns, srcPortToOutbounds } = this.state;
269
278
 
270
- console.debug('IBC onConnect', localAddr, remoteAddr);
279
+ trace('onConnect', localAddr, remoteAddr);
271
280
  // @ts-expect-error may not be LocalIbcAddress
272
281
  const portID = localAddrToPortID(localAddr);
273
282
  const pendingConns = portToPendingConns.get(portID);
@@ -313,16 +322,16 @@ export const prepareIBCProtocol = (zone, powers) => {
313
322
  },
314
323
  /** @type {Required<ProtocolHandler>['onListen']} */
315
324
  async onListen(_port, localAddr) {
316
- console.debug('IBC onListen', localAddr);
325
+ trace('onListen', localAddr);
317
326
  },
318
327
  /** @type {Required<ProtocolHandler>['onListenRemove']} */
319
328
  async onListenRemove(_port, localAddr) {
320
- console.debug('IBC onListenRemove', localAddr);
329
+ trace('onListenRemove', localAddr);
321
330
  },
322
331
  /** @type {Required<ProtocolHandler>['onRevoke']} */
323
332
  async onRevoke(_port, localAddr) {
324
333
  const { portToPendingConns } = this.state;
325
- console.debug('IBC onRevoke', localAddr);
334
+ trace('onRevoke', localAddr);
326
335
  // @ts-expect-error may not be LocalIbcAddress
327
336
  const portID = localAddrToPortID(localAddr);
328
337
 
@@ -583,11 +592,16 @@ export const prepareIBCProtocol = (zone, powers) => {
583
592
  break;
584
593
  }
585
594
 
586
- case 'channelCloseInit':
595
+ // We ignore the close init tx message, since any decision to
596
+ // close should be left to the VM...
597
+ case 'channelCloseInit': {
598
+ break;
599
+ }
600
+
601
+ // ... or received from the other side.
587
602
  case 'channelCloseConfirm': {
588
603
  const { portID, channelID } =
589
- // could be either but that complicates line wrapping
590
- /** @type {IBCEvent<'channelCloseInit'>} */ (obj);
604
+ /** @type {IBCEvent<'channelCloseConfirm'>} */ (obj);
591
605
  const channelKey = `${channelID}:${portID}`;
592
606
  if (channelKeyToConnP.has(channelKey)) {
593
607
  const conn = channelKeyToConnP.get(channelKey);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @import {RemotableObject} from '@endo/pass-style';
3
- * @import {Key} from '@endo/patterns');
3
+ * @import {Key} from '@endo/patterns';
4
4
  */
5
5
  export const DEFAULT_CRC_DIGITS: 2;
6
6
  export const DEFAULT_PREFIX: "board0";
@@ -80,7 +80,7 @@ export function prepareBoardKit(baggage: import("@agoric/vat-data").Baggage): (i
80
80
  unserialize(data: any): any;
81
81
  };
82
82
  }>;
83
- export function prepareRecorderFactory(zone: import("@agoric/zone").Zone): (label: string, marshaller: Marshaller) => <T>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: import("@agoric/zoe/src/contractSupport/recorder.js").TypedMatcher<T> | undefined) => RecorderKit<T>;
83
+ export function prepareRecorderFactory(zone: import("@agoric/zone").Zone): (label: string, marshaller: Marshaller) => <T>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: import("@agoric/internal").TypedPattern<T> | undefined) => RecorderKit<T>;
84
84
  /**
85
85
  * For a value with a known id in the board, we can use that board id as a slot
86
86
  * to preserve identity when marshaling.
@@ -100,9 +100,6 @@ import type { RemotableObject } from '@endo/pass-style';
100
100
  /**
101
101
  * @typedef {ReturnType<typeof initDurableBoardState>} BoardState // TODO: use
102
102
  * Key from @agoric/store when available
103
- * @import {Passable} from '@endo/marshal'
104
- * @see {prepareExoClassKit}
105
- * @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects} Hoisting this function makes defining the state type concise.
106
103
  */
107
104
  /**
108
105
  * Make state for the board. Hoisted up to define the BoardState type.
@@ -1 +1 @@
1
- {"version":3,"file":"lib-board.d.ts","sourceRoot":"","sources":["lib-board.js"],"names":[],"mappings":"AAiBA;;;GAGG;AAEH,mCAAoC;AACpC,sCAAuC;AAsOhC,yCAHI,OAAO,kBAAkB,EAAE,OAAO;;;yBAdpB,WAAW;;QAyB5B;;;;;;;;;;;;WAYG;qBADQ,eAAe;QAK1B;;;WAGG;qBAFQ,OAAO;QAMlB;;;;;;;;;WASG;wBADW,MAAM,EAAA;QAiBpB,mCAAmC;iBAAvB,eAAe;;QAS3B;;;WAGG;;;;;;;QAIH;;;;;;;WAOG;;;;;;;;;;;;;;;;;;;;GAuCV;AAGM,6CADK,OAAO,cAAc,EAAE,IAAI,WAS1B,MAAM,cACN,UAAU,mDA7NuB,WAAW,0IAyOxD;;;;;;;;;;sBA9UY,MAAM;;;;;yBAmBN,UAAU,CAAC,OAAO,qBAAqB,CAAC;qCA9DnB,kBAAkB;AA6DpD;;;;;;GAMG;AAGH;;;;;;;;GAQG;AACH;;;;;;;;;EA0BC"}
1
+ {"version":3,"file":"lib-board.d.ts","sourceRoot":"","sources":["lib-board.js"],"names":[],"mappings":"AAiBA;;;GAGG;AAEH,mCAAoC;AACpC,sCAAuC;AAmOhC,yCAHI,OAAO,kBAAkB,EAAE,OAAO;;;yBAHhB,WAAU;;QAc/B;;;;;;;;;;;;WAYG;qBADQ,eAAe;QAK1B;;;WAGG;qBAFQ,OAAO;QAMlB;;;;;;;;;WASG;wBADW,MAAM,EAAA;QAiBpB,mCAAmC;iBAAvB,eAAe;;QAS3B;;;WAGG;;;;;;;QAIH;;;;;;;WAOG;;;;;;;;;;;;;;;;;;;;GAuCV;AAGM,6CADK,OAAO,cAAc,EAAE,IAAI,WAS1B,MAAM,cACN,UAAU,mDAxNR,WAAW,+GAoOzB;;;;;;;;;;sBA3UY,MAAM;;;;;yBAmBN,UAAU,CAAC,OAAO,qBAAqB,CAAC;qCA9DnB,kBAAkB;AA6DpD;;;GAGG;AAGH;;;;;;;;GAQG;AACH;;;;;;;;;EA0BC"}
package/src/lib-board.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * @see prepareBoardKit()
4
4
  */
5
5
 
6
- import { assert, Fail, q } from '@agoric/assert';
6
+ import { assert, Fail, q } from '@endo/errors';
7
7
  import { prepareDurablePublishKit } from '@agoric/notifier';
8
8
  import { M, makeScalarBigMapStore, prepareExoClassKit } from '@agoric/vat-data';
9
9
  import {
@@ -17,7 +17,7 @@ import { crc6 } from './crc.js';
17
17
 
18
18
  /**
19
19
  * @import {RemotableObject} from '@endo/pass-style';
20
- * @import {Key} from '@endo/patterns');
20
+ * @import {Key} from '@endo/patterns';
21
21
  */
22
22
 
23
23
  export const DEFAULT_CRC_DIGITS = 2;
@@ -80,9 +80,6 @@ const calcCrc = (data, crcDigits) => {
80
80
  /**
81
81
  * @typedef {ReturnType<typeof initDurableBoardState>} BoardState // TODO: use
82
82
  * Key from @agoric/store when available
83
- * @import {Passable} from '@endo/marshal'
84
- * @see {prepareExoClassKit}
85
- * @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects} Hoisting this function makes defining the state type concise.
86
83
  */
87
84
 
88
85
  // TODO consider tightening initSequence to bigint only
@@ -18,6 +18,20 @@
18
18
  * Vow<JsonSafe<MsgTransferResponse & { ...; }>[]>' must have a
19
19
  * '[Symbol.iterator]()' method that returns an iterator.
20
20
  */
21
+ /**
22
+ * Send a batch of query requests to the local chain. Unless there is a system
23
+ * error, will return all results to indicate their success or failure.
24
+ *
25
+ * @template {TypedJson[]} [RT=TypedJson[]]
26
+ * @callback QueryManyFn
27
+ * @param {RT} requests
28
+ * @returns {PromiseVowOfTupleMappedToGenerics<{
29
+ * [K in keyof RT]: JsonSafe<{
30
+ * error?: string;
31
+ * reply: ResponseTo<RT[K]>;
32
+ * }>;
33
+ * }>}
34
+ */
21
35
  /**
22
36
  * @typedef {{
23
37
  * system: ScopedBridgeManager<'vlocalchain'>;
@@ -66,12 +80,12 @@ export function prepareLocalChainAccountKit(zone: import("@agoric/base-zone").Zo
66
80
  * This is safe, since even if the payment lies about its brand, ERTP
67
81
  * will reject spoofed payment objects when depositing into a purse.
68
82
  *
69
- * @param {Payment<'nat'>} payment
83
+ * @param {ERef<Payment<'nat'>>} payment
70
84
  * @param {Pattern} [optAmountShape] throws if the Amount of the Payment
71
85
  * does not match the provided Pattern
72
86
  * @returns {PromiseVow<Amount<'nat'>>}
73
87
  */
74
- deposit(payment: Payment<"nat">, optAmountShape?: Pattern): PromiseVow<Amount<"nat">>;
88
+ deposit(payment: ERef<Payment<"nat">>, optAmountShape?: Pattern): PromiseVow<Amount<"nat">>;
75
89
  /**
76
90
  * Withdraw a payment from the account's bank purse of the amount's
77
91
  * brand.
@@ -81,10 +95,14 @@ export function prepareLocalChainAccountKit(zone: import("@agoric/base-zone").Zo
81
95
  */
82
96
  withdraw(amount: Amount<"nat">): PromiseVow<Payment<"nat">>;
83
97
  /**
84
- * Execute a batch of messages in order as a single atomic transaction
85
- * and return the responses. If any of the messages fails, the entire
86
- * batch will be rolled back. Use `typedJson()` on the arguments to get
87
- * typed return values.
98
+ * Execute a batch of messages on the local chain. Note in particular,
99
+ * that for IBC `MsgTransfer`, execution only queues a packet for the
100
+ * local chain's IBC stack, and returns a `MsgTransferResponse`
101
+ * immediately, not waiting for the confirmation on the other chain.
102
+ *
103
+ * Messages are executed in order as a single atomic transaction and
104
+ * returns the responses. If any of the messages fails, the entire batch
105
+ * will be rolled back on the local chain.
88
106
  *
89
107
  * @template {TypedJson[]} MT messages tuple (use const with multiple
90
108
  * elements or it will be a mixed array)
@@ -92,6 +110,9 @@ export function prepareLocalChainAccountKit(zone: import("@agoric/base-zone").Zo
92
110
  * @returns {PromiseVowOfTupleMappedToGenerics<{
93
111
  * [K in keyof MT]: JsonSafe<ResponseTo<MT[K]>>;
94
112
  * }>}
113
+ *
114
+ * @see {typedJson} which can be used on arguments to get typed return
115
+ * values.
95
116
  */
96
117
  executeTx<MT extends TypedJson[]>(messages: MT): PromiseVowOfTupleMappedToGenerics<{ [K in keyof MT]: JsonSafe<ResponseTo<MT[K]>>; }>;
97
118
  /**
@@ -135,23 +156,16 @@ export function prepareLocalChainTools(zone: import("@agoric/base-zone").Zone, v
135
156
  query<T extends TypedJson = {
136
157
  '@type': string;
137
158
  }>(request: T): PromiseVow<JsonSafe<ResponseTo<T>>>;
138
- /**
139
- * Send a batch of query requests to the local chain. Unless there is a
140
- * system error, will return all results to indicate their success or
141
- * failure.
142
- *
143
- * @template {import('@agoric/cosmic-proto').TypedJson[]} RT
144
- * @param {RT} requests
145
- * @returns {PromiseVowOfTupleMappedToGenerics<{
146
- * [K in keyof RT]: JsonSafe<{
147
- * error?: string;
148
- * reply: ResponseTo<RT[K]>;
149
- * }>;
150
- * }>}
151
- */
152
- queryMany<RT extends import("@agoric/cosmic-proto").TypedJson[]>(requests: RT): PromiseVowOfTupleMappedToGenerics<{ [K in keyof RT]: JsonSafe<{
159
+ /** @type {QueryManyFn} */
160
+ queryMany(requests: {
161
+ '@type': string;
162
+ }[]): PromiseVowOfTupleMappedToGenerics<{ [K in keyof {
163
+ '@type': string;
164
+ }[]]: JsonSafe<{
153
165
  error?: string;
154
- reply: ResponseTo<RT[K]>;
166
+ reply: ResponseTo<{
167
+ '@type': string;
168
+ }[][K]>;
155
169
  }>; }>;
156
170
  }>;
157
171
  };
@@ -168,6 +182,16 @@ export function prepareLocalChainTools(zone: import("@agoric/base-zone").Zone, v
168
182
  * '[Symbol.iterator]()' method that returns an iterator.
169
183
  */
170
184
  export type PromiseVowOfTupleMappedToGenerics<T extends unknown[]> = Promise<T>;
185
+ /**
186
+ * Send a batch of query requests to the local chain. Unless there is a system
187
+ * error, will return all results to indicate their success or failure.
188
+ */
189
+ export type QueryManyFn<RT extends TypedJson[] = {
190
+ '@type': string;
191
+ }[]> = (requests: RT) => PromiseVowOfTupleMappedToGenerics<{ [K in keyof RT]: JsonSafe<{
192
+ error?: string;
193
+ reply: ResponseTo<RT[K]>;
194
+ }>; }>;
171
195
  export type AccountPowers = {
172
196
  system: ScopedBridgeManager<"vlocalchain">;
173
197
  bank: Bank;
@@ -1 +1 @@
1
- {"version":3,"file":"localchain.d.ts","sourceRoot":"","sources":["localchain.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;;;;;;GAaG;AAMI,kDAHI,OAAO,mBAAmB,EAAE,IAAI,aAChC,QAAQ;;QA2BX;;;;;;WAMG;2BALQ,KAAK,CAAC,KAAK,CAAC,+BACZ;YACV,OAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5B,cAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;SAC/B;;;;QAYJ;;;WAGG;0BAFQ,KAAK,CAAC,KAAK,CAAC,GACV,WAAW,MAAM,CAAC,KAAK,CAAC,CAAC;QAOtC;;;;;;;;;WASG;yBAJQ,OAAO,CAAC,KAAK,CAAC,mBACd,OAAO,GAEL,WAAW,MAAM,CAAC,KAAK,CAAC,CAAC;QAYtC;;;;;;WAMG;yBAFQ,MAAM,CAAC,KAAK,CAAC,GACX,WAAW,OAAO,CAAC,KAAK,CAAC,CAAC;QAOvC;;;;;;;;;;;;WAYG;kBANwB,EAAE,SAAf,SAAS,EAAG,YAEf,EAAE,GACA,iCAAiC,CAAC,GACzC,CAAa,IAAR,MAAM,EAAE,GAAG,SAAS,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAC7C,CAAC;QAgBL;;;WAGG;8BAFQ,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CHANGED
@@ -1,10 +1,15 @@
1
1
  // @ts-check
2
+ import { Fail } from '@endo/errors';
2
3
  import { E } from '@endo/far';
3
4
  import { M } from '@endo/patterns';
4
- import { AmountShape, BrandShape, PaymentShape } from '@agoric/ertp';
5
+ import {
6
+ AmountPatternShape,
7
+ AmountShape,
8
+ BrandShape,
9
+ PaymentShape,
10
+ } from '@agoric/ertp';
5
11
  import { Shape as NetworkShape } from '@agoric/network';
6
12
 
7
- const { Fail } = assert;
8
13
  const { Vow$ } = NetworkShape;
9
14
 
10
15
  /**
@@ -29,6 +34,21 @@ const { Vow$ } = NetworkShape;
29
34
  * '[Symbol.iterator]()' method that returns an iterator.
30
35
  */
31
36
 
37
+ /**
38
+ * Send a batch of query requests to the local chain. Unless there is a system
39
+ * error, will return all results to indicate their success or failure.
40
+ *
41
+ * @template {TypedJson[]} [RT=TypedJson[]]
42
+ * @callback QueryManyFn
43
+ * @param {RT} requests
44
+ * @returns {PromiseVowOfTupleMappedToGenerics<{
45
+ * [K in keyof RT]: JsonSafe<{
46
+ * error?: string;
47
+ * reply: ResponseTo<RT[K]>;
48
+ * }>;
49
+ * }>}
50
+ */
51
+
32
52
  /**
33
53
  * @typedef {{
34
54
  * system: ScopedBridgeManager<'vlocalchain'>;
@@ -49,7 +69,7 @@ export const LocalChainAccountI = M.interface('LocalChainAccount', {
49
69
  getAddress: M.callWhen().returns(Vow$(M.string())),
50
70
  getBalance: M.callWhen(BrandShape).returns(Vow$(AmountShape)),
51
71
  deposit: M.callWhen(PaymentShape)
52
- .optional(M.pattern())
72
+ .optional(AmountPatternShape)
53
73
  .returns(Vow$(AmountShape)),
54
74
  withdraw: M.callWhen(AmountShape).returns(Vow$(PaymentShape)),
55
75
  executeTx: M.callWhen(M.arrayOf(M.record())).returns(
@@ -115,12 +135,15 @@ export const prepareLocalChainAccountKit = (zone, { watch }) =>
115
135
  const purse = E(bank).getPurse(brand);
116
136
  return E(purse).getCurrentAmount();
117
137
  },
138
+
139
+ // TODO The payment parameter type below should be Payment<'nat'>.
140
+ // https://github.com/Agoric/agoric-sdk/issues/9828
118
141
  /**
119
142
  * Deposit a payment into the bank purse that matches the alleged brand.
120
143
  * This is safe, since even if the payment lies about its brand, ERTP
121
144
  * will reject spoofed payment objects when depositing into a purse.
122
145
  *
123
- * @param {Payment<'nat'>} payment
146
+ * @param {ERef<Payment<'nat'>>} payment
124
147
  * @param {Pattern} [optAmountShape] throws if the Amount of the Payment
125
148
  * does not match the provided Pattern
126
149
  * @returns {PromiseVow<Amount<'nat'>>}
@@ -148,10 +171,14 @@ export const prepareLocalChainAccountKit = (zone, { watch }) =>
148
171
  return E(purse).withdraw(amount);
149
172
  },
150
173
  /**
151
- * Execute a batch of messages in order as a single atomic transaction
152
- * and return the responses. If any of the messages fails, the entire
153
- * batch will be rolled back. Use `typedJson()` on the arguments to get
154
- * typed return values.
174
+ * Execute a batch of messages on the local chain. Note in particular,
175
+ * that for IBC `MsgTransfer`, execution only queues a packet for the
176
+ * local chain's IBC stack, and returns a `MsgTransferResponse`
177
+ * immediately, not waiting for the confirmation on the other chain.
178
+ *
179
+ * Messages are executed in order as a single atomic transaction and
180
+ * returns the responses. If any of the messages fails, the entire batch
181
+ * will be rolled back on the local chain.
155
182
  *
156
183
  * @template {TypedJson[]} MT messages tuple (use const with multiple
157
184
  * elements or it will be a mixed array)
@@ -159,6 +186,9 @@ export const prepareLocalChainAccountKit = (zone, { watch }) =>
159
186
  * @returns {PromiseVowOfTupleMappedToGenerics<{
160
187
  * [K in keyof MT]: JsonSafe<ResponseTo<MT[K]>>;
161
188
  * }>}
189
+ *
190
+ * @see {typedJson} which can be used on arguments to get typed return
191
+ * values.
162
192
  */
163
193
  async executeTx(messages) {
164
194
  const { address, system } = this.state;
@@ -257,20 +287,7 @@ const prepareLocalChain = (zone, makeAccountKit, { watch }) => {
257
287
  this.facets.extractFirstQueryResultWatcher,
258
288
  );
259
289
  },
260
- /**
261
- * Send a batch of query requests to the local chain. Unless there is a
262
- * system error, will return all results to indicate their success or
263
- * failure.
264
- *
265
- * @template {import('@agoric/cosmic-proto').TypedJson[]} RT
266
- * @param {RT} requests
267
- * @returns {PromiseVowOfTupleMappedToGenerics<{
268
- * [K in keyof RT]: JsonSafe<{
269
- * error?: string;
270
- * reply: ResponseTo<RT[K]>;
271
- * }>;
272
- * }>}
273
- */
290
+ /** @type {QueryManyFn} */
274
291
  async queryMany(requests) {
275
292
  const { system } = this.state;
276
293
  return E(system).toBridge({
@@ -1 +1 @@
1
- {"version":3,"file":"nameHub.d.ts","sourceRoot":"","sources":["nameHub.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA8CO,4CADK,OAAO,cAAc,EAAE,IAAI,eA4B1B,OAAO,YAAY,EAAE,SAAS,WAC9B,MAAM,0EAalB;AA4CM,wCAFI,OAAO,cAAc,EAAE,IAAI,SAcnB,OAAO,YAAY,EAAE,UAAU,CA0NjD;AAED;;;;;GAKG;AACH,mCAlOmB,OAAO,YAAY,EAAE,UAAU,CAkOc;2BAvRlD;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE"}
1
+ {"version":3,"file":"nameHub.d.ts","sourceRoot":"","sources":["nameHub.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA4CO,4CADK,OAAO,cAAc,EAAE,IAAI,eA4B1B,OAAO,YAAY,EAAE,SAAS,WAC9B,MAAM,0EAalB;AA4CM,wCAFI,OAAO,cAAc,EAAE,IAAI,SAcnB,OAAO,YAAY,EAAE,UAAU,CA0NjD;AAED;;;;;GAKG;AACH,mCAlOmB,OAAO,YAAY,EAAE,UAAU,CAkOc;2BAvRlD;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE"}
package/src/nameHub.js CHANGED
@@ -1,4 +1,4 @@
1
- import { assert, NonNullish } from '@agoric/assert';
1
+ import { assert, Fail, q } from '@endo/errors';
2
2
  import { E } from '@endo/far';
3
3
  import { makePromiseKit } from '@endo/promise-kit';
4
4
  import { M, getInterfaceGuardPayload } from '@endo/patterns';
@@ -9,9 +9,7 @@ import {
9
9
  prepareGuardedAttenuator,
10
10
  } from '@agoric/internal/src/callback.js';
11
11
  import { makeHeapZone } from '@agoric/zone';
12
- import { deeplyFulfilledObject } from '@agoric/internal';
13
-
14
- const { Fail, quote: q } = assert;
12
+ import { deeplyFulfilledObject, NonNullish } from '@agoric/internal';
15
13
 
16
14
  const KeyShape = M.string();
17
15
  const PathShape = M.arrayOf(KeyShape);
@@ -1 +1 @@
1
- {"version":3,"file":"priceAuthorityRegistry.d.ts","sourceRoot":"","sources":["priceAuthorityRegistry.js"],"names":[],"mappings":"AAiDO,uDAHI,OAAO,kBAAkB,EAAE,OAAO,GAChC,sBAAsB,CA4KlC;;YAtMa,MAAM,IAAI;;;;;;4BAKV,CACb,EAAM,EAAE,IAAI,CAAC,cAAc,CAAC,EAC5B,OAAW,EAAE,KAAK,EAClB,QAAY,EAAE,KAAK,EACnB,KAAS,CAAC,EAAE,OAAO,KACZ,OAAO,CAAC,OAAO,CAAC;;;;;;;;oBAQV,cAAc;gBACd,2BAA2B;;oCA1BgD,4BAA4B"}
1
+ {"version":3,"file":"priceAuthorityRegistry.d.ts","sourceRoot":"","sources":["priceAuthorityRegistry.js"],"names":[],"mappings":"AAiDO,uDAHI,OAAO,kBAAkB,EAAE,OAAO,GAChC,sBAAsB,CA4KlC;;YAtMa,MAAM,IAAI;;;;;;4BAKV,CACb,EAAM,EAAE,IAAI,CAAC,cAAc,CAAC,EAC5B,OAAW,EAAE,KAAK,EAClB,QAAY,EAAE,KAAK,EACnB,KAAS,CAAC,EAAE,OAAO,KACZ,OAAO,CAAC,OAAO,CAAC;;;;;;;;oBAQV,cAAc;gBACd,2BAA2B;;oCAxBgD,4BAA4B"}
@@ -1,3 +1,7 @@
1
+ import { Fail } from '@endo/errors';
2
+ import { E } from '@endo/far';
3
+ import { Far } from '@endo/marshal';
4
+
1
5
  import { BrandShape } from '@agoric/ertp';
2
6
  import {
3
7
  M,
@@ -6,8 +10,6 @@ import {
6
10
  provideDurableMapStore,
7
11
  } from '@agoric/vat-data';
8
12
  import { provideLazy } from '@agoric/store';
9
- import { E } from '@endo/far';
10
- import { Far } from '@endo/marshal';
11
13
  import { PriceAuthorityI } from '@agoric/zoe/src/contractSupport/priceAuthority.js';
12
14
 
13
15
  /**
@@ -15,8 +17,6 @@ import { PriceAuthorityI } from '@agoric/zoe/src/contractSupport/priceAuthority.
15
17
  * @import {MutableQuote, PriceAuthority, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
16
18
  */
17
19
 
18
- const { Fail } = assert;
19
-
20
20
  /**
21
21
  * @typedef {object} Deleter
22
22
  * @property {() => void} delete
@@ -1,6 +1,5 @@
1
1
  export function setupLocalChainVat({ consume: { loadCriticalVat, bridgeManager: bridgeManagerP, localchainBridgeManager: localchainBridgeManagerP, bankManager, transferMiddleware, }, produce: { localchainVat, localchain, localchainBridgeManager }, }: BootstrapPowers & {
2
2
  consume: {
3
- loadCriticalVat: VatLoader<any>;
4
3
  bridgeManager: import("../types").BridgeManager;
5
4
  localchainBridgeManager: import("../types").ScopedBridgeManager<"vlocalchain">;
6
5
  bankManager: Promise<import("../vat-bank.js").BankManager>;
@@ -1 +1 @@
1
- {"version":3,"file":"localchain-proposal.d.ts","sourceRoot":"","sources":["localchain-proposal.js"],"names":[],"mappings":"AA0BO,2PArBI,eAAe,GAAG;IAC5B,OAAW,EAAE;QACb,eAAqB,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;QACtC,aAAmB,EAAE,OAAO,UAAU,EAAE,aAAa,CAAC;QACtD,uBAA6B,EAAE,OAAO,UAAU,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;QACrF,WAAiB,EAAE,OAAO,CAAC,OAAO,gBAAgB,EAAE,WAAW,CAAC,CAAC;QACjE,kBAAwB,EAAE,OAAO,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;KAC1E,CAAC;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AE;QACb,UAAgB,EAAE,OAAO,kBAAkB,EAAE,UAAU,CAAC;KACnD,CAAC;CACH,YACO,MAAM,iBAOhB;AAEM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BL;6BAzGW;IACZ,UAAc,EAAE,IAAI,CAAC,OAAO,sBAAsB,EAAE,aAAa,CAAC,CAAC;CAChE"}
@@ -1,11 +1,11 @@
1
1
  // @ts-check
2
2
  import { E } from '@endo/far';
3
3
  import { BridgeId as BRIDGE_ID } from '@agoric/internal';
4
+ import { makeScopedBridge } from '../bridge.js';
4
5
 
5
6
  /**
6
7
  * @param {BootstrapPowers & {
7
8
  * consume: {
8
- * loadCriticalVat: VatLoader<any>;
9
9
  * bridgeManager: import('../types').BridgeManager;
10
10
  * localchainBridgeManager: import('../types').ScopedBridgeManager<'vlocalchain'>;
11
11
  * bankManager: Promise<import('../vat-bank.js').BankManager>;
@@ -58,9 +58,10 @@ export const setupLocalChainVat = async (
58
58
  /** @type {import('../types').ScopedBridgeManager<'vlocalchain'>} */
59
59
  let scopedManager;
60
60
  try {
61
- /** @type {import('../types.js').ScopedBridgeManager<'vlocalchain'>} */
62
- // @ts-expect-error XXX EProxy
63
- scopedManager = await E(bridgeManager).register(BRIDGE_ID.VLOCALCHAIN);
61
+ scopedManager = await makeScopedBridge(
62
+ bridgeManager,
63
+ BRIDGE_ID.VLOCALCHAIN,
64
+ );
64
65
  localchainBridgeManager.reset();
65
66
  localchainBridgeManager.resolve(scopedManager);
66
67
  } catch (e) {
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
  import { heapVowE as E } from '@agoric/vow/vat.js';
3
- import { typedJson } from '@agoric/cosmic-proto/vatsafe';
3
+ import { typedJson } from '@agoric/cosmic-proto';
4
4
 
5
5
  /**
6
6
  * @param {BootstrapPowers & {
@@ -20,7 +20,7 @@ export const testLocalChain = async (
20
20
  let node = await chainStorage;
21
21
  if (!node) {
22
22
  console.error('testLocalChain no chainStorage');
23
- throw new Error('no chainStorage');
23
+ throw Error('no chainStorage');
24
24
  }
25
25
 
26
26
  let result;
@@ -58,7 +58,7 @@ export const testLocalChain = async (
58
58
  const emptyQuery = await E(localchain).queryMany([]);
59
59
  console.info('emptyQuery', emptyQuery);
60
60
  if (emptyQuery.length !== 0) {
61
- throw new Error('emptyQuery results should be empty');
61
+ throw Error('emptyQuery results should be empty');
62
62
  }
63
63
 
64
64
  result = { success: true };
@@ -1,8 +1,5 @@
1
1
  export function registerNetworkProtocols(vats: SoloVats | NetVats, dibcBridgeManager?: globalThis.ERef<import("../types.js").ScopedBridgeManager<"dibc">> | undefined): Promise<void>;
2
2
  export function setupNetworkProtocols({ consume: { client, loadCriticalVat, bridgeManager: bridgeManagerP, provisioning, vatUpgradeInfo: vatUpgradeInfoP, }, produce: { portAllocator, vatUpgradeInfo: produceVatUpgradeInfo }, }: BootstrapPowers & {
3
- consume: {
4
- loadCriticalVat: VatLoader<any>;
5
- };
6
3
  produce: {
7
4
  portAllocator: Producer<any>;
8
5
  };
@@ -38,23 +35,6 @@ export function getManifestForNetwork(_powers: any, { networkRef, ibcRef }: {
38
35
  ibcRef: any;
39
36
  };
40
37
  };
41
- /**
42
- * Create the network and IBC vats; produce `portAllocator` in the core /
43
- * bootstrap space.
44
- *
45
- * The `portAllocator` is CLOSELY HELD in the core space, where later, we claim
46
- * ports using `E(portAllocator).allocateCustomIBCPort`, for example.
47
- *
48
- * Contracts are expected to use the services of the network and IBC vats by way
49
- * of such ports.
50
- *
51
- * Testing facilities include:
52
- *
53
- * - loopback ports: `E(portAllocator).allocateCustomLocalPort()`
54
- * - an echo port: `E(portAllocator).allocateCustomIBCPort("echo")`
55
- * - echo port addrees: /ibc-port/custom-echo
56
- */
57
- export type VatLoader2 = ((name: "network") => NetworkVat) & ((name: "ibc") => IBCVat);
58
38
  /**
59
39
  * Create the network and IBC vats; produce `portAllocator` in the core /
60
40
  * bootstrap space.
@@ -1 +1 @@
1
- {"version":3,"file":"network-proposal.d.ts","sourceRoot":"","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