github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/js/proto/validator_pb.js (about) 1 // source: validator.proto 2 /** 3 * @fileoverview 4 * @enhanceable 5 * @suppress {missingRequire} reports error on implicit type usages. 6 * @suppress {messageConventions} JS Compiler reports an error if a variable or 7 * field starts with 'MSG_' and isn't a translatable message. 8 * @public 9 */ 10 // GENERATED CODE -- DO NOT EDIT! 11 /* eslint-disable */ 12 // @ts-nocheck 13 14 var jspb = require('google-protobuf'); 15 var goog = jspb; 16 var global = Function('return this')(); 17 18 var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); 19 goog.object.extend(proto, gogoproto_gogo_pb); 20 var crypto_pb = require('./crypto_pb.js'); 21 goog.object.extend(proto, crypto_pb); 22 goog.exportSymbol('proto.validator.Validator', null, global); 23 /** 24 * Generated by JsPbCodeGenerator. 25 * @param {Array=} opt_data Optional initial data array, typically from a 26 * server response, or constructed directly in Javascript. The array is used 27 * in place and becomes part of the constructed object. It is not cloned. 28 * If no data is provided, the constructed object will be empty, but still 29 * valid. 30 * @extends {jspb.Message} 31 * @constructor 32 */ 33 proto.validator.Validator = function(opt_data) { 34 jspb.Message.initialize(this, opt_data, 0, -1, null, null); 35 }; 36 goog.inherits(proto.validator.Validator, jspb.Message); 37 if (goog.DEBUG && !COMPILED) { 38 /** 39 * @public 40 * @override 41 */ 42 proto.validator.Validator.displayName = 'proto.validator.Validator'; 43 } 44 45 46 47 if (jspb.Message.GENERATE_TO_OBJECT) { 48 /** 49 * Creates an object representation of this proto. 50 * Field names that are reserved in JavaScript and will be renamed to pb_name. 51 * Optional fields that are not set will be set to undefined. 52 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. 53 * For the list of reserved names please see: 54 * net/proto2/compiler/js/internal/generator.cc#kKeyword. 55 * @param {boolean=} opt_includeInstance Deprecated. whether to include the 56 * JSPB instance for transitional soy proto support: 57 * http://goto/soy-param-migration 58 * @return {!Object} 59 */ 60 proto.validator.Validator.prototype.toObject = function(opt_includeInstance) { 61 return proto.validator.Validator.toObject(opt_includeInstance, this); 62 }; 63 64 65 /** 66 * Static version of the {@see toObject} method. 67 * @param {boolean|undefined} includeInstance Deprecated. Whether to include 68 * the JSPB instance for transitional soy proto support: 69 * http://goto/soy-param-migration 70 * @param {!proto.validator.Validator} msg The msg instance to transform. 71 * @return {!Object} 72 * @suppress {unusedLocalVariables} f is only used for nested messages 73 */ 74 proto.validator.Validator.toObject = function(includeInstance, msg) { 75 var f, obj = { 76 address: msg.getAddress_asB64(), 77 publickey: (f = msg.getPublickey()) && crypto_pb.PublicKey.toObject(includeInstance, f), 78 power: jspb.Message.getFieldWithDefault(msg, 3, 0) 79 }; 80 81 if (includeInstance) { 82 obj.$jspbMessageInstance = msg; 83 } 84 return obj; 85 }; 86 } 87 88 89 /** 90 * Deserializes binary data (in protobuf wire format). 91 * @param {jspb.ByteSource} bytes The bytes to deserialize. 92 * @return {!proto.validator.Validator} 93 */ 94 proto.validator.Validator.deserializeBinary = function(bytes) { 95 var reader = new jspb.BinaryReader(bytes); 96 var msg = new proto.validator.Validator; 97 return proto.validator.Validator.deserializeBinaryFromReader(msg, reader); 98 }; 99 100 101 /** 102 * Deserializes binary data (in protobuf wire format) from the 103 * given reader into the given message object. 104 * @param {!proto.validator.Validator} msg The message object to deserialize into. 105 * @param {!jspb.BinaryReader} reader The BinaryReader to use. 106 * @return {!proto.validator.Validator} 107 */ 108 proto.validator.Validator.deserializeBinaryFromReader = function(msg, reader) { 109 while (reader.nextField()) { 110 if (reader.isEndGroup()) { 111 break; 112 } 113 var field = reader.getFieldNumber(); 114 switch (field) { 115 case 1: 116 var value = /** @type {!Uint8Array} */ (reader.readBytes()); 117 msg.setAddress(value); 118 break; 119 case 2: 120 var value = new crypto_pb.PublicKey; 121 reader.readMessage(value,crypto_pb.PublicKey.deserializeBinaryFromReader); 122 msg.setPublickey(value); 123 break; 124 case 3: 125 var value = /** @type {number} */ (reader.readUint64()); 126 msg.setPower(value); 127 break; 128 default: 129 reader.skipField(); 130 break; 131 } 132 } 133 return msg; 134 }; 135 136 137 /** 138 * Serializes the message to binary data (in protobuf wire format). 139 * @return {!Uint8Array} 140 */ 141 proto.validator.Validator.prototype.serializeBinary = function() { 142 var writer = new jspb.BinaryWriter(); 143 proto.validator.Validator.serializeBinaryToWriter(this, writer); 144 return writer.getResultBuffer(); 145 }; 146 147 148 /** 149 * Serializes the given message to binary data (in protobuf wire 150 * format), writing to the given BinaryWriter. 151 * @param {!proto.validator.Validator} message 152 * @param {!jspb.BinaryWriter} writer 153 * @suppress {unusedLocalVariables} f is only used for nested messages 154 */ 155 proto.validator.Validator.serializeBinaryToWriter = function(message, writer) { 156 var f = undefined; 157 f = message.getAddress_asU8(); 158 if (f.length > 0) { 159 writer.writeBytes( 160 1, 161 f 162 ); 163 } 164 f = message.getPublickey(); 165 if (f != null) { 166 writer.writeMessage( 167 2, 168 f, 169 crypto_pb.PublicKey.serializeBinaryToWriter 170 ); 171 } 172 f = message.getPower(); 173 if (f !== 0) { 174 writer.writeUint64( 175 3, 176 f 177 ); 178 } 179 }; 180 181 182 /** 183 * optional bytes Address = 1; 184 * @return {!(string|Uint8Array)} 185 */ 186 proto.validator.Validator.prototype.getAddress = function() { 187 return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); 188 }; 189 190 191 /** 192 * optional bytes Address = 1; 193 * This is a type-conversion wrapper around `getAddress()` 194 * @return {string} 195 */ 196 proto.validator.Validator.prototype.getAddress_asB64 = function() { 197 return /** @type {string} */ (jspb.Message.bytesAsB64( 198 this.getAddress())); 199 }; 200 201 202 /** 203 * optional bytes Address = 1; 204 * Note that Uint8Array is not supported on all browsers. 205 * @see http://caniuse.com/Uint8Array 206 * This is a type-conversion wrapper around `getAddress()` 207 * @return {!Uint8Array} 208 */ 209 proto.validator.Validator.prototype.getAddress_asU8 = function() { 210 return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( 211 this.getAddress())); 212 }; 213 214 215 /** 216 * @param {!(string|Uint8Array)} value 217 * @return {!proto.validator.Validator} returns this 218 */ 219 proto.validator.Validator.prototype.setAddress = function(value) { 220 return jspb.Message.setProto3BytesField(this, 1, value); 221 }; 222 223 224 /** 225 * optional crypto.PublicKey PublicKey = 2; 226 * @return {?proto.crypto.PublicKey} 227 */ 228 proto.validator.Validator.prototype.getPublickey = function() { 229 return /** @type{?proto.crypto.PublicKey} */ ( 230 jspb.Message.getWrapperField(this, crypto_pb.PublicKey, 2)); 231 }; 232 233 234 /** 235 * @param {?proto.crypto.PublicKey|undefined} value 236 * @return {!proto.validator.Validator} returns this 237 */ 238 proto.validator.Validator.prototype.setPublickey = function(value) { 239 return jspb.Message.setWrapperField(this, 2, value); 240 }; 241 242 243 /** 244 * Clears the message field making it undefined. 245 * @return {!proto.validator.Validator} returns this 246 */ 247 proto.validator.Validator.prototype.clearPublickey = function() { 248 return this.setPublickey(undefined); 249 }; 250 251 252 /** 253 * Returns whether this field is set. 254 * @return {boolean} 255 */ 256 proto.validator.Validator.prototype.hasPublickey = function() { 257 return jspb.Message.getField(this, 2) != null; 258 }; 259 260 261 /** 262 * optional uint64 Power = 3; 263 * @return {number} 264 */ 265 proto.validator.Validator.prototype.getPower = function() { 266 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); 267 }; 268 269 270 /** 271 * @param {number} value 272 * @return {!proto.validator.Validator} returns this 273 */ 274 proto.validator.Validator.prototype.setPower = function(value) { 275 return jspb.Message.setProto3IntField(this, 3, value); 276 }; 277 278 279 goog.object.extend(exports, proto.validator);