@agoric/vats 0.15.2-dev-857e650.0 → 0.15.2-dev-284e2db.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 +20 -20
- package/src/bridge.d.ts.map +1 -1
- package/src/bridge.js +23 -11
- package/src/centralSupply.d.ts.map +1 -1
- package/src/centralSupply.js +3 -3
- package/src/core/basic-behaviors.d.ts.map +1 -1
- package/src/core/basic-behaviors.js +55 -49
- package/src/core/boot-chain.js +3 -3
- package/src/core/boot-sim.js +3 -3
- package/src/core/boot-solo.js +4 -4
- package/src/core/chain-behaviors.d.ts.map +1 -1
- package/src/core/chain-behaviors.js +28 -23
- package/src/core/client-behaviors.d.ts.map +1 -1
- package/src/core/client-behaviors.js +5 -4
- package/src/core/demoIssuers.d.ts +17 -15
- package/src/core/demoIssuers.d.ts.map +1 -1
- package/src/core/demoIssuers.js +34 -34
- package/src/core/lib-boot.d.ts +9 -8
- package/src/core/lib-boot.d.ts.map +1 -1
- package/src/core/lib-boot.js +26 -15
- package/src/core/promise-space.d.ts.map +1 -1
- package/src/core/promise-space.js +14 -14
- package/src/core/startWalletFactory.d.ts +4 -1
- package/src/core/startWalletFactory.d.ts.map +1 -1
- package/src/core/startWalletFactory.js +25 -16
- package/src/core/types.d.ts +19 -278
- package/src/core/types.d.ts.map +1 -1
- package/src/core/types.js +385 -210
- package/src/core/utils.d.ts +4 -2
- package/src/core/utils.d.ts.map +1 -1
- package/src/core/utils.js +30 -28
- package/src/crc.d.ts +2 -6
- package/src/crc.d.ts.map +1 -1
- package/src/crc.js +5 -15
- package/src/ibc.d.ts +5 -5
- package/src/ibc.d.ts.map +1 -1
- package/src/ibc.js +22 -40
- package/src/lib-board.d.ts +48 -49
- package/src/lib-board.d.ts.map +1 -1
- package/src/lib-board.js +32 -39
- package/src/mintHolder.d.ts.map +1 -1
- package/src/mintHolder.js +5 -6
- package/src/nameHub.d.ts.map +1 -1
- package/src/nameHub.js +17 -7
- package/src/proposals/network-proposal.d.ts.map +1 -1
- package/src/proposals/network-proposal.js +13 -10
- package/src/proposals/restart-vats-proposal.d.ts +1 -1
- package/src/proposals/restart-vats-proposal.d.ts.map +1 -1
- package/src/proposals/restart-vats-proposal.js +3 -3
- package/src/provisionPool.d.ts.map +1 -1
- package/src/provisionPool.js +9 -10
- package/src/provisionPoolKit.d.ts +14 -27
- package/src/provisionPoolKit.d.ts.map +1 -1
- package/src/provisionPoolKit.js +26 -29
- package/src/repl.js +1 -1
- package/src/types.d.ts +28 -27
- package/src/types.d.ts.map +1 -1
- package/src/types.js +49 -46
- package/src/vat-bank.d.ts +49 -48
- package/src/vat-bank.d.ts.map +1 -1
- package/src/vat-bank.js +55 -50
- package/src/vat-mints.d.ts +10 -10
- package/src/vat-mints.d.ts.map +1 -1
- package/src/vat-mints.js +6 -6
- package/src/vat-provisioning.d.ts.map +1 -1
- package/src/vat-provisioning.js +11 -6
- package/src/virtual-purse.d.ts +6 -6
- package/src/virtual-purse.d.ts.map +1 -1
- package/src/virtual-purse.js +34 -33
- package/src/walletFlags.js +1 -2
- package/tools/authorityViz.d.ts.map +1 -1
- package/tools/authorityViz.js +34 -25
- package/tools/bank-utils.d.ts +1 -1
- package/tools/bank-utils.d.ts.map +1 -1
- package/tools/bank-utils.js +12 -5
- package/tools/board-utils.d.ts +1 -1
- package/tools/board-utils.d.ts.map +1 -1
- package/tools/board-utils.js +22 -14
- package/tools/boot-test-utils.d.ts.map +1 -1
- package/tools/boot-test-utils.js +7 -9
package/src/core/utils.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* We reserve these keys in name hubs.
|
|
3
3
|
*
|
|
4
|
-
* @type {{
|
|
4
|
+
* @type {{
|
|
5
|
+
* [P in keyof WellKnownName]: { [P2 in WellKnownName[P]]: string };
|
|
6
|
+
* }}
|
|
5
7
|
*/
|
|
6
8
|
export const agoricNamesReserved: {
|
|
7
9
|
issuer: {
|
|
@@ -49,7 +51,7 @@ export const agoricNamesReserved: {
|
|
|
49
51
|
VaultFactory: string;
|
|
50
52
|
};
|
|
51
53
|
};
|
|
52
|
-
/** @type {
|
|
54
|
+
/** @type {FeeIssuerConfig} */
|
|
53
55
|
export const feeIssuerConfig: FeeIssuerConfig;
|
|
54
56
|
export function addRemote(addr: string, { vats: { comms, vattp } }: {
|
|
55
57
|
vats: {
|
package/src/core/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAaA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDG;AAEH,8BAA8B;AAC9B,8BADW,eAAe,CAKxB;AAQK,gCAHI,MAAM,8BACN;IAAE,IAAI,EAAE;QAAE,KAAK,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE,CAAA;CAAE,iBAK5D;AAQM,8DAJkB,OAAO,MAAM,EAAE,OAAO,CAAC,cAClC,OAAO,KACR,OAAO,MAAM,EAAE,OAAO,CAAC,CAG0B;AAWvD,kCALI,IAAI,GAAG,MAAM,GAAG,OAAO,MAAM,EAAE,GAAG,CAAC,YAEnC,OAAO,oCAkCjB;AAQM,sCAJI,IAAI,GAAG,MAAM,GAAG,OAAO,MAAM,EAAE,GAAG,CAAC,aAEnC,OAAO,OAYjB;AAUM;eALI,OAAO;eACP,OAAO,MAAM,EAAE,OAAO,CAAC;cACvB,OAAO,MAAM,EAAE,OAAO,MAAM,EAAE,OAAO,CAAC,CAAC;uBAChC,MAAM,UAAU,OAAO,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO;mBAwBpE;AASM,sDAHI,KAAK,OAAO,UAAU,EAAE,SAAS,CAAC;;;4CAyB5C;AAOM,iDAJI,KAAK,OAAO,UAAU,EAAE,SAAS,CAAC;;;uEAsB5C;AAoBM;;;0BAXI,OAAO,MAAM,EAAE,OAAO,MAAM,EAAE,OAAO,CAAC,CAAC;iBAMhC,OAAO,aAAa,EAAE,OAAO;sBACxB,OAAO,aAAa,EAAE,SAAS;YACzC,eAAe;GAuB3B;AAMM,mDAFI,MAAM;;;EAgBhB;AAaM,kCAVI,KAAK,WAAW,QAAQ,WAAW,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,kBAC/D,OAAO,mBACG,GAAG,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDhC;;;;+BApDY,OAAO,sBAAsB,EAAE,gBAAgB;uBAG/C,SAAS,MAAM,EAAE,gBAAgB,CAAC"}
|
package/src/core/utils.js
CHANGED
|
@@ -14,7 +14,9 @@ const { Fail, quote: q } = assert;
|
|
|
14
14
|
/**
|
|
15
15
|
* We reserve these keys in name hubs.
|
|
16
16
|
*
|
|
17
|
-
* @type {{
|
|
17
|
+
* @type {{
|
|
18
|
+
* [P in keyof WellKnownName]: { [P2 in WellKnownName[P]]: string };
|
|
19
|
+
* }}
|
|
18
20
|
*/
|
|
19
21
|
export const agoricNamesReserved = harden({
|
|
20
22
|
issuer: {
|
|
@@ -74,7 +76,7 @@ export const agoricNamesReserved = harden({
|
|
|
74
76
|
},
|
|
75
77
|
});
|
|
76
78
|
|
|
77
|
-
/** @type {
|
|
79
|
+
/** @type {FeeIssuerConfig} */
|
|
78
80
|
export const feeIssuerConfig = {
|
|
79
81
|
name: Stable.symbol,
|
|
80
82
|
assetKind: Stable.assetKind,
|
|
@@ -85,7 +87,7 @@ export const feeIssuerConfig = {
|
|
|
85
87
|
* Wire up a remote between the comms vat and vattp.
|
|
86
88
|
*
|
|
87
89
|
* @param {string} addr
|
|
88
|
-
* @param {{ vats: { vattp: VattpVat
|
|
90
|
+
* @param {{ vats: { vattp: VattpVat; comms: CommsVatRoot } }} powers
|
|
89
91
|
*/
|
|
90
92
|
export const addRemote = async (addr, { vats: { comms, vattp } }) => {
|
|
91
93
|
const { transmitter, setReceiver } = await E(vattp).addRemote(addr);
|
|
@@ -94,17 +96,19 @@ export const addRemote = async (addr, { vats: { comms, vattp } }) => {
|
|
|
94
96
|
harden(addRemote);
|
|
95
97
|
|
|
96
98
|
/**
|
|
97
|
-
* @param {
|
|
98
|
-
* @param
|
|
99
|
+
* @param {((...args) => Record<string, unknown>)[]} builders
|
|
100
|
+
* @param {...unknown} args
|
|
99
101
|
* @returns {Record<string, unknown>}
|
|
100
102
|
*/
|
|
101
103
|
export const callProperties = (builders, ...args) =>
|
|
102
104
|
fromEntries(builders.map(fn => entries(fn(...args))).flat());
|
|
103
105
|
|
|
104
106
|
/**
|
|
105
|
-
* Attenuate `specimen` to only allow acccess to properties specified in
|
|
107
|
+
* Attenuate `specimen` to only allow acccess to properties specified in
|
|
108
|
+
* `template`
|
|
106
109
|
*
|
|
107
|
-
* @param {true | string | Record<string,
|
|
110
|
+
* @param {true | string | Record<string, any>} template true or vat name string
|
|
111
|
+
* or recursive object
|
|
108
112
|
* @param {unknown} specimen
|
|
109
113
|
* @param {string[]} [path]
|
|
110
114
|
*/
|
|
@@ -143,7 +147,8 @@ export const extract = (template, specimen, path = []) => {
|
|
|
143
147
|
harden(extract);
|
|
144
148
|
|
|
145
149
|
/**
|
|
146
|
-
* @param {true | string | Record<string,
|
|
150
|
+
* @param {true | string | Record<string, any>} permit the permit supplied by
|
|
151
|
+
* the manifest
|
|
147
152
|
* @param {unknown} allPowers the powers to attenuate
|
|
148
153
|
*/
|
|
149
154
|
export const extractPowers = (permit, allPowers) => {
|
|
@@ -164,7 +169,7 @@ harden(extractPowers);
|
|
|
164
169
|
* @param {unknown} opts.allPowers
|
|
165
170
|
* @param {Record<string, unknown>} opts.behaviors
|
|
166
171
|
* @param {Record<string, Record<string, unknown>>} opts.manifest
|
|
167
|
-
* @param {
|
|
172
|
+
* @param {(name: string, permit: Record<string, unknown>) => unknown} opts.makeConfig
|
|
168
173
|
*/
|
|
169
174
|
export const runModuleBehaviors = ({
|
|
170
175
|
allPowers,
|
|
@@ -194,7 +199,6 @@ harden(runModuleBehaviors);
|
|
|
194
199
|
const noop = harden(() => {});
|
|
195
200
|
|
|
196
201
|
/**
|
|
197
|
-
*
|
|
198
202
|
* @param {ERef<import('../types').NameAdmin>} nameAdmin
|
|
199
203
|
* @param {typeof console.log} [log]
|
|
200
204
|
*/
|
|
@@ -241,7 +245,7 @@ export const makeWellKnownSpaces = async (
|
|
|
241
245
|
}),
|
|
242
246
|
);
|
|
243
247
|
const spaces = Object.fromEntries(spaceEntries);
|
|
244
|
-
const typedSpaces = /** @type {
|
|
248
|
+
const typedSpaces = /** @type {WellKnownSpaces} */ (
|
|
245
249
|
/** @type {any} */ (spaces)
|
|
246
250
|
);
|
|
247
251
|
return typedSpaces;
|
|
@@ -249,23 +253,20 @@ export const makeWellKnownSpaces = async (
|
|
|
249
253
|
|
|
250
254
|
/**
|
|
251
255
|
* Make the well-known agoricNames namespace so that we can
|
|
252
|
-
* E(home.agoricNames).lookup('issuer', 'IST') and likewise
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
* @param {typeof console.log} [log]
|
|
256
|
-
* @param {Record<string, Record<string, unknown>>} reserved a property
|
|
257
|
-
* for each of issuer, brand, etc. with a value whose keys are names
|
|
258
|
-
* to reserve.
|
|
259
|
-
*
|
|
260
|
-
* For static typing and integrating with the bootstrap permit system,
|
|
261
|
-
* return { produce, consume } spaces rather than NameAdmins.
|
|
256
|
+
* E(home.agoricNames).lookup('issuer', 'IST') and likewise for brand,
|
|
257
|
+
* installation, instance, etc.
|
|
262
258
|
*
|
|
263
259
|
* @deprecated use vat-agoricNames, makeWellKnownSpaces
|
|
260
|
+
* @param {typeof console.log} [log]
|
|
261
|
+
* @param {Record<string, Record<string, unknown>>} reserved a property for each
|
|
262
|
+
* of issuer, brand, etc. with a value whose keys are names to reserve.
|
|
264
263
|
*
|
|
264
|
+
* For static typing and integrating with the bootstrap permit system, return {
|
|
265
|
+
* produce, consume } spaces rather than NameAdmins.
|
|
265
266
|
* @returns {Promise<{
|
|
266
|
-
* agoricNames: import('../types.js').NameHub
|
|
267
|
-
* agoricNamesAdmin: import('../types.js').NameAdmin
|
|
268
|
-
* spaces: WellKnownSpaces
|
|
267
|
+
* agoricNames: import('../types.js').NameHub;
|
|
268
|
+
* agoricNamesAdmin: import('../types.js').NameAdmin;
|
|
269
|
+
* spaces: WellKnownSpaces;
|
|
269
270
|
* }>}
|
|
270
271
|
*/
|
|
271
272
|
export const makeAgoricNamesAccess = async (
|
|
@@ -280,7 +281,7 @@ export const makeAgoricNamesAccess = async (
|
|
|
280
281
|
Object.keys(reserved),
|
|
281
282
|
);
|
|
282
283
|
|
|
283
|
-
const typedSpaces = /** @type {
|
|
284
|
+
const typedSpaces = /** @type {WellKnownSpaces} */ (
|
|
284
285
|
/** @type {any} */ (spaces)
|
|
285
286
|
);
|
|
286
287
|
return {
|
|
@@ -291,9 +292,8 @@ export const makeAgoricNamesAccess = async (
|
|
|
291
292
|
};
|
|
292
293
|
|
|
293
294
|
/**
|
|
294
|
-
* @param {string} address
|
|
295
|
-
*
|
|
296
295
|
* @deprecated use nameAdmin.provideChild() instead
|
|
296
|
+
* @param {string} address
|
|
297
297
|
*/
|
|
298
298
|
export const makeMyAddressNameAdminKit = address => {
|
|
299
299
|
// Create a name hub for this address.
|
|
@@ -317,7 +317,9 @@ export const makeMyAddressNameAdminKit = address => {
|
|
|
317
317
|
* @param {(...args: any) => void} [log]
|
|
318
318
|
* @param {string} [label]
|
|
319
319
|
*
|
|
320
|
-
* @typedef {import('@agoric/swingset-vat').CreateVatResults} CreateVatResults
|
|
320
|
+
* @typedef {import('@agoric/swingset-vat').CreateVatResults} CreateVatResults
|
|
321
|
+
* as from createVatByName
|
|
322
|
+
*
|
|
321
323
|
* @typedef {MapStore<string, CreateVatResults>} VatStore
|
|
322
324
|
*/
|
|
323
325
|
export const makeVatSpace = (
|
package/src/crc.d.ts
CHANGED
|
@@ -18,13 +18,9 @@ export class CRC {
|
|
|
18
18
|
crcShift: number;
|
|
19
19
|
shiftedXorIn: number;
|
|
20
20
|
table: Int32Array;
|
|
21
|
-
/**
|
|
22
|
-
* @param {Data} data
|
|
23
|
-
*/
|
|
21
|
+
/** @param {Data} data */
|
|
24
22
|
calculate(data: Data): number;
|
|
25
|
-
/**
|
|
26
|
-
* @param {Data} data
|
|
27
|
-
*/
|
|
23
|
+
/** @param {Data} data */
|
|
28
24
|
calculateNoTable(data: Data): number;
|
|
29
25
|
genTable(): Int32Array;
|
|
30
26
|
}
|
package/src/crc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crc.d.ts","sourceRoot":"","sources":["crc.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"crc.d.ts","sourceRoot":"","sources":["crc.js"],"names":[],"mappings":"AAmDA;IACE;;;;;;OAMG;IACH,mBANW,MAAM,QACN,MAAM,SACN,MAAM,UACN,MAAM,WACN,OAAO,EA4BjB;IAzBC,cAAkB;IAClB,aAAgB;IAChB,cAAkB;IAClB,uBAA0C;IAC1C,eAAoB;IACpB,iBAAsB;IACtB,gBAAoC;IACpC,aAAyC;IACzC,iBAAmD;IACnD,qBAA+C;IAG/C,kBAAkB;IAepB,yBAAyB;IACzB,gBADY,IAAI,UAuBf;IAED,yBAAyB;IACzB,uBADY,IAAI,UAkBf;IAED,uBAqBC;CACF;AAED,uBAAwD;AACxD,uBAAwD;AACxD,uBAAwD;AACxD,wBAA+D;AAC/D,wBAA+D;AAC/D,wBAAsE;AACtE,wBAA2E;AAC3E,yBAA4E;;;;;;;;;;;mBAxJ9D,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW"}
|
package/src/crc.js
CHANGED
|
@@ -9,15 +9,11 @@
|
|
|
9
9
|
// @ts-check
|
|
10
10
|
/* eslint-disable no-bitwise */
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {string | number | Uint8Array | ArrayBuffer} Data
|
|
14
|
-
*/
|
|
12
|
+
/** @typedef {string | number | Uint8Array | ArrayBuffer} Data */
|
|
15
13
|
|
|
16
14
|
const encoder = new TextEncoder();
|
|
17
15
|
|
|
18
|
-
/**
|
|
19
|
-
* @param {Data} data
|
|
20
|
-
*/
|
|
16
|
+
/** @param {Data} data */
|
|
21
17
|
function convert(data) {
|
|
22
18
|
if (typeof data === 'number') {
|
|
23
19
|
const bytes = [];
|
|
@@ -77,9 +73,7 @@ export class CRC {
|
|
|
77
73
|
this.table = table;
|
|
78
74
|
|
|
79
75
|
if (this.width === 8 && !this.xorIn && !this.xorOut && !this.reflect) {
|
|
80
|
-
/**
|
|
81
|
-
* @param {Data} data
|
|
82
|
-
*/
|
|
76
|
+
/** @param {Data} data */
|
|
83
77
|
this.calculate = function calculate(data) {
|
|
84
78
|
const buffer = convert(data);
|
|
85
79
|
let crc = 0;
|
|
@@ -91,9 +85,7 @@ export class CRC {
|
|
|
91
85
|
}
|
|
92
86
|
}
|
|
93
87
|
|
|
94
|
-
/**
|
|
95
|
-
* @param {Data} data
|
|
96
|
-
*/
|
|
88
|
+
/** @param {Data} data */
|
|
97
89
|
calculate(data) {
|
|
98
90
|
const buffer = convert(data);
|
|
99
91
|
let crc;
|
|
@@ -118,9 +110,7 @@ export class CRC {
|
|
|
118
110
|
return crc >>> 0;
|
|
119
111
|
}
|
|
120
112
|
|
|
121
|
-
/**
|
|
122
|
-
* @param {Data} data
|
|
123
|
-
*/
|
|
113
|
+
/** @param {Data} data */
|
|
124
114
|
calculateNoTable(data) {
|
|
125
115
|
const buffer = convert(data);
|
|
126
116
|
let crc = this.xorIn;
|
package/src/ibc.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {import('./types.js').BridgeHandler} BridgeHandler
|
|
3
|
-
*/
|
|
1
|
+
/** @typedef {import('./types.js').BridgeHandler} BridgeHandler */
|
|
4
2
|
/**
|
|
5
3
|
* @typedef {string} IBCPortID
|
|
4
|
+
*
|
|
6
5
|
* @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
|
|
19
|
-
*
|
|
18
|
+
* Create a handler for the IBC protocol, both from the network and from the
|
|
19
|
+
* 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":"AAuBA
|
|
1
|
+
{"version":3,"file":"ibc.d.ts","sourceRoot":"","sources":["ibc.js"],"names":[],"mappings":"AAuBA,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"}
|
package/src/ibc.js
CHANGED
|
@@ -21,13 +21,13 @@ const DEFAULT_ACKNOWLEDGEMENT = '\x00';
|
|
|
21
21
|
// Default timeout after 10 minutes.
|
|
22
22
|
const DEFAULT_PACKET_TIMEOUT_NS = 10n * 60n * 1_000_000_000n;
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* @typedef {import('./types.js').BridgeHandler} BridgeHandler
|
|
26
|
-
*/
|
|
24
|
+
/** @typedef {import('./types.js').BridgeHandler} BridgeHandler */
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
27
|
* @typedef {string} IBCPortID
|
|
28
|
+
*
|
|
30
29
|
* @typedef {string} IBCChannelID
|
|
30
|
+
*
|
|
31
31
|
* @typedef {string} IBCConnectionID
|
|
32
32
|
*/
|
|
33
33
|
|
|
@@ -41,8 +41,8 @@ const DEFAULT_PACKET_TIMEOUT_NS = 10n * 60n * 1_000_000_000n;
|
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Create a handler for the IBC protocol, both from the network
|
|
45
|
-
*
|
|
44
|
+
* Create a handler for the IBC protocol, both from the network and from the
|
|
45
|
+
* bridge.
|
|
46
46
|
*
|
|
47
47
|
* @param {typeof import('@endo/far').E} E
|
|
48
48
|
* @param {(method: string, params: any) => Promise<any>} rawCallIBCDevice
|
|
@@ -56,9 +56,7 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
|
|
|
56
56
|
console.info('IBC downcall', method, params);
|
|
57
57
|
return rawCallIBCDevice(method, params);
|
|
58
58
|
};
|
|
59
|
-
/**
|
|
60
|
-
* @type {MapStore<string, Promise<Connection>>}
|
|
61
|
-
*/
|
|
59
|
+
/** @type {MapStore<string, Promise<Connection>>} */
|
|
62
60
|
const channelKeyToConnP = makeScalarMapStore('CHANNEL:PORT');
|
|
63
61
|
|
|
64
62
|
/**
|
|
@@ -67,7 +65,7 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
|
|
|
67
65
|
* @property {string} channel_id
|
|
68
66
|
*
|
|
69
67
|
* @typedef {object} ConnectingInfo
|
|
70
|
-
* @property {'ORDERED'|'UNORDERED'} order
|
|
68
|
+
* @property {'ORDERED' | 'UNORDERED'} order
|
|
71
69
|
* @property {string[]} connectionHops
|
|
72
70
|
* @property {string} portID
|
|
73
71
|
* @property {string} channelID
|
|
@@ -75,31 +73,25 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
|
|
|
75
73
|
* @property {string} version
|
|
76
74
|
*
|
|
77
75
|
* @typedef {PromiseRecord<AttemptDescription>} OnConnectP
|
|
76
|
+
*
|
|
78
77
|
* @typedef {Omit<ConnectingInfo, 'counterparty' | 'channelID'> & {
|
|
79
|
-
* localAddr: Endpoint
|
|
80
|
-
*
|
|
78
|
+
* localAddr: Endpoint;
|
|
79
|
+
* onConnectP: OnConnectP;
|
|
80
|
+
* counterparty: { port_id: string };
|
|
81
81
|
* }} Outbound
|
|
82
82
|
*/
|
|
83
83
|
|
|
84
|
-
/**
|
|
85
|
-
* @type {LegacyMap<string, Array<Outbound>>}
|
|
86
|
-
*/
|
|
84
|
+
/** @type {LegacyMap<string, Outbound[]>} */
|
|
87
85
|
// Legacy because it holds a mutable Javascript Array
|
|
88
86
|
const srcPortToOutbounds = makeLegacyMap('SRC-PORT');
|
|
89
87
|
|
|
90
|
-
/**
|
|
91
|
-
* @type {MapStore<string, ConnectingInfo>}
|
|
92
|
-
*/
|
|
88
|
+
/** @type {MapStore<string, ConnectingInfo>} */
|
|
93
89
|
const channelKeyToInfo = makeScalarMapStore('CHANNEL:PORT');
|
|
94
90
|
|
|
95
|
-
/**
|
|
96
|
-
* @type {MapStore<string, Promise<InboundAttempt>>}
|
|
97
|
-
*/
|
|
91
|
+
/** @type {MapStore<string, Promise<InboundAttempt>>} */
|
|
98
92
|
const channelKeyToAttemptP = makeScalarMapStore('CHANNEL:PORT');
|
|
99
93
|
|
|
100
|
-
/**
|
|
101
|
-
* @type {LegacyMap<string, LegacyMap<number, PromiseRecord<Bytes>>>}
|
|
102
|
-
*/
|
|
94
|
+
/** @type {LegacyMap<string, LegacyMap<number, PromiseRecord<Bytes>>>} */
|
|
103
95
|
// Legacy because it holds a LegacyMap
|
|
104
96
|
const channelKeyToSeqAck = makeLegacyMap('CHANNEL:PORT');
|
|
105
97
|
|
|
@@ -124,9 +116,7 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
|
|
|
124
116
|
// Extract the actual sequence number from the return.
|
|
125
117
|
const { sequence } = fullPacket;
|
|
126
118
|
|
|
127
|
-
/**
|
|
128
|
-
* @type {PromiseRecord<Bytes>}
|
|
129
|
-
*/
|
|
119
|
+
/** @type {PromiseRecord<Bytes>} */
|
|
130
120
|
const ackDeferred = makePromiseKit();
|
|
131
121
|
|
|
132
122
|
// Register the ack resolver/rejector with this sequence number.
|
|
@@ -139,7 +129,7 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
|
|
|
139
129
|
* @param {string} portID
|
|
140
130
|
* @param {string} rChannelID
|
|
141
131
|
* @param {string} rPortID
|
|
142
|
-
* @param {'ORDERED'|'UNORDERED'} order
|
|
132
|
+
* @param {'ORDERED' | 'UNORDERED'} order
|
|
143
133
|
* @returns {ConnectionHandler}
|
|
144
134
|
*/
|
|
145
135
|
function makeIBCConnectionHandler(
|
|
@@ -213,9 +203,7 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
|
|
|
213
203
|
});
|
|
214
204
|
}
|
|
215
205
|
|
|
216
|
-
/**
|
|
217
|
-
* @param {string} localAddr
|
|
218
|
-
*/
|
|
206
|
+
/** @param {string} localAddr */
|
|
219
207
|
const localAddrToPortID = localAddr => {
|
|
220
208
|
const m = localAddr.match(/^\/ibc-port\/([-a-zA-Z0-9._+#[\]<>]+)$/);
|
|
221
209
|
if (!m) {
|
|
@@ -226,29 +214,23 @@ export function makeIBCProtocolHandler(E, rawCallIBCDevice) {
|
|
|
226
214
|
return m[1];
|
|
227
215
|
};
|
|
228
216
|
|
|
229
|
-
/**
|
|
230
|
-
* @type {ProtocolImpl}
|
|
231
|
-
*/
|
|
217
|
+
/** @type {ProtocolImpl} */
|
|
232
218
|
let protocolImpl;
|
|
233
219
|
|
|
234
220
|
/**
|
|
235
221
|
* @typedef {object} OutboundCircuitRecord
|
|
236
222
|
* @property {IBCConnectionID} dst
|
|
237
|
-
* @property {'ORDERED'|'UNORDERED'} order
|
|
223
|
+
* @property {'ORDERED' | 'UNORDERED'} order
|
|
238
224
|
* @property {string} version
|
|
239
225
|
* @property {IBCPacket} packet
|
|
240
226
|
* @property {PromiseRecord<ConnectionHandler>} deferredHandler
|
|
241
227
|
*/
|
|
242
228
|
|
|
243
|
-
/**
|
|
244
|
-
* @type {LegacyMap<Port, Set<PromiseRecord<ConnectionHandler>>>}
|
|
245
|
-
*/
|
|
229
|
+
/** @type {LegacyMap<Port, Set<PromiseRecord<ConnectionHandler>>>} */
|
|
246
230
|
// Legacy because it holds a raw JavaScript Set
|
|
247
231
|
const portToPendingConns = makeLegacyMap('Port');
|
|
248
232
|
|
|
249
|
-
/**
|
|
250
|
-
* @type {ProtocolHandler}
|
|
251
|
-
*/
|
|
233
|
+
/** @type {ProtocolHandler} */
|
|
252
234
|
const protocol = Far('IBCProtocolHandler', {
|
|
253
235
|
async onCreate(impl, _protocolHandler) {
|
|
254
236
|
console.debug('IBC onCreate');
|
package/src/lib-board.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ export function prepareBoardKit(baggage: MapStore<string, unknown>): (args_0?: n
|
|
|
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
|
-
* which mitigates typo risks.
|
|
11
|
+
* Each board ID includes a CRC so that the last part is
|
|
12
|
+
* well-distributed, which mitigates typo risks.
|
|
13
13
|
*
|
|
14
|
-
* Scaling Consideration: since we cannot know when consumers
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
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.
|
|
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: MapStore<string, unknown>): (args_0?: n
|
|
|
26
26
|
*/
|
|
27
27
|
getValue(id: BoardId): any;
|
|
28
28
|
/**
|
|
29
|
-
* Convenience method for recursively traversing boards and
|
|
30
|
-
*
|
|
31
|
-
* corresponding to each successive board.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
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".
|
|
35
35
|
*
|
|
36
|
-
* @param
|
|
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
|
-
* "publishing" previously un-mapped objects.
|
|
43
|
+
* Get a marshaller that implements the convertValToSlot hook using
|
|
44
|
+
* getId(), "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: MapStore<string, unknown>): (args_0?: n
|
|
|
50
50
|
unserialize(data: any): any;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
|
-
* Get a marshaller that implements the convertValToSlot hook using
|
|
54
|
-
* only for objects that the board has().
|
|
53
|
+
* Get a marshaller that implements the convertValToSlot hook using
|
|
54
|
+
* getId(), 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
|
|
58
|
-
*
|
|
57
|
+
* Un-serializing a null slot always produces a fresh object rather than
|
|
58
|
+
* 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: MapStore<string, unknown>): (args_0?: n
|
|
|
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
|
-
* which mitigates typo risks.
|
|
84
|
+
* Each board ID includes a CRC so that the last part is
|
|
85
|
+
* well-distributed, which mitigates typo risks.
|
|
86
86
|
*
|
|
87
|
-
* Scaling Consideration: since we cannot know when consumers
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
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.
|
|
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: MapStore<string, unknown>): (args_0?: n
|
|
|
99
99
|
*/
|
|
100
100
|
getValue(id: BoardId): any;
|
|
101
101
|
/**
|
|
102
|
-
* Convenience method for recursively traversing boards and
|
|
103
|
-
*
|
|
104
|
-
* corresponding to each successive board.
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
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".
|
|
108
108
|
*
|
|
109
|
-
* @param
|
|
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
|
-
* "publishing" previously un-mapped objects.
|
|
116
|
+
* Get a marshaller that implements the convertValToSlot hook using
|
|
117
|
+
* getId(), "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: MapStore<string, unknown>): (args_0?: n
|
|
|
123
123
|
unserialize(data: any): any;
|
|
124
124
|
};
|
|
125
125
|
/**
|
|
126
|
-
* Get a marshaller that implements the convertValToSlot hook using
|
|
127
|
-
* only for objects that the board has().
|
|
126
|
+
* Get a marshaller that implements the convertValToSlot hook using
|
|
127
|
+
* getId(), 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
|
|
131
|
-
*
|
|
130
|
+
* Un-serializing a null slot always produces a fresh object rather than
|
|
131
|
+
* preserving object identity.
|
|
132
132
|
*/
|
|
133
133
|
getReadonlyMarshaller(): {
|
|
134
134
|
toCapData(val: any): import("@endo/marshal").CapData<string | null>;
|
|
@@ -152,29 +152,27 @@ export function prepareBoardKit(baggage: MapStore<string, unknown>): (args_0?: n
|
|
|
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
|
|
156
|
-
*
|
|
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.
|
|
157
157
|
*
|
|
158
158
|
* The contents of the string depend on the `prefix` and `crcDigits` options:
|
|
159
|
-
*
|
|
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
|
|
165
|
+
* // TODO: use
|
|
166
|
+
* Key from
|
|
166
167
|
*/
|
|
167
168
|
export type BoardState = ReturnType<typeof initDurableBoardState>;
|
|
168
169
|
export type Key = import('@endo/marshal').Passable;
|
|
169
170
|
/**
|
|
171
|
+
* @typedef {ReturnType<typeof initDurableBoardState>} BoardState // TODO: use
|
|
172
|
+
* Key from @agoric/store when available
|
|
170
173
|
* @see {prepareExoClassKit}
|
|
171
|
-
* @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects}
|
|
174
|
+
* @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects} Hoisting this function makes defining the state type concise.
|
|
172
175
|
*
|
|
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
|
|
178
176
|
* @typedef {import('@endo/marshal').Passable} Key
|
|
179
177
|
*/
|
|
180
178
|
/**
|
|
@@ -183,7 +181,8 @@ export type Key = import('@endo/marshal').Passable;
|
|
|
183
181
|
* @param {bigint | number} [initSequence]
|
|
184
182
|
* @param {object} [options]
|
|
185
183
|
* @param {string} [options.prefix] prefix for all ids generated
|
|
186
|
-
* @param {number} [options.crcDigits] count of digits to use in CRC at end of
|
|
184
|
+
* @param {number} [options.crcDigits] count of digits to use in CRC at end of
|
|
185
|
+
* the id
|
|
187
186
|
*/
|
|
188
187
|
declare function initDurableBoardState(initSequence?: number | bigint | undefined, { prefix, crcDigits }?: {
|
|
189
188
|
prefix?: string | undefined;
|
package/src/lib-board.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib-board.d.ts","sourceRoot":"","sources":["lib-board.js"],"names":[],"mappings":"
|
|
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"}
|