feat: merge gossipsub type in CreateOptions interface

This commit is contained in:
fryorcraken.eth 2022-09-07 12:17:33 +10:00
parent a54494dbbf
commit aee054d9d6
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4

View File

@ -18,7 +18,7 @@ import * as constants from "./constants";
const log = debug("waku:relay"); const log = debug("waku:relay");
export interface CreateOptions { export type CreateOptions = {
/** /**
* The PubSub Topic to use. Defaults to {@link DefaultPubSubTopic}. * The PubSub Topic to use. Defaults to {@link DefaultPubSubTopic}.
* *
@ -34,7 +34,7 @@ export interface CreateOptions {
*/ */
pubSubTopic?: string; pubSubTopic?: string;
decryptionKeys?: Array<Uint8Array | string>; decryptionKeys?: Array<Uint8Array | string>;
} } & GossipsubOpts;
/** /**
* Implements the [Waku v2 Relay protocol](https://rfc.vac.dev/spec/11/). * Implements the [Waku v2 Relay protocol](https://rfc.vac.dev/spec/11/).
@ -59,7 +59,7 @@ export class WakuRelay extends GossipSub {
[contentTopic: string]: Set<(message: WakuMessage) => void>; [contentTopic: string]: Set<(message: WakuMessage) => void>;
}; };
constructor(options?: Partial<CreateOptions & GossipsubOpts>) { constructor(options?: Partial<CreateOptions>) {
options = Object.assign(options ?? {}, { options = Object.assign(options ?? {}, {
// Ensure that no signature is included nor expected in the messages. // Ensure that no signature is included nor expected in the messages.
globalSignaturePolicy: SignaturePolicy.StrictNoSign, globalSignaturePolicy: SignaturePolicy.StrictNoSign,