UNPKG

@waku/proto

Version:
542 lines 20.3 kB
/* eslint-disable import/export */ /* eslint-disable complexity */ /* eslint-disable @typescript-eslint/no-namespace */ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-empty-interface */ /* eslint-disable import/consistent-type-specifier-style */ /* eslint-disable @typescript-eslint/no-unused-vars */ import { decodeMessage, encodeMessage, message } from 'protons-runtime'; import { alloc as uint8ArrayAlloc } from 'uint8arrays/alloc'; export var PushRequest; (function (PushRequest) { let _codec; PushRequest.codec = () => { if (_codec == null) { _codec = message((obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { w.fork(); } if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) { w.uint32(10); w.string(obj.pubsubTopic); } if (obj.message != null) { w.uint32(18); WakuMessage.codec().encode(obj.message, w); } if (opts.lengthDelimited !== false) { w.ldelim(); } }, (reader, length, opts = {}) => { const obj = { pubsubTopic: '' }; const end = length == null ? reader.len : reader.pos + length; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { obj.pubsubTopic = reader.string(); break; } case 2: { obj.message = WakuMessage.codec().decode(reader, reader.uint32(), { limits: opts.limits?.message }); break; } default: { reader.skipType(tag & 7); break; } } } return obj; }); } return _codec; }; PushRequest.encode = (obj) => { return encodeMessage(obj, PushRequest.codec()); }; PushRequest.decode = (buf, opts) => { return decodeMessage(buf, PushRequest.codec(), opts); }; })(PushRequest || (PushRequest = {})); export var PushResponse; (function (PushResponse) { let _codec; PushResponse.codec = () => { if (_codec == null) { _codec = message((obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { w.fork(); } if ((obj.isSuccess != null && obj.isSuccess !== false)) { w.uint32(8); w.bool(obj.isSuccess); } if (obj.info != null) { w.uint32(18); w.string(obj.info); } if (obj.statusCode != null) { w.uint32(80); w.uint32(obj.statusCode); } if (obj.statusDesc != null) { w.uint32(90); w.string(obj.statusDesc); } if (obj.relayPeerCount != null) { w.uint32(96); w.uint32(obj.relayPeerCount); } if (opts.lengthDelimited !== false) { w.ldelim(); } }, (reader, length, opts = {}) => { const obj = { isSuccess: false }; const end = length == null ? reader.len : reader.pos + length; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { obj.isSuccess = reader.bool(); break; } case 2: { obj.info = reader.string(); break; } case 10: { obj.statusCode = reader.uint32(); break; } case 11: { obj.statusDesc = reader.string(); break; } case 12: { obj.relayPeerCount = reader.uint32(); break; } default: { reader.skipType(tag & 7); break; } } } return obj; }); } return _codec; }; PushResponse.encode = (obj) => { return encodeMessage(obj, PushResponse.codec()); }; PushResponse.decode = (buf, opts) => { return decodeMessage(buf, PushResponse.codec(), opts); }; })(PushResponse || (PushResponse = {})); export var PushRpc; (function (PushRpc) { let _codec; PushRpc.codec = () => { if (_codec == null) { _codec = message((obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { w.fork(); } if ((obj.requestId != null && obj.requestId !== '')) { w.uint32(10); w.string(obj.requestId); } if (obj.request != null) { w.uint32(18); PushRequest.codec().encode(obj.request, w); } if (obj.response != null) { w.uint32(26); PushResponse.codec().encode(obj.response, w); } if (opts.lengthDelimited !== false) { w.ldelim(); } }, (reader, length, opts = {}) => { const obj = { requestId: '' }; const end = length == null ? reader.len : reader.pos + length; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { obj.requestId = reader.string(); break; } case 2: { obj.request = PushRequest.codec().decode(reader, reader.uint32(), { limits: opts.limits?.request }); break; } case 3: { obj.response = PushResponse.codec().decode(reader, reader.uint32(), { limits: opts.limits?.response }); break; } default: { reader.skipType(tag & 7); break; } } } return obj; }); } return _codec; }; PushRpc.encode = (obj) => { return encodeMessage(obj, PushRpc.codec()); }; PushRpc.decode = (buf, opts) => { return decodeMessage(buf, PushRpc.codec(), opts); }; })(PushRpc || (PushRpc = {})); export var LightPushRequestV3; (function (LightPushRequestV3) { let _codec; LightPushRequestV3.codec = () => { if (_codec == null) { _codec = message((obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { w.fork(); } if ((obj.requestId != null && obj.requestId !== '')) { w.uint32(10); w.string(obj.requestId); } if (obj.pubsubTopic != null) { w.uint32(162); w.string(obj.pubsubTopic); } if (obj.message != null) { w.uint32(170); WakuMessage.codec().encode(obj.message, w); } if (opts.lengthDelimited !== false) { w.ldelim(); } }, (reader, length, opts = {}) => { const obj = { requestId: '' }; const end = length == null ? reader.len : reader.pos + length; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { obj.requestId = reader.string(); break; } case 20: { obj.pubsubTopic = reader.string(); break; } case 21: { obj.message = WakuMessage.codec().decode(reader, reader.uint32(), { limits: opts.limits?.message }); break; } default: { reader.skipType(tag & 7); break; } } } return obj; }); } return _codec; }; LightPushRequestV3.encode = (obj) => { return encodeMessage(obj, LightPushRequestV3.codec()); }; LightPushRequestV3.decode = (buf, opts) => { return decodeMessage(buf, LightPushRequestV3.codec(), opts); }; })(LightPushRequestV3 || (LightPushRequestV3 = {})); export var LightPushResponseV3; (function (LightPushResponseV3) { let _codec; LightPushResponseV3.codec = () => { if (_codec == null) { _codec = message((obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { w.fork(); } if ((obj.requestId != null && obj.requestId !== '')) { w.uint32(10); w.string(obj.requestId); } if ((obj.statusCode != null && obj.statusCode !== 0)) { w.uint32(80); w.uint32(obj.statusCode); } if (obj.statusDesc != null) { w.uint32(90); w.string(obj.statusDesc); } if (obj.relayPeerCount != null) { w.uint32(96); w.uint32(obj.relayPeerCount); } if (opts.lengthDelimited !== false) { w.ldelim(); } }, (reader, length, opts = {}) => { const obj = { requestId: '', statusCode: 0 }; const end = length == null ? reader.len : reader.pos + length; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { obj.requestId = reader.string(); break; } case 10: { obj.statusCode = reader.uint32(); break; } case 11: { obj.statusDesc = reader.string(); break; } case 12: { obj.relayPeerCount = reader.uint32(); break; } default: { reader.skipType(tag & 7); break; } } } return obj; }); } return _codec; }; LightPushResponseV3.encode = (obj) => { return encodeMessage(obj, LightPushResponseV3.codec()); }; LightPushResponseV3.decode = (buf, opts) => { return decodeMessage(buf, LightPushResponseV3.codec(), opts); }; })(LightPushResponseV3 || (LightPushResponseV3 = {})); export var RateLimitProof; (function (RateLimitProof) { let _codec; RateLimitProof.codec = () => { if (_codec == null) { _codec = message((obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { w.fork(); } if ((obj.proof != null && obj.proof.byteLength > 0)) { w.uint32(10); w.bytes(obj.proof); } if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) { w.uint32(18); w.bytes(obj.merkleRoot); } if ((obj.epoch != null && obj.epoch.byteLength > 0)) { w.uint32(26); w.bytes(obj.epoch); } if ((obj.shareX != null && obj.shareX.byteLength > 0)) { w.uint32(34); w.bytes(obj.shareX); } if ((obj.shareY != null && obj.shareY.byteLength > 0)) { w.uint32(42); w.bytes(obj.shareY); } if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) { w.uint32(50); w.bytes(obj.nullifier); } if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) { w.uint32(58); w.bytes(obj.rlnIdentifier); } if (opts.lengthDelimited !== false) { w.ldelim(); } }, (reader, length, opts = {}) => { const obj = { proof: uint8ArrayAlloc(0), merkleRoot: uint8ArrayAlloc(0), epoch: uint8ArrayAlloc(0), shareX: uint8ArrayAlloc(0), shareY: uint8ArrayAlloc(0), nullifier: uint8ArrayAlloc(0), rlnIdentifier: uint8ArrayAlloc(0) }; const end = length == null ? reader.len : reader.pos + length; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { obj.proof = reader.bytes(); break; } case 2: { obj.merkleRoot = reader.bytes(); break; } case 3: { obj.epoch = reader.bytes(); break; } case 4: { obj.shareX = reader.bytes(); break; } case 5: { obj.shareY = reader.bytes(); break; } case 6: { obj.nullifier = reader.bytes(); break; } case 7: { obj.rlnIdentifier = reader.bytes(); break; } default: { reader.skipType(tag & 7); break; } } } return obj; }); } return _codec; }; RateLimitProof.encode = (obj) => { return encodeMessage(obj, RateLimitProof.codec()); }; RateLimitProof.decode = (buf, opts) => { return decodeMessage(buf, RateLimitProof.codec(), opts); }; })(RateLimitProof || (RateLimitProof = {})); export var WakuMessage; (function (WakuMessage) { let _codec; WakuMessage.codec = () => { if (_codec == null) { _codec = message((obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { w.fork(); } if ((obj.payload != null && obj.payload.byteLength > 0)) { w.uint32(10); w.bytes(obj.payload); } if ((obj.contentTopic != null && obj.contentTopic !== '')) { w.uint32(18); w.string(obj.contentTopic); } if (obj.version != null) { w.uint32(24); w.uint32(obj.version); } if (obj.timestamp != null) { w.uint32(80); w.sint64(obj.timestamp); } if (obj.meta != null) { w.uint32(90); w.bytes(obj.meta); } if (obj.rateLimitProof != null) { w.uint32(170); RateLimitProof.codec().encode(obj.rateLimitProof, w); } if (obj.ephemeral != null) { w.uint32(248); w.bool(obj.ephemeral); } if (opts.lengthDelimited !== false) { w.ldelim(); } }, (reader, length, opts = {}) => { const obj = { payload: uint8ArrayAlloc(0), contentTopic: '' }; const end = length == null ? reader.len : reader.pos + length; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { obj.payload = reader.bytes(); break; } case 2: { obj.contentTopic = reader.string(); break; } case 3: { obj.version = reader.uint32(); break; } case 10: { obj.timestamp = reader.sint64(); break; } case 11: { obj.meta = reader.bytes(); break; } case 21: { obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), { limits: opts.limits?.rateLimitProof }); break; } case 31: { obj.ephemeral = reader.bool(); break; } default: { reader.skipType(tag & 7); break; } } } return obj; }); } return _codec; }; WakuMessage.encode = (obj) => { return encodeMessage(obj, WakuMessage.codec()); }; WakuMessage.decode = (buf, opts) => { return decodeMessage(buf, WakuMessage.codec(), opts); }; })(WakuMessage || (WakuMessage = {})); //# sourceMappingURL=light_push.js.map