StoreSDK is an implementation of the IStoreSDK interface. It provides methods to interact with the Waku Store protocol.

Implements

Constructors

Properties

connectionManager: waku.ConnectionManager
options: Partial<StoreProtocolOptions>
peerManager: PeerManager

Methods

  • Creates a cursor based on the provided decoded message.

    Parameters

    Returns Uint8Array

    A StoreCursor representing the message.

  • Private

    Processes messages based on the provided callback and options.

    Type Parameters

    Parameters

    • messages: Promise<undefined | T>[]

      An array of promises of decoded messages.

    • callback: ((message) => boolean | void | Promise<boolean | void>)

      A callback function to process each decoded message.

        • (message): boolean | void | Promise<boolean | void>
        • Parameters

          • message: T

          Returns boolean | void | Promise<boolean | void>

    Returns Promise<boolean>

    A promise that resolves to a boolean indicating whether the processing should abort.

  • Queries the Waku Store for historical messages using the provided decoders and options. Returns an asynchronous generator that yields promises of decoded messages.

    Type Parameters

    Parameters

    Returns AsyncGenerator<Promise<undefined | T>[], any, unknown>

    An asynchronous generator of promises of decoded messages.

    Throws

    If no peers are available to query or if an error occurs during the query.

  • Queries the Waku Store for historical messages and processes them with the provided callback in order.

    Type Parameters

    Parameters

    • decoders: IDecoder<T>[]

      An array of message decoders.

    • callback: ((message) => boolean | void | Promise<boolean | void>)

      A callback function to process each decoded message.

        • (message): boolean | void | Promise<boolean | void>
        • Parameters

          • message: T

          Returns boolean | void | Promise<boolean | void>

    • Optional options: Partial<QueryRequestParams>

      Optional query parameters.

    Returns Promise<void>

    A promise that resolves when the query and message processing are completed.

  • Queries the Waku Store for historical messages and processes them with the provided callback using promises.

    Type Parameters

    Parameters

    • decoders: IDecoder<T>[]

      An array of message decoders.

    • callback: ((message) => boolean | void | Promise<boolean | void>)

      A callback function to process each promise of a decoded message.

        • (message): boolean | void | Promise<boolean | void>
        • Parameters

          • message: Promise<undefined | T>

          Returns boolean | void | Promise<boolean | void>

    • Optional options: Partial<QueryRequestParams>

      Optional query parameters.

    Returns Promise<void>

    A promise that resolves when the query and message processing are completed.

  • Private

    Validates the provided decoders and pubsub topic.

    Type Parameters

    Parameters

    • decoders: IDecoder<T>[]

      An array of message decoders.

    Returns {
        contentTopics: string[];
        decodersAsMap: Map<string, IDecoder<T>>;
        pubsubTopic: string;
    }

    An object containing the pubsub topic, content topics, and a map of decoders.

    • contentTopics: string[]
    • decodersAsMap: Map<string, IDecoder<T>>
    • pubsubTopic: string

    Throws

    If no decoders are provided, if multiple pubsub topics are provided, or if no decoders are found for the pubsub topic.