@agoric/vats 0.15.2-dev-d756c83.0.d756c83 → 0.15.2-dev-9b2a827.0.9b2a827

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 (3) hide show
  1. package/package.json +18 -18
  2. package/src/types.js +344 -2
  3. package/src/types.ts +0 -344
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/vats",
3
- "version": "0.15.2-dev-d756c83.0.d756c83",
3
+ "version": "0.15.2-dev-9b2a827.0.9b2a827",
4
4
  "description": "Agoric's Vat library",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -8,8 +8,8 @@
8
8
  "scripts": {
9
9
  "build": "yarn build:bundles",
10
10
  "build:bundles": "node scripts/build-bundles.js",
11
- "prepack": "yarn run -T tsc --build tsconfig.build.json",
12
- "postpack": "git clean -f '*.d.*ts*' '*.tsbuildinfo'",
11
+ "prepack": "yarn run -T prepack-package",
12
+ "postpack": "yarn run -T postpack-package",
13
13
  "test": "ava",
14
14
  "test:c8": "c8 --all ${C8_OPTIONS:-} ava",
15
15
  "test:xs": "exit 0",
@@ -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-d756c83.0.d756c83",
26
- "@agoric/ertp": "0.16.3-dev-d756c83.0.d756c83",
27
- "@agoric/governance": "0.10.4-dev-d756c83.0.d756c83",
28
- "@agoric/internal": "0.3.3-dev-d756c83.0.d756c83",
29
- "@agoric/network": "0.1.1-dev-d756c83.0.d756c83",
30
- "@agoric/notifier": "0.6.3-dev-d756c83.0.d756c83",
31
- "@agoric/store": "0.9.3-dev-d756c83.0.d756c83",
32
- "@agoric/swingset-vat": "0.32.3-dev-d756c83.0.d756c83",
33
- "@agoric/time": "0.3.3-dev-d756c83.0.d756c83",
34
- "@agoric/vat-data": "0.5.3-dev-d756c83.0.d756c83",
35
- "@agoric/vow": "0.1.1-dev-d756c83.0.d756c83",
36
- "@agoric/zoe": "0.26.3-dev-d756c83.0.d756c83",
37
- "@agoric/zone": "0.2.3-dev-d756c83.0.d756c83",
25
+ "@agoric/cosmic-proto": "0.4.1-dev-9b2a827.0.9b2a827",
26
+ "@agoric/ertp": "0.16.3-dev-9b2a827.0.9b2a827",
27
+ "@agoric/governance": "0.10.4-dev-9b2a827.0.9b2a827",
28
+ "@agoric/internal": "0.3.3-dev-9b2a827.0.9b2a827",
29
+ "@agoric/network": "0.1.1-dev-9b2a827.0.9b2a827",
30
+ "@agoric/notifier": "0.6.3-dev-9b2a827.0.9b2a827",
31
+ "@agoric/store": "0.9.3-dev-9b2a827.0.9b2a827",
32
+ "@agoric/swingset-vat": "0.32.3-dev-9b2a827.0.9b2a827",
33
+ "@agoric/time": "0.3.3-dev-9b2a827.0.9b2a827",
34
+ "@agoric/vat-data": "0.5.3-dev-9b2a827.0.9b2a827",
35
+ "@agoric/vow": "0.1.1-dev-9b2a827.0.9b2a827",
36
+ "@agoric/zoe": "0.26.3-dev-9b2a827.0.9b2a827",
37
+ "@agoric/zone": "0.2.3-dev-9b2a827.0.9b2a827",
38
38
  "@endo/errors": "^1.2.13",
39
39
  "@endo/far": "^1.1.14",
40
40
  "@endo/import-bundle": "^1.5.2",
@@ -47,7 +47,7 @@
47
47
  "jessie.js": "^0.3.4"
48
48
  },
49
49
  "devDependencies": {
50
- "@agoric/swingset-liveslots": "0.10.3-dev-d756c83.0.d756c83",
50
+ "@agoric/swingset-liveslots": "0.10.3-dev-9b2a827.0.9b2a827",
51
51
  "@endo/bundle-source": "^4.1.2",
52
52
  "@endo/init": "^1.1.12",
53
53
  "ava": "^5.3.0",
@@ -79,5 +79,5 @@
79
79
  "typeCoverage": {
80
80
  "atLeast": 90.66
81
81
  },
82
- "gitHead": "d756c838c7eb3e3cec4a8bdf5c24b97f942b754e"
82
+ "gitHead": "9b2a827cdf1c3203c1a73637ed80dcd5b13edb8a"
83
83
  }
package/src/types.js CHANGED
@@ -1,2 +1,344 @@
1
- // Empty JS file to correspond with types.d.ts
2
- export {};
1
+ /* eslint-disable @typescript-eslint/no-unused-vars -- fails to notice the @see uses */
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+ /**
16
+ * read-only access to a node in a name hierarchy
17
+ *
18
+ * NOTE: We need to return arrays, not iterables, because even if marshal could
19
+ * allow passing a remote iterable, there would be an inordinate number of round
20
+ * trips for the contents of even the simplest nameHub.
21
+ */
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+ /** write access to a node in a name hierarchy */
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ /** a node in a name hierarchy */
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ /** An object that can receive messages from the bridge device */
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ /** An object which handles messages for a specific bridge */
125
+
126
+
127
+
128
+
129
+ /** The object to manage this bridge */
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+ /**
154
+ * The network host is the tuple type that identifies the system providing a
155
+ * NetworkBinding. We currently only support chain-based Caip10 hosts, but
156
+ * others may be added later.
157
+ */
158
+
159
+
160
+ /**
161
+ * A network binding is the protocol-specific minimal information needed to
162
+ * identify a specific source or destination, knowing the NetworkHost for which
163
+ * it has been bound.
164
+ */
165
+
166
+
167
+
168
+
169
+ /**
170
+ * A network endpoint is a tuple that identifies a specific network location,
171
+ * including the protocol, host, and any protocol-specific binding information.
172
+ */
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+ /** see [ibc_module.go](../../../golang/cosmos/x/vibc/types/ibc_module.go) */
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+ /**
236
+ * ActionTypes as specified by `vibc` and `vtransfer`. This list is expected to
237
+ * grow as more IBC Applications modules are implemented.
238
+ */
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+ /** see [receiver.go](../../../golang/cosmos/x/vibc/types/receiver.go) */
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+ /**
333
+ * This event is emitted when a FungibleTokenPacket is sent or received
334
+ * by a target (e.g. a {@link LocalChainAccount}) that has a registered
335
+ * {@link TargetApp}. It is passed through the `receiveUpcall` handler.
336
+ *
337
+ * For ICS-20 transfer (including `MsgTransfer`), the `packet.data` field is a
338
+ * {@link FungibleTokenPacketData} object, and you can use
339
+ * `JSON.parse(atob(packet.data))` to extract it.
340
+ */
341
+
342
+
343
+
344
+
package/src/types.ts DELETED
@@ -1,344 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars -- fails to notice the @see uses */
2
- import type { JsonSafe } from '@agoric/cosmic-proto';
3
- import type { FungibleTokenPacketData } from '@agoric/cosmic-proto/ibc/applications/transfer/v2/packet.js';
4
- import type { PacketSDKType } from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js';
5
- import type { BridgeId, Remote } from '@agoric/internal';
6
- import type { Bytes } from '@agoric/network';
7
- import type { Guarded } from '@endo/exo';
8
- import type { TargetApp } from './bridge-target.js';
9
- import type { LocalChainAccount } from './localchain.js';
10
-
11
- export type Board = ReturnType<
12
- ReturnType<typeof import('./lib-board.js').prepareBoardKit>
13
- >['board'];
14
-
15
- /**
16
- * read-only access to a node in a name hierarchy
17
- *
18
- * NOTE: We need to return arrays, not iterables, because even if marshal could
19
- * allow passing a remote iterable, there would be an inordinate number of round
20
- * trips for the contents of even the simplest nameHub.
21
- */
22
- export type NameHub<Value = any> = {
23
- has: (key: string) => boolean;
24
- /**
25
- * Look up a path of keys starting from the current NameHub. Wait on any
26
- * reserved promises.
27
- */
28
- lookup: (...path: string[]) => Promise<any>;
29
- /** get all the entries available in the current NameHub */
30
- entries: (includeReserved?: boolean) => [string, Value][];
31
- /** get all names available in the current NameHub */
32
- keys: () => string[];
33
- /** get all values available in the current NameHub */
34
- values: () => Value[];
35
- };
36
-
37
- /** write access to a node in a name hierarchy */
38
- export type NameAdmin = {
39
- provideChild: (key: string, reserved?: string[]) => Promise<NameHubKit>;
40
- /**
41
- * Mark a key as reserved; will return a promise that is fulfilled when the
42
- * key is updated (or rejected when deleted). If the key was already set it
43
- * does nothing.
44
- */
45
- reserve: (key: string) => Promise<void>;
46
- /**
47
- * Update if not already updated. Return existing value, or newValue if not
48
- * existing.
49
- */
50
- default: <T>(key: string, newValue: T, newAdmin?: NameAdmin) => T;
51
- /** Update only if already initialized. Reject if not. */
52
- set: (key: string, newValue: any, newAdmin?: NameAdmin) => void;
53
- /**
54
- * Fulfill an outstanding reserved promise (if any) to the newValue and set
55
- * the key to the newValue. If newAdmin is provided, set that to return via
56
- * lookupAdmin.
57
- */
58
- update: (key: string, newValue: any, newAdmin?: NameAdmin) => void;
59
- /**
60
- * Look up the `newAdmin` from the path of keys starting from the current
61
- * NameAdmin. Wait on any reserved promises.
62
- */
63
- lookupAdmin: (...path: string[]) => Promise<NameAdmin>;
64
- /** Delete a value and reject an outstanding reserved promise (if any). */
65
- delete: (key: string) => void;
66
- /** get the NameHub corresponding to the current NameAdmin */
67
- readonly: () => NameHub;
68
- /**
69
- * Set a function to be called whenever an update or deletion is made, with all the entries as of that point.
70
- *
71
- * Note: can be called at most once.
72
- */
73
- onUpdate: (fn: undefined | NameHubUpdateHandler) => void;
74
- };
75
-
76
- export type NameHubUpdateHandler = {
77
- /** Called when an update or deletion is made, with all entries as of that point. */
78
- write: (entries: [string, any][]) => void;
79
- };
80
-
81
- /** a node in a name hierarchy */
82
- export type NameHubKit = {
83
- /** read access */
84
- nameHub: NameHub;
85
- /** write access */
86
- nameAdmin: NameAdmin;
87
- };
88
-
89
- export type MyAddressNameAdmin = NameAdmin & {
90
- getMyAddress(): string;
91
- };
92
- export type NamesByAddressAdmin = NameAdmin & {
93
- provideChild(
94
- addr: string,
95
- reserved?: string[],
96
- ): Promise<{
97
- nameHub: NameHub;
98
- nameAdmin: MyAddressNameAdmin;
99
- }>;
100
- lookupAdmin(addr: string): Promise<MyAddressNameAdmin>;
101
- };
102
-
103
- /** An object that can receive messages from the bridge device */
104
- export type BridgeHandler = {
105
- /** Handle an inbound message */
106
- fromBridge: (obj: any) => Promise<unknown> | unknown;
107
- };
108
-
109
- export type ScopedBridgeManagerMethods<B extends BridgeId> = {
110
- /**
111
- * Optional bridge ID getter. Not part of the production bridge vat but
112
- * available in fake bridges as a means for test reflection and for the type
113
- * system to hang the bridgeId
114
- */
115
- getBridgeId?: () => B;
116
- /** Downcall from the VM into Golang */
117
- toBridge: (obj: any) => Promise<any>;
118
- /** Upcall from Golang into the VM */
119
- fromBridge: (obj: any) => Promise<unknown>;
120
- initHandler: (handler: Remote<BridgeHandler>) => void;
121
- setHandler: (handler: Remote<BridgeHandler>) => void;
122
- };
123
-
124
- /** An object which handles messages for a specific bridge */
125
- export type ScopedBridgeManager<B extends BridgeId> = Guarded<
126
- ScopedBridgeManagerMethods<B>
127
- >;
128
-
129
- /** The object to manage this bridge */
130
- export type BridgeManager = {
131
- register: <B extends BridgeId>(
132
- bridgeId: B,
133
- handler?: Remote<BridgeHandler>,
134
- ) => ScopedBridgeManager<B>;
135
- };
136
-
137
- export type IBCPortID = string;
138
- export type IBCChannelID = `channel-${number}`;
139
- export type IBCConnectionID = `connection-${number}`;
140
- export type IBCChannelOrdering = 'ORDERED' | 'UNORDERED';
141
-
142
- export type IBCPacket = JsonSafe<{
143
- data: Bytes;
144
- source_channel: IBCChannelID;
145
- source_port: IBCPortID;
146
- destination_channel: IBCChannelID;
147
- destination_port: IBCPortID;
148
- sequence?: PacketSDKType['sequence'];
149
- timeout_height?: PacketSDKType['timeout_height'];
150
- timeout_timestamp?: PacketSDKType['timeout_timestamp'];
151
- }>;
152
-
153
- /**
154
- * The network host is the tuple type that identifies the system providing a
155
- * NetworkBinding. We currently only support chain-based Caip10 hosts, but
156
- * others may be added later.
157
- */
158
- export type NetworkHost = [['chain', `${string}:${string}`]];
159
-
160
- /**
161
- * A network binding is the protocol-specific minimal information needed to
162
- * identify a specific source or destination, knowing the NetworkHost for which
163
- * it has been bound.
164
- */
165
- export interface NetworkBinding {
166
- ibc: [['port', IBCPortID], ['channel', IBCChannelID]];
167
- }
168
-
169
- /**
170
- * A network endpoint is a tuple that identifies a specific network location,
171
- * including the protocol, host, and any protocol-specific binding information.
172
- */
173
- export type NetworkEndpoint<Proto extends keyof NetworkBinding> = [
174
- Proto,
175
- ...(NetworkHost | []),
176
- ...(NetworkBinding[Proto] | []),
177
- ];
178
-
179
- export type IBCCounterParty = {
180
- port_id: IBCPortID;
181
- channel_id: IBCChannelID;
182
- };
183
-
184
- export type ConnectingInfo = {
185
- order: IBCChannelOrdering;
186
- connectionHops: IBCConnectionID[];
187
- portID: IBCPortID;
188
- channelID: IBCChannelID;
189
- counterparty: IBCCounterParty;
190
- counterpartyVersion: string;
191
- version: string;
192
- asyncVersions?: boolean;
193
- };
194
-
195
- /** see [ibc_module.go](../../../golang/cosmos/x/vibc/types/ibc_module.go) */
196
- export type IBCBridgeEvent =
197
- | 'writeAcknowledgement'
198
- | 'channelOpenInit'
199
- | 'channelOpenTry'
200
- | 'channelOpenAck'
201
- | 'channelOpenConfirm'
202
- | 'channelCloseInit'
203
- | 'channelCloseConfirm'
204
- | 'receivePacket'
205
- | 'acknowledgementPacket'
206
- | 'timeoutPacket'
207
- | 'sendPacket';
208
-
209
- type IBCPacketEvents = {
210
- channelOpenInit: ConnectingInfo;
211
- channelOpenTry: ConnectingInfo;
212
- channelOpenAck: ConnectingInfo;
213
- channelOpenConfirm: ConnectingInfo;
214
- receivePacket: {
215
- packet: IBCPacket;
216
- };
217
- acknowledgementPacket: {
218
- acknowledgement: Bytes;
219
- packet: IBCPacket;
220
- relayer: string; // chain address
221
- };
222
- writeAcknowledgement: {
223
- acknowledgement: Bytes;
224
- packet: IBCPacket;
225
- relayer: string; // chain address
226
- };
227
- timeoutPacket: {
228
- packet: IBCPacket;
229
- };
230
- channelCloseInit: { channelID: IBCChannelID; portID: IBCPortID };
231
- channelCloseConfirm: { channelID: IBCChannelID; portID: IBCPortID };
232
- sendPacket: { relativeTimeoutNs: bigint; packet: IBCPacket };
233
- };
234
-
235
- /**
236
- * ActionTypes as specified by `vibc` and `vtransfer`. This list is expected to
237
- * grow as more IBC Applications modules are implemented.
238
- */
239
- type IBCEventType = 'IBC_EVENT' | 'VTRANSFER_IBC_EVENT';
240
-
241
- export type IBCEvent<
242
- E extends IBCBridgeEvent,
243
- T extends IBCEventType = 'IBC_EVENT',
244
- > = {
245
- type: T;
246
- /** blockHeight may be missing from synthetic packets. */
247
- blockHeight?: number;
248
- /** blockTime may be missing from synthetic packets. */
249
- blockTime?: number;
250
- event: E;
251
- /** e.g. the chain address of the LocalChainAccount */
252
- target?: string | { onlyIfRegistered: string };
253
- } & {
254
- [K in keyof IBCPacketEvents[E]]: IBCPacketEvents[E][K];
255
- };
256
-
257
- /** see [receiver.go](../../../golang/cosmos/x/vibc/types/receiver.go) */
258
- export type IBCDowncallMethod =
259
- | 'sendPacket'
260
- | 'tryOpenExecuted'
261
- | 'receiveExecuted'
262
- | 'startChannelOpenInit'
263
- | 'startChannelCloseInit'
264
- | 'bindPort'
265
- | 'timeoutExecuted'
266
- | 'initOpenExecuted';
267
-
268
- type IBCMethodEvents = {
269
- sendPacket: SendPacketDownCall;
270
- tryOpenExecuted: ChannelOpenAckDowncall;
271
- receiveExecuted: {
272
- packet: IBCPacket;
273
- ack: Bytes;
274
- };
275
- startChannelOpenInit: ChannelOpenInitDowncall;
276
- startChannelCloseInit: {
277
- packet: Pick<IBCPacket, 'source_port' | 'source_channel'>;
278
- };
279
- bindPort: { packet: { source_port: IBCPortID } };
280
- timeoutExecuted: {
281
- packet: IBCPacket;
282
- };
283
- initOpenExecuted: ChannelOpenAckDowncall;
284
- };
285
-
286
- type IBCMethodReturns = {
287
- sendPacket: Required<IBCPacket>;
288
- };
289
-
290
- export type IBCMethod<M extends IBCDowncallMethod> = {
291
- type: 'IBC_METHOD';
292
- method: M;
293
- } & {
294
- [K in keyof IBCMethodEvents[M]]: IBCMethodEvents[M][K];
295
- };
296
-
297
- export type IBCDowncall<M extends IBCDowncallMethod> = {
298
- [K in keyof IBCMethodEvents[M]]: IBCMethodEvents[M][K];
299
- };
300
-
301
- export type IBCDowncallReturn<M extends IBCDowncallMethod> =
302
- M extends keyof IBCMethodReturns ? IBCMethodReturns[M] : void;
303
-
304
- export type IBCDowncallPacket<M extends IBCDowncallMethod> =
305
- IBCMethodEvents[M] extends { packet: infer P } ? P : never;
306
-
307
- type ChannelOpenDowncallBase = {
308
- hops: IBCConnectionID[];
309
- order: IBCChannelOrdering;
310
- version: string;
311
- };
312
-
313
- type ChannelOpenInitDowncall = ChannelOpenDowncallBase & {
314
- packet: Pick<IBCPacket, 'destination_port' | 'source_port'>;
315
- };
316
-
317
- type ChannelOpenAckDowncall = ChannelOpenDowncallBase & {
318
- packet: Pick<
319
- IBCPacket,
320
- | 'destination_port'
321
- | 'source_port'
322
- | 'destination_channel'
323
- | 'source_channel'
324
- >;
325
- };
326
-
327
- type SendPacketDownCall = {
328
- packet: IBCPacket;
329
- relativeTimeoutNs: bigint;
330
- };
331
-
332
- /**
333
- * This event is emitted when a FungibleTokenPacket is sent or received
334
- * by a target (e.g. a {@link LocalChainAccount}) that has a registered
335
- * {@link TargetApp}. It is passed through the `receiveUpcall` handler.
336
- *
337
- * For ICS-20 transfer (including `MsgTransfer`), the `packet.data` field is a
338
- * {@link FungibleTokenPacketData} object, and you can use
339
- * `JSON.parse(atob(packet.data))` to extract it.
340
- */
341
- export type VTransferIBCEvent =
342
- | IBCEvent<'acknowledgementPacket', 'VTRANSFER_IBC_EVENT'>
343
- | IBCEvent<'writeAcknowledgement', 'VTRANSFER_IBC_EVENT'>
344
- | IBCEvent<'timeoutPacket', 'VTRANSFER_IBC_EVENT'>;