address comments

This commit is contained in:
danisharora099 2022-11-16 19:00:09 +05:30
parent 5c4118041e
commit 0f73c0f331
No known key found for this signature in database
GPG Key ID: FBD2BF500037F135
2 changed files with 4 additions and 6 deletions

View File

@ -3,7 +3,7 @@ import type { PeerId } from "@libp2p/interface-peer-id";
import { Peer } from "@libp2p/interface-peer-store"; import { Peer } from "@libp2p/interface-peer-store";
import { sha256 } from "@noble/hashes/sha256"; import { sha256 } from "@noble/hashes/sha256";
import { concat, utf8ToBytes } from "@waku/byte-utils"; import { concat, utf8ToBytes } from "@waku/byte-utils";
import { DecodedMessage, Decoder } from "@waku/interfaces"; import { DecodedMessage, Decoder, Index } from "@waku/interfaces";
import debug from "debug"; import debug from "debug";
import all from "it-all"; import all from "it-all";
import * as lp from "it-length-prefixed"; import * as lp from "it-length-prefixed";
@ -80,7 +80,7 @@ export interface QueryOptions {
/** /**
* Cursor as an index to start a query from. * Cursor as an index to start a query from.
*/ */
cursor?: proto.Index; cursor?: Index;
} }
/** /**
@ -278,7 +278,7 @@ async function* paginate<T extends DecodedMessage>(
protocol: string, protocol: string,
queryOpts: Params, queryOpts: Params,
decoders: Map<string, Decoder<T>>, decoders: Map<string, Decoder<T>>,
cursor?: proto.Index cursor?: Index
): AsyncGenerator<Promise<T | undefined>[]> { ): AsyncGenerator<Promise<T | undefined>[]> {
if ( if (
queryOpts.contentTopics.toString() !== queryOpts.contentTopics.toString() !==
@ -381,7 +381,7 @@ export function isDefined<T>(msg: T | undefined): msg is T {
export async function createCursor( export async function createCursor(
message: DecodedMessage, message: DecodedMessage,
pubsubTopic: string = DefaultPubSubTopic pubsubTopic: string = DefaultPubSubTopic
): Promise<proto.Index> { ): Promise<Index> {
if ( if (
!message || !message ||
!message.timestamp || !message.timestamp ||

View File

@ -62,8 +62,6 @@ export class MessageV1 extends MessageV0 implements DecodedMessage {
} }
} }
export { sha256 } from "./crypto";
export class AsymEncoder implements Encoder { export class AsymEncoder implements Encoder {
constructor( constructor(
public contentTopic: string, public contentTopic: string,