chore: remove store cursor creation

This commit is contained in:
Sasha 2025-08-20 23:28:34 +02:00
parent c8dfdb1ace
commit 27b17ae685
3 changed files with 7 additions and 19 deletions

View File

@ -1,7 +1,5 @@
import type { IDecodedMessage, IDecoder } from "./message.js";
export type StoreCursor = Uint8Array;
/**
* Parameters for a store query request, as specified in the Waku Store v3 RFC.
*/
@ -77,8 +75,6 @@ export type QueryRequestParams = {
export type IStore = {
readonly multicodec: string;
createCursor(message: IDecodedMessage): StoreCursor;
queryGenerator: <T extends IDecodedMessage>(
decoders: IDecoder<T>[],
options?: Partial<QueryRequestParams>

View File

@ -1,7 +1,7 @@
import type { PeerId } from "@libp2p/interface";
import { peerIdFromString } from "@libp2p/peer-id";
import { multiaddr } from "@multiformats/multiaddr";
import { messageHash, StoreCore } from "@waku/core";
import { StoreCore } from "@waku/core";
import {
IDecodedMessage,
IDecoder,
@ -9,7 +9,6 @@ import {
Libp2p,
Protocols,
QueryRequestParams,
StoreCursor,
StoreProtocolOptions
} from "@waku/interfaces";
import { isDefined, Logger } from "@waku/utils";
@ -160,16 +159,6 @@ export class Store implements IStore {
return abort;
}
/**
* Creates a cursor based on the provided decoded message.
*
* @param message - The decoded message.
* @returns A StoreCursor representing the message.
*/
public createCursor(message: IDecodedMessage): StoreCursor {
return messageHash(message.pubsubTopic, message);
}
/**
* Validates the provided decoders and pubsub topic.
*

View File

@ -1,4 +1,4 @@
import { DecodedMessage } from "@waku/core";
import { DecodedMessage, messageHash } from "@waku/core";
import type { LightNode } from "@waku/interfaces";
import { bytesToUtf8 } from "@waku/utils/bytes";
import { expect } from "chai";
@ -65,7 +65,10 @@ describe("Waku Store, cursor", function () {
}
// create cursor to extract messages after the cursorIndex
const cursor = waku.store.createCursor(messages[cursorIndex]);
const cursor = messageHash(
messages[cursorIndex].pubsubTopic,
messages[cursorIndex]
);
const messagesAfterCursor: DecodedMessage[] = [];
for await (const page of waku.store.queryGenerator([TestDecoder], {
@ -114,7 +117,7 @@ describe("Waku Store, cursor", function () {
}
// create cursor to extract messages after the cursorIndex
const cursor = waku.store.createCursor(messages[5]);
const cursor = messageHash(messages[5].pubsubTopic, messages[5]);
// query node2 with the cursor from node1
const messagesAfterCursor: DecodedMessage[] = [];