Merge pull request #957 from waku-org/relay-type

This commit is contained in:
fryorcraken.eth 2022-09-14 22:54:13 +10:00 committed by GitHub
commit 0c83953e55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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<RelayCreateOptions>
): Promise<WakuPrivacy> {
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<RelayCreateOptions>
): Promise<WakuFull> {
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<RelayCreateOptions>
): Promise<Waku> {
const libp2pOptions = options?.libp2p ?? {};
const peerDiscovery = libp2pOptions.peerDiscovery ?? [];

View File

@ -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,