@agoric/network 0.1.1-calypso-dev-84eb287.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/CHANGELOG.md +0 -0
- package/LICENSE +201 -0
- package/README.md +155 -0
- package/package.json +71 -0
- package/src/bytes.d.ts +46 -0
- package/src/bytes.d.ts.map +1 -0
- package/src/bytes.js +103 -0
- package/src/index.d.ts +7 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +7 -0
- package/src/multiaddr.d.ts +68 -0
- package/src/multiaddr.d.ts.map +1 -0
- package/src/multiaddr.js +72 -0
- package/src/network.d.ts +163 -0
- package/src/network.d.ts.map +1 -0
- package/src/network.js +1525 -0
- package/src/router.d.ts +106 -0
- package/src/router.d.ts.map +1 -0
- package/src/router.js +187 -0
- package/src/shapes.d.ts +119 -0
- package/src/shapes.d.ts.map +1 -0
- package/src/shapes.js +187 -0
- package/src/types.d.ts +218 -0
- package/src/types.d.ts.map +1 -0
- package/src/types.js +202 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Here is the difference between Textaddr and Multiaddr:
|
|
3
|
+
*
|
|
4
|
+
* - unspecified port on local ibc interface:
|
|
5
|
+
* - /if/ibc0
|
|
6
|
+
* - [['if', 'ibc0']]
|
|
7
|
+
* - specific local port:
|
|
8
|
+
* - /if/ibc0/ordered/transfer
|
|
9
|
+
* - [['if', 'ibc0'], ['ordered', 'transfer']]
|
|
10
|
+
* - remote pointer to chain:
|
|
11
|
+
* - /dnsaddr/ibc.testnet.agoric.com/ordered/transfer
|
|
12
|
+
* - [['dnsaddr', 'ibc.testnet.agoric.com'], ['ordered', 'transfer']]
|
|
13
|
+
* - resolve step to another pointer:
|
|
14
|
+
* - /dnsaddr/rpc.testnet.agoric.com/ibc/testnet-1.19.0/gci/4bc8d.../ordered/transfer
|
|
15
|
+
* - [['dnsaddr', 'rpc.testnet.agoric.com'], ['ibc', 'testnet-1.19.0'], ['gci',
|
|
16
|
+
* '4bc8d...'], ['ordered', 'transfer']]
|
|
17
|
+
* - resolve to the individual interfaces:
|
|
18
|
+
* - /ip4/172.17.0.4/tcp/26657/tendermint/0.33/ibc/testnet-1.19.0/gci/4bc8d.../ordered/transfer
|
|
19
|
+
* - [['ip4', '172.17.0.4'], ['tcp', '26657'], ['tendermint', '0.33'], ['ibc',
|
|
20
|
+
* 'testnet-1.19.0'], ['gci', '4bc8d...'], ['ordered', 'transfer']]
|
|
21
|
+
*
|
|
22
|
+
* @typedef {[string, string][]} Multiaddr
|
|
23
|
+
*
|
|
24
|
+
* @typedef {string} Textaddr An address string formatted as in
|
|
25
|
+
* https://github.com/multiformats/multiaddr
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Transform a text address to a parsed multiaddr
|
|
29
|
+
*
|
|
30
|
+
* @param {Textaddr} ma
|
|
31
|
+
* @returns {Multiaddr}
|
|
32
|
+
*/
|
|
33
|
+
export function parse(ma: Textaddr): Multiaddr;
|
|
34
|
+
/**
|
|
35
|
+
* Transform a parsed multiaddr to a string.
|
|
36
|
+
*
|
|
37
|
+
* @param {Multiaddr | Textaddr} ma
|
|
38
|
+
* @returns {Textaddr}
|
|
39
|
+
*/
|
|
40
|
+
export function unparse(ma: Multiaddr | Textaddr): Textaddr;
|
|
41
|
+
/**
|
|
42
|
+
* Here is the difference between Textaddr and Multiaddr:
|
|
43
|
+
*
|
|
44
|
+
* - unspecified port on local ibc interface:
|
|
45
|
+
* - /if/ibc0
|
|
46
|
+
* - [['if', 'ibc0']]
|
|
47
|
+
* - specific local port:
|
|
48
|
+
* - /if/ibc0/ordered/transfer
|
|
49
|
+
* - [['if', 'ibc0'], ['ordered', 'transfer']]
|
|
50
|
+
* - remote pointer to chain:
|
|
51
|
+
* - /dnsaddr/ibc.testnet.agoric.com/ordered/transfer
|
|
52
|
+
* - [['dnsaddr', 'ibc.testnet.agoric.com'], ['ordered', 'transfer']]
|
|
53
|
+
* - resolve step to another pointer:
|
|
54
|
+
* - /dnsaddr/rpc.testnet.agoric.com/ibc/testnet-1.19.0/gci/4bc8d.../ordered/transfer
|
|
55
|
+
* - [['dnsaddr', 'rpc.testnet.agoric.com'], ['ibc', 'testnet-1.19.0'], ['gci',
|
|
56
|
+
* '4bc8d...'], ['ordered', 'transfer']]
|
|
57
|
+
* - resolve to the individual interfaces:
|
|
58
|
+
* - /ip4/172.17.0.4/tcp/26657/tendermint/0.33/ibc/testnet-1.19.0/gci/4bc8d.../ordered/transfer
|
|
59
|
+
* - [['ip4', '172.17.0.4'], ['tcp', '26657'], ['tendermint', '0.33'], ['ibc',
|
|
60
|
+
* 'testnet-1.19.0'], ['gci', '4bc8d...'], ['ordered', 'transfer']]
|
|
61
|
+
*/
|
|
62
|
+
export type Multiaddr = [string, string][];
|
|
63
|
+
/**
|
|
64
|
+
* An address string formatted as in
|
|
65
|
+
* https://github.com/multiformats/multiaddr
|
|
66
|
+
*/
|
|
67
|
+
export type Textaddr = string;
|
|
68
|
+
//# sourceMappingURL=multiaddr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiaddr.d.ts","sourceRoot":"","sources":["multiaddr.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;GAKG;AACH,0BAHW,QAAQ,GACN,SAAS,CA0BrB;AAED;;;;;GAKG;AACH,4BAHW,SAAS,GAAG,QAAQ,GAClB,QAAQ,CAQpB;;;;;;;;;;;;;;;;;;;;;;wBAlDY,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;;;;;uBAElB,MAAM"}
|
package/src/multiaddr.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Here is the difference between Textaddr and Multiaddr:
|
|
3
|
+
*
|
|
4
|
+
* - unspecified port on local ibc interface:
|
|
5
|
+
* - /if/ibc0
|
|
6
|
+
* - [['if', 'ibc0']]
|
|
7
|
+
* - specific local port:
|
|
8
|
+
* - /if/ibc0/ordered/transfer
|
|
9
|
+
* - [['if', 'ibc0'], ['ordered', 'transfer']]
|
|
10
|
+
* - remote pointer to chain:
|
|
11
|
+
* - /dnsaddr/ibc.testnet.agoric.com/ordered/transfer
|
|
12
|
+
* - [['dnsaddr', 'ibc.testnet.agoric.com'], ['ordered', 'transfer']]
|
|
13
|
+
* - resolve step to another pointer:
|
|
14
|
+
* - /dnsaddr/rpc.testnet.agoric.com/ibc/testnet-1.19.0/gci/4bc8d.../ordered/transfer
|
|
15
|
+
* - [['dnsaddr', 'rpc.testnet.agoric.com'], ['ibc', 'testnet-1.19.0'], ['gci',
|
|
16
|
+
* '4bc8d...'], ['ordered', 'transfer']]
|
|
17
|
+
* - resolve to the individual interfaces:
|
|
18
|
+
* - /ip4/172.17.0.4/tcp/26657/tendermint/0.33/ibc/testnet-1.19.0/gci/4bc8d.../ordered/transfer
|
|
19
|
+
* - [['ip4', '172.17.0.4'], ['tcp', '26657'], ['tendermint', '0.33'], ['ibc',
|
|
20
|
+
* 'testnet-1.19.0'], ['gci', '4bc8d...'], ['ordered', 'transfer']]
|
|
21
|
+
*
|
|
22
|
+
* @typedef {[string, string][]} Multiaddr
|
|
23
|
+
*
|
|
24
|
+
* @typedef {string} Textaddr An address string formatted as in
|
|
25
|
+
* https://github.com/multiformats/multiaddr
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Transform a text address to a parsed multiaddr
|
|
30
|
+
*
|
|
31
|
+
* @param {Textaddr} ma
|
|
32
|
+
* @returns {Multiaddr}
|
|
33
|
+
*/
|
|
34
|
+
export function parse(ma) {
|
|
35
|
+
if (typeof ma !== 'string') {
|
|
36
|
+
return ma;
|
|
37
|
+
}
|
|
38
|
+
let s = ma;
|
|
39
|
+
let m;
|
|
40
|
+
/** @type {[string, string][]} */
|
|
41
|
+
const acc = [];
|
|
42
|
+
// eslint-disable-next-line no-cond-assign
|
|
43
|
+
while ((m = s.match(/^\/([^/]*)(\/([^/]*))?/))) {
|
|
44
|
+
s = s.slice(m[0].length);
|
|
45
|
+
if (m[2]) {
|
|
46
|
+
acc.push([m[1], m[3]]);
|
|
47
|
+
} else {
|
|
48
|
+
// @ts-expect-error '[string]' is not assignable to parameter of type '[string, string]'
|
|
49
|
+
acc.push([m[1]]);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (s !== '' || s === ma) {
|
|
53
|
+
throw TypeError(
|
|
54
|
+
`Error parsing Multiaddr ${JSON.stringify(ma)} at ${JSON.stringify(s)}`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return acc;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Transform a parsed multiaddr to a string.
|
|
62
|
+
*
|
|
63
|
+
* @param {Multiaddr | Textaddr} ma
|
|
64
|
+
* @returns {Textaddr}
|
|
65
|
+
*/
|
|
66
|
+
export function unparse(ma) {
|
|
67
|
+
if (typeof ma === 'string') {
|
|
68
|
+
return ma;
|
|
69
|
+
}
|
|
70
|
+
const joined = ma.map(kv => kv.join('/')).join('/');
|
|
71
|
+
return `/${joined}`;
|
|
72
|
+
}
|
package/src/network.d.ts
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the list of prefixes from longest to shortest.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} addr
|
|
5
|
+
*/
|
|
6
|
+
export function getPrefixes(addr: string): string[];
|
|
7
|
+
/** @typedef {ReturnType<typeof prepareEchoConnectionKit>} MakeEchoConnectionKit */
|
|
8
|
+
/**
|
|
9
|
+
* Create a protocol handler that just connects to itself.
|
|
10
|
+
*
|
|
11
|
+
* @param {import('@agoric/base-zone').Zone} zone
|
|
12
|
+
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers
|
|
13
|
+
*/
|
|
14
|
+
export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone").Zone, { watch, allVows }: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: {
|
|
15
|
+
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined;
|
|
16
|
+
} | undefined) => {
|
|
17
|
+
E: (<T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => ECallableOrMethods<RemoteFunctions<T>>) & {
|
|
18
|
+
readonly get: <T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => EGetters<LocalRecord<T>>;
|
|
19
|
+
readonly resolve: <T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => Promise<Awaited<T>>;
|
|
20
|
+
readonly sendOnly: <T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => ESendOnlyCallableOrMethods<RemoteFunctions<T>>;
|
|
21
|
+
readonly when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(x: import("@agoric/vow/src/E.js").ERef<T>, onfulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => ERef<TResult1>) | undefined, onrejected?: ((reason: any) => ERef<TResult2>) | undefined, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => Promise<TResult1 | TResult2>;
|
|
22
|
+
} & {
|
|
23
|
+
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
24
|
+
watch: <T = any, TResult1 = T, TResult2 = never, C extends any[] = any[]>(specimenP: import("@agoric/vow").EVow<T>, watcher?: import("@agoric/vow").Watcher<T, TResult1, TResult2, C> | undefined, ...watcherArgs: C) => import("@agoric/vow").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
|
|
25
|
+
};
|
|
26
|
+
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
27
|
+
watch: <T = any, TResult1 = T, TResult2 = never, C extends any[] = any[]>(specimenP: import("@agoric/vow").EVow<T>, watcher?: import("@agoric/vow").Watcher<T, TResult1, TResult2, C> | undefined, ...watcherArgs: C) => import("@agoric/vow").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
|
|
28
|
+
makeVowKit: <T>() => import("@agoric/vow").VowKit<T>;
|
|
29
|
+
allVows: (maybeVows: import("@agoric/vow").EVow<unknown>[]) => import("@agoric/vow").Vow<any[]>;
|
|
30
|
+
asVow: <T extends unknown>(fn: (...args: any[]) => import("@agoric/vow").Vow<Awaited<T>> | Awaited<T> | import("@agoric/vow").PromiseVow<T>) => import("@agoric/vow").Vow<Awaited<T>>;
|
|
31
|
+
asPromise: import("@agoric/vow").AsPromiseFunction;
|
|
32
|
+
}>): (instancePrefix?: string | undefined) => import("@endo/exo").Guarded<{
|
|
33
|
+
onCreate(_impl: any, _protocolHandler: any): Promise<void>;
|
|
34
|
+
generatePortID(_localAddr: any, _protocolHandler: any): Promise<string>;
|
|
35
|
+
onBind(_port: any, _localAddr: any, _protocolHandler: any): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* @param {*} _port
|
|
38
|
+
* @param {Endpoint} localAddr
|
|
39
|
+
* @param {Endpoint} remoteAddr
|
|
40
|
+
* @returns {import('@agoric/vow').PromiseVow<AttemptDescription>}}
|
|
41
|
+
*/
|
|
42
|
+
onConnect(_port: any, localAddr: Endpoint, remoteAddr: Endpoint): import("@agoric/vow").PromiseVow<AttemptDescription>;
|
|
43
|
+
onInstantiate(_port: any, _localAddr: any, _remote: any, _protocol: any): Promise<string>;
|
|
44
|
+
onListen(port: any, localAddr: any, listenHandler: any, _protocolHandler: any): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* @param {import('@agoric/vow').Remote<Port>} port
|
|
47
|
+
* @param {Endpoint} localAddr
|
|
48
|
+
* @param {import('@agoric/vow').Remote<ListenHandler>} listenHandler
|
|
49
|
+
* @param {*} _protocolHandler
|
|
50
|
+
*/
|
|
51
|
+
onListenRemove(port: import("@agoric/vow").Remote<Port>, localAddr: Endpoint, listenHandler: import("@agoric/vow").Remote<ListenHandler>, _protocolHandler: any): Promise<void>;
|
|
52
|
+
onRevoke(_port: any, _localAddr: any, _protocolHandler: any): Promise<void>;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* @import {AttemptDescription, Bytes, Closable, CloseReason, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js';
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* Compatibility note: this must match what our peers use, so don't change it
|
|
59
|
+
* casually.
|
|
60
|
+
*/
|
|
61
|
+
export const ENDPOINT_SEPARATOR: "/";
|
|
62
|
+
export function rethrowUnlessMissing(err: unknown): undefined;
|
|
63
|
+
export function crossoverConnection(zone: import("@agoric/zone").Zone, handler0: import("@agoric/vow").Remote<Required<ConnectionHandler>>, addr0: Endpoint, handler1: import("@agoric/vow").Remote<Required<ConnectionHandler>>, addr1: Endpoint, makeConnection: (opts: ConnectionOpts) => Connection, current?: globalThis.WeakSetStore<Closable> | undefined): Connection[];
|
|
64
|
+
export function prepareNetworkProtocol(zone: import("@agoric/base-zone").Zone, powers: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: {
|
|
65
|
+
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined;
|
|
66
|
+
} | undefined) => {
|
|
67
|
+
E: (<T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => ECallableOrMethods<RemoteFunctions<T>>) & {
|
|
68
|
+
readonly get: <T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => EGetters<LocalRecord<T>>;
|
|
69
|
+
readonly resolve: <T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => Promise<Awaited<T>>;
|
|
70
|
+
readonly sendOnly: <T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => ESendOnlyCallableOrMethods<RemoteFunctions<T>>;
|
|
71
|
+
readonly when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(x: import("@agoric/vow/src/E.js").ERef<T>, onfulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => ERef<TResult1>) | undefined, onrejected?: ((reason: any) => ERef<TResult2>) | undefined, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => Promise<TResult1 | TResult2>;
|
|
72
|
+
} & {
|
|
73
|
+
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
74
|
+
watch: <T = any, TResult1 = T, TResult2 = never, C extends any[] = any[]>(specimenP: import("@agoric/vow").EVow<T>, watcher?: import("@agoric/vow").Watcher<T, TResult1, TResult2, C> | undefined, ...watcherArgs: C) => import("@agoric/vow").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
|
|
75
|
+
};
|
|
76
|
+
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
77
|
+
watch: <T = any, TResult1 = T, TResult2 = never, C extends any[] = any[]>(specimenP: import("@agoric/vow").EVow<T>, watcher?: import("@agoric/vow").Watcher<T, TResult1, TResult2, C> | undefined, ...watcherArgs: C) => import("@agoric/vow").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
|
|
78
|
+
makeVowKit: <T>() => import("@agoric/vow").VowKit<T>;
|
|
79
|
+
allVows: (maybeVows: import("@agoric/vow").EVow<unknown>[]) => import("@agoric/vow").Vow<any[]>;
|
|
80
|
+
asVow: <T extends unknown>(fn: (...args: any[]) => import("@agoric/vow").Vow<Awaited<T>> | Awaited<T> | import("@agoric/vow").PromiseVow<T>) => import("@agoric/vow").Vow<Awaited<T>>;
|
|
81
|
+
asPromise: import("@agoric/vow").AsPromiseFunction;
|
|
82
|
+
}>): (protocolHandler: import("@agoric/vow").Remote<ProtocolHandler>) => Protocol;
|
|
83
|
+
export function prepareEchoConnectionKit(zone: import("@agoric/base-zone").Zone): () => import("@endo/exo").GuardedKit<{
|
|
84
|
+
handler: {
|
|
85
|
+
/**
|
|
86
|
+
* @param {Connection} _connection
|
|
87
|
+
* @param {Bytes} bytes
|
|
88
|
+
* @param {ConnectionHandler} _connectionHandler
|
|
89
|
+
*/
|
|
90
|
+
onReceive(_connection: Connection, bytes: Bytes, _connectionHandler: ConnectionHandler): Promise<string>;
|
|
91
|
+
/**
|
|
92
|
+
* @param {Connection} _connection
|
|
93
|
+
* @param {CloseReason} [_reason]
|
|
94
|
+
* @param {ConnectionHandler} [_connectionHandler]
|
|
95
|
+
*/
|
|
96
|
+
onClose(_connection: Connection, _reason?: CloseReason, _connectionHandler?: ConnectionHandler | undefined): Promise<void>;
|
|
97
|
+
};
|
|
98
|
+
listener: {
|
|
99
|
+
onAccept(_port: any, _localAddr: any, _remoteAddr: any, _listenHandler: any): Promise<import("@endo/exo").Guarded<{
|
|
100
|
+
/**
|
|
101
|
+
* @param {Connection} _connection
|
|
102
|
+
* @param {Bytes} bytes
|
|
103
|
+
* @param {ConnectionHandler} _connectionHandler
|
|
104
|
+
*/
|
|
105
|
+
onReceive(_connection: Connection, bytes: Bytes, _connectionHandler: ConnectionHandler): Promise<string>;
|
|
106
|
+
/**
|
|
107
|
+
* @param {Connection} _connection
|
|
108
|
+
* @param {CloseReason} [_reason]
|
|
109
|
+
* @param {ConnectionHandler} [_connectionHandler]
|
|
110
|
+
*/
|
|
111
|
+
onClose(_connection: Connection, _reason?: CloseReason, _connectionHandler?: ConnectionHandler | undefined): Promise<void>;
|
|
112
|
+
}>>;
|
|
113
|
+
onListen(port: any, _listenHandler: any): Promise<void>;
|
|
114
|
+
};
|
|
115
|
+
}>;
|
|
116
|
+
export function preparePortAllocator(zone: import("@agoric/base-zone").Zone, { watch }: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: {
|
|
117
|
+
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined;
|
|
118
|
+
} | undefined) => {
|
|
119
|
+
E: (<T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => ECallableOrMethods<RemoteFunctions<T>>) & {
|
|
120
|
+
readonly get: <T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => EGetters<LocalRecord<T>>;
|
|
121
|
+
readonly resolve: <T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => Promise<Awaited<T>>;
|
|
122
|
+
readonly sendOnly: <T>(x: T, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => ESendOnlyCallableOrMethods<RemoteFunctions<T>>;
|
|
123
|
+
readonly when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(x: import("@agoric/vow/src/E.js").ERef<T>, onfulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => ERef<TResult1>) | undefined, onrejected?: ((reason: any) => ERef<TResult2>) | undefined, opts?: import("@agoric/vow").EUnwrapOptions | undefined) => Promise<TResult1 | TResult2>;
|
|
124
|
+
} & {
|
|
125
|
+
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
126
|
+
watch: <T = any, TResult1 = T, TResult2 = never, C extends any[] = any[]>(specimenP: import("@agoric/vow").EVow<T>, watcher?: import("@agoric/vow").Watcher<T, TResult1, TResult2, C> | undefined, ...watcherArgs: C) => import("@agoric/vow").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
|
|
127
|
+
};
|
|
128
|
+
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
129
|
+
watch: <T = any, TResult1 = T, TResult2 = never, C extends any[] = any[]>(specimenP: import("@agoric/vow").EVow<T>, watcher?: import("@agoric/vow").Watcher<T, TResult1, TResult2, C> | undefined, ...watcherArgs: C) => import("@agoric/vow").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
|
|
130
|
+
makeVowKit: <T>() => import("@agoric/vow").VowKit<T>;
|
|
131
|
+
allVows: (maybeVows: import("@agoric/vow").EVow<unknown>[]) => import("@agoric/vow").Vow<any[]>;
|
|
132
|
+
asVow: <T extends unknown>(fn: (...args: any[]) => import("@agoric/vow").Vow<Awaited<T>> | Awaited<T> | import("@agoric/vow").PromiseVow<T>) => import("@agoric/vow").Vow<Awaited<T>>;
|
|
133
|
+
asPromise: import("@agoric/vow").AsPromiseFunction;
|
|
134
|
+
}>): (args_0: {
|
|
135
|
+
protocol: Protocol;
|
|
136
|
+
}) => import("@endo/exo").Guarded<{
|
|
137
|
+
allocateCustomIBCPort(specifiedName?: string): Promise<import("@agoric/vow").Vow<Port>>;
|
|
138
|
+
allocateICAControllerPort(): Promise<import("@agoric/vow").Vow<Port>>;
|
|
139
|
+
allocateICQControllerPort(): Promise<import("@agoric/vow").Vow<Port>>;
|
|
140
|
+
allocateCustomLocalPort(specifiedName?: string): Promise<import("@agoric/vow").Vow<Port>>;
|
|
141
|
+
}>;
|
|
142
|
+
export type MakeEchoConnectionKit = ReturnType<typeof prepareEchoConnectionKit>;
|
|
143
|
+
export type ConnectionOpts = {
|
|
144
|
+
addrs: Endpoint[];
|
|
145
|
+
handlers: import("@agoric/vow").Remote<Required<ConnectionHandler>>[];
|
|
146
|
+
conns: MapStore<number, Connection>;
|
|
147
|
+
current: WeakSetStore<Closable>;
|
|
148
|
+
l: 0 | 1;
|
|
149
|
+
r: 0 | 1;
|
|
150
|
+
};
|
|
151
|
+
export type PortAllocator = ReturnType<ReturnType<typeof preparePortAllocator>>;
|
|
152
|
+
import type { Endpoint } from './types.js';
|
|
153
|
+
import type { AttemptDescription } from './types.js';
|
|
154
|
+
import type { Port } from './types.js';
|
|
155
|
+
import type { ListenHandler } from './types.js';
|
|
156
|
+
import type { ConnectionHandler } from './types.js';
|
|
157
|
+
import type { Connection } from './types.js';
|
|
158
|
+
import type { Closable } from './types.js';
|
|
159
|
+
import type { ProtocolHandler } from './types.js';
|
|
160
|
+
import type { Protocol } from './types.js';
|
|
161
|
+
import type { Bytes } from './types.js';
|
|
162
|
+
import type { CloseReason } from './types.js';
|
|
163
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["network.js"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,kCAFW,MAAM,YAahB;AAutCD,mFAAmF;AAEnF;;;;;GAKG;AACH,qDAHW,OAAO,mBAAmB,EAAE,IAAI,sBAChC,UAAU,CAAC;;;;;;;;;;;;;;;;oCApqCE,GAAG;;CAoqCgC,CAAC;;;;IAmCpD;;;;;OAKG;qBAJQ,GAAC,aACD,QAAQ,cACR,QAAQ,GACN,OAAO,aAAa,EAAE,UAAU,CAAC,kBAAkB,CAAC;;;IAiEjE;;;;;OAKG;yBAJQ,OAAO,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,aAClC,QAAQ,iBACR,OAAO,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,oBAC3C,GAAC;;GA+CnB;AA/5CD;;GAEG;AAEH;;;GAGG;AACH,qCAAsC;AAG/B,0CADK,OAAO,aAWlB;AAyJM,0CARI,OAAO,cAAc,EAAE,IAAI,YAC3B,OAAO,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,SACzD,QAAQ,YACR,OAAO,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,SACzD,QAAQ,kBACR,CAAC,IAAI,EAAE,cAAc,KAAK,UAAU,yEAgD9C;AA+6BM,6CAHI,OAAO,mBAAmB,EAAE,IAAI,UAChC,UAAU,CAAC;;;;;;;;;;;;;;;;oCAxiCE,GAAG;;CAwiCgC,CAAC,qBAM/C,OAAO,aAAa,EAAE,MAAM,CAAC,eAAe,CAAC,KAC3C,QAAQ,CA2BtB;AAOM,+CAFI,OAAO,mBAAmB,EAAE,IAAI;;QAsCnC;;;;WAIG;+BAHQ,UAAU,SACV,KAAK,sBACL,iBAAiB;QAU5B;;;;WAIG;6BAHQ,UAAU,YACV,WAAW;;;;YAftB;;;;eAIG;mCAHQ,UAAU,SACV,KAAK,sBACL,iBAAiB;YAU5B;;;;eAIG;iCAHQ,UAAU,YACV,WAAW;;;;GAyB7B;AAyKM,2CAHI,OAAO,mBAAmB,EAAE,IAAI,aAChC,UAAU,CAAC;;;;;;;;;;;;;;;;oCAp0CE,GAAG;;CAo0CgC,CAAC;cAkB7C,QAAQ;;;;;;GAkDpB;oCA1OW,UAAU,CAAC,OAAO,wBAAwB,CAAC;;WArsC3C,QAAQ,EAAE;cACV,OAAO,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,EAAE;WAC3D,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;aAC5B,YAAY,CAAC,QAAQ,CAAC;OACtB,CAAC,GAAC,CAAC;OACH,CAAC,GAAC,CAAC;;4BA26CH,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;8BAx+CyG,YAAY;wCAAZ,YAAY;0BAAZ,YAAY;mCAAZ,YAAY;uCAAZ,YAAY;gCAAZ,YAAY;8BAAZ,YAAY;qCAAZ,YAAY;8BAAZ,YAAY;2BAAZ,YAAY;iCAAZ,YAAY"}
|