From b113f3fc25b22c351c45929ff8fcd30ff81472ea Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Wed, 14 Sep 2022 22:24:00 +1000 Subject: [PATCH] fix: correct options type to enable passing gossipsub options on create* --- CHANGELOG.md | 4 ++++ src/lib/create_waku.ts | 8 ++++---- src/lib/waku_relay/index.node.spec.ts | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa25bb5466..1414e46d6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Correct options type for `createFullNode` & `createPrivacy` to enable passing gossipsub options. + ## [0.27.0] - 2022-09-13 ### Added diff --git a/src/lib/create_waku.ts b/src/lib/create_waku.ts index c11476c41b..f0c1d2c8ee 100644 --- a/src/lib/create_waku.ts +++ b/src/lib/create_waku.ts @@ -12,7 +12,7 @@ import { getPredefinedBootstrapNodes } from "./predefined_bootstrap_nodes"; import { WakuNode, WakuOptions } from "./waku"; import { WakuFilter } from "./waku_filter"; import { WakuLightPush } from "./waku_light_push"; -import { WakuRelay } from "./waku_relay"; +import { CreateOptions as RelayCreateOptions, WakuRelay } from "./waku_relay"; import { WakuStore } from "./waku_store"; export interface CreateOptions { @@ -87,7 +87,7 @@ export async function createLightNode( * enabling some privacy preserving properties. */ export async function createPrivacyNode( - options?: CreateOptions & WakuOptions + options?: CreateOptions & WakuOptions & Partial ): Promise { const libp2pOptions = options?.libp2p ?? {}; const peerDiscovery = libp2pOptions.peerDiscovery ?? []; @@ -115,7 +115,7 @@ export async function createPrivacyNode( * @internal */ export async function createFullNode( - options?: CreateOptions & WakuOptions + options?: CreateOptions & WakuOptions & Partial ): Promise { const libp2pOptions = options?.libp2p ?? {}; const peerDiscovery = libp2pOptions.peerDiscovery ?? []; @@ -144,7 +144,7 @@ export async function createFullNode( * { @link index.waku.WakuNode.constructor } instead. */ export async function createWaku( - options?: CreateOptions & WakuOptions + options?: CreateOptions & WakuOptions & Partial ): Promise { const libp2pOptions = options?.libp2p ?? {}; const peerDiscovery = libp2pOptions.peerDiscovery ?? []; diff --git a/src/lib/waku_relay/index.node.spec.ts b/src/lib/waku_relay/index.node.spec.ts index 8f9f7319ba..3fb93e615c 100644 --- a/src/lib/waku_relay/index.node.spec.ts +++ b/src/lib/waku_relay/index.node.spec.ts @@ -444,6 +444,7 @@ describe("Waku Relay [node only]", () => { [waku1, waku2] = await Promise.all([ createPrivacyNode({ staticNoiseKey: NOISE_KEY_1, + emitSelf: true, }).then((waku) => waku.start().then(() => waku)), createPrivacyNode({ staticNoiseKey: NOISE_KEY_2,