@agoric/vats 0.15.2-dev-438955e.0 → 0.15.2-dev-2fa8100.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/vats",
3
- "version": "0.15.2-dev-438955e.0+438955e",
3
+ "version": "0.15.2-dev-2fa8100.0+2fa8100",
4
4
  "description": "Agoric's Vat library",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -22,19 +22,19 @@
22
22
  "author": "Agoric",
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@agoric/cosmic-proto": "0.4.1-dev-438955e.0+438955e",
26
- "@agoric/ertp": "0.16.3-dev-438955e.0+438955e",
27
- "@agoric/governance": "0.10.4-dev-438955e.0+438955e",
28
- "@agoric/internal": "0.3.3-dev-438955e.0+438955e",
29
- "@agoric/network": "0.1.1-dev-438955e.0+438955e",
30
- "@agoric/notifier": "0.6.3-dev-438955e.0+438955e",
31
- "@agoric/store": "0.9.3-dev-438955e.0+438955e",
32
- "@agoric/swingset-vat": "0.32.3-dev-438955e.0+438955e",
33
- "@agoric/time": "0.3.3-dev-438955e.0+438955e",
34
- "@agoric/vat-data": "0.5.3-dev-438955e.0+438955e",
35
- "@agoric/vow": "0.1.1-dev-438955e.0+438955e",
36
- "@agoric/zoe": "0.26.3-dev-438955e.0+438955e",
37
- "@agoric/zone": "0.2.3-dev-438955e.0+438955e",
25
+ "@agoric/cosmic-proto": "0.4.1-dev-2fa8100.0+2fa8100",
26
+ "@agoric/ertp": "0.16.3-dev-2fa8100.0+2fa8100",
27
+ "@agoric/governance": "0.10.4-dev-2fa8100.0+2fa8100",
28
+ "@agoric/internal": "0.3.3-dev-2fa8100.0+2fa8100",
29
+ "@agoric/network": "0.1.1-dev-2fa8100.0+2fa8100",
30
+ "@agoric/notifier": "0.6.3-dev-2fa8100.0+2fa8100",
31
+ "@agoric/store": "0.9.3-dev-2fa8100.0+2fa8100",
32
+ "@agoric/swingset-vat": "0.32.3-dev-2fa8100.0+2fa8100",
33
+ "@agoric/time": "0.3.3-dev-2fa8100.0+2fa8100",
34
+ "@agoric/vat-data": "0.5.3-dev-2fa8100.0+2fa8100",
35
+ "@agoric/vow": "0.1.1-dev-2fa8100.0+2fa8100",
36
+ "@agoric/zoe": "0.26.3-dev-2fa8100.0+2fa8100",
37
+ "@agoric/zone": "0.2.3-dev-2fa8100.0+2fa8100",
38
38
  "@endo/errors": "^1.2.10",
39
39
  "@endo/far": "^1.1.11",
40
40
  "@endo/import-bundle": "^1.4.0",
@@ -47,7 +47,7 @@
47
47
  "jessie.js": "^0.3.4"
48
48
  },
49
49
  "devDependencies": {
50
- "@agoric/swingset-liveslots": "0.10.3-dev-438955e.0+438955e",
50
+ "@agoric/swingset-liveslots": "0.10.3-dev-2fa8100.0+2fa8100",
51
51
  "@endo/bundle-source": "^4.0.0",
52
52
  "@endo/init": "^1.1.9",
53
53
  "ava": "^5.3.0",
@@ -79,5 +79,5 @@
79
79
  "typeCoverage": {
80
80
  "atLeast": 90.49
81
81
  },
82
- "gitHead": "438955ec4d895b3abde3f8fb61bf575df0e26e56"
82
+ "gitHead": "2fa8100b71ce02fe19dbf5b77436d843fb929b71"
83
83
  }
@@ -16,7 +16,7 @@ export const LOCALCHAIN_QUERY_ALL_BALANCES_RESPONSE: {
16
16
  denom: string;
17
17
  }[];
18
18
  export function fakeLocalChainBridgeQueryHandler(message: object): unknown;
19
- export function makeFakeLocalchainBridge(zone: import("@agoric/zone").Zone, onToBridge?: (obj: object) => void, makeAddressFn?: (index: number) => string): ScopedBridgeManager<"vlocalchain">;
19
+ export function makeFakeLocalchainBridge(zone: import("@agoric/zone").Zone, onToBridge?: (obj: object, result: unknown) => void, makeAddressFn?: (index: number) => string): ScopedBridgeManager<"vlocalchain">;
20
20
  export function makeFakeTransferBridge(zone: import("@agoric/zone").Zone, onToBridge?: (obj: any) => void): ScopedBridgeManager<"vtransfer">;
21
21
  export type Balances = {
22
22
  [address: string]: {
@@ -1 +1 @@
1
- {"version":3,"file":"fake-bridge.d.ts","sourceRoot":"","sources":["fake-bridge.js"],"names":[],"mappings":"AAkBA,6EAA6E;AAE7E,6BAA8B,QAAQ,CAAC;AAehC,yCAPI,OAAO,cAAc,EAAE,IAAI,6BAEnC;IAAwB,QAAQ;IACH,UAAU,kBAAtB,IAAI;CACrB,GAAU,oBAAoB,MAAM,CAAC,CA4FvC;AAOM,wCAJI,OAAO,cAAc,EAAE,IAAI,cAC3B,CAAC,GAAG,KAAA,KAAK,IAAI,GACX,oBAAoB,MAAM,CAAC,CAwCvC;AAED,yCAA0C,uBAAuB,CAAC;;;;;AAwB3D,0DALI,MAAM,YACN,MAAM,GACJ,OAAO,CAgDnB;AAED;;;IASE;AAWK,0DAHI,MAAM,GACJ,OAAO,CAsCnB;AAQM,+CALI,OAAO,cAAc,EAAE,IAAI,eAC3B,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,kBACrB,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GACvB,oBAAoB,aAAa,CAAC,CAoD9C;AAOM,6CAJI,OAAO,cAAc,EAAE,IAAI,eAC3B,CAAC,GAAG,KAAA,KAAK,IAAI,GACX,oBAAoB,WAAW,CAAC,CAuC5C;uBA9Xa;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAAE;yCAPX,iBAAiB"}
1
+ {"version":3,"file":"fake-bridge.d.ts","sourceRoot":"","sources":["fake-bridge.js"],"names":[],"mappings":"AAkBA,6EAA6E;AAE7E,6BAA8B,QAAQ,CAAC;AAehC,yCAPI,OAAO,cAAc,EAAE,IAAI,6BAEnC;IAAwB,QAAQ;IACH,UAAU,kBAAtB,IAAI;CACrB,GAAU,oBAAoB,MAAM,CAAC,CA4FvC;AAOM,wCAJI,OAAO,cAAc,EAAE,IAAI,cAC3B,CAAC,GAAG,KAAA,KAAK,IAAI,GACX,oBAAoB,MAAM,CAAC,CAwCvC;AAED,yCAA0C,uBAAuB,CAAC;;;;;AAwB3D,0DALI,MAAM,YACN,MAAM,GACJ,OAAO,CAgDnB;AAED;;;IASE;AAWK,0DAHI,MAAM,GACJ,OAAO,CAsCnB;AASM,+CANI,OAAO,cAAc,EAAE,IAAI,eAC3B,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,kBAEtC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GACvB,oBAAoB,aAAa,CAAC,CA4E9C;AAOM,6CAJI,OAAO,cAAc,EAAE,IAAI,eAC3B,CAAC,GAAG,KAAA,KAAK,IAAI,GACX,oBAAoB,WAAW,CAAC,CAuC5C;uBAvZa;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAAE;yCAPX,iBAAiB"}
@@ -300,46 +300,71 @@ export const fakeLocalChainBridgeQueryHandler = message => {
300
300
 
301
301
  /**
302
302
  * @param {import('@agoric/zone').Zone} zone
303
- * @param {(obj: object) => void} [onToBridge]
303
+ * @param {(obj: object, result: unknown) => void} [onToBridge] Log message and
304
+ * result
304
305
  * @param {(index: number) => string} makeAddressFn
305
306
  * @returns {ScopedBridgeManager<'vlocalchain'>}
306
307
  */
307
308
  export const makeFakeLocalchainBridge = (
308
309
  zone,
309
- onToBridge = () => {},
310
+ onToBridge = (_obj, _result) => {},
310
311
  makeAddressFn = index => `${LOCALCHAIN_DEFAULT_ADDRESS}${index || ''}`,
311
312
  ) => {
312
313
  /** @type {Remote<BridgeHandler>} */
313
314
  let hndlr;
314
315
  let lcaExecuteTxSequence = 0;
315
316
  let accountsCreated = 0;
317
+
316
318
  return zone.exo('Fake Localchain Bridge Manager', undefined, {
317
319
  getBridgeId: () => 'vlocalchain',
318
320
  toBridge: async obj => {
319
- onToBridge(obj);
320
321
  const { method, type, ...params } = obj;
321
322
  trace('toBridge', type, method, params);
323
+ let result;
322
324
  switch (type) {
323
325
  case 'VLOCALCHAIN_ALLOCATE_ADDRESS': {
324
326
  const address = makeAddressFn(accountsCreated);
325
327
  accountsCreated += 1;
326
- return address;
328
+ result = address;
329
+ break;
327
330
  }
328
331
  case 'VLOCALCHAIN_EXECUTE_TX': {
329
- lcaExecuteTxSequence += 1;
330
- return obj.messages.map(message =>
331
- fakeLocalChainBridgeTxMsgHandler(message, lcaExecuteTxSequence),
332
- );
332
+ const results = [];
333
+ for (const message of obj.messages) {
334
+ lcaExecuteTxSequence += 1;
335
+ /** @type {any} */
336
+ const msgResult = fakeLocalChainBridgeTxMsgHandler(
337
+ message,
338
+ lcaExecuteTxSequence,
339
+ );
340
+ // Store the sequence *in* the result object for MsgTransfer
341
+ if (
342
+ message['@type'] === '/ibc.applications.transfer.v1.MsgTransfer'
343
+ ) {
344
+ // Ensure result is an object before assigning sequence
345
+ if (typeof msgResult !== 'object' || msgResult === null) {
346
+ throw new Error(
347
+ `Expected object result for MsgTransfer, got ${typeof msgResult}`,
348
+ );
349
+ }
350
+ msgResult.sequence = lcaExecuteTxSequence;
351
+ }
352
+ results.push(msgResult);
353
+ }
354
+ result = results;
355
+ break;
333
356
  }
334
357
  case 'VLOCALCHAIN_QUERY_MANY': {
335
- return obj.messages.map(message =>
358
+ result = obj.messages.map(message =>
336
359
  fakeLocalChainBridgeQueryHandler(message),
337
360
  );
361
+ break;
338
362
  }
339
363
  default:
340
364
  Fail`unknown type ${type}`;
341
365
  }
342
- return undefined;
366
+ onToBridge(obj, result); // Log the input obj and the computed result
367
+ return result;
343
368
  },
344
369
  fromBridge: async obj => {
345
370
  if (!hndlr) throw Error('no handler!');