@@ -14,7 +14,13 @@ import {
14
14
} from "@waku/core" ;
15
15
import { DefaultUserAgent } from "@waku/core" ;
16
16
import { enrTree , wakuDnsDiscovery } from "@waku/dns-discovery" ;
17
- import type { FullNode , IRelay , LightNode , RelayNode } from "@waku/interfaces" ;
17
+ import type {
18
+ FullNode ,
19
+ IRelay ,
20
+ LightNode ,
21
+ ProtocolCreateOptions ,
22
+ RelayNode ,
23
+ } from "@waku/interfaces" ;
18
24
import { wakuPeerExchange } from "@waku/peer-exchange" ;
19
25
import type { Libp2p } from "libp2p" ;
20
26
import { createLibp2p , Libp2pOptions } from "libp2p" ;
@@ -29,39 +35,6 @@ const DEFAULT_NODE_REQUIREMENTS = {
29
35
30
36
export { Libp2pComponents } ;
31
37
32
- export interface CreateOptions {
33
- /**
34
- * The PubSub Topic to use.
35
- *
36
- * One and only one pubsub topic is used by Waku. This is used by:
37
- * - WakuRelay to receive, route and send messages,
38
- * - WakuLightPush to send messages,
39
- * - WakuStore to retrieve messages.
40
- *
41
- * The usage of the default pubsub topic is recommended.
42
- * See [Waku v2 Topic Usage Recommendations](https://rfc.vac.dev/spec/23/) for details.
43
- */
44
- pubSubTopic ?: string ;
45
- /**
46
- * You can pass options to the `Libp2p` instance used by {@link @waku/core.WakuNode } using the {@link CreateOptions.libp2p} property.
47
- * This property is the same type as the one passed to [`Libp2p.create`](https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#create)
48
- * apart that we made the `modules` property optional and partial,
49
- * allowing its omission and letting Waku set good defaults.
50
- * Notes that some values are overridden by {@link @waku/core.WakuNode } to ensure it implements the Waku protocol.
51
- */
52
- libp2p ?: Partial < Libp2pOptions > ;
53
- /**
54
- * Byte array used as key for the noise protocol used for connection encryption
55
- * by [`Libp2p.create`](https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#create)
56
- * This is only used for test purposes to not run out of entropy during CI runs.
57
- */
58
- staticNoiseKey ?: Uint8Array ;
59
- /**
60
- * Use recommended bootstrap method to discovery and connect to new nodes.
61
- */
62
- defaultBootstrap ?: boolean ;
63
- }
64
-
65
38
/**
66
39
* Create a Waku node that uses Waku Light Push, Filter and Store to send and
67
40
* receive messages, enabling low resource consumption.
@@ -70,7 +43,7 @@ export interface CreateOptions {
70
43
* @see https://github.com/status-im/nwaku/issues/1085
71
44
*/
72
45
export async function createLightNode (
73
- options ?: CreateOptions & WakuOptions
46
+ options ?: ProtocolCreateOptions & WakuOptions
74
47
) : Promise < LightNode > {
75
48
const libp2pOptions = options ?. libp2p ?? { } ;
76
49
const peerDiscovery = libp2pOptions . peerDiscovery ?? [ ] ;
@@ -106,7 +79,7 @@ export async function createLightNode(
106
79
* enabling some privacy preserving properties.
107
80
*/
108
81
export async function createRelayNode (
109
- options ?: CreateOptions & WakuOptions & Partial < RelayCreateOptions >
82
+ options ?: ProtocolCreateOptions & WakuOptions & Partial < RelayCreateOptions >
110
83
) : Promise < RelayNode > {
111
84
const libp2pOptions = options ?. libp2p ?? { } ;
112
85
const peerDiscovery = libp2pOptions . peerDiscovery ?? [ ] ;
@@ -138,7 +111,7 @@ export async function createRelayNode(
138
111
* @internal
139
112
*/
140
113
export async function createFullNode (
141
- options ?: CreateOptions & WakuOptions & Partial < RelayCreateOptions >
114
+ options ?: ProtocolCreateOptions & WakuOptions & Partial < RelayCreateOptions >
142
115
) : Promise < FullNode > {
143
116
const libp2pOptions = options ?. libp2p ?? { } ;
144
117
const peerDiscovery = libp2pOptions . peerDiscovery ?? [ ] ;
0 commit comments