js-waku-examples/eth-pm/static/media/rpc.93e8f6196bd2c425bf03.cjs

1 line
21 KiB
JavaScript
Raw Normal View History

2022-09-07 06:09:30 +00:00
"use strict";!function(e,t){"function"===typeof define&&define.amd?define(["protobufjs/minimal"],t):"function"===typeof require&&"object"===typeof module&&module&&module.exports&&(module.exports=t(require("protobufjs/minimal")))}(0,(function(e){var t=e.Reader,r=e.Writer,o=e.util,n=e.roots.default||(e.roots.default={});return n.RPC=function(){function s(e){if(this.subscriptions=[],this.messages=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var a;return s.prototype.subscriptions=o.emptyArray,s.prototype.messages=o.emptyArray,s.prototype.control=null,Object.defineProperty(s.prototype,"_control",{get:o.oneOfGetter(a=["control"]),set:o.oneOfSetter(a)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.subscriptions&&e.subscriptions.length)for(var o=0;o<e.subscriptions.length;++o)n.RPC.SubOpts.encode(e.subscriptions[o],t.uint32(10).fork()).ldelim();if(null!=e.messages&&e.messages.length)for(o=0;o<e.messages.length;++o)n.RPC.Message.encode(e.messages[o],t.uint32(18).fork()).ldelim();return null!=e.control&&Object.hasOwnProperty.call(e,"control")&&n.RPC.ControlMessage.encode(e.control,t.uint32(26).fork()).ldelim(),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var o=void 0===r?e.len:e.pos+r,s=new n.RPC;e.pos<o;){var a=e.uint32();switch(a>>>3){case 1:s.subscriptions&&s.subscriptions.length||(s.subscriptions=[]),s.subscriptions.push(n.RPC.SubOpts.decode(e,e.uint32()));break;case 2:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(n.RPC.Message.decode(e,e.uint32()));break;case 3:s.control=n.RPC.ControlMessage.decode(e,e.uint32());break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC)return e;var t=new n.RPC;if(e.subscriptions){if(!Array.isArray(e.subscriptions))throw TypeError(".RPC.subscriptions: array expected");t.subscriptions=[];for(var r=0;r<e.subscriptions.length;++r){if("object"!==typeof e.subscriptions[r])throw TypeError(".RPC.subscriptions: object expected");t.subscriptions[r]=n.RPC.SubOpts.fromObject(e.subscriptions[r])}}if(e.messages){if(!Array.isArray(e.messages))throw TypeError(".RPC.messages: array expected");t.messages=[];for(r=0;r<e.messages.length;++r){if("object"!==typeof e.messages[r])throw TypeError(".RPC.messages: object expected");t.messages[r]=n.RPC.Message.fromObject(e.messages[r])}}if(null!=e.control){if("object"!==typeof e.control)throw TypeError(".RPC.control: object expected");t.control=n.RPC.ControlMessage.fromObject(e.control)}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.subscriptions=[],r.messages=[]),e.subscriptions&&e.subscriptions.length){r.subscriptions=[];for(var o=0;o<e.subscriptions.length;++o)r.subscriptions[o]=n.RPC.SubOpts.toObject(e.subscriptions[o],t)}if(e.messages&&e.messages.length){r.messages=[];for(o=0;o<e.messages.length;++o)r.messages[o]=n.RPC.Message.toObject(e.messages[o],t)}return null!=e.control&&e.hasOwnProperty("control")&&(r.control=n.RPC.ControlMessage.toObject(e.control,t),t.oneofs&&(r._control="control")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s.SubOpts=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var a;return s.prototype.subscribe=null,s.prototype.topic=null,Object.defineProperty(s.prototype,"_subscribe",{get:o.oneOfGetter(a=["subscribe"]),set:o.oneOfSetter(a)}),Object.defineProperty(s.prototype,"_topic",{get:o.oneOfGetter(a=["topic"]),set:o.oneOfSetter(a)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.subscribe&&Object.hasOwnProperty.call(e,"subscribe")&&t.uint32(8).bool(e.subscribe),null!=e.topic&&Object.hasOwnProperty.call(e,"topic")&&t.uint32(18).string(e.topic),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var o=void 0===r?e.len:e.pos+r,s=new n.RPC.SubOpts;e.pos<o;){var a=e.uint32();switch(a>>>3){case 1:s.subscribe=e.bool();break;case 2:s.topic=e.string();break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.SubOpts)return e;var t=new n.RPC.SubOpts;r