UNPKG

pegasys-orchestrate

Version:

The PegaSys Orchestrate library provides convenient access to the Codefi Orchestrate API from applications written in server-side JavaScript

1,071 lines (1,070 loc) 953 kB
"use strict"; /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ (function (global, factory) { /* AMD */ if (typeof define === 'function' && define.amd) define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) module.exports = factory(require("protobufjs/minimal")); })(this, function ($protobuf) { "use strict"; // Common aliases var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); $root.abi = (function () { /** * Namespace abi. * @exports abi * @namespace */ var abi = {}; abi.ContractId = (function () { /** * Properties of a ContractId. * @memberof abi * @interface IContractId * @property {string|null} [registry] ContractId registry * @property {string|null} [name] ContractId name * @property {string|null} [tag] ContractId tag */ /** * Constructs a new ContractId. * @memberof abi * @classdesc Represents a ContractId. * @implements IContractId * @constructor * @param {abi.IContractId=} [properties] Properties to set */ function ContractId(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * ContractId registry. * @member {string} registry * @memberof abi.ContractId * @instance */ ContractId.prototype.registry = ""; /** * ContractId name. * @member {string} name * @memberof abi.ContractId * @instance */ ContractId.prototype.name = ""; /** * ContractId tag. * @member {string} tag * @memberof abi.ContractId * @instance */ ContractId.prototype.tag = ""; /** * Creates a new ContractId instance using the specified properties. * @function create * @memberof abi.ContractId * @static * @param {abi.IContractId=} [properties] Properties to set * @returns {abi.ContractId} ContractId instance */ ContractId.create = function create(properties) { return new ContractId(properties); }; /** * Encodes the specified ContractId message. Does not implicitly {@link abi.ContractId.verify|verify} messages. * @function encode * @memberof abi.ContractId * @static * @param {abi.IContractId} message ContractId message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ContractId.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.registry != null && Object.hasOwnProperty.call(message, "registry")) writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.registry); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.name); if (message.tag != null && Object.hasOwnProperty.call(message, "tag")) writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.tag); return writer; }; /** * Encodes the specified ContractId message, length delimited. Does not implicitly {@link abi.ContractId.verify|verify} messages. * @function encodeDelimited * @memberof abi.ContractId * @static * @param {abi.IContractId} message ContractId message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ContractId.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a ContractId message from the specified reader or buffer. * @function decode * @memberof abi.ContractId * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {abi.ContractId} ContractId * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ContractId.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.abi.ContractId(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.registry = reader.string(); break; case 2: message.name = reader.string(); break; case 3: message.tag = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a ContractId message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof abi.ContractId * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {abi.ContractId} ContractId * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ContractId.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a ContractId message. * @function verify * @memberof abi.ContractId * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ ContractId.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.registry != null && message.hasOwnProperty("registry")) if (!$util.isString(message.registry)) return "registry: string expected"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; if (message.tag != null && message.hasOwnProperty("tag")) if (!$util.isString(message.tag)) return "tag: string expected"; return null; }; /** * Creates a ContractId message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof abi.ContractId * @static * @param {Object.<string,*>} object Plain object * @returns {abi.ContractId} ContractId */ ContractId.fromObject = function fromObject(object) { if (object instanceof $root.abi.ContractId) return object; var message = new $root.abi.ContractId(); if (object.registry != null) message.registry = String(object.registry); if (object.name != null) message.name = String(object.name); if (object.tag != null) message.tag = String(object.tag); return message; }; /** * Creates a plain object from a ContractId message. Also converts values to other types if specified. * @function toObject * @memberof abi.ContractId * @static * @param {abi.ContractId} message ContractId * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ ContractId.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.registry = ""; object.name = ""; object.tag = ""; } if (message.registry != null && message.hasOwnProperty("registry")) object.registry = message.registry; if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.tag != null && message.hasOwnProperty("tag")) object.tag = message.tag; return object; }; /** * Converts this ContractId to JSON. * @function toJSON * @memberof abi.ContractId * @instance * @returns {Object.<string,*>} JSON object */ ContractId.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return ContractId; })(); abi.Contract = (function () { /** * Properties of a Contract. * @memberof abi * @interface IContract * @property {abi.IContractId|null} [id] Contract id * @property {string|null} [abi] Contract abi * @property {string|null} [bytecode] Contract bytecode * @property {Array.<abi.IMethod>|null} [methods] Contract methods * @property {Array.<abi.IEvent>|null} [events] Contract events * @property {string|null} [deployedBytecode] Contract deployedBytecode */ /** * Constructs a new Contract. * @memberof abi * @classdesc Represents a Contract. * @implements IContract * @constructor * @param {abi.IContract=} [properties] Properties to set */ function Contract(properties) { this.methods = []; this.events = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * Contract id. * @member {abi.IContractId|null|undefined} id * @memberof abi.Contract * @instance */ Contract.prototype.id = null; /** * Contract abi. * @member {string} abi * @memberof abi.Contract * @instance */ Contract.prototype.abi = ""; /** * Contract bytecode. * @member {string} bytecode * @memberof abi.Contract * @instance */ Contract.prototype.bytecode = ""; /** * Contract methods. * @member {Array.<abi.IMethod>} methods * @memberof abi.Contract * @instance */ Contract.prototype.methods = $util.emptyArray; /** * Contract events. * @member {Array.<abi.IEvent>} events * @memberof abi.Contract * @instance */ Contract.prototype.events = $util.emptyArray; /** * Contract deployedBytecode. * @member {string} deployedBytecode * @memberof abi.Contract * @instance */ Contract.prototype.deployedBytecode = ""; /** * Creates a new Contract instance using the specified properties. * @function create * @memberof abi.Contract * @static * @param {abi.IContract=} [properties] Properties to set * @returns {abi.Contract} Contract instance */ Contract.create = function create(properties) { return new Contract(properties); }; /** * Encodes the specified Contract message. Does not implicitly {@link abi.Contract.verify|verify} messages. * @function encode * @memberof abi.Contract * @static * @param {abi.IContract} message Contract message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Contract.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.id != null && Object.hasOwnProperty.call(message, "id")) $root.abi.ContractId.encode(message.id, writer.uint32(/* id 1, wireType 2 =*/ 10).fork()).ldelim(); if (message.abi != null && Object.hasOwnProperty.call(message, "abi")) writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.abi); if (message.bytecode != null && Object.hasOwnProperty.call(message, "bytecode")) writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.bytecode); if (message.methods != null && message.methods.length) for (var i = 0; i < message.methods.length; ++i) $root.abi.Method.encode(message.methods[i], writer.uint32(/* id 4, wireType 2 =*/ 34).fork()).ldelim(); if (message.events != null && message.events.length) for (var i = 0; i < message.events.length; ++i) $root.abi.Event.encode(message.events[i], writer.uint32(/* id 5, wireType 2 =*/ 42).fork()).ldelim(); if (message.deployedBytecode != null && Object.hasOwnProperty.call(message, "deployedBytecode")) writer.uint32(/* id 6, wireType 2 =*/ 50).string(message.deployedBytecode); return writer; }; /** * Encodes the specified Contract message, length delimited. Does not implicitly {@link abi.Contract.verify|verify} messages. * @function encodeDelimited * @memberof abi.Contract * @static * @param {abi.IContract} message Contract message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Contract.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a Contract message from the specified reader or buffer. * @function decode * @memberof abi.Contract * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {abi.Contract} Contract * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Contract.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.abi.Contract(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.id = $root.abi.ContractId.decode(reader, reader.uint32()); break; case 2: message.abi = reader.string(); break; case 3: message.bytecode = reader.string(); break; case 4: if (!(message.methods && message.methods.length)) message.methods = []; message.methods.push($root.abi.Method.decode(reader, reader.uint32())); break; case 5: if (!(message.events && message.events.length)) message.events = []; message.events.push($root.abi.Event.decode(reader, reader.uint32())); break; case 6: message.deployedBytecode = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a Contract message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof abi.Contract * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {abi.Contract} Contract * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Contract.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a Contract message. * @function verify * @memberof abi.Contract * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Contract.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.id != null && message.hasOwnProperty("id")) { var error = $root.abi.ContractId.verify(message.id); if (error) return "id." + error; } if (message.abi != null && message.hasOwnProperty("abi")) if (!$util.isString(message.abi)) return "abi: string expected"; if (message.bytecode != null && message.hasOwnProperty("bytecode")) if (!$util.isString(message.bytecode)) return "bytecode: string expected"; if (message.methods != null && message.hasOwnProperty("methods")) { if (!Array.isArray(message.methods)) return "methods: array expected"; for (var i = 0; i < message.methods.length; ++i) { var error = $root.abi.Method.verify(message.methods[i]); if (error) return "methods." + error; } } if (message.events != null && message.hasOwnProperty("events")) { if (!Array.isArray(message.events)) return "events: array expected"; for (var i = 0; i < message.events.length; ++i) { var error = $root.abi.Event.verify(message.events[i]); if (error) return "events." + error; } } if (message.deployedBytecode != null && message.hasOwnProperty("deployedBytecode")) if (!$util.isString(message.deployedBytecode)) return "deployedBytecode: string expected"; return null; }; /** * Creates a Contract message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof abi.Contract * @static * @param {Object.<string,*>} object Plain object * @returns {abi.Contract} Contract */ Contract.fromObject = function fromObject(object) { if (object instanceof $root.abi.Contract) return object; var message = new $root.abi.Contract(); if (object.id != null) { if (typeof object.id !== "object") throw TypeError(".abi.Contract.id: object expected"); message.id = $root.abi.ContractId.fromObject(object.id); } if (object.abi != null) message.abi = String(object.abi); if (object.bytecode != null) message.bytecode = String(object.bytecode); if (object.methods) { if (!Array.isArray(object.methods)) throw TypeError(".abi.Contract.methods: array expected"); message.methods = []; for (var i = 0; i < object.methods.length; ++i) { if (typeof object.methods[i] !== "object") throw TypeError(".abi.Contract.methods: object expected"); message.methods[i] = $root.abi.Method.fromObject(object.methods[i]); } } if (object.events) { if (!Array.isArray(object.events)) throw TypeError(".abi.Contract.events: array expected"); message.events = []; for (var i = 0; i < object.events.length; ++i) { if (typeof object.events[i] !== "object") throw TypeError(".abi.Contract.events: object expected"); message.events[i] = $root.abi.Event.fromObject(object.events[i]); } } if (object.deployedBytecode != null) message.deployedBytecode = String(object.deployedBytecode); return message; }; /** * Creates a plain object from a Contract message. Also converts values to other types if specified. * @function toObject * @memberof abi.Contract * @static * @param {abi.Contract} message Contract * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ Contract.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) { object.methods = []; object.events = []; } if (options.defaults) { object.id = null; object.abi = ""; object.bytecode = ""; object.deployedBytecode = ""; } if (message.id != null && message.hasOwnProperty("id")) object.id = $root.abi.ContractId.toObject(message.id, options); if (message.abi != null && message.hasOwnProperty("abi")) object.abi = message.abi; if (message.bytecode != null && message.hasOwnProperty("bytecode")) object.bytecode = message.bytecode; if (message.methods && message.methods.length) { object.methods = []; for (var j = 0; j < message.methods.length; ++j) object.methods[j] = $root.abi.Method.toObject(message.methods[j], options); } if (message.events && message.events.length) { object.events = []; for (var j = 0; j < message.events.length; ++j) object.events[j] = $root.abi.Event.toObject(message.events[j], options); } if (message.deployedBytecode != null && message.hasOwnProperty("deployedBytecode")) object.deployedBytecode = message.deployedBytecode; return object; }; /** * Converts this Contract to JSON. * @function toJSON * @memberof abi.Contract * @instance * @returns {Object.<string,*>} JSON object */ Contract.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return Contract; })(); abi.Method = (function () { /** * Properties of a Method. * @memberof abi * @interface IMethod * @property {string|null} [signature] Method signature * @property {string|null} [abi] Method abi */ /** * Constructs a new Method. * @memberof abi * @classdesc Represents a Method. * @implements IMethod * @constructor * @param {abi.IMethod=} [properties] Properties to set */ function Method(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * Method signature. * @member {string} signature * @memberof abi.Method * @instance */ Method.prototype.signature = ""; /** * Method abi. * @member {string} abi * @memberof abi.Method * @instance */ Method.prototype.abi = ""; /** * Creates a new Method instance using the specified properties. * @function create * @memberof abi.Method * @static * @param {abi.IMethod=} [properties] Properties to set * @returns {abi.Method} Method instance */ Method.create = function create(properties) { return new Method(properties); }; /** * Encodes the specified Method message. Does not implicitly {@link abi.Method.verify|verify} messages. * @function encode * @memberof abi.Method * @static * @param {abi.IMethod} message Method message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Method.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.signature); if (message.abi != null && Object.hasOwnProperty.call(message, "abi")) writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.abi); return writer; }; /** * Encodes the specified Method message, length delimited. Does not implicitly {@link abi.Method.verify|verify} messages. * @function encodeDelimited * @memberof abi.Method * @static * @param {abi.IMethod} message Method message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Method.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a Method message from the specified reader or buffer. * @function decode * @memberof abi.Method * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {abi.Method} Method * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Method.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.abi.Method(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.signature = reader.string(); break; case 2: message.abi = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a Method message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof abi.Method * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {abi.Method} Method * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Method.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a Method message. * @function verify * @memberof abi.Method * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Method.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.signature != null && message.hasOwnProperty("signature")) if (!$util.isString(message.signature)) return "signature: string expected"; if (message.abi != null && message.hasOwnProperty("abi")) if (!$util.isString(message.abi)) return "abi: string expected"; return null; }; /** * Creates a Method message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof abi.Method * @static * @param {Object.<string,*>} object Plain object * @returns {abi.Method} Method */ Method.fromObject = function fromObject(object) { if (object instanceof $root.abi.Method) return object; var message = new $root.abi.Method(); if (object.signature != null) message.signature = String(object.signature); if (object.abi != null) message.abi = String(object.abi); return message; }; /** * Creates a plain object from a Method message. Also converts values to other types if specified. * @function toObject * @memberof abi.Method * @static * @param {abi.Method} message Method * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ Method.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.signature = ""; object.abi = ""; } if (message.signature != null && message.hasOwnProperty("signature")) object.signature = message.signature; if (message.abi != null && message.hasOwnProperty("abi")) object.abi = message.abi; return object; }; /** * Converts this Method to JSON. * @function toJSON * @memberof abi.Method * @instance * @returns {Object.<string,*>} JSON object */ Method.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return Method; })(); abi.Event = (function () { /** * Properties of an Event. * @memberof abi * @interface IEvent * @property {string|null} [signature] Event signature * @property {string|null} [abi] Event abi */ /** * Constructs a new Event. * @memberof abi * @classdesc Represents an Event. * @implements IEvent * @constructor * @param {abi.IEvent=} [properties] Properties to set */ function Event(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * Event signature. * @member {string} signature * @memberof abi.Event * @instance */ Event.prototype.signature = ""; /** * Event abi. * @member {string} abi * @memberof abi.Event * @instance */ Event.prototype.abi = ""; /** * Creates a new Event instance using the specified properties. * @function create * @memberof abi.Event * @static * @param {abi.IEvent=} [properties] Properties to set * @returns {abi.Event} Event instance */ Event.create = function create(properties) { return new Event(properties); }; /** * Encodes the specified Event message. Does not implicitly {@link abi.Event.verify|verify} messages. * @function encode * @memberof abi.Event * @static * @param {abi.IEvent} message Event message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Event.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.signature); if (message.abi != null && Object.hasOwnProperty.call(message, "abi")) writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.abi); return writer; }; /** * Encodes the specified Event message, length delimited. Does not implicitly {@link abi.Event.verify|verify} messages. * @function encodeDelimited * @memberof abi.Event * @static * @param {abi.IEvent} message Event message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Event.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes an Event message from the specified reader or buffer. * @function decode * @memberof abi.Event * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {abi.Event} Event * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Event.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.abi.Event(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.signature = reader.string(); break; case 2: message.abi = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes an Event message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof abi.Event * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {abi.Event} Event * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Event.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies an Event message. * @function verify * @memberof abi.Event * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Event.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.signature != null && message.hasOwnProperty("signature")) if (!$util.isString(message.signature)) return "signature: string expected"; if (message.abi != null && message.hasOwnProperty("abi")) if (!$util.isString(message.abi)) return "abi: string expected"; return null; }; /** * Creates an Event message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof abi.Event * @static * @param {Object.<string,*>} object Plain object * @returns {abi.Event} Event */ Event.fromObject = function fromObject(object) { if (object instanceof $root.abi.Event) return object; var message = new $root.abi.Event(); if (object.signature != null) message.signature = String(object.signature); if (object.abi != null) message.abi = String(object.abi); return message; }; /** * Creates a plain object from an Event message. Also converts values to other types if specified. * @function toObject * @memberof abi.Event * @static * @param {abi.Event} message Event * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ Event.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.signature = ""; object.abi = ""; } if (message.signature != null && message.hasOwnProperty("signature")) object.signature = message.signature; if (message.abi != null && message.hasOwnProperty("abi")) object.abi = message.abi; return object; }; /** * Converts this Event to JSON. * @function toJSON * @memberof abi.Event * @instance * @returns {Object.<string,*>} JSON object */ Event.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return Event; })(); return abi; })(); $root.common = (function () { /** * Namespace common. * @exports common * @namespace */ var common = {}; common.AccountInstance = (function () { /** * Properties of an AccountInstance. * @memberof common * @interface IAccountInstance * @property {string|null} [chainId] AccountInstance chainId * @property {string|null} [account] AccountInstance account */ /** * Constructs a new AccountInstance. * @memberof common * @classdesc Represents an AccountInstance. * @implements IAccountInstance * @constructor * @param {common.IAccountInstance=} [properties] Properties to set */ function AccountInstance(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * AccountInstance chainId. * @member {string} chainId * @memberof common.AccountInstance * @instance */ AccountInstance.prototype.chainId = ""; /** * AccountInstance account. * @member {string} account * @memberof common.AccountInstance * @instance */ AccountInstance.prototype.account = ""; /** * Creates a new AccountInstance instance using the specified properties. * @function create * @memberof common.AccountInstance * @static * @param {common.IAccountInstance=} [properties] Properties to set * @returns {common.AccountInstance} AccountInstance instance */ AccountInstance.create = function create(properties) { return new AccountInstance(properties); }; /** * Encodes the specified AccountInstance message. Does not implicitly {@link common.AccountInstance.verify|verify} messages. * @function encode * @memberof common.AccountInstance * @static * @param {common.IAccountInstance} message AccountInstance message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ AccountInstance.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.chainId != null && Object.hasOwnProperty.call(message, "chainId")) writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.chainId); if (message.account != null && Object.hasOwnProperty.call(message, "account")) writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.account); return writer; }; /** * Encodes the specified AccountInstance message, length delimited. Does not implicitly {@link common.AccountInstance.verify|verify} messages. * @function encodeDelimited * @memberof common.AccountInstance * @static * @param {common.IAccountInstance} message AccountInstance message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ AccountInstance.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes an AccountInstance message from the specified reader or buffer. * @function decode * @memberof common.AccountInstance * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {common.AccountInstance} AccountInstance * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ AccountInstance.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.common.AccountInstance(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.chainId = reader.string(); break; case 2: message.account = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message;