2022-05-27 16:48:44 +10:00
|
|
|
/* eslint-disable import/export */
|
|
|
|
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
encodeMessage,
|
|
|
|
|
decodeMessage,
|
|
|
|
|
message,
|
|
|
|
|
enumeration,
|
|
|
|
|
} from "protons-runtime";
|
2022-09-05 14:39:24 +10:00
|
|
|
import type { Uint8ArrayList } from "uint8arraylist";
|
2022-05-27 16:48:44 +10:00
|
|
|
import type { Codec } from "protons-runtime";
|
|
|
|
|
|
|
|
|
|
export interface Index {
|
2022-06-15 19:15:28 +10:00
|
|
|
digest?: Uint8Array;
|
|
|
|
|
receivedTime?: bigint;
|
|
|
|
|
senderTime?: bigint;
|
|
|
|
|
pubsubTopic?: string;
|
2022-05-27 16:48:44 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export namespace Index {
|
2022-09-05 14:39:24 +10:00
|
|
|
let _codec: Codec<Index>;
|
|
|
|
|
|
2022-05-27 16:48:44 +10:00
|
|
|
export const codec = (): Codec<Index> => {
|
2022-09-05 14:39:24 +10:00
|
|
|
if (_codec == null) {
|
|
|
|
|
_codec = message<Index>(
|
|
|
|
|
(obj, writer, opts = {}) => {
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.fork();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.digest != null) {
|
|
|
|
|
writer.uint32(10);
|
|
|
|
|
writer.bytes(obj.digest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.receivedTime != null) {
|
|
|
|
|
writer.uint32(16);
|
|
|
|
|
writer.sint64(obj.receivedTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.senderTime != null) {
|
|
|
|
|
writer.uint32(24);
|
|
|
|
|
writer.sint64(obj.senderTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.pubsubTopic != null) {
|
|
|
|
|
writer.uint32(34);
|
|
|
|
|
writer.string(obj.pubsubTopic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.ldelim();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
(reader, length) => {
|
|
|
|
|
const obj: any = {};
|
|
|
|
|
|
|
|
|
|
const end = length == null ? reader.len : reader.pos + length;
|
|
|
|
|
|
|
|
|
|
while (reader.pos < end) {
|
|
|
|
|
const tag = reader.uint32();
|
|
|
|
|
|
|
|
|
|
switch (tag >>> 3) {
|
|
|
|
|
case 1:
|
|
|
|
|
obj.digest = reader.bytes();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
obj.receivedTime = reader.sint64();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
obj.senderTime = reader.sint64();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
obj.pubsubTopic = reader.string();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
reader.skipType(tag & 7);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _codec;
|
2022-05-27 16:48:44 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const encode = (obj: Index): Uint8Array => {
|
|
|
|
|
return encodeMessage(obj, Index.codec());
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-05 14:39:24 +10:00
|
|
|
export const decode = (buf: Uint8Array | Uint8ArrayList): Index => {
|
2022-05-27 16:48:44 +10:00
|
|
|
return decodeMessage(buf, Index.codec());
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface PagingInfo {
|
2022-06-15 19:15:28 +10:00
|
|
|
pageSize?: bigint;
|
|
|
|
|
cursor?: Index;
|
|
|
|
|
direction?: PagingInfo.Direction;
|
2022-05-27 16:48:44 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export namespace PagingInfo {
|
|
|
|
|
export enum Direction {
|
|
|
|
|
DIRECTION_BACKWARD_UNSPECIFIED = "DIRECTION_BACKWARD_UNSPECIFIED",
|
|
|
|
|
DIRECTION_FORWARD = "DIRECTION_FORWARD",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum __DirectionValues {
|
|
|
|
|
DIRECTION_BACKWARD_UNSPECIFIED = 0,
|
|
|
|
|
DIRECTION_FORWARD = 1,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export namespace Direction {
|
|
|
|
|
export const codec = () => {
|
2022-09-05 14:39:24 +10:00
|
|
|
return enumeration<Direction>(__DirectionValues);
|
2022-05-27 16:48:44 +10:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-05 14:39:24 +10:00
|
|
|
let _codec: Codec<PagingInfo>;
|
|
|
|
|
|
2022-05-27 16:48:44 +10:00
|
|
|
export const codec = (): Codec<PagingInfo> => {
|
2022-09-05 14:39:24 +10:00
|
|
|
if (_codec == null) {
|
|
|
|
|
_codec = message<PagingInfo>(
|
|
|
|
|
(obj, writer, opts = {}) => {
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.fork();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.pageSize != null) {
|
|
|
|
|
writer.uint32(8);
|
|
|
|
|
writer.uint64(obj.pageSize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.cursor != null) {
|
|
|
|
|
writer.uint32(18);
|
|
|
|
|
Index.codec().encode(obj.cursor, writer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.direction != null) {
|
|
|
|
|
writer.uint32(24);
|
|
|
|
|
PagingInfo.Direction.codec().encode(obj.direction, writer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.ldelim();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
(reader, length) => {
|
|
|
|
|
const obj: any = {};
|
|
|
|
|
|
|
|
|
|
const end = length == null ? reader.len : reader.pos + length;
|
|
|
|
|
|
|
|
|
|
while (reader.pos < end) {
|
|
|
|
|
const tag = reader.uint32();
|
|
|
|
|
|
|
|
|
|
switch (tag >>> 3) {
|
|
|
|
|
case 1:
|
|
|
|
|
obj.pageSize = reader.uint64();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
obj.cursor = Index.codec().decode(reader, reader.uint32());
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
obj.direction = PagingInfo.Direction.codec().decode(reader);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
reader.skipType(tag & 7);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _codec;
|
2022-05-27 16:48:44 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const encode = (obj: PagingInfo): Uint8Array => {
|
|
|
|
|
return encodeMessage(obj, PagingInfo.codec());
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-05 14:39:24 +10:00
|
|
|
export const decode = (buf: Uint8Array | Uint8ArrayList): PagingInfo => {
|
2022-05-27 16:48:44 +10:00
|
|
|
return decodeMessage(buf, PagingInfo.codec());
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ContentFilter {
|
2022-06-15 19:15:28 +10:00
|
|
|
contentTopic?: string;
|
2022-05-27 16:48:44 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export namespace ContentFilter {
|
2022-09-05 14:39:24 +10:00
|
|
|
let _codec: Codec<ContentFilter>;
|
|
|
|
|
|
2022-05-27 16:48:44 +10:00
|
|
|
export const codec = (): Codec<ContentFilter> => {
|
2022-09-05 14:39:24 +10:00
|
|
|
if (_codec == null) {
|
|
|
|
|
_codec = message<ContentFilter>(
|
|
|
|
|
(obj, writer, opts = {}) => {
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.fork();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.contentTopic != null) {
|
|
|
|
|
writer.uint32(10);
|
|
|
|
|
writer.string(obj.contentTopic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.ldelim();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
(reader, length) => {
|
|
|
|
|
const obj: any = {};
|
|
|
|
|
|
|
|
|
|
const end = length == null ? reader.len : reader.pos + length;
|
|
|
|
|
|
|
|
|
|
while (reader.pos < end) {
|
|
|
|
|
const tag = reader.uint32();
|
|
|
|
|
|
|
|
|
|
switch (tag >>> 3) {
|
|
|
|
|
case 1:
|
|
|
|
|
obj.contentTopic = reader.string();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
reader.skipType(tag & 7);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _codec;
|
2022-05-27 16:48:44 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const encode = (obj: ContentFilter): Uint8Array => {
|
|
|
|
|
return encodeMessage(obj, ContentFilter.codec());
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-05 14:39:24 +10:00
|
|
|
export const decode = (buf: Uint8Array | Uint8ArrayList): ContentFilter => {
|
2022-05-27 16:48:44 +10:00
|
|
|
return decodeMessage(buf, ContentFilter.codec());
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface HistoryQuery {
|
|
|
|
|
pubSubTopic?: string;
|
|
|
|
|
contentFilters: ContentFilter[];
|
|
|
|
|
pagingInfo?: PagingInfo;
|
|
|
|
|
startTime?: bigint;
|
|
|
|
|
endTime?: bigint;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export namespace HistoryQuery {
|
2022-09-05 14:39:24 +10:00
|
|
|
let _codec: Codec<HistoryQuery>;
|
|
|
|
|
|
2022-05-27 16:48:44 +10:00
|
|
|
export const codec = (): Codec<HistoryQuery> => {
|
2022-09-05 14:39:24 +10:00
|
|
|
if (_codec == null) {
|
|
|
|
|
_codec = message<HistoryQuery>(
|
|
|
|
|
(obj, writer, opts = {}) => {
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.fork();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.pubSubTopic != null) {
|
|
|
|
|
writer.uint32(18);
|
|
|
|
|
writer.string(obj.pubSubTopic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.contentFilters != null) {
|
|
|
|
|
for (const value of obj.contentFilters) {
|
|
|
|
|
writer.uint32(26);
|
|
|
|
|
ContentFilter.codec().encode(value, writer);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: required field "contentFilters" was not found in object'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.pagingInfo != null) {
|
|
|
|
|
writer.uint32(34);
|
|
|
|
|
PagingInfo.codec().encode(obj.pagingInfo, writer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.startTime != null) {
|
|
|
|
|
writer.uint32(40);
|
|
|
|
|
writer.sint64(obj.startTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.endTime != null) {
|
|
|
|
|
writer.uint32(48);
|
|
|
|
|
writer.sint64(obj.endTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.ldelim();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
(reader, length) => {
|
|
|
|
|
const obj: any = {
|
|
|
|
|
contentFilters: [],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const end = length == null ? reader.len : reader.pos + length;
|
|
|
|
|
|
|
|
|
|
while (reader.pos < end) {
|
|
|
|
|
const tag = reader.uint32();
|
|
|
|
|
|
|
|
|
|
switch (tag >>> 3) {
|
|
|
|
|
case 2:
|
|
|
|
|
obj.pubSubTopic = reader.string();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
obj.contentFilters.push(
|
|
|
|
|
ContentFilter.codec().decode(reader, reader.uint32())
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
obj.pagingInfo = PagingInfo.codec().decode(
|
|
|
|
|
reader,
|
|
|
|
|
reader.uint32()
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
obj.startTime = reader.sint64();
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
obj.endTime = reader.sint64();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
reader.skipType(tag & 7);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _codec;
|
2022-05-27 16:48:44 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const encode = (obj: HistoryQuery): Uint8Array => {
|
|
|
|
|
return encodeMessage(obj, HistoryQuery.codec());
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-05 14:39:24 +10:00
|
|
|
export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryQuery => {
|
2022-05-27 16:48:44 +10:00
|
|
|
return decodeMessage(buf, HistoryQuery.codec());
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface HistoryResponse {
|
|
|
|
|
messages: WakuMessage[];
|
2022-06-15 19:15:28 +10:00
|
|
|
pagingInfo?: PagingInfo;
|
2022-09-05 13:49:43 +10:00
|
|
|
error?: HistoryResponse.HistoryError;
|
2022-05-27 16:48:44 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export namespace HistoryResponse {
|
2022-09-05 13:49:43 +10:00
|
|
|
export enum HistoryError {
|
2022-05-27 16:48:44 +10:00
|
|
|
ERROR_NONE_UNSPECIFIED = "ERROR_NONE_UNSPECIFIED",
|
|
|
|
|
ERROR_INVALID_CURSOR = "ERROR_INVALID_CURSOR",
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-05 13:49:43 +10:00
|
|
|
enum __HistoryErrorValues {
|
2022-05-27 16:48:44 +10:00
|
|
|
ERROR_NONE_UNSPECIFIED = 0,
|
|
|
|
|
ERROR_INVALID_CURSOR = 1,
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-05 13:49:43 +10:00
|
|
|
export namespace HistoryError {
|
2022-05-27 16:48:44 +10:00
|
|
|
export const codec = () => {
|
2022-09-05 14:39:24 +10:00
|
|
|
return enumeration<HistoryError>(__HistoryErrorValues);
|
2022-05-27 16:48:44 +10:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-05 14:39:24 +10:00
|
|
|
let _codec: Codec<HistoryResponse>;
|
|
|
|
|
|
2022-05-27 16:48:44 +10:00
|
|
|
export const codec = (): Codec<HistoryResponse> => {
|
2022-09-05 14:39:24 +10:00
|
|
|
if (_codec == null) {
|
|
|
|
|
_codec = message<HistoryResponse>(
|
|
|
|
|
(obj, writer, opts = {}) => {
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.fork();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.messages != null) {
|
|
|
|
|
for (const value of obj.messages) {
|
|
|
|
|
writer.uint32(18);
|
|
|
|
|
WakuMessage.codec().encode(value, writer);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: required field "messages" was not found in object'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.pagingInfo != null) {
|
|
|
|
|
writer.uint32(26);
|
|
|
|
|
PagingInfo.codec().encode(obj.pagingInfo, writer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.error != null) {
|
|
|
|
|
writer.uint32(32);
|
|
|
|
|
HistoryResponse.HistoryError.codec().encode(obj.error, writer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.ldelim();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
(reader, length) => {
|
|
|
|
|
const obj: any = {
|
|
|
|
|
messages: [],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const end = length == null ? reader.len : reader.pos + length;
|
|
|
|
|
|
|
|
|
|
while (reader.pos < end) {
|
|
|
|
|
const tag = reader.uint32();
|
|
|
|
|
|
|
|
|
|
switch (tag >>> 3) {
|
|
|
|
|
case 2:
|
|
|
|
|
obj.messages.push(
|
|
|
|
|
WakuMessage.codec().decode(reader, reader.uint32())
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
obj.pagingInfo = PagingInfo.codec().decode(
|
|
|
|
|
reader,
|
|
|
|
|
reader.uint32()
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
obj.error = HistoryResponse.HistoryError.codec().decode(reader);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
reader.skipType(tag & 7);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _codec;
|
2022-05-27 16:48:44 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const encode = (obj: HistoryResponse): Uint8Array => {
|
|
|
|
|
return encodeMessage(obj, HistoryResponse.codec());
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-05 14:39:24 +10:00
|
|
|
export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryResponse => {
|
2022-05-27 16:48:44 +10:00
|
|
|
return decodeMessage(buf, HistoryResponse.codec());
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface HistoryRPC {
|
2022-06-15 19:15:28 +10:00
|
|
|
requestId?: string;
|
2022-05-27 16:48:44 +10:00
|
|
|
query?: HistoryQuery;
|
|
|
|
|
response?: HistoryResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export namespace HistoryRPC {
|
2022-09-05 14:39:24 +10:00
|
|
|
let _codec: Codec<HistoryRPC>;
|
|
|
|
|
|
2022-05-27 16:48:44 +10:00
|
|
|
export const codec = (): Codec<HistoryRPC> => {
|
2022-09-05 14:39:24 +10:00
|
|
|
if (_codec == null) {
|
|
|
|
|
_codec = message<HistoryRPC>(
|
|
|
|
|
(obj, writer, opts = {}) => {
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.fork();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.requestId != null) {
|
|
|
|
|
writer.uint32(10);
|
|
|
|
|
writer.string(obj.requestId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.query != null) {
|
|
|
|
|
writer.uint32(18);
|
|
|
|
|
HistoryQuery.codec().encode(obj.query, writer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.response != null) {
|
|
|
|
|
writer.uint32(26);
|
|
|
|
|
HistoryResponse.codec().encode(obj.response, writer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.ldelim();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
(reader, length) => {
|
|
|
|
|
const obj: any = {};
|
|
|
|
|
|
|
|
|
|
const end = length == null ? reader.len : reader.pos + length;
|
|
|
|
|
|
|
|
|
|
while (reader.pos < end) {
|
|
|
|
|
const tag = reader.uint32();
|
|
|
|
|
|
|
|
|
|
switch (tag >>> 3) {
|
|
|
|
|
case 1:
|
|
|
|
|
obj.requestId = reader.string();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
obj.query = HistoryQuery.codec().decode(
|
|
|
|
|
reader,
|
|
|
|
|
reader.uint32()
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
obj.response = HistoryResponse.codec().decode(
|
|
|
|
|
reader,
|
|
|
|
|
reader.uint32()
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
reader.skipType(tag & 7);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _codec;
|
2022-05-27 16:48:44 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const encode = (obj: HistoryRPC): Uint8Array => {
|
|
|
|
|
return encodeMessage(obj, HistoryRPC.codec());
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-05 14:39:24 +10:00
|
|
|
export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryRPC => {
|
2022-05-27 16:48:44 +10:00
|
|
|
return decodeMessage(buf, HistoryRPC.codec());
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-25 11:30:26 -04:00
|
|
|
export interface RateLimitProof {
|
|
|
|
|
proof: Uint8Array;
|
|
|
|
|
merkleRoot: Uint8Array;
|
|
|
|
|
epoch: Uint8Array;
|
|
|
|
|
shareX: Uint8Array;
|
|
|
|
|
shareY: Uint8Array;
|
|
|
|
|
nullifier: Uint8Array;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export namespace RateLimitProof {
|
|
|
|
|
let _codec: Codec<RateLimitProof>;
|
|
|
|
|
|
|
|
|
|
export const codec = (): Codec<RateLimitProof> => {
|
|
|
|
|
if (_codec == null) {
|
|
|
|
|
_codec = message<RateLimitProof>(
|
|
|
|
|
(obj, writer, opts = {}) => {
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.fork();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.proof != null) {
|
|
|
|
|
writer.uint32(10);
|
|
|
|
|
writer.bytes(obj.proof);
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: required field "proof" was not found in object'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.merkleRoot != null) {
|
|
|
|
|
writer.uint32(18);
|
|
|
|
|
writer.bytes(obj.merkleRoot);
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: required field "merkleRoot" was not found in object'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.epoch != null) {
|
|
|
|
|
writer.uint32(26);
|
|
|
|
|
writer.bytes(obj.epoch);
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: required field "epoch" was not found in object'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.shareX != null) {
|
|
|
|
|
writer.uint32(34);
|
|
|
|
|
writer.bytes(obj.shareX);
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: required field "shareX" was not found in object'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.shareY != null) {
|
|
|
|
|
writer.uint32(42);
|
|
|
|
|
writer.bytes(obj.shareY);
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: required field "shareY" was not found in object'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.nullifier != null) {
|
|
|
|
|
writer.uint32(50);
|
|
|
|
|
writer.bytes(obj.nullifier);
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: required field "nullifier" was not found in object'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.ldelim();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
(reader, length) => {
|
|
|
|
|
const obj: any = {
|
|
|
|
|
proof: new Uint8Array(0),
|
|
|
|
|
merkleRoot: new Uint8Array(0),
|
|
|
|
|
epoch: new Uint8Array(0),
|
|
|
|
|
shareX: new Uint8Array(0),
|
|
|
|
|
shareY: new Uint8Array(0),
|
|
|
|
|
nullifier: new Uint8Array(0),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const end = length == null ? reader.len : reader.pos + length;
|
|
|
|
|
|
|
|
|
|
while (reader.pos < end) {
|
|
|
|
|
const tag = reader.uint32();
|
|
|
|
|
|
|
|
|
|
switch (tag >>> 3) {
|
|
|
|
|
case 1:
|
|
|
|
|
obj.proof = reader.bytes();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
obj.merkleRoot = reader.bytes();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
obj.epoch = reader.bytes();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
obj.shareX = reader.bytes();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
obj.shareY = reader.bytes();
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
obj.nullifier = reader.bytes();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
reader.skipType(tag & 7);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.proof == null) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: value for required field "proof" was not found in protobuf'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.merkleRoot == null) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: value for required field "merkleRoot" was not found in protobuf'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.epoch == null) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: value for required field "epoch" was not found in protobuf'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.shareX == null) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: value for required field "shareX" was not found in protobuf'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.shareY == null) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: value for required field "shareY" was not found in protobuf'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.nullifier == null) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'Protocol error: value for required field "nullifier" was not found in protobuf'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _codec;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const encode = (obj: RateLimitProof): Uint8Array => {
|
|
|
|
|
return encodeMessage(obj, RateLimitProof.codec());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => {
|
|
|
|
|
return decodeMessage(buf, RateLimitProof.codec());
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-27 16:48:44 +10:00
|
|
|
export interface WakuMessage {
|
|
|
|
|
payload?: Uint8Array;
|
|
|
|
|
contentTopic?: string;
|
|
|
|
|
version?: number;
|
|
|
|
|
timestampDeprecated?: number;
|
|
|
|
|
timestamp?: bigint;
|
2022-09-25 11:30:26 -04:00
|
|
|
rateLimitProof?: RateLimitProof;
|
2022-05-27 16:48:44 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export namespace WakuMessage {
|
2022-09-05 14:39:24 +10:00
|
|
|
let _codec: Codec<WakuMessage>;
|
|
|
|
|
|
2022-05-27 16:48:44 +10:00
|
|
|
export const codec = (): Codec<WakuMessage> => {
|
2022-09-05 14:39:24 +10:00
|
|
|
if (_codec == null) {
|
|
|
|
|
_codec = message<WakuMessage>(
|
|
|
|
|
(obj, writer, opts = {}) => {
|
|
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.fork();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.payload != null) {
|
|
|
|
|
writer.uint32(10);
|
|
|
|
|
writer.bytes(obj.payload);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.contentTopic != null) {
|
|
|
|
|
writer.uint32(18);
|
|
|
|
|
writer.string(obj.contentTopic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.version != null) {
|
|
|
|
|
writer.uint32(24);
|
|
|
|
|
writer.uint32(obj.version);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.timestampDeprecated != null) {
|
|
|
|
|
writer.uint32(33);
|
|
|
|
|
writer.double(obj.timestampDeprecated);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.timestamp != null) {
|
|
|
|
|
writer.uint32(80);
|
|
|
|
|
writer.sint64(obj.timestamp);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-25 11:30:26 -04:00
|
|
|
if (obj.rateLimitProof != null) {
|
|
|
|
|
writer.uint32(170);
|
|
|
|
|
RateLimitProof.codec().encode(obj.rateLimitProof, writer);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-05 14:39:24 +10:00
|
|
|
if (opts.lengthDelimited !== false) {
|
|
|
|
|
writer.ldelim();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
(reader, length) => {
|
|
|
|
|
const obj: any = {};
|
|
|
|
|
|
|
|
|
|
const end = length == null ? reader.len : reader.pos + length;
|
|
|
|
|
|
|
|
|
|
while (reader.pos < end) {
|
|
|
|
|
const tag = reader.uint32();
|
|
|
|
|
|
|
|
|
|
switch (tag >>> 3) {
|
|
|
|
|
case 1:
|
|
|
|
|
obj.payload = reader.bytes();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
obj.contentTopic = reader.string();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
obj.version = reader.uint32();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
obj.timestampDeprecated = reader.double();
|
|
|
|
|
break;
|
|
|
|
|
case 10:
|
|
|
|
|
obj.timestamp = reader.sint64();
|
|
|
|
|
break;
|
2022-09-25 11:30:26 -04:00
|
|
|
case 21:
|
|
|
|
|
obj.rateLimitProof = RateLimitProof.codec().decode(
|
|
|
|
|
reader,
|
|
|
|
|
reader.uint32()
|
|
|
|
|
);
|
|
|
|
|
break;
|
2022-09-05 14:39:24 +10:00
|
|
|
default:
|
|
|
|
|
reader.skipType(tag & 7);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _codec;
|
2022-05-27 16:48:44 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const encode = (obj: WakuMessage): Uint8Array => {
|
|
|
|
|
return encodeMessage(obj, WakuMessage.codec());
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-05 14:39:24 +10:00
|
|
|
export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {
|
2022-05-27 16:48:44 +10:00
|
|
|
return decodeMessage(buf, WakuMessage.codec());
|
|
|
|
|
};
|
|
|
|
|
}
|