@waku/interfaces 0.0.6 → 0.0.7
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 +9 -1
- package/dist/enr.d.ts +34 -0
- package/dist/enr.js +2 -0
- package/dist/enr.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/peer_exchange.d.ts +4 -2
- package/package.json +1 -1
- package/src/enr.ts +38 -0
- package/src/index.ts +1 -0
- package/src/peer_exchange.ts +4 -2
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.0.7] - 2023-01-18
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- `IPeerExchange` interface.
|
15
|
+
- `IEnr` interface.
|
16
|
+
|
10
17
|
## [0.0.6] - 2022-12-15
|
11
18
|
|
12
19
|
### Changed
|
@@ -21,7 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
21
28
|
|
22
29
|
- Alpha version of `@waku/interfaces`.
|
23
30
|
|
24
|
-
[unreleased]: https://github.com/waku-org/js-waku/compare/@waku/interfaces@0.0.
|
31
|
+
[unreleased]: https://github.com/waku-org/js-waku/compare/@waku/interfaces@0.0.7...HEAD
|
32
|
+
[0.0.7]: https://github.com/waku-org/js-waku/compare/@waku/interfaces@0.0.6...@waku/interfaces@0.0.7
|
25
33
|
[0.0.6]: https://github.com/waku-org/js-waku/compare/@waku/interfaces@0.0.5...@waku/interfaces@0.0.6
|
26
34
|
[0.0.5]: https://github.com/waku-org/js-waku/compare/@waku/interfaces@0.0.4...@waku/interfaces@0.0.5
|
27
35
|
[0.0.4]: https://github.com/waku-org/js-waku/compare/@waku/interfaces@0.0.3...@waku/interfaces@0.0.4
|
package/dist/enr.d.ts
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { PeerId } from "@libp2p/interface-peer-id";
|
2
|
+
import type { Multiaddr } from "@multiformats/multiaddr";
|
3
|
+
export declare type ENRKey = string;
|
4
|
+
export declare type ENRValue = Uint8Array;
|
5
|
+
/**
|
6
|
+
* We represent NodeId as a hex string, since node equality is used very heavily
|
7
|
+
* and it is convenient to index data by NodeId
|
8
|
+
*/
|
9
|
+
export declare type NodeId = string;
|
10
|
+
export declare type SequenceNumber = bigint;
|
11
|
+
export interface Waku2 {
|
12
|
+
relay: boolean;
|
13
|
+
store: boolean;
|
14
|
+
filter: boolean;
|
15
|
+
lightPush: boolean;
|
16
|
+
}
|
17
|
+
export interface IEnr extends Map<ENRKey, ENRValue> {
|
18
|
+
nodeId?: NodeId;
|
19
|
+
peerId?: PeerId;
|
20
|
+
id: string;
|
21
|
+
seq: SequenceNumber;
|
22
|
+
publicKey?: Uint8Array;
|
23
|
+
signature?: Uint8Array;
|
24
|
+
ip?: string;
|
25
|
+
tcp?: number;
|
26
|
+
udp?: number;
|
27
|
+
ip6?: string;
|
28
|
+
tcp6?: number;
|
29
|
+
udp6?: number;
|
30
|
+
multiaddrs?: Multiaddr[];
|
31
|
+
waku2?: Waku2;
|
32
|
+
encode(privateKey?: Uint8Array): Promise<Uint8Array>;
|
33
|
+
getFullMultiaddrs(): Multiaddr[];
|
34
|
+
}
|
package/dist/enr.js
ADDED
package/dist/enr.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"enr.js","sourceRoot":"","sources":["../src/enr.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
package/dist/peer_exchange.d.ts
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
import type { ConnectionManager } from "@libp2p/interface-connection-manager";
|
2
|
+
import type { PeerId } from "@libp2p/interface-peer-id";
|
2
3
|
import type { PeerStore } from "@libp2p/interface-peer-store";
|
3
4
|
import type { Registrar } from "@libp2p/interface-registrar";
|
4
|
-
import {
|
5
|
+
import { IEnr } from "./enr.js";
|
5
6
|
import { PointToPointProtocol } from "./protocols.js";
|
6
7
|
export interface IPeerExchange extends PointToPointProtocol {
|
7
8
|
query(params: PeerExchangeQueryParams, callback: (response: PeerExchangeResponse) => Promise<void> | void): Promise<void>;
|
8
9
|
}
|
9
10
|
export interface PeerExchangeQueryParams {
|
10
11
|
numPeers: number;
|
12
|
+
peerId?: PeerId;
|
11
13
|
}
|
12
14
|
export interface PeerExchangeResponse {
|
13
15
|
peerInfos: PeerInfo[];
|
14
16
|
}
|
15
17
|
export interface PeerInfo {
|
16
|
-
ENR?:
|
18
|
+
ENR?: IEnr;
|
17
19
|
}
|
18
20
|
export interface PeerExchangeComponents {
|
19
21
|
connectionManager: ConnectionManager;
|
package/package.json
CHANGED
package/src/enr.ts
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { PeerId } from "@libp2p/interface-peer-id";
|
2
|
+
import type { Multiaddr } from "@multiformats/multiaddr";
|
3
|
+
|
4
|
+
export type ENRKey = string;
|
5
|
+
export type ENRValue = Uint8Array;
|
6
|
+
/**
|
7
|
+
* We represent NodeId as a hex string, since node equality is used very heavily
|
8
|
+
* and it is convenient to index data by NodeId
|
9
|
+
*/
|
10
|
+
export type NodeId = string;
|
11
|
+
export type SequenceNumber = bigint;
|
12
|
+
|
13
|
+
export interface Waku2 {
|
14
|
+
relay: boolean;
|
15
|
+
store: boolean;
|
16
|
+
filter: boolean;
|
17
|
+
lightPush: boolean;
|
18
|
+
}
|
19
|
+
|
20
|
+
export interface IEnr extends Map<ENRKey, ENRValue> {
|
21
|
+
nodeId?: NodeId;
|
22
|
+
peerId?: PeerId;
|
23
|
+
id: string;
|
24
|
+
seq: SequenceNumber;
|
25
|
+
publicKey?: Uint8Array;
|
26
|
+
signature?: Uint8Array;
|
27
|
+
ip?: string;
|
28
|
+
tcp?: number;
|
29
|
+
udp?: number;
|
30
|
+
ip6?: string;
|
31
|
+
tcp6?: number;
|
32
|
+
udp6?: number;
|
33
|
+
multiaddrs?: Multiaddr[];
|
34
|
+
waku2?: Waku2;
|
35
|
+
|
36
|
+
encode(privateKey?: Uint8Array): Promise<Uint8Array>;
|
37
|
+
getFullMultiaddrs(): Multiaddr[];
|
38
|
+
}
|
package/src/index.ts
CHANGED
package/src/peer_exchange.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import type { ConnectionManager } from "@libp2p/interface-connection-manager";
|
2
|
+
import type { PeerId } from "@libp2p/interface-peer-id";
|
2
3
|
import type { PeerStore } from "@libp2p/interface-peer-store";
|
3
4
|
import type { Registrar } from "@libp2p/interface-registrar";
|
4
|
-
import { ENR } from "@waku/enr";
|
5
5
|
|
6
|
+
import { IEnr } from "./enr.js";
|
6
7
|
import { PointToPointProtocol } from "./protocols.js";
|
7
8
|
|
8
9
|
export interface IPeerExchange extends PointToPointProtocol {
|
@@ -14,6 +15,7 @@ export interface IPeerExchange extends PointToPointProtocol {
|
|
14
15
|
|
15
16
|
export interface PeerExchangeQueryParams {
|
16
17
|
numPeers: number;
|
18
|
+
peerId?: PeerId;
|
17
19
|
}
|
18
20
|
|
19
21
|
export interface PeerExchangeResponse {
|
@@ -21,7 +23,7 @@ export interface PeerExchangeResponse {
|
|
21
23
|
}
|
22
24
|
|
23
25
|
export interface PeerInfo {
|
24
|
-
ENR?:
|
26
|
+
ENR?: IEnr;
|
25
27
|
}
|
26
28
|
|
27
29
|
export interface PeerExchangeComponents {
|