@agoric/internal 0.3.3-other-dev-3eb1a1d.0 → 0.3.3-other-dev-d15096d.0.d15096d

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 (111) hide show
  1. package/README.md +1 -4
  2. package/package.json +29 -23
  3. package/src/action-types.d.ts +2 -1
  4. package/src/action-types.d.ts.map +1 -1
  5. package/src/action-types.js +4 -4
  6. package/src/batched-deliver.d.ts +6 -2
  7. package/src/batched-deliver.d.ts.map +1 -1
  8. package/src/batched-deliver.js +7 -2
  9. package/src/callback.d.ts +10 -12
  10. package/src/callback.d.ts.map +1 -1
  11. package/src/callback.js +23 -16
  12. package/src/chain-storage-paths.d.ts.map +1 -1
  13. package/src/chain-utils.d.ts +3 -1
  14. package/src/chain-utils.d.ts.map +1 -1
  15. package/src/chain-utils.js +6 -1
  16. package/src/cli-utils.d.ts +2 -0
  17. package/src/cli-utils.d.ts.map +1 -0
  18. package/src/cli-utils.js +21 -0
  19. package/src/config.d.ts +21 -4
  20. package/src/config.d.ts.map +1 -1
  21. package/src/config.js +25 -2
  22. package/src/debug.d.ts +4 -1
  23. package/src/debug.d.ts.map +1 -1
  24. package/src/debug.js +26 -13
  25. package/src/errors.d.ts +1 -1
  26. package/src/errors.d.ts.map +1 -1
  27. package/src/hex.d.ts +15 -0
  28. package/src/hex.d.ts.map +1 -0
  29. package/src/hex.js +105 -0
  30. package/src/index.d.ts +5 -3
  31. package/src/index.js +13 -4
  32. package/src/js-utils.d.ts +38 -1
  33. package/src/js-utils.d.ts.map +1 -1
  34. package/src/js-utils.js +184 -14
  35. package/src/lib-chainStorage.d.ts +45 -32
  36. package/src/lib-chainStorage.d.ts.map +1 -1
  37. package/src/lib-chainStorage.js +24 -32
  38. package/src/lib-nodejs/ava-unhandled-rejection.d.ts +13 -0
  39. package/src/lib-nodejs/ava-unhandled-rejection.d.ts.map +1 -0
  40. package/src/lib-nodejs/ava-unhandled-rejection.js +66 -0
  41. package/src/lib-nodejs/spawnSubprocessWorker.d.ts +0 -2
  42. package/src/lib-nodejs/spawnSubprocessWorker.d.ts.map +1 -1
  43. package/src/lib-nodejs/spawnSubprocessWorker.js +5 -3
  44. package/src/lib-nodejs/waitUntilQuiescent.d.ts +3 -0
  45. package/src/lib-nodejs/waitUntilQuiescent.d.ts.map +1 -1
  46. package/src/lib-nodejs/waitUntilQuiescent.js +5 -1
  47. package/src/marshal/board-client-utils.d.ts +19 -0
  48. package/src/marshal/board-client-utils.d.ts.map +1 -0
  49. package/src/{marshal.js → marshal/board-client-utils.js} +30 -36
  50. package/src/marshal/cap-data.d.ts +3 -0
  51. package/src/marshal/cap-data.d.ts.map +1 -0
  52. package/src/marshal/cap-data.js +20 -0
  53. package/src/marshal/inaccessible-val.d.ts +2 -0
  54. package/src/marshal/inaccessible-val.d.ts.map +1 -0
  55. package/src/marshal/inaccessible-val.js +15 -0
  56. package/src/marshal/pure-data.d.ts +8 -0
  57. package/src/marshal/pure-data.d.ts.map +1 -0
  58. package/src/marshal/pure-data.js +14 -0
  59. package/src/marshal/wrap-marshaller.d.ts +33 -0
  60. package/src/marshal/wrap-marshaller.d.ts.map +1 -0
  61. package/src/marshal/wrap-marshaller.js +439 -0
  62. package/src/method-tools.d.ts.map +1 -1
  63. package/src/method-tools.js +8 -50
  64. package/src/metrics.d.ts +183 -0
  65. package/src/metrics.d.ts.map +1 -0
  66. package/src/metrics.js +476 -0
  67. package/src/module-utils.d.ts +2 -0
  68. package/src/module-utils.d.ts.map +1 -0
  69. package/src/module-utils.js +27 -0
  70. package/src/natural-sort.d.ts +2 -0
  71. package/src/natural-sort.d.ts.map +1 -0
  72. package/src/natural-sort.js +83 -0
  73. package/src/netstring.d.ts +2 -2
  74. package/src/netstring.d.ts.map +1 -1
  75. package/src/netstring.js +1 -0
  76. package/src/node/buffer-line-transform.d.ts +12 -7
  77. package/src/node/buffer-line-transform.d.ts.map +1 -1
  78. package/src/node/buffer-line-transform.js +8 -4
  79. package/src/node/fs-stream.d.ts +4 -1
  80. package/src/node/fs-stream.d.ts.map +1 -1
  81. package/src/node/fs-stream.js +28 -27
  82. package/src/node/shutdown.d.ts.map +1 -1
  83. package/src/node/shutdown.js +2 -0
  84. package/src/priority-senders.d.ts +3 -1
  85. package/src/priority-senders.d.ts.map +1 -1
  86. package/src/priority-senders.js +7 -2
  87. package/src/queue.d.ts +1 -1
  88. package/src/queue.d.ts.map +1 -1
  89. package/src/ses-utils.d.ts +24 -5
  90. package/src/ses-utils.d.ts.map +1 -1
  91. package/src/ses-utils.js +189 -15
  92. package/src/storage-test-utils.d.ts +25 -7
  93. package/src/storage-test-utils.d.ts.map +1 -1
  94. package/src/storage-test-utils.js +141 -22
  95. package/src/tagged.d.ts +4 -1
  96. package/src/testing-utils.js +1 -1
  97. package/src/tmpDir.d.ts +2 -0
  98. package/src/tmpDir.d.ts.map +1 -0
  99. package/src/tmpDir.js +17 -0
  100. package/src/tokens.d.ts.map +1 -1
  101. package/src/typeGuards.d.ts +19 -0
  102. package/src/typeGuards.d.ts.map +1 -1
  103. package/src/typeGuards.js +16 -0
  104. package/src/types.d.ts +30 -17
  105. package/src/types.d.ts.map +1 -1
  106. package/src/types.ts +43 -18
  107. package/src/work-pool.d.ts +13 -0
  108. package/src/work-pool.d.ts.map +1 -0
  109. package/src/work-pool.js +233 -0
  110. package/src/marshal.d.ts +0 -20
  111. package/src/marshal.d.ts.map +0 -1
package/README.md CHANGED
@@ -7,6 +7,7 @@ This package contains code that is required by agoric-sdk and not meant to be im
7
7
  Like all `@agoric` packages it follows Semantic Versioning. Unlike the others, it will never have a stable API. In terms of [SemVer spec item 4](https://semver.org/#spec-item-4), it will never reach 1.0:
8
8
  > Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.
9
9
 
10
+ To keep down the size of [@endo/bundle-source](https://github.com/endojs/endo/tree/master/packages/bundle-source) bundles of source that imports from this package, modules that depend upon it should use deep imports (e.g., `import { defineName } from '@agoric/internal/src/js-utils.js';`) rather than importing the entire module.
10
11
 
11
12
  # Design
12
13
 
@@ -19,7 +20,3 @@ It is meant to be a home for modules that have no dependencies on other packages
19
20
  This package may not take dependencies on any others in this repository.
20
21
 
21
22
  It must never export ambient types.
22
-
23
- It should not be imported by deep imports. Eventually this will be enforced by [`exports`](https://nodejs.org/api/packages.html#exports) but the tooling isn't ready:
24
- - https://github.com/import-js/eslint-plugin-import/issues/1810
25
- - https://github.com/microsoft/TypeScript/issues/33079 (or some related problem with JSdoc types)
package/package.json CHANGED
@@ -1,44 +1,50 @@
1
1
  {
2
2
  "name": "@agoric/internal",
3
- "version": "0.3.3-other-dev-3eb1a1d.0+3eb1a1d",
3
+ "version": "0.3.3-other-dev-d15096d.0.d15096d",
4
4
  "description": "Externally unsupported utilities internal to agoric-sdk",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "engines": {
8
- "node": "^18.12 || ^20.9"
8
+ "node": "^20.9 || ^22.11"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "exit 0",
12
- "prepack": "tsc --build tsconfig.build.json",
13
- "postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
12
+ "prepack": "yarn run -T tsc --build tsconfig.build.json",
13
+ "postpack": "git clean -f '*.d.*ts*' '*.tsbuildinfo'",
14
14
  "test": "ava",
15
15
  "test:nyc": "exit 0",
16
16
  "test:xs": "exit 0",
17
17
  "lint-fix": "yarn lint:eslint --fix",
18
- "lint": "run-s --continue-on-error lint:*",
19
- "lint:eslint": "eslint .",
20
- "lint:types": "tsc"
18
+ "lint": "yarn run -T run-s --continue-on-error 'lint:*'",
19
+ "lint:eslint": "yarn run -T eslint .",
20
+ "lint:types": "yarn run -T tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/base-zone": "0.1.1-other-dev-3eb1a1d.0+3eb1a1d",
24
- "@endo/common": "^1.2.8",
25
- "@endo/errors": "^1.2.8",
26
- "@endo/far": "^1.1.9",
27
- "@endo/init": "^1.1.7",
28
- "@endo/marshal": "^1.6.2",
29
- "@endo/pass-style": "^1.4.7",
30
- "@endo/patterns": "^1.4.7",
31
- "@endo/promise-kit": "^1.1.8",
32
- "@endo/stream": "^1.2.8",
23
+ "@agoric/base-zone": "0.1.1-other-dev-d15096d.0.d15096d",
24
+ "@endo/cache-map": "^1.1.0",
25
+ "@endo/common": "^1.2.13",
26
+ "@endo/compartment-mapper": "^1.6.3",
27
+ "@endo/errors": "^1.2.13",
28
+ "@endo/eventual-send": "^1.3.4",
29
+ "@endo/far": "^1.1.14",
30
+ "@endo/init": "^1.1.12",
31
+ "@endo/marshal": "^1.8.0",
32
+ "@endo/nat": "^5.1.3",
33
+ "@endo/pass-style": "^1.6.3",
34
+ "@endo/patterns": "^1.7.0",
35
+ "@endo/promise-kit": "^1.1.13",
36
+ "@endo/stream": "^1.2.13",
33
37
  "anylogger": "^0.21.0",
34
38
  "jessie.js": "^0.3.4"
35
39
  },
36
40
  "devDependencies": {
37
- "@agoric/cosmic-proto": "0.4.1-other-dev-3eb1a1d.0+3eb1a1d",
38
- "@endo/exo": "^1.5.7",
39
- "@endo/init": "^1.1.7",
41
+ "@agoric/cosmic-proto": "0.4.1-other-dev-d15096d.0.d15096d",
42
+ "@endo/exo": "^1.5.12",
43
+ "@endo/init": "^1.1.12",
44
+ "@endo/ses-ava": "^1.3.2",
45
+ "@fast-check/ava": "^2.0.1",
40
46
  "ava": "^5.3.0",
41
- "tsd": "^0.31.1"
47
+ "tsd": "^0.33.0"
42
48
  },
43
49
  "ava": {
44
50
  "require": [
@@ -58,7 +64,7 @@
58
64
  "access": "public"
59
65
  },
60
66
  "typeCoverage": {
61
- "atLeast": 93.14
67
+ "atLeast": 92.89
62
68
  },
63
- "gitHead": "3eb1a1d2d75b2b4a94807cd3bf759bc9fc531f05"
69
+ "gitHead": "d15096dc4ff8b96e9b6cd11954c20d3a9efbb393"
64
70
  }
@@ -46,6 +46,8 @@ export namespace QueuedActionType {
46
46
  let VBANK_BALANCE_UPDATE: "VBANK_BALANCE_UPDATE";
47
47
  let WALLET_ACTION: "WALLET_ACTION";
48
48
  let WALLET_SPEND_ACTION: "WALLET_SPEND_ACTION";
49
+ let VTRANSFER_IBC_EVENT: "VTRANSFER_IBC_EVENT";
50
+ let KERNEL_UPGRADE_EVENTS: "KERNEL_UPGRADE_EVENTS";
49
51
  }
50
52
  export const CORE_EVAL: "CORE_EVAL";
51
53
  export const DELIVER_INBOUND: "DELIVER_INBOUND";
@@ -55,7 +57,6 @@ export const PLEASE_PROVISION: "PLEASE_PROVISION";
55
57
  export const VBANK_BALANCE_UPDATE: "VBANK_BALANCE_UPDATE";
56
58
  export const WALLET_ACTION: "WALLET_ACTION";
57
59
  export const WALLET_SPEND_ACTION: "WALLET_SPEND_ACTION";
58
- export const CALCULATE_FEES_IN_BEANS: "CALCULATE_FEES_IN_BEANS";
59
60
  export const VTRANSFER_IBC_EVENT: "VTRANSFER_IBC_EVENT";
60
61
  export const KERNEL_UPGRADE_EVENTS: "KERNEL_UPGRADE_EVENTS";
61
62
  //# sourceMappingURL=action-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["action-types.js"],"names":[],"mappings":";;;;;;;;;;;;kCAcU,CAAC,OAAO,mBAAmB,EAAE,MAAM,OAAO,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;+BAiC9D,CAAC,OAAO,gBAAgB,EAAE,MAAM,OAAO,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;AA0BlE,gEAAiE;AACjE,wDAAyD;AACzD,4DAA6D"}
1
+ {"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["action-types.js"],"names":[],"mappings":";;;;;;;;;;;;kCAcU,CAAC,OAAO,mBAAmB,EAAE,MAAM,OAAO,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;+BAiC9D,CAAC,OAAO,gBAAgB,EAAE,MAAM,OAAO,gBAAgB,CAAC"}
@@ -56,6 +56,8 @@ export const QueuedActionType = /** @type {const} */ ({
56
56
  VBANK_BALANCE_UPDATE: 'VBANK_BALANCE_UPDATE',
57
57
  WALLET_ACTION: 'WALLET_ACTION',
58
58
  WALLET_SPEND_ACTION: 'WALLET_SPEND_ACTION',
59
+ VTRANSFER_IBC_EVENT: 'VTRANSFER_IBC_EVENT',
60
+ KERNEL_UPGRADE_EVENTS: 'KERNEL_UPGRADE_EVENTS',
59
61
  });
60
62
  harden(QueuedActionType);
61
63
 
@@ -69,8 +71,6 @@ export const {
69
71
  VBANK_BALANCE_UPDATE,
70
72
  WALLET_ACTION,
71
73
  WALLET_SPEND_ACTION,
74
+ VTRANSFER_IBC_EVENT,
75
+ KERNEL_UPGRADE_EVENTS,
72
76
  } = QueuedActionType;
73
-
74
- export const CALCULATE_FEES_IN_BEANS = 'CALCULATE_FEES_IN_BEANS';
75
- export const VTRANSFER_IBC_EVENT = 'VTRANSFER_IBC_EVENT';
76
- export const KERNEL_UPGRADE_EVENTS = 'KERNEL_UPGRADE_EVENTS';
@@ -4,8 +4,8 @@
4
4
  /**
5
5
  * @param {DeliverMessages} deliver
6
6
  * @param {{
7
- * clearTimeout: import('node:timers').clearTimeout;
8
- * setTimeout: import('node:timers').setTimeout;
7
+ * clearTimeout: clearTimeout;
8
+ * setTimeout: setTimeout;
9
9
  * }} io
10
10
  * @param {number} batchTimeoutMs
11
11
  */
@@ -13,6 +13,10 @@ export function makeBatchedDeliver(deliver: DeliverMessages, { clearTimeout, set
13
13
  clearTimeout: typeof globalThis.clearTimeout;
14
14
  setTimeout: typeof globalThis.setTimeout;
15
15
  }, batchTimeoutMs?: number): (message: unknown[], ackNum: number) => Promise<void>;
16
+ /**
17
+ * @import {clearTimeout} from 'node:timers';
18
+ * @import {setTimeout} from 'node:timers';
19
+ */
16
20
  export const DEFAULT_BATCH_TIMEOUT_MS: 1000;
17
21
  export type DeliverMessages = (message: unknown[], ackNum: number) => Promise<void>;
18
22
  //# sourceMappingURL=batched-deliver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;;;;;GAOG;AACH,4CAPW,eAAe,gCACf;IACN,YAAY,EAAE,8BAAkC,CAAC;IACjD,UAAU,EAAE,4BAAgC,CAAC;CAC9C,mBACO,MAAM,aATM,OAAO,EAAE,UAAU,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAiDjE;AApDD,4CAA6C;8BAGhC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC"}
1
+ {"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"AAUA;;GAEG;AAEH;;;;;;;GAOG;AACH,4CAPW,eAAe,gCACf;IACN,YAAY,iCAAe;IAC3B,UAAU,+BAAa;CACxB,mBACO,MAAM,aATM,OAAO,EAAE,UAAU,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAiDjE;AAzDD;;;GAGG;AAEH,uCAAwC,IAAI,CAAC;8BAGhC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC"}
@@ -1,6 +1,11 @@
1
1
  // @jessie-check
2
2
  // @ts-check
3
3
 
4
+ /**
5
+ * @import {clearTimeout} from 'node:timers';
6
+ * @import {setTimeout} from 'node:timers';
7
+ */
8
+
4
9
  export const DEFAULT_BATCH_TIMEOUT_MS = 1000;
5
10
 
6
11
  /**
@@ -10,8 +15,8 @@ export const DEFAULT_BATCH_TIMEOUT_MS = 1000;
10
15
  /**
11
16
  * @param {DeliverMessages} deliver
12
17
  * @param {{
13
- * clearTimeout: import('node:timers').clearTimeout;
14
- * setTimeout: import('node:timers').setTimeout;
18
+ * clearTimeout: clearTimeout;
19
+ * setTimeout: setTimeout;
15
20
  * }} io
16
21
  * @param {number} batchTimeoutMs
17
22
  */
package/src/callback.d.ts CHANGED
@@ -5,26 +5,24 @@ export function makeFunctionCallback<I extends (...args: any[]) => any, T extend
5
5
  export function makeSyncMethodCallback<I extends (...args: any[]) => any, P extends PropertyKey, T extends { [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>; } = { [x in P]: I; }, B extends any[] = []>(target: T, methodName: P, ...bound: B): SyncCallback<I>;
6
6
  export function makeMethodCallback<I extends (...args: any[]) => any, P extends PropertyKey, T extends ERef<{ [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>; }> = ERef<{ [x in P]: I; }>, B extends any[] = []>(target: T, methodName: P, ...bound: B): Callback<I>;
7
7
  export function isCallback(callback: any): callback is Callback<any>;
8
- export function prepareAttenuator<M extends PropertyKey>(zone: import("@agoric/base-zone").Zone, methodNames: M[], { interfaceGuard, tag }?: {
9
- interfaceGuard?: import("@endo/patterns").InterfaceGuard<{ [K in M]: import("@endo/patterns").MethodGuard; }> | undefined;
8
+ export function prepareAttenuator<M extends PropertyKey>(zone: Zone, methodNames: M[], { interfaceGuard, tag }?: {
9
+ interfaceGuard?: InterfaceGuard<{ [K in M]: MethodGuard; }> | undefined;
10
10
  tag?: string | undefined;
11
11
  }): (args_0: {
12
12
  target?: any;
13
13
  isSync?: boolean | undefined;
14
14
  overrides?: { [K_1 in M]?: Callback<any> | null | undefined; } | undefined;
15
15
  }) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args: any[]) => any; }>;
16
- export function prepareGuardedAttenuator<G extends import("@endo/patterns").InterfaceGuard>(zone: import("@agoric/base-zone").Zone, interfaceGuard: G, opts?: {
16
+ export function prepareGuardedAttenuator<G extends InterfaceGuard>(zone: Zone, interfaceGuard: G, opts?: {
17
17
  tag?: string | undefined;
18
- } | undefined): MakeAttenuator<any>;
19
- export type MakeAttenuator<T extends import("@endo/exo").Methods> = (...args: Parameters<ReturnType<(<M extends PropertyKey>(zone: import("@agoric/base-zone").Zone, methodNames: M[], { interfaceGuard, tag }?: {
20
- interfaceGuard?: import("@endo/patterns").InterfaceGuard<{ [K in M]: import("@endo/patterns").MethodGuard; }> | undefined;
21
- tag?: string | undefined;
22
- }) => (args_0: {
23
- target?: any;
24
- isSync?: boolean | undefined;
25
- overrides?: { [K_1 in M]?: Callback<any> | null | undefined; } | undefined;
26
- }) => import("@endo/exo").Guarded<{ [K_2 in M]: (this: any, ...args: any[]) => any; }>)>>) => import("@endo/exo").Farable<T>;
18
+ }): MakeAttenuator<any>;
19
+ export type MakeAttenuator<T extends Methods> = (...args: Parameters<ReturnType<typeof prepareAttenuator>>) => Farable<T>;
27
20
  import type { SyncCallback } from './types.js';
28
21
  import type { Callback } from './types.js';
29
22
  import type { ERef } from '@endo/far';
23
+ import type { Zone } from '@agoric/base-zone';
24
+ import type { MethodGuard } from '@endo/patterns';
25
+ import type { InterfaceGuard } from '@endo/patterns';
26
+ import type { Methods } from '@endo/exo';
27
+ import type { Farable } from '@endo/exo';
30
28
  //# sourceMappingURL=callback.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["callback.js"],"names":[],"mappings":"AAgDO,yBALgC,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAI,YAC3B,aAAa,CAAC,CAAC,WACf,UAAU,CAAC,CAAC,CAAC,GACX,UAAU,CAAC,CAAC,CAAC,CAQzB;AAWM,sBALgC,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAI,YAC3B,SAAS,CAAC,CAAC,WACX,UAAU,CAAC,CAAC,CAAC,GACX,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAQ3C;AAaM,yCAPgC,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAI,EAC+B,CAAC,SAAzD,CAAE,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC,C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SAAT,GAAG,EAAG,eACT,CAAC,cACD,CAAC,YACD,CAAC,GACC,SAAS,CAAC,CAAC,CAWvB;AAOM,qCAHI,GAAG,GACD,QAAQ,IAAI,SAAS,GAAG,CAAC,CAcrC;AAgBM,kCAVoB,CAAC,SAAd,WAAY,QACf,IAAI,eACJ,CAAC,EAAE,4BAEX;IAEU,cAAc,qBADrB,CAAC;IAGkB,GAAG;CAC3B;aAgEc,GAAG;;;uDArDgB,GAAG,WAAW,GAAG,EAAE,KAAK,GAAG,KAwF5D;AAYM,yCANuB,CAAC,SAAlB,cAAgB,QAClB,IAAI,kBACJ,CAAC,SAET;IAAsB,GAAG;CAAC,GAQT,cAAc,CAAC,GAAG,CAAC,CACtC;2BAvSsB,CAAC,SAAX,OAAS,IACT,CACZ,GAAO,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,KACtD,QAAQ,CAAC,CAAC;kCAdwB,YAAY;8BAAZ,YAAY;0BAP/B,WAAW;0BAGX,mBAAmB;iCAEZ,gBAAgB;oCADb,gBAAgB;6BAHvB,WAAW;6BACX,WAAW"}
package/src/callback.js CHANGED
@@ -1,10 +1,17 @@
1
1
  // @ts-check
2
2
  import { Fail, makeError, q } from '@endo/errors';
3
3
  import { E } from '@endo/far';
4
- import { isObject, isPassableSymbol } from '@endo/marshal';
4
+ import { isPrimitive, isPassableSymbol } from '@endo/pass-style';
5
5
  import { getInterfaceMethodKeys } from '@endo/patterns';
6
6
 
7
- /** @import {ERef} from '@endo/far' */
7
+ /**
8
+ * @import {ERef} from '@endo/far'
9
+ * @import {Methods} from '@endo/exo';
10
+ * @import {Farable} from '@endo/exo';
11
+ * @import {Zone} from '@agoric/base-zone';
12
+ * @import {InterfaceGuard} from '@endo/patterns';
13
+ * @import {MethodGuard} from '@endo/patterns';
14
+ */
8
15
  /** @import {Callback, SyncCallback} from './types.js' */
9
16
 
10
17
  const { fromEntries } = Object;
@@ -16,10 +23,10 @@ const ownKeys =
16
23
  );
17
24
 
18
25
  /**
19
- * @template {import('@endo/exo').Methods} T
26
+ * @template {Methods} T
20
27
  * @typedef {(
21
- * ...args: Parameters<ReturnType<prepareAttenuator>>
22
- * ) => import('@endo/exo').Farable<T>} MakeAttenuator
28
+ * ...args: Parameters<ReturnType<typeof prepareAttenuator>>
29
+ * ) => Farable<T>} MakeAttenuator
23
30
  */
24
31
 
25
32
  /**
@@ -102,7 +109,7 @@ harden(makeSyncFunctionCallback);
102
109
  * @returns {Callback<I>}
103
110
  */
104
111
  export const makeFunctionCallback = (target, ...bound) => {
105
- isObject(target) ||
112
+ !isPrimitive(target) ||
106
113
  Fail`function callback target must be a function presence: ${target}`;
107
114
  /** @type {unknown} */
108
115
  const cb = harden({ target, bound });
@@ -125,7 +132,7 @@ harden(makeFunctionCallback);
125
132
  * @returns {SyncCallback<I>}
126
133
  */
127
134
  export const makeSyncMethodCallback = (target, methodName, ...bound) => {
128
- isObject(target) ||
135
+ !isPrimitive(target) ||
129
136
  Fail`sync method callback target must be an object: ${target}`;
130
137
  typeof methodName === 'string' ||
131
138
  isPassableSymbol(methodName) ||
@@ -151,7 +158,8 @@ harden(makeSyncMethodCallback);
151
158
  * @returns {Callback<I>}
152
159
  */
153
160
  export const makeMethodCallback = (target, methodName, ...bound) => {
154
- isObject(target) || Fail`method callback target must be an object: ${target}`;
161
+ !isPrimitive(target) ||
162
+ Fail`method callback target must be an object: ${target}`;
155
163
  typeof methodName === 'string' ||
156
164
  isPassableSymbol(methodName) ||
157
165
  Fail`method name must be a string or passable symbol: ${methodName}`;
@@ -166,12 +174,12 @@ harden(makeMethodCallback);
166
174
  * @returns {callback is Callback<any>}
167
175
  */
168
176
  export const isCallback = callback => {
169
- if (!isObject(callback)) {
177
+ if (isPrimitive(callback)) {
170
178
  return false;
171
179
  }
172
180
  const { target, methodName, bound } = callback;
173
181
  return (
174
- isObject(target) &&
182
+ !isPrimitive(target) &&
175
183
  (methodName === undefined ||
176
184
  typeof methodName === 'string' ||
177
185
  isPassableSymbol(methodName)) &&
@@ -184,12 +192,11 @@ harden(isCallback);
184
192
  * Prepare an attenuator class whose methods can be redirected via callbacks.
185
193
  *
186
194
  * @template {PropertyKey} M
187
- * @param {import('@agoric/base-zone').Zone} zone The zone in which to allocate
188
- * attenuators.
195
+ * @param {Zone} zone The zone in which to allocate attenuators.
189
196
  * @param {M[]} methodNames Methods to forward.
190
197
  * @param {object} opts
191
- * @param {import('@endo/patterns').InterfaceGuard<{
192
- * [K in M]: import('@endo/patterns').MethodGuard;
198
+ * @param {InterfaceGuard<{
199
+ * [K in M]: MethodGuard;
193
200
  * }>} [opts.interfaceGuard]
194
201
  * An interface guard for the new attenuator.
195
202
  * @param {string} [opts.tag] A tag for the new attenuator exoClass.
@@ -298,8 +305,8 @@ harden(prepareAttenuator);
298
305
  /**
299
306
  * Prepare an attenuator whose methodNames are derived from the interfaceGuard.
300
307
  *
301
- * @template {import('@endo/patterns').InterfaceGuard} G
302
- * @param {import('@agoric/base-zone').Zone} zone
308
+ * @template {InterfaceGuard} G
309
+ * @param {Zone} zone
303
310
  * @param {G} interfaceGuard
304
311
  * @param {object} [opts]
305
312
  * @param {string} [opts.tag]
@@ -1 +1 @@
1
- {"version":3,"file":"chain-storage-paths.d.ts","sourceRoot":"","sources":["chain-storage-paths.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,yCAA0C;AAC1C,sDAAuD;AACvD,0DAA2D;AAC3D,sCAAuC;AACvC,8BAA+B;AAC/B,gCAAiC;AACjC,gCAAiC;AACjC,iCAAkC;AAClC,uCAAwC"}
1
+ {"version":3,"file":"chain-storage-paths.d.ts","sourceRoot":"","sources":["chain-storage-paths.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,2BAA4B,aAAa,CAAC;AAC1C,kCAAmC,mBAAmB,CAAC;AACvD,oCAAqC,qBAAqB,CAAC;AAC3D,yBAA0B,YAAY,CAAC;AACvC,qBAAsB,QAAQ,CAAC;AAC/B,sBAAuB,SAAS,CAAC;AACjC,sBAAuB,SAAS,CAAC;AACjC,qBAAsB,WAAW,CAAC;AAClC,0BAA2B,YAAY,CAAC"}
@@ -6,7 +6,7 @@ export type BlockInfo = {
6
6
  * POSIX Seconds Since the Epoch
7
7
  */
8
8
  blockTime: number;
9
- params: import("@agoric/cosmic-proto/swingset/swingset.js").ParamsSDKType;
9
+ params: JsonSafe<ParamsSDKType>;
10
10
  };
11
11
  /**
12
12
  * cosmosInitAction fields that are subject to consensus. See cosmosInitAction
@@ -21,5 +21,7 @@ export type InitMsg = BlockInfo & {
21
21
  amount: NatString;
22
22
  }[];
23
23
  };
24
+ import type { ParamsSDKType } from '@agoric/cosmic-proto/swingset/swingset.js';
25
+ import type { JsonSafe } from '@agoric/cosmic-proto/json-safe';
24
26
  import * as _ActionType from './action-types.js';
25
27
  //# sourceMappingURL=chain-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chain-utils.d.ts","sourceRoot":"","sources":["chain-utils.js"],"names":[],"mappings":"AAsCO,wCAHI,GAAG,GACD,OAAO,CAoBnB;wBA1Ca,GAAG,MAAM,EAAE;;iBAIX,MAAM;;;;eACN,MAAM;YACN,OAAO,2CAA2C,EAAE,aAAa;;;;;;sBAIlE,SAAS,GAAG;IACpB,IAAI,EAAE,OAAO,WAAW,CAAC,cAAc,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;CACrD;6BAjByB,mBAAmB"}
1
+ {"version":3,"file":"chain-utils.d.ts","sourceRoot":"","sources":["chain-utils.js"],"names":[],"mappings":"AA2CO,wCAHI,GAAG,GACD,OAAO,CAoBnB;wBA/Ca,GAAG,MAAM,EAAE;;iBASX,MAAM;;;;eACN,MAAM;YACN,SAAS,aAAa,CAAC;;;;;;sBAIxB,SAAS,GAAG;IACpB,IAAI,EAAE,OAAO,WAAW,CAAC,cAAc,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;CACrD;mCAjB4B,2CAA2C;8BAChD,gCAAgC;6BAN9B,mBAAmB"}
@@ -14,11 +14,16 @@ import * as _ActionType from './action-types.js';
14
14
 
15
15
  /** @typedef {`${bigint}`} NatString */
16
16
 
17
+ /**
18
+ * @import {ParamsSDKType} from '@agoric/cosmic-proto/swingset/swingset.js'
19
+ * @import {JsonSafe} from '@agoric/cosmic-proto/json-safe'
20
+ */
21
+
17
22
  /**
18
23
  * @typedef {object} BlockInfo
19
24
  * @property {number} blockHeight
20
25
  * @property {number} blockTime POSIX Seconds Since the Epoch
21
- * @property {import('@agoric/cosmic-proto/swingset/swingset.js').ParamsSDKType} params
26
+ * @property {JsonSafe<ParamsSDKType>} params
22
27
  */
23
28
 
24
29
  /**
@@ -0,0 +1,2 @@
1
+ export function toCLIOptions(record: Record<string, undefined | boolean | string | string[]>): string[];
2
+ //# sourceMappingURL=cli-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-utils.d.ts","sourceRoot":"","sources":["cli-utils.js"],"names":[],"mappings":"AAUO,qCAJI,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,GAErD,MAAM,EAAE,CAYjB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Convert a string-keyed object into an array of CLI options, using each key as
3
+ * the name of a GNU-style long option `--${key}`, ignoring each key with an
4
+ * undefined value and converting boolean values into no-argument `--${key}` or
5
+ * `--no-${key}` options.
6
+ *
7
+ * @param {Record<string, undefined | boolean | string | string[]>} record -
8
+ * e.g. { color: 'blue' }
9
+ * @returns {string[]} - e.g. ['--color', 'blue']
10
+ */
11
+ export const toCLIOptions = record =>
12
+ Object.entries(record).flatMap(([key, value]) => {
13
+ if (value === undefined) return [];
14
+ if (value === true) return [`--${key}`];
15
+ if (value === false) return [`--no-${key}`];
16
+ if (Array.isArray(value)) {
17
+ // Represent as a repeated option.
18
+ return value.flatMap(v => [`--${key}`, v]);
19
+ }
20
+ return [`--${key}`, value];
21
+ });
package/src/config.d.ts CHANGED
@@ -14,10 +14,8 @@ export namespace BridgeId {
14
14
  let WALLET: "wallet";
15
15
  }
16
16
  export namespace CosmosInitKeyToBridgeId {
17
- import vbankPort = BANK;
18
- export { vbankPort };
19
- import vibcPort = DIBC;
20
- export { vibcPort };
17
+ let vbankPort: "bank";
18
+ let vibcPort: "dibc";
21
19
  }
22
20
  export namespace WalletName {
23
21
  let depositFacet: "depositFacet";
@@ -34,4 +32,23 @@ export namespace VBankAccount {
34
32
  export { address_1 as address };
35
33
  }
36
34
  }
35
+ /**
36
+ * ClusterName specifies a collection of networks. The specific networks
37
+ * associated with a particular name may vary from context to context, and may
38
+ * also overlap (e.g. a "local" cluster may connect to the same remote networks
39
+ * as a "testnet" cluster), but this type nevertheless supports cross-package
40
+ * coordination where the values associated with static labels are subject to
41
+ * choice of cluster. Some examples:
42
+ *
43
+ * - the chain ID for a static label like "Agoric" or "Ethereum"
44
+ * - the cryptographic hash for a static label like "BLD" or "USDC"
45
+ * - the URL for a service like "Agoric RPC" or "Axelar" or "Spectrum"
46
+ *
47
+ * "mainnet" should always include the Agoric network described by
48
+ * https://main.agoric.net/network-config rather than some other alternative.
49
+ *
50
+ * XXX This actually belongs somewhere else, possibly with refactoring.
51
+ * https://github.com/Agoric/agoric-sdk/pull/12185#discussion_r2500123226
52
+ */
53
+ export type ClusterName = "local" | "testnet" | "mainnet";
37
54
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.js"],"names":[],"mappings":";;;uBAkBU,CAAC,OAAO,QAAQ,EAAE,MAAM,OAAO,QAAQ,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.js"],"names":[],"mappings":";;;uBAuCU,CAAC,OAAO,QAAQ,EAAE,MAAM,OAAO,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BANrC,OAAO,GAAG,SAAS,GAAG,SAAS"}
package/src/config.js CHANGED
@@ -13,6 +13,27 @@
13
13
  * package are placed here.
14
14
  */
15
15
 
16
+ /**
17
+ * ClusterName specifies a collection of networks. The specific networks
18
+ * associated with a particular name may vary from context to context, and may
19
+ * also overlap (e.g. a "local" cluster may connect to the same remote networks
20
+ * as a "testnet" cluster), but this type nevertheless supports cross-package
21
+ * coordination where the values associated with static labels are subject to
22
+ * choice of cluster. Some examples:
23
+ *
24
+ * - the chain ID for a static label like "Agoric" or "Ethereum"
25
+ * - the cryptographic hash for a static label like "BLD" or "USDC"
26
+ * - the URL for a service like "Agoric RPC" or "Axelar" or "Spectrum"
27
+ *
28
+ * "mainnet" should always include the Agoric network described by
29
+ * https://main.agoric.net/network-config rather than some other alternative.
30
+ *
31
+ * XXX This actually belongs somewhere else, possibly with refactoring.
32
+ * https://github.com/Agoric/agoric-sdk/pull/12185#discussion_r2500123226
33
+ *
34
+ * @typedef {'local' | 'testnet' | 'mainnet'} ClusterName
35
+ */
36
+
16
37
  /**
17
38
  * Event source ids used by the bridge device.
18
39
  *
@@ -31,10 +52,12 @@ export const BridgeId = /** @type {const} */ ({
31
52
  });
32
53
  harden(BridgeId);
33
54
 
55
+ /** @satisfies {Record<string, BridgeId>} */
34
56
  export const CosmosInitKeyToBridgeId = {
35
- vbankPort: BridgeId.BANK,
36
- vibcPort: BridgeId.DIBC,
57
+ vbankPort: 'bank',
58
+ vibcPort: 'dibc',
37
59
  };
60
+ harden(CosmosInitKeyToBridgeId);
38
61
 
39
62
  export const WalletName = /** @type {const} */ ({
40
63
  depositFacet: 'depositFacet',
package/src/debug.d.ts CHANGED
@@ -1,2 +1,5 @@
1
- export function makeTracer(name: string, enable?: boolean | "verbose"): (..._args: any[]) => void;
1
+ export function makeTracer(label: string, enable?: boolean | "verbose"): ((..._args: any[]) => void) & {
2
+ sub: (subLabel: any, subEnable?: boolean | "verbose") => ((..._args: any[]) => void) & /*elided*/ any;
3
+ };
4
+ export type TraceLogger = ReturnType<typeof makeTracer>;
2
5
  //# sourceMappingURL=debug.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["debug.js"],"names":[],"mappings":"AAQO,iCAHI,MAAM,WACN,OAAO,GAAG,SAAS,6BAiC7B"}
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["debug.js"],"names":[],"mappings":"AAUO,kCAHI,MAAM,WACN,OAAO,GAAG,SAAS;;EAwC7B;0BAIY,UAAU,CAAC,OAAO,UAAU,CAAC"}
package/src/debug.js CHANGED
@@ -1,41 +1,54 @@
1
1
  // @jessie-check
2
2
 
3
+ // See https://github.com/Agoric/agoric-sdk/issues/11844
4
+ // See https://github.com/Agoric/agoric-sdk/issues/11845
3
5
  let debugInstance = 1;
4
6
 
5
7
  /**
6
- * @param {string} name
8
+ * @param {string} label
7
9
  * @param {boolean | 'verbose'} enable
8
10
  */
9
- export const makeTracer = (name, enable = true) => {
11
+ export const makeTracer = (label, enable = true) => {
12
+ const sub = (subLabel, subEnable = enable) =>
13
+ makeTracer(`${label}.${subLabel}`, subEnable);
14
+ const key = `----- ${label},${debugInstance} `;
10
15
  debugInstance += 1;
11
- let debugCount = 1;
12
- const key = `----- ${name}.${debugInstance} `;
13
16
  // the cases below define a named variable to provide better debug info
14
17
  switch (enable) {
15
18
  case false: {
16
19
  const logDisabled = (..._args) => {};
17
- return logDisabled;
20
+ return harden(Object.assign(logDisabled, { sub }));
18
21
  }
19
22
  case 'verbose': {
20
23
  const infoTick = (optLog, ...args) => {
21
- if (optLog.log) {
22
- console.info(key, (debugCount += 1), ...args);
24
+ // XXX Sniff tests such as this are inherently unreliable and smell bad.
25
+ // Even aside from the security hazard of
26
+ // https://github.com/Agoric/agoric-sdk/issues/11845
27
+ // an object intended as a normal logging argument may accidentally
28
+ // pass this sniff test, causing confusion.
29
+ if (typeof optLog?.log === 'function') {
30
+ console.info(key, ...args);
23
31
  } else {
24
- console.info(key, (debugCount += 1), optLog, ...args);
32
+ console.info(key, optLog, ...args);
25
33
  }
26
34
  };
27
- return infoTick;
35
+ return harden(Object.assign(infoTick, { sub }));
28
36
  }
29
37
  default: {
30
38
  const debugTick = (optLog, ...args) => {
31
- if (optLog.log) {
32
- optLog.log(key, (debugCount += 1), ...args);
39
+ // Another unreliable sniff test like the one above
40
+ if (typeof optLog?.log === 'function') {
41
+ optLog.log(key, ...args);
33
42
  } else {
34
- console.info(key, (debugCount += 1), optLog, ...args);
43
+ console.info(key, optLog, ...args);
35
44
  }
36
45
  };
37
- return debugTick;
46
+ return harden(Object.assign(debugTick, { sub }));
38
47
  }
39
48
  }
40
49
  };
41
50
  harden(makeTracer);
51
+
52
+ /**
53
+ * @typedef {ReturnType<typeof makeTracer>} TraceLogger
54
+ */
package/src/errors.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export function NonNullish<T>(val: T | null | undefined, optDetails?: string | undefined): T;
1
+ export function NonNullish<T>(val: T | null | undefined, optDetails?: string): T;
2
2
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["errors.js"],"names":[],"mappings":"AAQO,2BALM,CAAC,OACH,CAAC,GAAG,IAAI,GAAG,SAAS,oCAElB,CAAC,CAQb"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["errors.js"],"names":[],"mappings":"AAQO,2BALM,CAAC,OACH,CAAC,GAAG,IAAI,GAAG,SAAS,eACpB,MAAM,GACJ,CAAC,CAQb"}
package/src/hex.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ export function makePortableHexCodec(): HexCodec;
2
+ export function makeBufferishHexCodec(Bufferish: BufferishConstructor): HexCodec;
3
+ export const encodeHex: (buf: Uint8Array) => string;
4
+ export const decodeHex: (hex: string) => Uint8Array;
5
+ export type HexCodec = {
6
+ encodeHex: (buf: Uint8Array) => string;
7
+ decodeHex: (hex: string) => Uint8Array;
8
+ };
9
+ /**
10
+ * is the portion of the Node.js Buffer API we need for hex conversion.
11
+ */
12
+ export type BufferishConstructor = Pick<BufferConstructor, "from" | "isBuffer"> & {
13
+ prototype: Pick<Buffer, "toString"> & Uint8Array;
14
+ };
15
+ //# sourceMappingURL=hex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hex.d.ts","sourceRoot":"","sources":["hex.js"],"names":[],"mappings":"AAsCO,wCAFM,QAAQ,CAyBpB;AAgBM,iDAJI,oBAAoB,GAElB,QAAQ,CAoBpB;8BA7FmB,UAAU,KAAK,MAAM;8BACrB,MAAM,KAAK,UAAU;;eAD3B,CAAC,GAAG,EAAE,UAAU,KAAK,MAAM;eAC3B,CAAC,GAAG,EAAE,MAAM,KAAK,UAAU;;;;;mCA6D5B,IAAI,CAAC,iBAAiB,EAAE,MAAM,GAAG,UAAU,CAAC,GAAG;IACvD,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,UAAU,CAAC;CAClD"}