refactor nwaku.ts to support filterv2

This commit is contained in:
danisharora099 2023-04-12 12:17:16 +05:30
parent 60ffa8fddf
commit 02bcd4ec24
No known key found for this signature in database
GPG Key ID: FBD2BF500037F135

View File

@ -47,6 +47,7 @@ export interface Args {
logLevel?: LogLevel; logLevel?: LogLevel;
lightpush?: boolean; lightpush?: boolean;
filter?: boolean; filter?: boolean;
useFilterV2?: boolean;
store?: boolean; store?: boolean;
peerExchange?: boolean; peerExchange?: boolean;
discv5Discovery?: boolean; discv5Discovery?: boolean;
@ -183,6 +184,18 @@ export class Nwaku {
const rpcAddress = "--rpc-address=0.0.0.0"; const rpcAddress = "--rpc-address=0.0.0.0";
argsArray.push(natExtIp, rpcAddress); argsArray.push(natExtIp, rpcAddress);
if (isGoWaku) {
if (mergedArgs.useFilterV2) {
argsArray.push(
"--use-filterv2",
"--light-client",
"--min-relay-peers-to-publish=0"
);
} else {
throw new Error("FilterV2 is only supported by go-waku currently");
}
}
if (WAKU_SERVICE_NODE_PARAMS) { if (WAKU_SERVICE_NODE_PARAMS) {
argsArray.push(WAKU_SERVICE_NODE_PARAMS); argsArray.push(WAKU_SERVICE_NODE_PARAMS);
} }
@ -522,7 +535,7 @@ export function defaultArgs(): Args {
relay: false, relay: false,
rpcAdmin: true, rpcAdmin: true,
websocketSupport: true, websocketSupport: true,
logLevel: LogLevel.Trace, // logLevel: LogLevel.Trace,
}; };
} }