chore: remove prettier, and default to eslint (#1495)

* rm: unwanted commit ff3ffdd138

* prettier: readds trailing commas

* update: .vscode settings to use eslint by default

* run eslint -- removes trailing commas

* remove: prettier

* remove linting from autogen proto

* address comments

* lint .eslintrc.json
This commit is contained in:
Danish Arora 2023-09-04 12:37:38 +05:30 committed by GitHub
parent 574a05ff68
commit 78f64f60ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 5146 additions and 9832 deletions

View File

@ -22,7 +22,6 @@
"trailingComma": "none" "trailingComma": "none"
} }
], ],
"comma-dangle": ["error", "never"],
"@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/explicit-module-boundary-types": "off",
"eslint-comments/disable-enable-pair": [ "eslint-comments/disable-enable-pair": [
@ -68,9 +67,6 @@
"overrides": [ "overrides": [
{ {
"files": ["*.spec.ts", "**/test_utils/*.ts", "*.js", "*.cjs"], "files": ["*.spec.ts", "**/test_utils/*.ts", "*.js", "*.cjs"],
"env": {
"node": true
},
"rules": { "rules": {
"@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",

View File

@ -1,3 +0,0 @@
{
"trailingComma": "none"
}

View File

@ -1,7 +1,11 @@
{ {
"cSpell.userWords": [], // only use words from .cspell.json "cSpell.userWords": [], // only use words from .cspell.json
"cSpell.enabled": true, "cSpell.enabled": true,
"editor.formatOnSave": true, "editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": false, // Disable general format on save
"typescript.tsdk": "node_modules/typescript/lib", "typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true "typescript.enablePromptUseWorkspaceTsdk": true
} }

10415
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,10 +24,8 @@
"size": "npm run build && size-limit", "size": "npm run build && size-limit",
"fix": "run-s fix:*", "fix": "run-s fix:*",
"fix:workspaces": "npm run fix --workspaces --if-present", "fix:workspaces": "npm run fix --workspaces --if-present",
"fix:prettier": "prettier ./packages --write",
"check": "run-s check:*", "check": "run-s check:*",
"check:workspaces": "npm run check --workspaces --if-present", "check:workspaces": "npm run check --workspaces --if-present",
"check:prettier": "prettier ./packages --list-different",
"check:ws": "[ $(ls -1 ./packages|wc -l) -eq $(cat package.json | jq '.workspaces | length') ] || exit 1 # check no packages left behind", "check:ws": "[ $(ls -1 ./packages|wc -l) -eq $(cat package.json | jq '.workspaces | length') ] || exit 1 # check no packages left behind",
"test": "npm run test --workspaces --if-present", "test": "npm run test --workspaces --if-present",
"test:browser": "npm run test:browser --workspaces --if-present", "test:browser": "npm run test:browser --workspaces --if-present",
@ -52,7 +50,6 @@
"gh-pages": "^5.0.0", "gh-pages": "^5.0.0",
"husky": "^8.0.3", "husky": "^8.0.3",
"lint-staged": "^13.2.2", "lint-staged": "^13.2.2",
"prettier": "^3.0.0",
"size-limit": "^8.1.2", "size-limit": "^8.1.2",
"typedoc": "^0.23.26", "typedoc": "^0.23.26",
"typedoc-plugin-resolve-crossmodule-references": "^0.3.3" "typedoc-plugin-resolve-crossmodule-references": "^0.3.3"
@ -60,9 +57,6 @@
"lint-staged": { "lint-staged": {
"*.{ts,js}": [ "*.{ts,js}": [
"eslint --fix" "eslint --fix"
],
"*.{ts,json,js,md,cjs}": [
"prettier --write"
] ]
} }
} }

View File

@ -4,542 +4,511 @@
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
/* eslint-disable @typescript-eslint/no-empty-interface */ /* eslint-disable @typescript-eslint/no-empty-interface */
import { encodeMessage, decodeMessage, message } from "protons-runtime"; import { encodeMessage, decodeMessage, message } from 'protons-runtime'
import type { Codec } from "protons-runtime"; import type { Codec } from 'protons-runtime'
import type { Uint8ArrayList } from "uint8arraylist"; import type { Uint8ArrayList } from 'uint8arraylist'
export interface FilterRequest { export interface FilterRequest {
subscribe: boolean; subscribe: boolean
topic: string; topic: string
contentFilters: FilterRequest.ContentFilter[]; contentFilters: FilterRequest.ContentFilter[]
} }
export namespace FilterRequest { export namespace FilterRequest {
export interface ContentFilter { export interface ContentFilter {
contentTopic: string; contentTopic: string
} }
export namespace ContentFilter { export namespace ContentFilter {
let _codec: Codec<ContentFilter>; let _codec: Codec<ContentFilter>
export const codec = (): Codec<ContentFilter> => { export const codec = (): Codec<ContentFilter> => {
if (_codec == null) { if (_codec == null) {
_codec = message<ContentFilter>( _codec = message<ContentFilter>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.contentTopic != null && obj.contentTopic !== "") {
w.uint32(10);
w.string(obj.contentTopic);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
contentTopic: ""
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.contentTopic = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
w.uint32(10)
w.string(obj.contentTopic)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
contentTopic: ''
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.contentTopic = reader.string()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<ContentFilter>): Uint8Array => { export const encode = (obj: Partial<ContentFilter>): Uint8Array => {
return encodeMessage(obj, ContentFilter.codec()); return encodeMessage(obj, ContentFilter.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): ContentFilter => { export const decode = (buf: Uint8Array | Uint8ArrayList): ContentFilter => {
return decodeMessage(buf, ContentFilter.codec()); return decodeMessage(buf, ContentFilter.codec())
}; }
} }
let _codec: Codec<FilterRequest>; let _codec: Codec<FilterRequest>
export const codec = (): Codec<FilterRequest> => { export const codec = (): Codec<FilterRequest> => {
if (_codec == null) { if (_codec == null) {
_codec = message<FilterRequest>( _codec = message<FilterRequest>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.subscribe != null && obj.subscribe !== false) {
w.uint32(8);
w.bool(obj.subscribe);
}
if (obj.topic != null && obj.topic !== "") {
w.uint32(18);
w.string(obj.topic);
}
if (obj.contentFilters != null) {
for (const value of obj.contentFilters) {
w.uint32(26);
FilterRequest.ContentFilter.codec().encode(value, w);
}
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
subscribe: false,
topic: "",
contentFilters: []
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.subscribe = reader.bool();
break;
case 2:
obj.topic = reader.string();
break;
case 3:
obj.contentFilters.push(
FilterRequest.ContentFilter.codec().decode(
reader,
reader.uint32()
)
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.subscribe != null && obj.subscribe !== false)) {
w.uint32(8)
w.bool(obj.subscribe)
}
if ((obj.topic != null && obj.topic !== '')) {
w.uint32(18)
w.string(obj.topic)
}
if (obj.contentFilters != null) {
for (const value of obj.contentFilters) {
w.uint32(26)
FilterRequest.ContentFilter.codec().encode(value, w)
}
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
subscribe: false,
topic: '',
contentFilters: []
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.subscribe = reader.bool()
break
case 2:
obj.topic = reader.string()
break
case 3:
obj.contentFilters.push(FilterRequest.ContentFilter.codec().decode(reader, reader.uint32()))
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<FilterRequest>): Uint8Array => { export const encode = (obj: Partial<FilterRequest>): Uint8Array => {
return encodeMessage(obj, FilterRequest.codec()); return encodeMessage(obj, FilterRequest.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): FilterRequest => { export const decode = (buf: Uint8Array | Uint8ArrayList): FilterRequest => {
return decodeMessage(buf, FilterRequest.codec()); return decodeMessage(buf, FilterRequest.codec())
}; }
} }
export interface MessagePush { export interface MessagePush {
messages: WakuMessage[]; messages: WakuMessage[]
} }
export namespace MessagePush { export namespace MessagePush {
let _codec: Codec<MessagePush>; let _codec: Codec<MessagePush>
export const codec = (): Codec<MessagePush> => { export const codec = (): Codec<MessagePush> => {
if (_codec == null) { if (_codec == null) {
_codec = message<MessagePush>( _codec = message<MessagePush>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.messages != null) {
for (const value of obj.messages) {
w.uint32(10);
WakuMessage.codec().encode(value, w);
}
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
messages: []
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.messages.push(
WakuMessage.codec().decode(reader, reader.uint32())
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if (obj.messages != null) {
for (const value of obj.messages) {
w.uint32(10)
WakuMessage.codec().encode(value, w)
}
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
messages: []
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32()))
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<MessagePush>): Uint8Array => { export const encode = (obj: Partial<MessagePush>): Uint8Array => {
return encodeMessage(obj, MessagePush.codec()); return encodeMessage(obj, MessagePush.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): MessagePush => { export const decode = (buf: Uint8Array | Uint8ArrayList): MessagePush => {
return decodeMessage(buf, MessagePush.codec()); return decodeMessage(buf, MessagePush.codec())
}; }
} }
export interface FilterRpc { export interface FilterRpc {
requestId: string; requestId: string
request?: FilterRequest; request?: FilterRequest
push?: MessagePush; push?: MessagePush
} }
export namespace FilterRpc { export namespace FilterRpc {
let _codec: Codec<FilterRpc>; let _codec: Codec<FilterRpc>
export const codec = (): Codec<FilterRpc> => { export const codec = (): Codec<FilterRpc> => {
if (_codec == null) { if (_codec == null) {
_codec = message<FilterRpc>( _codec = message<FilterRpc>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.requestId != null && obj.requestId !== "") {
w.uint32(10);
w.string(obj.requestId);
}
if (obj.request != null) {
w.uint32(18);
FilterRequest.codec().encode(obj.request, w);
}
if (obj.push != null) {
w.uint32(26);
MessagePush.codec().encode(obj.push, w);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
requestId: ""
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string();
break;
case 2:
obj.request = FilterRequest.codec().decode(
reader,
reader.uint32()
);
break;
case 3:
obj.push = MessagePush.codec().decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.requestId != null && obj.requestId !== '')) {
w.uint32(10)
w.string(obj.requestId)
}
if (obj.request != null) {
w.uint32(18)
FilterRequest.codec().encode(obj.request, w)
}
if (obj.push != null) {
w.uint32(26)
MessagePush.codec().encode(obj.push, w)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
requestId: ''
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string()
break
case 2:
obj.request = FilterRequest.codec().decode(reader, reader.uint32())
break
case 3:
obj.push = MessagePush.codec().decode(reader, reader.uint32())
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<FilterRpc>): Uint8Array => { export const encode = (obj: Partial<FilterRpc>): Uint8Array => {
return encodeMessage(obj, FilterRpc.codec()); return encodeMessage(obj, FilterRpc.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): FilterRpc => { export const decode = (buf: Uint8Array | Uint8ArrayList): FilterRpc => {
return decodeMessage(buf, FilterRpc.codec()); return decodeMessage(buf, FilterRpc.codec())
}; }
} }
export interface RateLimitProof { export interface RateLimitProof {
proof: Uint8Array; proof: Uint8Array
merkleRoot: Uint8Array; merkleRoot: Uint8Array
epoch: Uint8Array; epoch: Uint8Array
shareX: Uint8Array; shareX: Uint8Array
shareY: Uint8Array; shareY: Uint8Array
nullifier: Uint8Array; nullifier: Uint8Array
rlnIdentifier: Uint8Array; rlnIdentifier: Uint8Array
} }
export namespace RateLimitProof { export namespace RateLimitProof {
let _codec: Codec<RateLimitProof>; let _codec: Codec<RateLimitProof>
export const codec = (): Codec<RateLimitProof> => { export const codec = (): Codec<RateLimitProof> => {
if (_codec == null) { if (_codec == null) {
_codec = message<RateLimitProof>( _codec = message<RateLimitProof>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.proof != null && obj.proof.byteLength > 0) {
w.uint32(10);
w.bytes(obj.proof);
}
if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {
w.uint32(18);
w.bytes(obj.merkleRoot);
}
if (obj.epoch != null && obj.epoch.byteLength > 0) {
w.uint32(26);
w.bytes(obj.epoch);
}
if (obj.shareX != null && obj.shareX.byteLength > 0) {
w.uint32(34);
w.bytes(obj.shareX);
}
if (obj.shareY != null && obj.shareY.byteLength > 0) {
w.uint32(42);
w.bytes(obj.shareY);
}
if (obj.nullifier != null && obj.nullifier.byteLength > 0) {
w.uint32(50);
w.bytes(obj.nullifier);
}
if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {
w.uint32(58);
w.bytes(obj.rlnIdentifier);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
proof: new Uint8Array(0),
merkleRoot: new Uint8Array(0),
epoch: new Uint8Array(0),
shareX: new Uint8Array(0),
shareY: new Uint8Array(0),
nullifier: new Uint8Array(0),
rlnIdentifier: new Uint8Array(0)
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes();
break;
case 2:
obj.merkleRoot = reader.bytes();
break;
case 3:
obj.epoch = reader.bytes();
break;
case 4:
obj.shareX = reader.bytes();
break;
case 5:
obj.shareY = reader.bytes();
break;
case 6:
obj.nullifier = reader.bytes();
break;
case 7:
obj.rlnIdentifier = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.proof != null && obj.proof.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.proof)
}
if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {
w.uint32(18)
w.bytes(obj.merkleRoot)
}
if ((obj.epoch != null && obj.epoch.byteLength > 0)) {
w.uint32(26)
w.bytes(obj.epoch)
}
if ((obj.shareX != null && obj.shareX.byteLength > 0)) {
w.uint32(34)
w.bytes(obj.shareX)
}
if ((obj.shareY != null && obj.shareY.byteLength > 0)) {
w.uint32(42)
w.bytes(obj.shareY)
}
if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {
w.uint32(50)
w.bytes(obj.nullifier)
}
if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {
w.uint32(58)
w.bytes(obj.rlnIdentifier)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
proof: new Uint8Array(0),
merkleRoot: new Uint8Array(0),
epoch: new Uint8Array(0),
shareX: new Uint8Array(0),
shareY: new Uint8Array(0),
nullifier: new Uint8Array(0),
rlnIdentifier: new Uint8Array(0)
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes()
break
case 2:
obj.merkleRoot = reader.bytes()
break
case 3:
obj.epoch = reader.bytes()
break
case 4:
obj.shareX = reader.bytes()
break
case 5:
obj.shareY = reader.bytes()
break
case 6:
obj.nullifier = reader.bytes()
break
case 7:
obj.rlnIdentifier = reader.bytes()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<RateLimitProof>): Uint8Array => { export const encode = (obj: Partial<RateLimitProof>): Uint8Array => {
return encodeMessage(obj, RateLimitProof.codec()); return encodeMessage(obj, RateLimitProof.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => { export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => {
return decodeMessage(buf, RateLimitProof.codec()); return decodeMessage(buf, RateLimitProof.codec())
}; }
} }
export interface WakuMessage { export interface WakuMessage {
payload: Uint8Array; payload: Uint8Array
contentTopic: string; contentTopic: string
version?: number; version?: number
timestamp?: bigint; timestamp?: bigint
meta?: Uint8Array; meta?: Uint8Array
rateLimitProof?: RateLimitProof; rateLimitProof?: RateLimitProof
ephemeral?: boolean; ephemeral?: boolean
} }
export namespace WakuMessage { export namespace WakuMessage {
let _codec: Codec<WakuMessage>; let _codec: Codec<WakuMessage>
export const codec = (): Codec<WakuMessage> => { export const codec = (): Codec<WakuMessage> => {
if (_codec == null) { if (_codec == null) {
_codec = message<WakuMessage>( _codec = message<WakuMessage>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.payload != null && obj.payload.byteLength > 0) {
w.uint32(10);
w.bytes(obj.payload);
}
if (obj.contentTopic != null && obj.contentTopic !== "") {
w.uint32(18);
w.string(obj.contentTopic);
}
if (obj.version != null) {
w.uint32(24);
w.uint32(obj.version);
}
if (obj.timestamp != null) {
w.uint32(80);
w.sint64(obj.timestamp);
}
if (obj.meta != null) {
w.uint32(90);
w.bytes(obj.meta);
}
if (obj.rateLimitProof != null) {
w.uint32(170);
RateLimitProof.codec().encode(obj.rateLimitProof, w);
}
if (obj.ephemeral != null) {
w.uint32(248);
w.bool(obj.ephemeral);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
payload: new Uint8Array(0),
contentTopic: ""
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes();
break;
case 2:
obj.contentTopic = reader.string();
break;
case 3:
obj.version = reader.uint32();
break;
case 10:
obj.timestamp = reader.sint64();
break;
case 11:
obj.meta = reader.bytes();
break;
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(
reader,
reader.uint32()
);
break;
case 31:
obj.ephemeral = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.payload != null && obj.payload.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.payload)
}
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
w.uint32(18)
w.string(obj.contentTopic)
}
if (obj.version != null) {
w.uint32(24)
w.uint32(obj.version)
}
if (obj.timestamp != null) {
w.uint32(80)
w.sint64(obj.timestamp)
}
if (obj.meta != null) {
w.uint32(90)
w.bytes(obj.meta)
}
if (obj.rateLimitProof != null) {
w.uint32(170)
RateLimitProof.codec().encode(obj.rateLimitProof, w)
}
if (obj.ephemeral != null) {
w.uint32(248)
w.bool(obj.ephemeral)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
payload: new Uint8Array(0),
contentTopic: ''
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes()
break
case 2:
obj.contentTopic = reader.string()
break
case 3:
obj.version = reader.uint32()
break
case 10:
obj.timestamp = reader.sint64()
break
case 11:
obj.meta = reader.bytes()
break
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32())
break
case 31:
obj.ephemeral = reader.bool()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<WakuMessage>): Uint8Array => { export const encode = (obj: Partial<WakuMessage>): Uint8Array => {
return encodeMessage(obj, WakuMessage.codec()); return encodeMessage(obj, WakuMessage.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => { export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {
return decodeMessage(buf, WakuMessage.codec()); return decodeMessage(buf, WakuMessage.codec())
}; }
} }

View File

@ -4,28 +4,23 @@
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
/* eslint-disable @typescript-eslint/no-empty-interface */ /* eslint-disable @typescript-eslint/no-empty-interface */
import { import { enumeration, encodeMessage, decodeMessage, message } from 'protons-runtime'
enumeration, import type { Codec } from 'protons-runtime'
encodeMessage, import type { Uint8ArrayList } from 'uint8arraylist'
decodeMessage,
message
} from "protons-runtime";
import type { Codec } from "protons-runtime";
import type { Uint8ArrayList } from "uint8arraylist";
export interface FilterSubscribeRequest { export interface FilterSubscribeRequest {
requestId: string; requestId: string
filterSubscribeType: FilterSubscribeRequest.FilterSubscribeType; filterSubscribeType: FilterSubscribeRequest.FilterSubscribeType
pubsubTopic?: string; pubsubTopic?: string
contentTopics: string[]; contentTopics: string[]
} }
export namespace FilterSubscribeRequest { export namespace FilterSubscribeRequest {
export enum FilterSubscribeType { export enum FilterSubscribeType {
SUBSCRIBER_PING = "SUBSCRIBER_PING", SUBSCRIBER_PING = 'SUBSCRIBER_PING',
SUBSCRIBE = "SUBSCRIBE", SUBSCRIBE = 'SUBSCRIBE',
UNSUBSCRIBE = "UNSUBSCRIBE", UNSUBSCRIBE = 'UNSUBSCRIBE',
UNSUBSCRIBE_ALL = "UNSUBSCRIBE_ALL" UNSUBSCRIBE_ALL = 'UNSUBSCRIBE_ALL'
} }
enum __FilterSubscribeTypeValues { enum __FilterSubscribeTypeValues {
@ -37,494 +32,460 @@ export namespace FilterSubscribeRequest {
export namespace FilterSubscribeType { export namespace FilterSubscribeType {
export const codec = (): Codec<FilterSubscribeType> => { export const codec = (): Codec<FilterSubscribeType> => {
return enumeration<FilterSubscribeType>(__FilterSubscribeTypeValues); return enumeration<FilterSubscribeType>(__FilterSubscribeTypeValues)
}; }
} }
let _codec: Codec<FilterSubscribeRequest>; let _codec: Codec<FilterSubscribeRequest>
export const codec = (): Codec<FilterSubscribeRequest> => { export const codec = (): Codec<FilterSubscribeRequest> => {
if (_codec == null) { if (_codec == null) {
_codec = message<FilterSubscribeRequest>( _codec = message<FilterSubscribeRequest>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.requestId != null && obj.requestId !== "") {
w.uint32(10);
w.string(obj.requestId);
}
if (
obj.filterSubscribeType != null &&
__FilterSubscribeTypeValues[obj.filterSubscribeType] !== 0
) {
w.uint32(16);
FilterSubscribeRequest.FilterSubscribeType.codec().encode(
obj.filterSubscribeType,
w
);
}
if (obj.pubsubTopic != null) {
w.uint32(82);
w.string(obj.pubsubTopic);
}
if (obj.contentTopics != null) {
for (const value of obj.contentTopics) {
w.uint32(90);
w.string(value);
}
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
requestId: "",
filterSubscribeType: FilterSubscribeType.SUBSCRIBER_PING,
contentTopics: []
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string();
break;
case 2:
obj.filterSubscribeType =
FilterSubscribeRequest.FilterSubscribeType.codec().decode(
reader
);
break;
case 10:
obj.pubsubTopic = reader.string();
break;
case 11:
obj.contentTopics.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.requestId != null && obj.requestId !== '')) {
w.uint32(10)
w.string(obj.requestId)
}
if (obj.filterSubscribeType != null && __FilterSubscribeTypeValues[obj.filterSubscribeType] !== 0) {
w.uint32(16)
FilterSubscribeRequest.FilterSubscribeType.codec().encode(obj.filterSubscribeType, w)
}
if (obj.pubsubTopic != null) {
w.uint32(82)
w.string(obj.pubsubTopic)
}
if (obj.contentTopics != null) {
for (const value of obj.contentTopics) {
w.uint32(90)
w.string(value)
}
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
requestId: '',
filterSubscribeType: FilterSubscribeType.SUBSCRIBER_PING,
contentTopics: []
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string()
break
case 2:
obj.filterSubscribeType = FilterSubscribeRequest.FilterSubscribeType.codec().decode(reader)
break
case 10:
obj.pubsubTopic = reader.string()
break
case 11:
obj.contentTopics.push(reader.string())
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<FilterSubscribeRequest>): Uint8Array => { export const encode = (obj: Partial<FilterSubscribeRequest>): Uint8Array => {
return encodeMessage(obj, FilterSubscribeRequest.codec()); return encodeMessage(obj, FilterSubscribeRequest.codec())
}; }
export const decode = ( export const decode = (buf: Uint8Array | Uint8ArrayList): FilterSubscribeRequest => {
buf: Uint8Array | Uint8ArrayList return decodeMessage(buf, FilterSubscribeRequest.codec())
): FilterSubscribeRequest => { }
return decodeMessage(buf, FilterSubscribeRequest.codec());
};
} }
export interface FilterSubscribeResponse { export interface FilterSubscribeResponse {
requestId: string; requestId: string
statusCode: number; statusCode: number
statusDesc?: string; statusDesc?: string
} }
export namespace FilterSubscribeResponse { export namespace FilterSubscribeResponse {
let _codec: Codec<FilterSubscribeResponse>; let _codec: Codec<FilterSubscribeResponse>
export const codec = (): Codec<FilterSubscribeResponse> => { export const codec = (): Codec<FilterSubscribeResponse> => {
if (_codec == null) { if (_codec == null) {
_codec = message<FilterSubscribeResponse>( _codec = message<FilterSubscribeResponse>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.requestId != null && obj.requestId !== "") {
w.uint32(10);
w.string(obj.requestId);
}
if (obj.statusCode != null && obj.statusCode !== 0) {
w.uint32(80);
w.uint32(obj.statusCode);
}
if (obj.statusDesc != null) {
w.uint32(90);
w.string(obj.statusDesc);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
requestId: "",
statusCode: 0
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string();
break;
case 10:
obj.statusCode = reader.uint32();
break;
case 11:
obj.statusDesc = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.requestId != null && obj.requestId !== '')) {
w.uint32(10)
w.string(obj.requestId)
}
if ((obj.statusCode != null && obj.statusCode !== 0)) {
w.uint32(80)
w.uint32(obj.statusCode)
}
if (obj.statusDesc != null) {
w.uint32(90)
w.string(obj.statusDesc)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
requestId: '',
statusCode: 0
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string()
break
case 10:
obj.statusCode = reader.uint32()
break
case 11:
obj.statusDesc = reader.string()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<FilterSubscribeResponse>): Uint8Array => { export const encode = (obj: Partial<FilterSubscribeResponse>): Uint8Array => {
return encodeMessage(obj, FilterSubscribeResponse.codec()); return encodeMessage(obj, FilterSubscribeResponse.codec())
}; }
export const decode = ( export const decode = (buf: Uint8Array | Uint8ArrayList): FilterSubscribeResponse => {
buf: Uint8Array | Uint8ArrayList return decodeMessage(buf, FilterSubscribeResponse.codec())
): FilterSubscribeResponse => { }
return decodeMessage(buf, FilterSubscribeResponse.codec());
};
} }
export interface MessagePush { export interface MessagePush {
wakuMessage?: WakuMessage; wakuMessage?: WakuMessage
pubsubTopic?: string; pubsubTopic?: string
} }
export namespace MessagePush { export namespace MessagePush {
let _codec: Codec<MessagePush>; let _codec: Codec<MessagePush>
export const codec = (): Codec<MessagePush> => { export const codec = (): Codec<MessagePush> => {
if (_codec == null) { if (_codec == null) {
_codec = message<MessagePush>( _codec = message<MessagePush>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.wakuMessage != null) {
w.uint32(10);
WakuMessage.codec().encode(obj.wakuMessage, w);
}
if (obj.pubsubTopic != null) {
w.uint32(18);
w.string(obj.pubsubTopic);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.wakuMessage = WakuMessage.codec().decode(
reader,
reader.uint32()
);
break;
case 2:
obj.pubsubTopic = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if (obj.wakuMessage != null) {
w.uint32(10)
WakuMessage.codec().encode(obj.wakuMessage, w)
}
if (obj.pubsubTopic != null) {
w.uint32(18)
w.string(obj.pubsubTopic)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.wakuMessage = WakuMessage.codec().decode(reader, reader.uint32())
break
case 2:
obj.pubsubTopic = reader.string()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<MessagePush>): Uint8Array => { export const encode = (obj: Partial<MessagePush>): Uint8Array => {
return encodeMessage(obj, MessagePush.codec()); return encodeMessage(obj, MessagePush.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): MessagePush => { export const decode = (buf: Uint8Array | Uint8ArrayList): MessagePush => {
return decodeMessage(buf, MessagePush.codec()); return decodeMessage(buf, MessagePush.codec())
}; }
} }
export interface RateLimitProof { export interface RateLimitProof {
proof: Uint8Array; proof: Uint8Array
merkleRoot: Uint8Array; merkleRoot: Uint8Array
epoch: Uint8Array; epoch: Uint8Array
shareX: Uint8Array; shareX: Uint8Array
shareY: Uint8Array; shareY: Uint8Array
nullifier: Uint8Array; nullifier: Uint8Array
rlnIdentifier: Uint8Array; rlnIdentifier: Uint8Array
} }
export namespace RateLimitProof { export namespace RateLimitProof {
let _codec: Codec<RateLimitProof>; let _codec: Codec<RateLimitProof>
export const codec = (): Codec<RateLimitProof> => { export const codec = (): Codec<RateLimitProof> => {
if (_codec == null) { if (_codec == null) {
_codec = message<RateLimitProof>( _codec = message<RateLimitProof>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.proof != null && obj.proof.byteLength > 0) {
w.uint32(10);
w.bytes(obj.proof);
}
if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {
w.uint32(18);
w.bytes(obj.merkleRoot);
}
if (obj.epoch != null && obj.epoch.byteLength > 0) {
w.uint32(26);
w.bytes(obj.epoch);
}
if (obj.shareX != null && obj.shareX.byteLength > 0) {
w.uint32(34);
w.bytes(obj.shareX);
}
if (obj.shareY != null && obj.shareY.byteLength > 0) {
w.uint32(42);
w.bytes(obj.shareY);
}
if (obj.nullifier != null && obj.nullifier.byteLength > 0) {
w.uint32(50);
w.bytes(obj.nullifier);
}
if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {
w.uint32(58);
w.bytes(obj.rlnIdentifier);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
proof: new Uint8Array(0),
merkleRoot: new Uint8Array(0),
epoch: new Uint8Array(0),
shareX: new Uint8Array(0),
shareY: new Uint8Array(0),
nullifier: new Uint8Array(0),
rlnIdentifier: new Uint8Array(0)
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes();
break;
case 2:
obj.merkleRoot = reader.bytes();
break;
case 3:
obj.epoch = reader.bytes();
break;
case 4:
obj.shareX = reader.bytes();
break;
case 5:
obj.shareY = reader.bytes();
break;
case 6:
obj.nullifier = reader.bytes();
break;
case 7:
obj.rlnIdentifier = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.proof != null && obj.proof.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.proof)
}
if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {
w.uint32(18)
w.bytes(obj.merkleRoot)
}
if ((obj.epoch != null && obj.epoch.byteLength > 0)) {
w.uint32(26)
w.bytes(obj.epoch)
}
if ((obj.shareX != null && obj.shareX.byteLength > 0)) {
w.uint32(34)
w.bytes(obj.shareX)
}
if ((obj.shareY != null && obj.shareY.byteLength > 0)) {
w.uint32(42)
w.bytes(obj.shareY)
}
if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {
w.uint32(50)
w.bytes(obj.nullifier)
}
if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {
w.uint32(58)
w.bytes(obj.rlnIdentifier)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
proof: new Uint8Array(0),
merkleRoot: new Uint8Array(0),
epoch: new Uint8Array(0),
shareX: new Uint8Array(0),
shareY: new Uint8Array(0),
nullifier: new Uint8Array(0),
rlnIdentifier: new Uint8Array(0)
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes()
break
case 2:
obj.merkleRoot = reader.bytes()
break
case 3:
obj.epoch = reader.bytes()
break
case 4:
obj.shareX = reader.bytes()
break
case 5:
obj.shareY = reader.bytes()
break
case 6:
obj.nullifier = reader.bytes()
break
case 7:
obj.rlnIdentifier = reader.bytes()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<RateLimitProof>): Uint8Array => { export const encode = (obj: Partial<RateLimitProof>): Uint8Array => {
return encodeMessage(obj, RateLimitProof.codec()); return encodeMessage(obj, RateLimitProof.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => { export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => {
return decodeMessage(buf, RateLimitProof.codec()); return decodeMessage(buf, RateLimitProof.codec())
}; }
} }
export interface WakuMessage { export interface WakuMessage {
payload: Uint8Array; payload: Uint8Array
contentTopic: string; contentTopic: string
version?: number; version?: number
timestamp?: bigint; timestamp?: bigint
meta?: Uint8Array; meta?: Uint8Array
rateLimitProof?: RateLimitProof; rateLimitProof?: RateLimitProof
ephemeral?: boolean; ephemeral?: boolean
} }
export namespace WakuMessage { export namespace WakuMessage {
let _codec: Codec<WakuMessage>; let _codec: Codec<WakuMessage>
export const codec = (): Codec<WakuMessage> => { export const codec = (): Codec<WakuMessage> => {
if (_codec == null) { if (_codec == null) {
_codec = message<WakuMessage>( _codec = message<WakuMessage>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.payload != null && obj.payload.byteLength > 0) {
w.uint32(10);
w.bytes(obj.payload);
}
if (obj.contentTopic != null && obj.contentTopic !== "") {
w.uint32(18);
w.string(obj.contentTopic);
}
if (obj.version != null) {
w.uint32(24);
w.uint32(obj.version);
}
if (obj.timestamp != null) {
w.uint32(80);
w.sint64(obj.timestamp);
}
if (obj.meta != null) {
w.uint32(90);
w.bytes(obj.meta);
}
if (obj.rateLimitProof != null) {
w.uint32(170);
RateLimitProof.codec().encode(obj.rateLimitProof, w);
}
if (obj.ephemeral != null) {
w.uint32(248);
w.bool(obj.ephemeral);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
payload: new Uint8Array(0),
contentTopic: ""
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes();
break;
case 2:
obj.contentTopic = reader.string();
break;
case 3:
obj.version = reader.uint32();
break;
case 10:
obj.timestamp = reader.sint64();
break;
case 11:
obj.meta = reader.bytes();
break;
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(
reader,
reader.uint32()
);
break;
case 31:
obj.ephemeral = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.payload != null && obj.payload.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.payload)
}
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
w.uint32(18)
w.string(obj.contentTopic)
}
if (obj.version != null) {
w.uint32(24)
w.uint32(obj.version)
}
if (obj.timestamp != null) {
w.uint32(80)
w.sint64(obj.timestamp)
}
if (obj.meta != null) {
w.uint32(90)
w.bytes(obj.meta)
}
if (obj.rateLimitProof != null) {
w.uint32(170)
RateLimitProof.codec().encode(obj.rateLimitProof, w)
}
if (obj.ephemeral != null) {
w.uint32(248)
w.bool(obj.ephemeral)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
payload: new Uint8Array(0),
contentTopic: ''
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes()
break
case 2:
obj.contentTopic = reader.string()
break
case 3:
obj.version = reader.uint32()
break
case 10:
obj.timestamp = reader.sint64()
break
case 11:
obj.meta = reader.bytes()
break
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32())
break
case 31:
obj.ephemeral = reader.bool()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<WakuMessage>): Uint8Array => { export const encode = (obj: Partial<WakuMessage>): Uint8Array => {
return encodeMessage(obj, WakuMessage.codec()); return encodeMessage(obj, WakuMessage.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => { export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {
return decodeMessage(buf, WakuMessage.codec()); return decodeMessage(buf, WakuMessage.codec())
}; }
} }

View File

@ -4,474 +4,447 @@
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
/* eslint-disable @typescript-eslint/no-empty-interface */ /* eslint-disable @typescript-eslint/no-empty-interface */
import { encodeMessage, decodeMessage, message } from "protons-runtime"; import { encodeMessage, decodeMessage, message } from 'protons-runtime'
import type { Codec } from "protons-runtime"; import type { Codec } from 'protons-runtime'
import type { Uint8ArrayList } from "uint8arraylist"; import type { Uint8ArrayList } from 'uint8arraylist'
export interface PushRequest { export interface PushRequest {
pubsubTopic: string; pubsubTopic: string
message?: WakuMessage; message?: WakuMessage
} }
export namespace PushRequest { export namespace PushRequest {
let _codec: Codec<PushRequest>; let _codec: Codec<PushRequest>
export const codec = (): Codec<PushRequest> => { export const codec = (): Codec<PushRequest> => {
if (_codec == null) { if (_codec == null) {
_codec = message<PushRequest>( _codec = message<PushRequest>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.pubsubTopic != null && obj.pubsubTopic !== "") {
w.uint32(10);
w.string(obj.pubsubTopic);
}
if (obj.message != null) {
w.uint32(18);
WakuMessage.codec().encode(obj.message, w);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
pubsubTopic: ""
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.pubsubTopic = reader.string();
break;
case 2:
obj.message = WakuMessage.codec().decode(
reader,
reader.uint32()
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {
w.uint32(10)
w.string(obj.pubsubTopic)
}
if (obj.message != null) {
w.uint32(18)
WakuMessage.codec().encode(obj.message, w)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
pubsubTopic: ''
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.pubsubTopic = reader.string()
break
case 2:
obj.message = WakuMessage.codec().decode(reader, reader.uint32())
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<PushRequest>): Uint8Array => { export const encode = (obj: Partial<PushRequest>): Uint8Array => {
return encodeMessage(obj, PushRequest.codec()); return encodeMessage(obj, PushRequest.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): PushRequest => { export const decode = (buf: Uint8Array | Uint8ArrayList): PushRequest => {
return decodeMessage(buf, PushRequest.codec()); return decodeMessage(buf, PushRequest.codec())
}; }
} }
export interface PushResponse { export interface PushResponse {
isSuccess: boolean; isSuccess: boolean
info?: string; info?: string
} }
export namespace PushResponse { export namespace PushResponse {
let _codec: Codec<PushResponse>; let _codec: Codec<PushResponse>
export const codec = (): Codec<PushResponse> => { export const codec = (): Codec<PushResponse> => {
if (_codec == null) { if (_codec == null) {
_codec = message<PushResponse>( _codec = message<PushResponse>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.isSuccess != null && obj.isSuccess !== false) {
w.uint32(8);
w.bool(obj.isSuccess);
}
if (obj.info != null) {
w.uint32(18);
w.string(obj.info);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
isSuccess: false
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.isSuccess = reader.bool();
break;
case 2:
obj.info = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.isSuccess != null && obj.isSuccess !== false)) {
w.uint32(8)
w.bool(obj.isSuccess)
}
if (obj.info != null) {
w.uint32(18)
w.string(obj.info)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
isSuccess: false
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.isSuccess = reader.bool()
break
case 2:
obj.info = reader.string()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<PushResponse>): Uint8Array => { export const encode = (obj: Partial<PushResponse>): Uint8Array => {
return encodeMessage(obj, PushResponse.codec()); return encodeMessage(obj, PushResponse.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): PushResponse => { export const decode = (buf: Uint8Array | Uint8ArrayList): PushResponse => {
return decodeMessage(buf, PushResponse.codec()); return decodeMessage(buf, PushResponse.codec())
}; }
} }
export interface PushRpc { export interface PushRpc {
requestId: string; requestId: string
request?: PushRequest; request?: PushRequest
response?: PushResponse; response?: PushResponse
} }
export namespace PushRpc { export namespace PushRpc {
let _codec: Codec<PushRpc>; let _codec: Codec<PushRpc>
export const codec = (): Codec<PushRpc> => { export const codec = (): Codec<PushRpc> => {
if (_codec == null) { if (_codec == null) {
_codec = message<PushRpc>( _codec = message<PushRpc>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.requestId != null && obj.requestId !== "") {
w.uint32(10);
w.string(obj.requestId);
}
if (obj.request != null) {
w.uint32(18);
PushRequest.codec().encode(obj.request, w);
}
if (obj.response != null) {
w.uint32(26);
PushResponse.codec().encode(obj.response, w);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
requestId: ""
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string();
break;
case 2:
obj.request = PushRequest.codec().decode(
reader,
reader.uint32()
);
break;
case 3:
obj.response = PushResponse.codec().decode(
reader,
reader.uint32()
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.requestId != null && obj.requestId !== '')) {
w.uint32(10)
w.string(obj.requestId)
}
if (obj.request != null) {
w.uint32(18)
PushRequest.codec().encode(obj.request, w)
}
if (obj.response != null) {
w.uint32(26)
PushResponse.codec().encode(obj.response, w)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
requestId: ''
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string()
break
case 2:
obj.request = PushRequest.codec().decode(reader, reader.uint32())
break
case 3:
obj.response = PushResponse.codec().decode(reader, reader.uint32())
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<PushRpc>): Uint8Array => { export const encode = (obj: Partial<PushRpc>): Uint8Array => {
return encodeMessage(obj, PushRpc.codec()); return encodeMessage(obj, PushRpc.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): PushRpc => { export const decode = (buf: Uint8Array | Uint8ArrayList): PushRpc => {
return decodeMessage(buf, PushRpc.codec()); return decodeMessage(buf, PushRpc.codec())
}; }
} }
export interface RateLimitProof { export interface RateLimitProof {
proof: Uint8Array; proof: Uint8Array
merkleRoot: Uint8Array; merkleRoot: Uint8Array
epoch: Uint8Array; epoch: Uint8Array
shareX: Uint8Array; shareX: Uint8Array
shareY: Uint8Array; shareY: Uint8Array
nullifier: Uint8Array; nullifier: Uint8Array
rlnIdentifier: Uint8Array; rlnIdentifier: Uint8Array
} }
export namespace RateLimitProof { export namespace RateLimitProof {
let _codec: Codec<RateLimitProof>; let _codec: Codec<RateLimitProof>
export const codec = (): Codec<RateLimitProof> => { export const codec = (): Codec<RateLimitProof> => {
if (_codec == null) { if (_codec == null) {
_codec = message<RateLimitProof>( _codec = message<RateLimitProof>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.proof != null && obj.proof.byteLength > 0) {
w.uint32(10);
w.bytes(obj.proof);
}
if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {
w.uint32(18);
w.bytes(obj.merkleRoot);
}
if (obj.epoch != null && obj.epoch.byteLength > 0) {
w.uint32(26);
w.bytes(obj.epoch);
}
if (obj.shareX != null && obj.shareX.byteLength > 0) {
w.uint32(34);
w.bytes(obj.shareX);
}
if (obj.shareY != null && obj.shareY.byteLength > 0) {
w.uint32(42);
w.bytes(obj.shareY);
}
if (obj.nullifier != null && obj.nullifier.byteLength > 0) {
w.uint32(50);
w.bytes(obj.nullifier);
}
if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {
w.uint32(58);
w.bytes(obj.rlnIdentifier);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
proof: new Uint8Array(0),
merkleRoot: new Uint8Array(0),
epoch: new Uint8Array(0),
shareX: new Uint8Array(0),
shareY: new Uint8Array(0),
nullifier: new Uint8Array(0),
rlnIdentifier: new Uint8Array(0)
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes();
break;
case 2:
obj.merkleRoot = reader.bytes();
break;
case 3:
obj.epoch = reader.bytes();
break;
case 4:
obj.shareX = reader.bytes();
break;
case 5:
obj.shareY = reader.bytes();
break;
case 6:
obj.nullifier = reader.bytes();
break;
case 7:
obj.rlnIdentifier = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.proof != null && obj.proof.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.proof)
}
if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {
w.uint32(18)
w.bytes(obj.merkleRoot)
}
if ((obj.epoch != null && obj.epoch.byteLength > 0)) {
w.uint32(26)
w.bytes(obj.epoch)
}
if ((obj.shareX != null && obj.shareX.byteLength > 0)) {
w.uint32(34)
w.bytes(obj.shareX)
}
if ((obj.shareY != null && obj.shareY.byteLength > 0)) {
w.uint32(42)
w.bytes(obj.shareY)
}
if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {
w.uint32(50)
w.bytes(obj.nullifier)
}
if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {
w.uint32(58)
w.bytes(obj.rlnIdentifier)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
proof: new Uint8Array(0),
merkleRoot: new Uint8Array(0),
epoch: new Uint8Array(0),
shareX: new Uint8Array(0),
shareY: new Uint8Array(0),
nullifier: new Uint8Array(0),
rlnIdentifier: new Uint8Array(0)
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes()
break
case 2:
obj.merkleRoot = reader.bytes()
break
case 3:
obj.epoch = reader.bytes()
break
case 4:
obj.shareX = reader.bytes()
break
case 5:
obj.shareY = reader.bytes()
break
case 6:
obj.nullifier = reader.bytes()
break
case 7:
obj.rlnIdentifier = reader.bytes()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<RateLimitProof>): Uint8Array => { export const encode = (obj: Partial<RateLimitProof>): Uint8Array => {
return encodeMessage(obj, RateLimitProof.codec()); return encodeMessage(obj, RateLimitProof.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => { export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => {
return decodeMessage(buf, RateLimitProof.codec()); return decodeMessage(buf, RateLimitProof.codec())
}; }
} }
export interface WakuMessage { export interface WakuMessage {
payload: Uint8Array; payload: Uint8Array
contentTopic: string; contentTopic: string
version?: number; version?: number
timestamp?: bigint; timestamp?: bigint
meta?: Uint8Array; meta?: Uint8Array
rateLimitProof?: RateLimitProof; rateLimitProof?: RateLimitProof
ephemeral?: boolean; ephemeral?: boolean
} }
export namespace WakuMessage { export namespace WakuMessage {
let _codec: Codec<WakuMessage>; let _codec: Codec<WakuMessage>
export const codec = (): Codec<WakuMessage> => { export const codec = (): Codec<WakuMessage> => {
if (_codec == null) { if (_codec == null) {
_codec = message<WakuMessage>( _codec = message<WakuMessage>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.payload != null && obj.payload.byteLength > 0) {
w.uint32(10);
w.bytes(obj.payload);
}
if (obj.contentTopic != null && obj.contentTopic !== "") {
w.uint32(18);
w.string(obj.contentTopic);
}
if (obj.version != null) {
w.uint32(24);
w.uint32(obj.version);
}
if (obj.timestamp != null) {
w.uint32(80);
w.sint64(obj.timestamp);
}
if (obj.meta != null) {
w.uint32(90);
w.bytes(obj.meta);
}
if (obj.rateLimitProof != null) {
w.uint32(170);
RateLimitProof.codec().encode(obj.rateLimitProof, w);
}
if (obj.ephemeral != null) {
w.uint32(248);
w.bool(obj.ephemeral);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
payload: new Uint8Array(0),
contentTopic: ""
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes();
break;
case 2:
obj.contentTopic = reader.string();
break;
case 3:
obj.version = reader.uint32();
break;
case 10:
obj.timestamp = reader.sint64();
break;
case 11:
obj.meta = reader.bytes();
break;
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(
reader,
reader.uint32()
);
break;
case 31:
obj.ephemeral = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.payload != null && obj.payload.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.payload)
}
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
w.uint32(18)
w.string(obj.contentTopic)
}
if (obj.version != null) {
w.uint32(24)
w.uint32(obj.version)
}
if (obj.timestamp != null) {
w.uint32(80)
w.sint64(obj.timestamp)
}
if (obj.meta != null) {
w.uint32(90)
w.bytes(obj.meta)
}
if (obj.rateLimitProof != null) {
w.uint32(170)
RateLimitProof.codec().encode(obj.rateLimitProof, w)
}
if (obj.ephemeral != null) {
w.uint32(248)
w.bool(obj.ephemeral)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
payload: new Uint8Array(0),
contentTopic: ''
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes()
break
case 2:
obj.contentTopic = reader.string()
break
case 3:
obj.version = reader.uint32()
break
case 10:
obj.timestamp = reader.sint64()
break
case 11:
obj.meta = reader.bytes()
break
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32())
break
case 31:
obj.ephemeral = reader.bool()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<WakuMessage>): Uint8Array => { export const encode = (obj: Partial<WakuMessage>): Uint8Array => {
return encodeMessage(obj, WakuMessage.codec()); return encodeMessage(obj, WakuMessage.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => { export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {
return decodeMessage(buf, WakuMessage.codec()); return decodeMessage(buf, WakuMessage.codec())
}; }
} }

View File

@ -4,246 +4,237 @@
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
/* eslint-disable @typescript-eslint/no-empty-interface */ /* eslint-disable @typescript-eslint/no-empty-interface */
import { encodeMessage, decodeMessage, message } from "protons-runtime"; import { encodeMessage, decodeMessage, message } from 'protons-runtime'
import type { Codec } from "protons-runtime"; import type { Codec } from 'protons-runtime'
import type { Uint8ArrayList } from "uint8arraylist"; import type { Uint8ArrayList } from 'uint8arraylist'
export interface RateLimitProof { export interface RateLimitProof {
proof: Uint8Array; proof: Uint8Array
merkleRoot: Uint8Array; merkleRoot: Uint8Array
epoch: Uint8Array; epoch: Uint8Array
shareX: Uint8Array; shareX: Uint8Array
shareY: Uint8Array; shareY: Uint8Array
nullifier: Uint8Array; nullifier: Uint8Array
rlnIdentifier: Uint8Array; rlnIdentifier: Uint8Array
} }
export namespace RateLimitProof { export namespace RateLimitProof {
let _codec: Codec<RateLimitProof>; let _codec: Codec<RateLimitProof>
export const codec = (): Codec<RateLimitProof> => { export const codec = (): Codec<RateLimitProof> => {
if (_codec == null) { if (_codec == null) {
_codec = message<RateLimitProof>( _codec = message<RateLimitProof>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.proof != null && obj.proof.byteLength > 0) {
w.uint32(10);
w.bytes(obj.proof);
}
if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {
w.uint32(18);
w.bytes(obj.merkleRoot);
}
if (obj.epoch != null && obj.epoch.byteLength > 0) {
w.uint32(26);
w.bytes(obj.epoch);
}
if (obj.shareX != null && obj.shareX.byteLength > 0) {
w.uint32(34);
w.bytes(obj.shareX);
}
if (obj.shareY != null && obj.shareY.byteLength > 0) {
w.uint32(42);
w.bytes(obj.shareY);
}
if (obj.nullifier != null && obj.nullifier.byteLength > 0) {
w.uint32(50);
w.bytes(obj.nullifier);
}
if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {
w.uint32(58);
w.bytes(obj.rlnIdentifier);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
proof: new Uint8Array(0),
merkleRoot: new Uint8Array(0),
epoch: new Uint8Array(0),
shareX: new Uint8Array(0),
shareY: new Uint8Array(0),
nullifier: new Uint8Array(0),
rlnIdentifier: new Uint8Array(0)
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes();
break;
case 2:
obj.merkleRoot = reader.bytes();
break;
case 3:
obj.epoch = reader.bytes();
break;
case 4:
obj.shareX = reader.bytes();
break;
case 5:
obj.shareY = reader.bytes();
break;
case 6:
obj.nullifier = reader.bytes();
break;
case 7:
obj.rlnIdentifier = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.proof != null && obj.proof.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.proof)
}
if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {
w.uint32(18)
w.bytes(obj.merkleRoot)
}
if ((obj.epoch != null && obj.epoch.byteLength > 0)) {
w.uint32(26)
w.bytes(obj.epoch)
}
if ((obj.shareX != null && obj.shareX.byteLength > 0)) {
w.uint32(34)
w.bytes(obj.shareX)
}
if ((obj.shareY != null && obj.shareY.byteLength > 0)) {
w.uint32(42)
w.bytes(obj.shareY)
}
if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {
w.uint32(50)
w.bytes(obj.nullifier)
}
if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {
w.uint32(58)
w.bytes(obj.rlnIdentifier)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
proof: new Uint8Array(0),
merkleRoot: new Uint8Array(0),
epoch: new Uint8Array(0),
shareX: new Uint8Array(0),
shareY: new Uint8Array(0),
nullifier: new Uint8Array(0),
rlnIdentifier: new Uint8Array(0)
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes()
break
case 2:
obj.merkleRoot = reader.bytes()
break
case 3:
obj.epoch = reader.bytes()
break
case 4:
obj.shareX = reader.bytes()
break
case 5:
obj.shareY = reader.bytes()
break
case 6:
obj.nullifier = reader.bytes()
break
case 7:
obj.rlnIdentifier = reader.bytes()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<RateLimitProof>): Uint8Array => { export const encode = (obj: Partial<RateLimitProof>): Uint8Array => {
return encodeMessage(obj, RateLimitProof.codec()); return encodeMessage(obj, RateLimitProof.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => { export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => {
return decodeMessage(buf, RateLimitProof.codec()); return decodeMessage(buf, RateLimitProof.codec())
}; }
} }
export interface WakuMessage { export interface WakuMessage {
payload: Uint8Array; payload: Uint8Array
contentTopic: string; contentTopic: string
version?: number; version?: number
timestamp?: bigint; timestamp?: bigint
meta?: Uint8Array; meta?: Uint8Array
rateLimitProof?: RateLimitProof; rateLimitProof?: RateLimitProof
ephemeral?: boolean; ephemeral?: boolean
} }
export namespace WakuMessage { export namespace WakuMessage {
let _codec: Codec<WakuMessage>; let _codec: Codec<WakuMessage>
export const codec = (): Codec<WakuMessage> => { export const codec = (): Codec<WakuMessage> => {
if (_codec == null) { if (_codec == null) {
_codec = message<WakuMessage>( _codec = message<WakuMessage>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.payload != null && obj.payload.byteLength > 0) {
w.uint32(10);
w.bytes(obj.payload);
}
if (obj.contentTopic != null && obj.contentTopic !== "") {
w.uint32(18);
w.string(obj.contentTopic);
}
if (obj.version != null) {
w.uint32(24);
w.uint32(obj.version);
}
if (obj.timestamp != null) {
w.uint32(80);
w.sint64(obj.timestamp);
}
if (obj.meta != null) {
w.uint32(90);
w.bytes(obj.meta);
}
if (obj.rateLimitProof != null) {
w.uint32(170);
RateLimitProof.codec().encode(obj.rateLimitProof, w);
}
if (obj.ephemeral != null) {
w.uint32(248);
w.bool(obj.ephemeral);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
payload: new Uint8Array(0),
contentTopic: ""
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes();
break;
case 2:
obj.contentTopic = reader.string();
break;
case 3:
obj.version = reader.uint32();
break;
case 10:
obj.timestamp = reader.sint64();
break;
case 11:
obj.meta = reader.bytes();
break;
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(
reader,
reader.uint32()
);
break;
case 31:
obj.ephemeral = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.payload != null && obj.payload.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.payload)
}
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
w.uint32(18)
w.string(obj.contentTopic)
}
if (obj.version != null) {
w.uint32(24)
w.uint32(obj.version)
}
if (obj.timestamp != null) {
w.uint32(80)
w.sint64(obj.timestamp)
}
if (obj.meta != null) {
w.uint32(90)
w.bytes(obj.meta)
}
if (obj.rateLimitProof != null) {
w.uint32(170)
RateLimitProof.codec().encode(obj.rateLimitProof, w)
}
if (obj.ephemeral != null) {
w.uint32(248)
w.bool(obj.ephemeral)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
payload: new Uint8Array(0),
contentTopic: ''
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes()
break
case 2:
obj.contentTopic = reader.string()
break
case 3:
obj.version = reader.uint32()
break
case 10:
obj.timestamp = reader.sint64()
break
case 11:
obj.meta = reader.bytes()
break
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32())
break
case 31:
obj.ephemeral = reader.bool()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<WakuMessage>): Uint8Array => { export const encode = (obj: Partial<WakuMessage>): Uint8Array => {
return encodeMessage(obj, WakuMessage.codec()); return encodeMessage(obj, WakuMessage.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => { export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {
return decodeMessage(buf, WakuMessage.codec()); return decodeMessage(buf, WakuMessage.codec())
}; }
} }

View File

@ -4,267 +4,243 @@
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
/* eslint-disable @typescript-eslint/no-empty-interface */ /* eslint-disable @typescript-eslint/no-empty-interface */
import { encodeMessage, decodeMessage, message } from "protons-runtime"; import { encodeMessage, decodeMessage, message } from 'protons-runtime'
import type { Codec } from "protons-runtime"; import type { Codec } from 'protons-runtime'
import type { Uint8ArrayList } from "uint8arraylist"; import type { Uint8ArrayList } from 'uint8arraylist'
export interface PeerInfo { export interface PeerInfo {
enr?: Uint8Array; enr?: Uint8Array
} }
export namespace PeerInfo { export namespace PeerInfo {
let _codec: Codec<PeerInfo>; let _codec: Codec<PeerInfo>
export const codec = (): Codec<PeerInfo> => { export const codec = (): Codec<PeerInfo> => {
if (_codec == null) { if (_codec == null) {
_codec = message<PeerInfo>( _codec = message<PeerInfo>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.enr != null) {
w.uint32(10);
w.bytes(obj.enr);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.enr = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if (obj.enr != null) {
w.uint32(10)
w.bytes(obj.enr)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.enr = reader.bytes()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<PeerInfo>): Uint8Array => { export const encode = (obj: Partial<PeerInfo>): Uint8Array => {
return encodeMessage(obj, PeerInfo.codec()); return encodeMessage(obj, PeerInfo.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): PeerInfo => { export const decode = (buf: Uint8Array | Uint8ArrayList): PeerInfo => {
return decodeMessage(buf, PeerInfo.codec()); return decodeMessage(buf, PeerInfo.codec())
}; }
} }
export interface PeerExchangeQuery { export interface PeerExchangeQuery {
numPeers?: bigint; numPeers?: bigint
} }
export namespace PeerExchangeQuery { export namespace PeerExchangeQuery {
let _codec: Codec<PeerExchangeQuery>; let _codec: Codec<PeerExchangeQuery>
export const codec = (): Codec<PeerExchangeQuery> => { export const codec = (): Codec<PeerExchangeQuery> => {
if (_codec == null) { if (_codec == null) {
_codec = message<PeerExchangeQuery>( _codec = message<PeerExchangeQuery>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.numPeers != null) {
w.uint32(8);
w.uint64(obj.numPeers);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.numPeers = reader.uint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if (obj.numPeers != null) {
w.uint32(8)
w.uint64(obj.numPeers)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.numPeers = reader.uint64()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<PeerExchangeQuery>): Uint8Array => { export const encode = (obj: Partial<PeerExchangeQuery>): Uint8Array => {
return encodeMessage(obj, PeerExchangeQuery.codec()); return encodeMessage(obj, PeerExchangeQuery.codec())
}; }
export const decode = ( export const decode = (buf: Uint8Array | Uint8ArrayList): PeerExchangeQuery => {
buf: Uint8Array | Uint8ArrayList return decodeMessage(buf, PeerExchangeQuery.codec())
): PeerExchangeQuery => { }
return decodeMessage(buf, PeerExchangeQuery.codec());
};
} }
export interface PeerExchangeResponse { export interface PeerExchangeResponse {
peerInfos: PeerInfo[]; peerInfos: PeerInfo[]
} }
export namespace PeerExchangeResponse { export namespace PeerExchangeResponse {
let _codec: Codec<PeerExchangeResponse>; let _codec: Codec<PeerExchangeResponse>
export const codec = (): Codec<PeerExchangeResponse> => { export const codec = (): Codec<PeerExchangeResponse> => {
if (_codec == null) { if (_codec == null) {
_codec = message<PeerExchangeResponse>( _codec = message<PeerExchangeResponse>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.peerInfos != null) {
for (const value of obj.peerInfos) {
w.uint32(10);
PeerInfo.codec().encode(value, w);
}
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
peerInfos: []
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.peerInfos.push(
PeerInfo.codec().decode(reader, reader.uint32())
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if (obj.peerInfos != null) {
for (const value of obj.peerInfos) {
w.uint32(10)
PeerInfo.codec().encode(value, w)
}
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
peerInfos: []
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.peerInfos.push(PeerInfo.codec().decode(reader, reader.uint32()))
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<PeerExchangeResponse>): Uint8Array => { export const encode = (obj: Partial<PeerExchangeResponse>): Uint8Array => {
return encodeMessage(obj, PeerExchangeResponse.codec()); return encodeMessage(obj, PeerExchangeResponse.codec())
}; }
export const decode = ( export const decode = (buf: Uint8Array | Uint8ArrayList): PeerExchangeResponse => {
buf: Uint8Array | Uint8ArrayList return decodeMessage(buf, PeerExchangeResponse.codec())
): PeerExchangeResponse => { }
return decodeMessage(buf, PeerExchangeResponse.codec());
};
} }
export interface PeerExchangeRPC { export interface PeerExchangeRPC {
query?: PeerExchangeQuery; query?: PeerExchangeQuery
response?: PeerExchangeResponse; response?: PeerExchangeResponse
} }
export namespace PeerExchangeRPC { export namespace PeerExchangeRPC {
let _codec: Codec<PeerExchangeRPC>; let _codec: Codec<PeerExchangeRPC>
export const codec = (): Codec<PeerExchangeRPC> => { export const codec = (): Codec<PeerExchangeRPC> => {
if (_codec == null) { if (_codec == null) {
_codec = message<PeerExchangeRPC>( _codec = message<PeerExchangeRPC>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.query != null) {
w.uint32(10);
PeerExchangeQuery.codec().encode(obj.query, w);
}
if (obj.response != null) {
w.uint32(18);
PeerExchangeResponse.codec().encode(obj.response, w);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.query = PeerExchangeQuery.codec().decode(
reader,
reader.uint32()
);
break;
case 2:
obj.response = PeerExchangeResponse.codec().decode(
reader,
reader.uint32()
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if (obj.query != null) {
w.uint32(10)
PeerExchangeQuery.codec().encode(obj.query, w)
}
if (obj.response != null) {
w.uint32(18)
PeerExchangeResponse.codec().encode(obj.response, w)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1:
obj.query = PeerExchangeQuery.codec().decode(reader, reader.uint32())
break
case 2:
obj.response = PeerExchangeResponse.codec().decode(reader, reader.uint32())
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<PeerExchangeRPC>): Uint8Array => { export const encode = (obj: Partial<PeerExchangeRPC>): Uint8Array => {
return encodeMessage(obj, PeerExchangeRPC.codec()); return encodeMessage(obj, PeerExchangeRPC.codec())
}; }
export const decode = (buf: Uint8Array | Uint8ArrayList): PeerExchangeRPC => { export const decode = (buf: Uint8Array | Uint8ArrayList): PeerExchangeRPC => {
return decodeMessage(buf, PeerExchangeRPC.codec()); return decodeMessage(buf, PeerExchangeRPC.codec())
}; }
} }

File diff suppressed because it is too large Load Diff

View File

@ -4,69 +4,64 @@
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
/* eslint-disable @typescript-eslint/no-empty-interface */ /* eslint-disable @typescript-eslint/no-empty-interface */
import { encodeMessage, decodeMessage, message } from "protons-runtime"; import { encodeMessage, decodeMessage, message } from 'protons-runtime'
import type { Codec } from "protons-runtime"; import type { Codec } from 'protons-runtime'
import type { Uint8ArrayList } from "uint8arraylist"; import type { Uint8ArrayList } from 'uint8arraylist'
export interface TopicOnlyMessage { export interface TopicOnlyMessage {
contentTopic: string; contentTopic: string
} }
export namespace TopicOnlyMessage { export namespace TopicOnlyMessage {
let _codec: Codec<TopicOnlyMessage>; let _codec: Codec<TopicOnlyMessage>
export const codec = (): Codec<TopicOnlyMessage> => { export const codec = (): Codec<TopicOnlyMessage> => {
if (_codec == null) { if (_codec == null) {
_codec = message<TopicOnlyMessage>( _codec = message<TopicOnlyMessage>((obj, w, opts = {}) => {
(obj, w, opts = {}) => { if (opts.lengthDelimited !== false) {
if (opts.lengthDelimited !== false) { w.fork()
w.fork();
}
if (obj.contentTopic != null && obj.contentTopic !== "") {
w.uint32(18);
w.string(obj.contentTopic);
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
},
(reader, length) => {
const obj: any = {
contentTopic: ""
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
obj.contentTopic = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
} }
);
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
w.uint32(18)
w.string(obj.contentTopic)
}
if (opts.lengthDelimited !== false) {
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
contentTopic: ''
}
const end = length == null ? reader.len : reader.pos + length
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 2:
obj.contentTopic = reader.string()
break
default:
reader.skipType(tag & 7)
break
}
}
return obj
})
} }
return _codec; return _codec
}; }
export const encode = (obj: Partial<TopicOnlyMessage>): Uint8Array => { export const encode = (obj: Partial<TopicOnlyMessage>): Uint8Array => {
return encodeMessage(obj, TopicOnlyMessage.codec()); return encodeMessage(obj, TopicOnlyMessage.codec())
}; }
export const decode = ( export const decode = (buf: Uint8Array | Uint8ArrayList): TopicOnlyMessage => {
buf: Uint8Array | Uint8ArrayList return decodeMessage(buf, TopicOnlyMessage.codec())
): TopicOnlyMessage => { }
return decodeMessage(buf, TopicOnlyMessage.codec());
};
} }

View File

@ -85,7 +85,6 @@
"libp2p": "^0.46.3", "libp2p": "^0.46.3",
"mocha": "^10.2.0", "mocha": "^10.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"typescript": "^5.0.4" "typescript": "^5.0.4"
} }
} }