@paradeum/burrow
Version:
TypeScript library that calls a Hyperledger Burrow server over GRPC.
277 lines (238 loc) • 7.89 kB
JavaScript
// source: validator.proto
/**
* @fileoverview
* @enhanceable
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
var github_com_gogo_protobuf_gogoproto_gogo_pb = require('./github.com/gogo/protobuf/gogoproto/gogo_pb.js');
goog.object.extend(proto, github_com_gogo_protobuf_gogoproto_gogo_pb);
var crypto_pb = require('./crypto_pb.js');
goog.object.extend(proto, crypto_pb);
goog.exportSymbol('proto.validator.Validator', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.validator.Validator = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.validator.Validator, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.validator.Validator.displayName = 'proto.validator.Validator';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.validator.Validator.prototype.toObject = function(opt_includeInstance) {
return proto.validator.Validator.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.validator.Validator} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.validator.Validator.toObject = function(includeInstance, msg) {
var f, obj = {
address: msg.getAddress_asB64(),
publickey: (f = msg.getPublickey()) && crypto_pb.PublicKey.toObject(includeInstance, f),
power: jspb.Message.getFieldWithDefault(msg, 3, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.validator.Validator}
*/
proto.validator.Validator.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.validator.Validator;
return proto.validator.Validator.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.validator.Validator} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.validator.Validator}
*/
proto.validator.Validator.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setAddress(value);
break;
case 2:
var value = new crypto_pb.PublicKey;
reader.readMessage(value,crypto_pb.PublicKey.deserializeBinaryFromReader);
msg.setPublickey(value);
break;
case 3:
var value = /** @type {number} */ (reader.readUint64());
msg.setPower(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.validator.Validator.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.validator.Validator.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.validator.Validator} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.validator.Validator.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getAddress_asU8();
if (f.length > 0) {
writer.writeBytes(
1,
f
);
}
f = message.getPublickey();
if (f != null) {
writer.writeMessage(
2,
f,
crypto_pb.PublicKey.serializeBinaryToWriter
);
}
f = message.getPower();
if (f !== 0) {
writer.writeUint64(
3,
f
);
}
};
/**
* optional bytes Address = 1;
* @return {!(string|Uint8Array)}
*/
proto.validator.Validator.prototype.getAddress = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* optional bytes Address = 1;
* This is a type-conversion wrapper around `getAddress()`
* @return {string}
*/
proto.validator.Validator.prototype.getAddress_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getAddress()));
};
/**
* optional bytes Address = 1;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getAddress()`
* @return {!Uint8Array}
*/
proto.validator.Validator.prototype.getAddress_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getAddress()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.validator.Validator} returns this
*/
proto.validator.Validator.prototype.setAddress = function(value) {
return jspb.Message.setProto3BytesField(this, 1, value);
};
/**
* optional crypto.PublicKey PublicKey = 2;
* @return {?proto.crypto.PublicKey}
*/
proto.validator.Validator.prototype.getPublickey = function() {
return /** @type{?proto.crypto.PublicKey} */ (
jspb.Message.getWrapperField(this, crypto_pb.PublicKey, 2));
};
/**
* @param {?proto.crypto.PublicKey|undefined} value
* @return {!proto.validator.Validator} returns this
*/
proto.validator.Validator.prototype.setPublickey = function(value) {
return jspb.Message.setWrapperField(this, 2, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.validator.Validator} returns this
*/
proto.validator.Validator.prototype.clearPublickey = function() {
return this.setPublickey(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.validator.Validator.prototype.hasPublickey = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* optional uint64 Power = 3;
* @return {number}
*/
proto.validator.Validator.prototype.getPower = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {number} value
* @return {!proto.validator.Validator} returns this
*/
proto.validator.Validator.prototype.setPower = function(value) {
return jspb.Message.setProto3IntField(this, 3, value);
};
goog.object.extend(exports, proto.validator);