Skip to content

Commit

Permalink
fix: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Jun 20, 2024
1 parent 59b9f51 commit d7583ff
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/interfaces/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from "./peer_exchange.js";
export * from "./protocols.js";
export * from "./relay.js";
export * as store_v2 from "./store/v2.js";
export * from "./store/v3.js";
export * from "./waku.js";
export * from "./connection_manager.js";
export * from "./sender.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export * from "./waku.js";
export { createLightNode } from "./light-node/index.js";
export { wakuLightPush } from "./protocols/light_push.js";
export { wakuFilter } from "./protocols/filter.js";
export { wakuStore as wakuStoreV2 } from "./protocols/store/v2.js";
export { wakuStore as wakuStoreV2 } from "./protocols/store/v3.js";
export { wakuStore } from "./protocols/store/v3.js";

export * as waku from "@waku/core";
Expand Down
19 changes: 13 additions & 6 deletions packages/sdk/src/protocols/store/v3.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StoreCore } from "@waku/core";
import { ConnectionManager, StoreCore } from "@waku/core";
import {
IDecodedMessage,
IDecoder,
Expand All @@ -24,9 +24,15 @@ const log = new Logger("waku:store:sdk");
export class StoreSDK extends BaseProtocolSDK implements IStoreSDK {
public readonly protocol: StoreCore;

constructor(libp2p: Libp2p, options?: ProtocolCreateOptions) {
super({ numPeersToUse: DEFAULT_NUM_PEERS });
this.protocol = new StoreCore(libp2p, options);
constructor(
connectionManager: ConnectionManager,
libp2p: Libp2p,
options?: ProtocolCreateOptions
) {
super(new StoreCore(libp2p, options), connectionManager, {
numPeersToUse: DEFAULT_NUM_PEERS
});
this.protocol = this.core as StoreCore;
}

/**
Expand Down Expand Up @@ -55,7 +61,7 @@ export class StoreSDK extends BaseProtocolSDK implements IStoreSDK {

const peer = (
await this.protocol.getPeers({
numPeers: this.numPeers,
numPeers: this.numPeersToUse,
maxBootstrapPeers: 1
})
)[0];
Expand Down Expand Up @@ -232,9 +238,10 @@ export class StoreSDK extends BaseProtocolSDK implements IStoreSDK {
* @returns A function that takes a Libp2p instance and returns a StoreSDK instance.
*/
export function wakuStore(
connectionManager: ConnectionManager,
init: Partial<ProtocolCreateOptions> = {}
): (libp2p: Libp2p) => IStoreSDK {
return (libp2p: Libp2p) => {
return new StoreSDK(libp2p, init);
return new StoreSDK(connectionManager, libp2p, init);
};
}
2 changes: 1 addition & 1 deletion packages/sdk/src/waku.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Logger } from "@waku/utils";

import { wakuFilter } from "./protocols/filter.js";
import { wakuLightPush } from "./protocols/light_push.js";
import { wakuStore } from "./protocols/store.js";
import { wakuStore } from "./protocols/store/v3.js";
import { subscribeToContentTopic } from "./utils/content_topic.js";

export const DefaultPingKeepAliveValueSecs = 5 * 60;
Expand Down

0 comments on commit d7583ff

Please sign in to comment.