mirror of https://github.com/waku-org/js-waku.git
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:
parent
574a05ff68
commit
78f64f60ee
|
@ -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",
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"trailingComma": "none"
|
|
||||||
}
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,367 +4,343 @@
|
||||||
/* 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 !== "") {
|
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.string(obj.contentTopic);
|
w.string(obj.contentTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
contentTopic: ""
|
contentTopic: ''
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.contentTopic = reader.string();
|
obj.contentTopic = reader.string()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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 => {
|
|
||||||
return decodeMessage(buf, ContentFilter.codec());
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let _codec: Codec<FilterRequest>;
|
export const decode = (buf: Uint8Array | Uint8ArrayList): ContentFilter => {
|
||||||
|
return decodeMessage(buf, ContentFilter.codec())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
if ((obj.subscribe != null && obj.subscribe !== false)) {
|
||||||
w.uint32(8);
|
w.uint32(8)
|
||||||
w.bool(obj.subscribe);
|
w.bool(obj.subscribe)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.topic != null && obj.topic !== "") {
|
if ((obj.topic != null && obj.topic !== '')) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.string(obj.topic);
|
w.string(obj.topic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.contentFilters != null) {
|
if (obj.contentFilters != null) {
|
||||||
for (const value of obj.contentFilters) {
|
for (const value of obj.contentFilters) {
|
||||||
w.uint32(26);
|
w.uint32(26)
|
||||||
FilterRequest.ContentFilter.codec().encode(value, w);
|
FilterRequest.ContentFilter.codec().encode(value, w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
subscribe: false,
|
subscribe: false,
|
||||||
topic: "",
|
topic: '',
|
||||||
contentFilters: []
|
contentFilters: []
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.subscribe = reader.bool();
|
obj.subscribe = reader.bool()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.topic = reader.string();
|
obj.topic = reader.string()
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
obj.contentFilters.push(
|
obj.contentFilters.push(FilterRequest.ContentFilter.codec().decode(reader, reader.uint32()))
|
||||||
FilterRequest.ContentFilter.codec().decode(
|
break
|
||||||
reader,
|
|
||||||
reader.uint32()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if (obj.messages != null) {
|
||||||
for (const value of obj.messages) {
|
for (const value of obj.messages) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
WakuMessage.codec().encode(value, w);
|
WakuMessage.codec().encode(value, w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
messages: []
|
messages: []
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.messages.push(
|
obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32()))
|
||||||
WakuMessage.codec().decode(reader, reader.uint32())
|
break
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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 !== "") {
|
if ((obj.requestId != null && obj.requestId !== '')) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.string(obj.requestId);
|
w.string(obj.requestId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.request != null) {
|
if (obj.request != null) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
FilterRequest.codec().encode(obj.request, w);
|
FilterRequest.codec().encode(obj.request, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.push != null) {
|
if (obj.push != null) {
|
||||||
w.uint32(26);
|
w.uint32(26)
|
||||||
MessagePush.codec().encode(obj.push, w);
|
MessagePush.codec().encode(obj.push, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
requestId: ""
|
requestId: ''
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.requestId = reader.string();
|
obj.requestId = reader.string()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.request = FilterRequest.codec().decode(
|
obj.request = FilterRequest.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 3:
|
case 3:
|
||||||
obj.push = MessagePush.codec().decode(reader, reader.uint32());
|
obj.push = MessagePush.codec().decode(reader, reader.uint32())
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if ((obj.proof != null && obj.proof.byteLength > 0)) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.bytes(obj.proof);
|
w.bytes(obj.proof)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {
|
if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.bytes(obj.merkleRoot);
|
w.bytes(obj.merkleRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.epoch != null && obj.epoch.byteLength > 0) {
|
if ((obj.epoch != null && obj.epoch.byteLength > 0)) {
|
||||||
w.uint32(26);
|
w.uint32(26)
|
||||||
w.bytes(obj.epoch);
|
w.bytes(obj.epoch)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.shareX != null && obj.shareX.byteLength > 0) {
|
if ((obj.shareX != null && obj.shareX.byteLength > 0)) {
|
||||||
w.uint32(34);
|
w.uint32(34)
|
||||||
w.bytes(obj.shareX);
|
w.bytes(obj.shareX)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.shareY != null && obj.shareY.byteLength > 0) {
|
if ((obj.shareY != null && obj.shareY.byteLength > 0)) {
|
||||||
w.uint32(42);
|
w.uint32(42)
|
||||||
w.bytes(obj.shareY);
|
w.bytes(obj.shareY)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.nullifier != null && obj.nullifier.byteLength > 0) {
|
if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {
|
||||||
w.uint32(50);
|
w.uint32(50)
|
||||||
w.bytes(obj.nullifier);
|
w.bytes(obj.nullifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {
|
if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {
|
||||||
w.uint32(58);
|
w.uint32(58)
|
||||||
w.bytes(obj.rlnIdentifier);
|
w.bytes(obj.rlnIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
proof: new Uint8Array(0),
|
proof: new Uint8Array(0),
|
||||||
merkleRoot: new Uint8Array(0),
|
merkleRoot: new Uint8Array(0),
|
||||||
|
@ -373,173 +349,166 @@ export namespace RateLimitProof {
|
||||||
shareY: new Uint8Array(0),
|
shareY: new Uint8Array(0),
|
||||||
nullifier: new Uint8Array(0),
|
nullifier: new Uint8Array(0),
|
||||||
rlnIdentifier: new Uint8Array(0)
|
rlnIdentifier: new Uint8Array(0)
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.proof = reader.bytes();
|
obj.proof = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.merkleRoot = reader.bytes();
|
obj.merkleRoot = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
obj.epoch = reader.bytes();
|
obj.epoch = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 4:
|
case 4:
|
||||||
obj.shareX = reader.bytes();
|
obj.shareX = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 5:
|
case 5:
|
||||||
obj.shareY = reader.bytes();
|
obj.shareY = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 6:
|
case 6:
|
||||||
obj.nullifier = reader.bytes();
|
obj.nullifier = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 7:
|
case 7:
|
||||||
obj.rlnIdentifier = reader.bytes();
|
obj.rlnIdentifier = reader.bytes()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if ((obj.payload != null && obj.payload.byteLength > 0)) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.bytes(obj.payload);
|
w.bytes(obj.payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.contentTopic != null && obj.contentTopic !== "") {
|
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.string(obj.contentTopic);
|
w.string(obj.contentTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.version != null) {
|
if (obj.version != null) {
|
||||||
w.uint32(24);
|
w.uint32(24)
|
||||||
w.uint32(obj.version);
|
w.uint32(obj.version)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.timestamp != null) {
|
if (obj.timestamp != null) {
|
||||||
w.uint32(80);
|
w.uint32(80)
|
||||||
w.sint64(obj.timestamp);
|
w.sint64(obj.timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.meta != null) {
|
if (obj.meta != null) {
|
||||||
w.uint32(90);
|
w.uint32(90)
|
||||||
w.bytes(obj.meta);
|
w.bytes(obj.meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.rateLimitProof != null) {
|
if (obj.rateLimitProof != null) {
|
||||||
w.uint32(170);
|
w.uint32(170)
|
||||||
RateLimitProof.codec().encode(obj.rateLimitProof, w);
|
RateLimitProof.codec().encode(obj.rateLimitProof, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.ephemeral != null) {
|
if (obj.ephemeral != null) {
|
||||||
w.uint32(248);
|
w.uint32(248)
|
||||||
w.bool(obj.ephemeral);
|
w.bool(obj.ephemeral)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
payload: new Uint8Array(0),
|
payload: new Uint8Array(0),
|
||||||
contentTopic: ""
|
contentTopic: ''
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.payload = reader.bytes();
|
obj.payload = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.contentTopic = reader.string();
|
obj.contentTopic = reader.string()
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
obj.version = reader.uint32();
|
obj.version = reader.uint32()
|
||||||
break;
|
break
|
||||||
case 10:
|
case 10:
|
||||||
obj.timestamp = reader.sint64();
|
obj.timestamp = reader.sint64()
|
||||||
break;
|
break
|
||||||
case 11:
|
case 11:
|
||||||
obj.meta = reader.bytes();
|
obj.meta = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 21:
|
case 21:
|
||||||
obj.rateLimitProof = RateLimitProof.codec().decode(
|
obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 31:
|
case 31:
|
||||||
obj.ephemeral = reader.bool();
|
obj.ephemeral = reader.bool()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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())
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,319 +32,292 @@ 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 !== "") {
|
if ((obj.requestId != null && obj.requestId !== '')) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.string(obj.requestId);
|
w.string(obj.requestId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (obj.filterSubscribeType != null && __FilterSubscribeTypeValues[obj.filterSubscribeType] !== 0) {
|
||||||
obj.filterSubscribeType != null &&
|
w.uint32(16)
|
||||||
__FilterSubscribeTypeValues[obj.filterSubscribeType] !== 0
|
FilterSubscribeRequest.FilterSubscribeType.codec().encode(obj.filterSubscribeType, w)
|
||||||
) {
|
|
||||||
w.uint32(16);
|
|
||||||
FilterSubscribeRequest.FilterSubscribeType.codec().encode(
|
|
||||||
obj.filterSubscribeType,
|
|
||||||
w
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.pubsubTopic != null) {
|
if (obj.pubsubTopic != null) {
|
||||||
w.uint32(82);
|
w.uint32(82)
|
||||||
w.string(obj.pubsubTopic);
|
w.string(obj.pubsubTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.contentTopics != null) {
|
if (obj.contentTopics != null) {
|
||||||
for (const value of obj.contentTopics) {
|
for (const value of obj.contentTopics) {
|
||||||
w.uint32(90);
|
w.uint32(90)
|
||||||
w.string(value);
|
w.string(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
requestId: "",
|
requestId: '',
|
||||||
filterSubscribeType: FilterSubscribeType.SUBSCRIBER_PING,
|
filterSubscribeType: FilterSubscribeType.SUBSCRIBER_PING,
|
||||||
contentTopics: []
|
contentTopics: []
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.requestId = reader.string();
|
obj.requestId = reader.string()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.filterSubscribeType =
|
obj.filterSubscribeType = FilterSubscribeRequest.FilterSubscribeType.codec().decode(reader)
|
||||||
FilterSubscribeRequest.FilterSubscribeType.codec().decode(
|
break
|
||||||
reader
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 10:
|
case 10:
|
||||||
obj.pubsubTopic = reader.string();
|
obj.pubsubTopic = reader.string()
|
||||||
break;
|
break
|
||||||
case 11:
|
case 11:
|
||||||
obj.contentTopics.push(reader.string());
|
obj.contentTopics.push(reader.string())
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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 !== "") {
|
if ((obj.requestId != null && obj.requestId !== '')) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.string(obj.requestId);
|
w.string(obj.requestId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.statusCode != null && obj.statusCode !== 0) {
|
if ((obj.statusCode != null && obj.statusCode !== 0)) {
|
||||||
w.uint32(80);
|
w.uint32(80)
|
||||||
w.uint32(obj.statusCode);
|
w.uint32(obj.statusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.statusDesc != null) {
|
if (obj.statusDesc != null) {
|
||||||
w.uint32(90);
|
w.uint32(90)
|
||||||
w.string(obj.statusDesc);
|
w.string(obj.statusDesc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
requestId: "",
|
requestId: '',
|
||||||
statusCode: 0
|
statusCode: 0
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.requestId = reader.string();
|
obj.requestId = reader.string()
|
||||||
break;
|
break
|
||||||
case 10:
|
case 10:
|
||||||
obj.statusCode = reader.uint32();
|
obj.statusCode = reader.uint32()
|
||||||
break;
|
break
|
||||||
case 11:
|
case 11:
|
||||||
obj.statusDesc = reader.string();
|
obj.statusDesc = reader.string()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if (obj.wakuMessage != null) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
WakuMessage.codec().encode(obj.wakuMessage, w);
|
WakuMessage.codec().encode(obj.wakuMessage, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.pubsubTopic != null) {
|
if (obj.pubsubTopic != null) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.string(obj.pubsubTopic);
|
w.string(obj.pubsubTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
const obj: any = {}
|
||||||
const obj: any = {};
|
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.wakuMessage = WakuMessage.codec().decode(
|
obj.wakuMessage = WakuMessage.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 2:
|
case 2:
|
||||||
obj.pubsubTopic = reader.string();
|
obj.pubsubTopic = reader.string()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if ((obj.proof != null && obj.proof.byteLength > 0)) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.bytes(obj.proof);
|
w.bytes(obj.proof)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {
|
if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.bytes(obj.merkleRoot);
|
w.bytes(obj.merkleRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.epoch != null && obj.epoch.byteLength > 0) {
|
if ((obj.epoch != null && obj.epoch.byteLength > 0)) {
|
||||||
w.uint32(26);
|
w.uint32(26)
|
||||||
w.bytes(obj.epoch);
|
w.bytes(obj.epoch)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.shareX != null && obj.shareX.byteLength > 0) {
|
if ((obj.shareX != null && obj.shareX.byteLength > 0)) {
|
||||||
w.uint32(34);
|
w.uint32(34)
|
||||||
w.bytes(obj.shareX);
|
w.bytes(obj.shareX)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.shareY != null && obj.shareY.byteLength > 0) {
|
if ((obj.shareY != null && obj.shareY.byteLength > 0)) {
|
||||||
w.uint32(42);
|
w.uint32(42)
|
||||||
w.bytes(obj.shareY);
|
w.bytes(obj.shareY)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.nullifier != null && obj.nullifier.byteLength > 0) {
|
if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {
|
||||||
w.uint32(50);
|
w.uint32(50)
|
||||||
w.bytes(obj.nullifier);
|
w.bytes(obj.nullifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {
|
if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {
|
||||||
w.uint32(58);
|
w.uint32(58)
|
||||||
w.bytes(obj.rlnIdentifier);
|
w.bytes(obj.rlnIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
proof: new Uint8Array(0),
|
proof: new Uint8Array(0),
|
||||||
merkleRoot: new Uint8Array(0),
|
merkleRoot: new Uint8Array(0),
|
||||||
|
@ -358,173 +326,166 @@ export namespace RateLimitProof {
|
||||||
shareY: new Uint8Array(0),
|
shareY: new Uint8Array(0),
|
||||||
nullifier: new Uint8Array(0),
|
nullifier: new Uint8Array(0),
|
||||||
rlnIdentifier: new Uint8Array(0)
|
rlnIdentifier: new Uint8Array(0)
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.proof = reader.bytes();
|
obj.proof = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.merkleRoot = reader.bytes();
|
obj.merkleRoot = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
obj.epoch = reader.bytes();
|
obj.epoch = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 4:
|
case 4:
|
||||||
obj.shareX = reader.bytes();
|
obj.shareX = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 5:
|
case 5:
|
||||||
obj.shareY = reader.bytes();
|
obj.shareY = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 6:
|
case 6:
|
||||||
obj.nullifier = reader.bytes();
|
obj.nullifier = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 7:
|
case 7:
|
||||||
obj.rlnIdentifier = reader.bytes();
|
obj.rlnIdentifier = reader.bytes()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if ((obj.payload != null && obj.payload.byteLength > 0)) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.bytes(obj.payload);
|
w.bytes(obj.payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.contentTopic != null && obj.contentTopic !== "") {
|
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.string(obj.contentTopic);
|
w.string(obj.contentTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.version != null) {
|
if (obj.version != null) {
|
||||||
w.uint32(24);
|
w.uint32(24)
|
||||||
w.uint32(obj.version);
|
w.uint32(obj.version)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.timestamp != null) {
|
if (obj.timestamp != null) {
|
||||||
w.uint32(80);
|
w.uint32(80)
|
||||||
w.sint64(obj.timestamp);
|
w.sint64(obj.timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.meta != null) {
|
if (obj.meta != null) {
|
||||||
w.uint32(90);
|
w.uint32(90)
|
||||||
w.bytes(obj.meta);
|
w.bytes(obj.meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.rateLimitProof != null) {
|
if (obj.rateLimitProof != null) {
|
||||||
w.uint32(170);
|
w.uint32(170)
|
||||||
RateLimitProof.codec().encode(obj.rateLimitProof, w);
|
RateLimitProof.codec().encode(obj.rateLimitProof, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.ephemeral != null) {
|
if (obj.ephemeral != null) {
|
||||||
w.uint32(248);
|
w.uint32(248)
|
||||||
w.bool(obj.ephemeral);
|
w.bool(obj.ephemeral)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
payload: new Uint8Array(0),
|
payload: new Uint8Array(0),
|
||||||
contentTopic: ""
|
contentTopic: ''
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.payload = reader.bytes();
|
obj.payload = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.contentTopic = reader.string();
|
obj.contentTopic = reader.string()
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
obj.version = reader.uint32();
|
obj.version = reader.uint32()
|
||||||
break;
|
break
|
||||||
case 10:
|
case 10:
|
||||||
obj.timestamp = reader.sint64();
|
obj.timestamp = reader.sint64()
|
||||||
break;
|
break
|
||||||
case 11:
|
case 11:
|
||||||
obj.meta = reader.bytes();
|
obj.meta = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 21:
|
case 21:
|
||||||
obj.rateLimitProof = RateLimitProof.codec().decode(
|
obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 31:
|
case 31:
|
||||||
obj.ephemeral = reader.bool();
|
obj.ephemeral = reader.bool()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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())
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,299 +4,279 @@
|
||||||
/* 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 !== "") {
|
if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.string(obj.pubsubTopic);
|
w.string(obj.pubsubTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.message != null) {
|
if (obj.message != null) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
WakuMessage.codec().encode(obj.message, w);
|
WakuMessage.codec().encode(obj.message, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
pubsubTopic: ""
|
pubsubTopic: ''
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.pubsubTopic = reader.string();
|
obj.pubsubTopic = reader.string()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.message = WakuMessage.codec().decode(
|
obj.message = WakuMessage.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if ((obj.isSuccess != null && obj.isSuccess !== false)) {
|
||||||
w.uint32(8);
|
w.uint32(8)
|
||||||
w.bool(obj.isSuccess);
|
w.bool(obj.isSuccess)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.info != null) {
|
if (obj.info != null) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.string(obj.info);
|
w.string(obj.info)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
isSuccess: false
|
isSuccess: false
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.isSuccess = reader.bool();
|
obj.isSuccess = reader.bool()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.info = reader.string();
|
obj.info = reader.string()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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 !== "") {
|
if ((obj.requestId != null && obj.requestId !== '')) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.string(obj.requestId);
|
w.string(obj.requestId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.request != null) {
|
if (obj.request != null) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
PushRequest.codec().encode(obj.request, w);
|
PushRequest.codec().encode(obj.request, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.response != null) {
|
if (obj.response != null) {
|
||||||
w.uint32(26);
|
w.uint32(26)
|
||||||
PushResponse.codec().encode(obj.response, w);
|
PushResponse.codec().encode(obj.response, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
requestId: ""
|
requestId: ''
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.requestId = reader.string();
|
obj.requestId = reader.string()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.request = PushRequest.codec().decode(
|
obj.request = PushRequest.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 3:
|
case 3:
|
||||||
obj.response = PushResponse.codec().decode(
|
obj.response = PushResponse.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if ((obj.proof != null && obj.proof.byteLength > 0)) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.bytes(obj.proof);
|
w.bytes(obj.proof)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {
|
if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.bytes(obj.merkleRoot);
|
w.bytes(obj.merkleRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.epoch != null && obj.epoch.byteLength > 0) {
|
if ((obj.epoch != null && obj.epoch.byteLength > 0)) {
|
||||||
w.uint32(26);
|
w.uint32(26)
|
||||||
w.bytes(obj.epoch);
|
w.bytes(obj.epoch)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.shareX != null && obj.shareX.byteLength > 0) {
|
if ((obj.shareX != null && obj.shareX.byteLength > 0)) {
|
||||||
w.uint32(34);
|
w.uint32(34)
|
||||||
w.bytes(obj.shareX);
|
w.bytes(obj.shareX)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.shareY != null && obj.shareY.byteLength > 0) {
|
if ((obj.shareY != null && obj.shareY.byteLength > 0)) {
|
||||||
w.uint32(42);
|
w.uint32(42)
|
||||||
w.bytes(obj.shareY);
|
w.bytes(obj.shareY)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.nullifier != null && obj.nullifier.byteLength > 0) {
|
if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {
|
||||||
w.uint32(50);
|
w.uint32(50)
|
||||||
w.bytes(obj.nullifier);
|
w.bytes(obj.nullifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {
|
if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {
|
||||||
w.uint32(58);
|
w.uint32(58)
|
||||||
w.bytes(obj.rlnIdentifier);
|
w.bytes(obj.rlnIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
proof: new Uint8Array(0),
|
proof: new Uint8Array(0),
|
||||||
merkleRoot: new Uint8Array(0),
|
merkleRoot: new Uint8Array(0),
|
||||||
|
@ -305,173 +285,166 @@ export namespace RateLimitProof {
|
||||||
shareY: new Uint8Array(0),
|
shareY: new Uint8Array(0),
|
||||||
nullifier: new Uint8Array(0),
|
nullifier: new Uint8Array(0),
|
||||||
rlnIdentifier: new Uint8Array(0)
|
rlnIdentifier: new Uint8Array(0)
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.proof = reader.bytes();
|
obj.proof = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.merkleRoot = reader.bytes();
|
obj.merkleRoot = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
obj.epoch = reader.bytes();
|
obj.epoch = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 4:
|
case 4:
|
||||||
obj.shareX = reader.bytes();
|
obj.shareX = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 5:
|
case 5:
|
||||||
obj.shareY = reader.bytes();
|
obj.shareY = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 6:
|
case 6:
|
||||||
obj.nullifier = reader.bytes();
|
obj.nullifier = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 7:
|
case 7:
|
||||||
obj.rlnIdentifier = reader.bytes();
|
obj.rlnIdentifier = reader.bytes()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if ((obj.payload != null && obj.payload.byteLength > 0)) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.bytes(obj.payload);
|
w.bytes(obj.payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.contentTopic != null && obj.contentTopic !== "") {
|
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.string(obj.contentTopic);
|
w.string(obj.contentTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.version != null) {
|
if (obj.version != null) {
|
||||||
w.uint32(24);
|
w.uint32(24)
|
||||||
w.uint32(obj.version);
|
w.uint32(obj.version)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.timestamp != null) {
|
if (obj.timestamp != null) {
|
||||||
w.uint32(80);
|
w.uint32(80)
|
||||||
w.sint64(obj.timestamp);
|
w.sint64(obj.timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.meta != null) {
|
if (obj.meta != null) {
|
||||||
w.uint32(90);
|
w.uint32(90)
|
||||||
w.bytes(obj.meta);
|
w.bytes(obj.meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.rateLimitProof != null) {
|
if (obj.rateLimitProof != null) {
|
||||||
w.uint32(170);
|
w.uint32(170)
|
||||||
RateLimitProof.codec().encode(obj.rateLimitProof, w);
|
RateLimitProof.codec().encode(obj.rateLimitProof, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.ephemeral != null) {
|
if (obj.ephemeral != null) {
|
||||||
w.uint32(248);
|
w.uint32(248)
|
||||||
w.bool(obj.ephemeral);
|
w.bool(obj.ephemeral)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
payload: new Uint8Array(0),
|
payload: new Uint8Array(0),
|
||||||
contentTopic: ""
|
contentTopic: ''
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.payload = reader.bytes();
|
obj.payload = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.contentTopic = reader.string();
|
obj.contentTopic = reader.string()
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
obj.version = reader.uint32();
|
obj.version = reader.uint32()
|
||||||
break;
|
break
|
||||||
case 10:
|
case 10:
|
||||||
obj.timestamp = reader.sint64();
|
obj.timestamp = reader.sint64()
|
||||||
break;
|
break
|
||||||
case 11:
|
case 11:
|
||||||
obj.meta = reader.bytes();
|
obj.meta = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 21:
|
case 21:
|
||||||
obj.rateLimitProof = RateLimitProof.codec().decode(
|
obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 31:
|
case 31:
|
||||||
obj.ephemeral = reader.bool();
|
obj.ephemeral = reader.bool()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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())
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,71 +4,69 @@
|
||||||
/* 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) {
|
if ((obj.proof != null && obj.proof.byteLength > 0)) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.bytes(obj.proof);
|
w.bytes(obj.proof)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {
|
if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.bytes(obj.merkleRoot);
|
w.bytes(obj.merkleRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.epoch != null && obj.epoch.byteLength > 0) {
|
if ((obj.epoch != null && obj.epoch.byteLength > 0)) {
|
||||||
w.uint32(26);
|
w.uint32(26)
|
||||||
w.bytes(obj.epoch);
|
w.bytes(obj.epoch)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.shareX != null && obj.shareX.byteLength > 0) {
|
if ((obj.shareX != null && obj.shareX.byteLength > 0)) {
|
||||||
w.uint32(34);
|
w.uint32(34)
|
||||||
w.bytes(obj.shareX);
|
w.bytes(obj.shareX)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.shareY != null && obj.shareY.byteLength > 0) {
|
if ((obj.shareY != null && obj.shareY.byteLength > 0)) {
|
||||||
w.uint32(42);
|
w.uint32(42)
|
||||||
w.bytes(obj.shareY);
|
w.bytes(obj.shareY)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.nullifier != null && obj.nullifier.byteLength > 0) {
|
if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {
|
||||||
w.uint32(50);
|
w.uint32(50)
|
||||||
w.bytes(obj.nullifier);
|
w.bytes(obj.nullifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {
|
if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {
|
||||||
w.uint32(58);
|
w.uint32(58)
|
||||||
w.bytes(obj.rlnIdentifier);
|
w.bytes(obj.rlnIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
proof: new Uint8Array(0),
|
proof: new Uint8Array(0),
|
||||||
merkleRoot: new Uint8Array(0),
|
merkleRoot: new Uint8Array(0),
|
||||||
|
@ -77,173 +75,166 @@ export namespace RateLimitProof {
|
||||||
shareY: new Uint8Array(0),
|
shareY: new Uint8Array(0),
|
||||||
nullifier: new Uint8Array(0),
|
nullifier: new Uint8Array(0),
|
||||||
rlnIdentifier: new Uint8Array(0)
|
rlnIdentifier: new Uint8Array(0)
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.proof = reader.bytes();
|
obj.proof = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.merkleRoot = reader.bytes();
|
obj.merkleRoot = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
obj.epoch = reader.bytes();
|
obj.epoch = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 4:
|
case 4:
|
||||||
obj.shareX = reader.bytes();
|
obj.shareX = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 5:
|
case 5:
|
||||||
obj.shareY = reader.bytes();
|
obj.shareY = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 6:
|
case 6:
|
||||||
obj.nullifier = reader.bytes();
|
obj.nullifier = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 7:
|
case 7:
|
||||||
obj.rlnIdentifier = reader.bytes();
|
obj.rlnIdentifier = reader.bytes()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if ((obj.payload != null && obj.payload.byteLength > 0)) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.bytes(obj.payload);
|
w.bytes(obj.payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.contentTopic != null && obj.contentTopic !== "") {
|
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.string(obj.contentTopic);
|
w.string(obj.contentTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.version != null) {
|
if (obj.version != null) {
|
||||||
w.uint32(24);
|
w.uint32(24)
|
||||||
w.uint32(obj.version);
|
w.uint32(obj.version)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.timestamp != null) {
|
if (obj.timestamp != null) {
|
||||||
w.uint32(80);
|
w.uint32(80)
|
||||||
w.sint64(obj.timestamp);
|
w.sint64(obj.timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.meta != null) {
|
if (obj.meta != null) {
|
||||||
w.uint32(90);
|
w.uint32(90)
|
||||||
w.bytes(obj.meta);
|
w.bytes(obj.meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.rateLimitProof != null) {
|
if (obj.rateLimitProof != null) {
|
||||||
w.uint32(170);
|
w.uint32(170)
|
||||||
RateLimitProof.codec().encode(obj.rateLimitProof, w);
|
RateLimitProof.codec().encode(obj.rateLimitProof, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.ephemeral != null) {
|
if (obj.ephemeral != null) {
|
||||||
w.uint32(248);
|
w.uint32(248)
|
||||||
w.bool(obj.ephemeral);
|
w.bool(obj.ephemeral)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
payload: new Uint8Array(0),
|
payload: new Uint8Array(0),
|
||||||
contentTopic: ""
|
contentTopic: ''
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.payload = reader.bytes();
|
obj.payload = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
obj.contentTopic = reader.string();
|
obj.contentTopic = reader.string()
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
obj.version = reader.uint32();
|
obj.version = reader.uint32()
|
||||||
break;
|
break
|
||||||
case 10:
|
case 10:
|
||||||
obj.timestamp = reader.sint64();
|
obj.timestamp = reader.sint64()
|
||||||
break;
|
break
|
||||||
case 11:
|
case 11:
|
||||||
obj.meta = reader.bytes();
|
obj.meta = reader.bytes()
|
||||||
break;
|
break
|
||||||
case 21:
|
case 21:
|
||||||
obj.rateLimitProof = RateLimitProof.codec().decode(
|
obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 31:
|
case 31:
|
||||||
obj.ephemeral = reader.bool();
|
obj.ephemeral = reader.bool()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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())
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
if (obj.enr != null) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
w.bytes(obj.enr);
|
w.bytes(obj.enr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
const obj: any = {}
|
||||||
const obj: any = {};
|
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.enr = reader.bytes();
|
obj.enr = reader.bytes()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if (obj.numPeers != null) {
|
||||||
w.uint32(8);
|
w.uint32(8)
|
||||||
w.uint64(obj.numPeers);
|
w.uint64(obj.numPeers)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
const obj: any = {}
|
||||||
const obj: any = {};
|
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.numPeers = reader.uint64();
|
obj.numPeers = reader.uint64()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if (obj.peerInfos != null) {
|
||||||
for (const value of obj.peerInfos) {
|
for (const value of obj.peerInfos) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
PeerInfo.codec().encode(value, w);
|
PeerInfo.codec().encode(value, w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
peerInfos: []
|
peerInfos: []
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.peerInfos.push(
|
obj.peerInfos.push(PeerInfo.codec().decode(reader, reader.uint32()))
|
||||||
PeerInfo.codec().decode(reader, reader.uint32())
|
break
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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) {
|
if (obj.query != null) {
|
||||||
w.uint32(10);
|
w.uint32(10)
|
||||||
PeerExchangeQuery.codec().encode(obj.query, w);
|
PeerExchangeQuery.codec().encode(obj.query, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.response != null) {
|
if (obj.response != null) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
PeerExchangeResponse.codec().encode(obj.response, w);
|
PeerExchangeResponse.codec().encode(obj.response, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
const obj: any = {}
|
||||||
const obj: any = {};
|
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 1:
|
case 1:
|
||||||
obj.query = PeerExchangeQuery.codec().decode(
|
obj.query = PeerExchangeQuery.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 2:
|
case 2:
|
||||||
obj.response = PeerExchangeResponse.codec().decode(
|
obj.response = PeerExchangeResponse.codec().decode(reader, reader.uint32())
|
||||||
reader,
|
break
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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
|
@ -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 !== "") {
|
if ((obj.contentTopic != null && obj.contentTopic !== '')) {
|
||||||
w.uint32(18);
|
w.uint32(18)
|
||||||
w.string(obj.contentTopic);
|
w.string(obj.contentTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.lengthDelimited !== false) {
|
if (opts.lengthDelimited !== false) {
|
||||||
w.ldelim();
|
w.ldelim()
|
||||||
}
|
}
|
||||||
},
|
}, (reader, length) => {
|
||||||
(reader, length) => {
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
contentTopic: ""
|
contentTopic: ''
|
||||||
};
|
}
|
||||||
|
|
||||||
const end = length == null ? reader.len : reader.pos + length;
|
const end = length == null ? reader.len : reader.pos + length
|
||||||
|
|
||||||
while (reader.pos < end) {
|
while (reader.pos < end) {
|
||||||
const tag = reader.uint32();
|
const tag = reader.uint32()
|
||||||
|
|
||||||
switch (tag >>> 3) {
|
switch (tag >>> 3) {
|
||||||
case 2:
|
case 2:
|
||||||
obj.contentTopic = reader.string();
|
obj.contentTopic = reader.string()
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
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());
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue