@routerprotocol/chain-api
Version:
Router Chain API Query client with generated gRPC bindings.
1,667 lines (1,456 loc) • 82.2 kB
JavaScript
// source: cosmos/gov/v1/gov.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @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!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
var cosmos_base_v1beta1_coin_pb = require('../../../cosmos/base/v1beta1/coin_pb.js');
goog.object.extend(proto, cosmos_base_v1beta1_coin_pb);
var gogoproto_gogo_pb = require('../../../gogoproto/gogo_pb.js');
goog.object.extend(proto, gogoproto_gogo_pb);
var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js');
goog.object.extend(proto, google_protobuf_timestamp_pb);
var google_protobuf_any_pb = require('google-protobuf/google/protobuf/any_pb.js');
goog.object.extend(proto, google_protobuf_any_pb);
var google_protobuf_duration_pb = require('google-protobuf/google/protobuf/duration_pb.js');
goog.object.extend(proto, google_protobuf_duration_pb);
var cosmos_proto_cosmos_pb = require('../../../cosmos_proto/cosmos_pb.js');
goog.object.extend(proto, cosmos_proto_cosmos_pb);
var amino_amino_pb = require('../../../amino/amino_pb.js');
goog.object.extend(proto, amino_amino_pb);
goog.exportSymbol('proto.cosmos.gov.v1.Deposit', null, global);
goog.exportSymbol('proto.cosmos.gov.v1.DepositParams', null, global);
goog.exportSymbol('proto.cosmos.gov.v1.Params', null, global);
goog.exportSymbol('proto.cosmos.gov.v1.Proposal', null, global);
goog.exportSymbol('proto.cosmos.gov.v1.ProposalStatus', null, global);
goog.exportSymbol('proto.cosmos.gov.v1.TallyParams', null, global);
goog.exportSymbol('proto.cosmos.gov.v1.TallyResult', null, global);
goog.exportSymbol('proto.cosmos.gov.v1.Vote', null, global);
goog.exportSymbol('proto.cosmos.gov.v1.VoteOption', null, global);
goog.exportSymbol('proto.cosmos.gov.v1.VotingParams', null, global);
goog.exportSymbol('proto.cosmos.gov.v1.WeightedVoteOption', 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.cosmos.gov.v1.WeightedVoteOption = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cosmos.gov.v1.WeightedVoteOption, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cosmos.gov.v1.WeightedVoteOption.displayName = 'proto.cosmos.gov.v1.WeightedVoteOption';
}
/**
* 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.cosmos.gov.v1.Deposit = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cosmos.gov.v1.Deposit.repeatedFields_, null);
};
goog.inherits(proto.cosmos.gov.v1.Deposit, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cosmos.gov.v1.Deposit.displayName = 'proto.cosmos.gov.v1.Deposit';
}
/**
* 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.cosmos.gov.v1.Proposal = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cosmos.gov.v1.Proposal.repeatedFields_, null);
};
goog.inherits(proto.cosmos.gov.v1.Proposal, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cosmos.gov.v1.Proposal.displayName = 'proto.cosmos.gov.v1.Proposal';
}
/**
* 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.cosmos.gov.v1.TallyResult = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cosmos.gov.v1.TallyResult, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cosmos.gov.v1.TallyResult.displayName = 'proto.cosmos.gov.v1.TallyResult';
}
/**
* 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.cosmos.gov.v1.Vote = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cosmos.gov.v1.Vote.repeatedFields_, null);
};
goog.inherits(proto.cosmos.gov.v1.Vote, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cosmos.gov.v1.Vote.displayName = 'proto.cosmos.gov.v1.Vote';
}
/**
* 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.cosmos.gov.v1.DepositParams = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cosmos.gov.v1.DepositParams.repeatedFields_, null);
};
goog.inherits(proto.cosmos.gov.v1.DepositParams, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cosmos.gov.v1.DepositParams.displayName = 'proto.cosmos.gov.v1.DepositParams';
}
/**
* 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.cosmos.gov.v1.VotingParams = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cosmos.gov.v1.VotingParams, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cosmos.gov.v1.VotingParams.displayName = 'proto.cosmos.gov.v1.VotingParams';
}
/**
* 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.cosmos.gov.v1.TallyParams = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cosmos.gov.v1.TallyParams, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cosmos.gov.v1.TallyParams.displayName = 'proto.cosmos.gov.v1.TallyParams';
}
/**
* 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.cosmos.gov.v1.Params = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cosmos.gov.v1.Params.repeatedFields_, null);
};
goog.inherits(proto.cosmos.gov.v1.Params, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cosmos.gov.v1.Params.displayName = 'proto.cosmos.gov.v1.Params';
}
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.cosmos.gov.v1.WeightedVoteOption.prototype.toObject = function(opt_includeInstance) {
return proto.cosmos.gov.v1.WeightedVoteOption.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.cosmos.gov.v1.WeightedVoteOption} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cosmos.gov.v1.WeightedVoteOption.toObject = function(includeInstance, msg) {
var f, obj = {
option: jspb.Message.getFieldWithDefault(msg, 1, 0),
weight: jspb.Message.getFieldWithDefault(msg, 2, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cosmos.gov.v1.WeightedVoteOption}
*/
proto.cosmos.gov.v1.WeightedVoteOption.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cosmos.gov.v1.WeightedVoteOption;
return proto.cosmos.gov.v1.WeightedVoteOption.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cosmos.gov.v1.WeightedVoteOption} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cosmos.gov.v1.WeightedVoteOption}
*/
proto.cosmos.gov.v1.WeightedVoteOption.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {!proto.cosmos.gov.v1.VoteOption} */ (reader.readEnum());
msg.setOption(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setWeight(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cosmos.gov.v1.WeightedVoteOption.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cosmos.gov.v1.WeightedVoteOption.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cosmos.gov.v1.WeightedVoteOption} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cosmos.gov.v1.WeightedVoteOption.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getOption();
if (f !== 0.0) {
writer.writeEnum(
1,
f
);
}
f = message.getWeight();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
};
/**
* optional VoteOption option = 1;
* @return {!proto.cosmos.gov.v1.VoteOption}
*/
proto.cosmos.gov.v1.WeightedVoteOption.prototype.getOption = function() {
return /** @type {!proto.cosmos.gov.v1.VoteOption} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {!proto.cosmos.gov.v1.VoteOption} value
* @return {!proto.cosmos.gov.v1.WeightedVoteOption} returns this
*/
proto.cosmos.gov.v1.WeightedVoteOption.prototype.setOption = function(value) {
return jspb.Message.setProto3EnumField(this, 1, value);
};
/**
* optional string weight = 2;
* @return {string}
*/
proto.cosmos.gov.v1.WeightedVoteOption.prototype.getWeight = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos.gov.v1.WeightedVoteOption} returns this
*/
proto.cosmos.gov.v1.WeightedVoteOption.prototype.setWeight = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.cosmos.gov.v1.Deposit.repeatedFields_ = [3];
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.cosmos.gov.v1.Deposit.prototype.toObject = function(opt_includeInstance) {
return proto.cosmos.gov.v1.Deposit.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.cosmos.gov.v1.Deposit} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cosmos.gov.v1.Deposit.toObject = function(includeInstance, msg) {
var f, obj = {
proposalId: jspb.Message.getFieldWithDefault(msg, 1, 0),
depositor: jspb.Message.getFieldWithDefault(msg, 2, ""),
amountList: jspb.Message.toObjectList(msg.getAmountList(),
cosmos_base_v1beta1_coin_pb.Coin.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cosmos.gov.v1.Deposit}
*/
proto.cosmos.gov.v1.Deposit.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cosmos.gov.v1.Deposit;
return proto.cosmos.gov.v1.Deposit.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cosmos.gov.v1.Deposit} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cosmos.gov.v1.Deposit}
*/
proto.cosmos.gov.v1.Deposit.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
msg.setProposalId(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setDepositor(value);
break;
case 3:
var value = new cosmos_base_v1beta1_coin_pb.Coin;
reader.readMessage(value,cosmos_base_v1beta1_coin_pb.Coin.deserializeBinaryFromReader);
msg.addAmount(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cosmos.gov.v1.Deposit.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cosmos.gov.v1.Deposit.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cosmos.gov.v1.Deposit} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cosmos.gov.v1.Deposit.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getProposalId();
if (f !== 0) {
writer.writeUint64(
1,
f
);
}
f = message.getDepositor();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getAmountList();
if (f.length > 0) {
writer.writeRepeatedMessage(
3,
f,
cosmos_base_v1beta1_coin_pb.Coin.serializeBinaryToWriter
);
}
};
/**
* optional uint64 proposal_id = 1;
* @return {number}
*/
proto.cosmos.gov.v1.Deposit.prototype.getProposalId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.cosmos.gov.v1.Deposit} returns this
*/
proto.cosmos.gov.v1.Deposit.prototype.setProposalId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};
/**
* optional string depositor = 2;
* @return {string}
*/
proto.cosmos.gov.v1.Deposit.prototype.getDepositor = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos.gov.v1.Deposit} returns this
*/
proto.cosmos.gov.v1.Deposit.prototype.setDepositor = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* repeated cosmos.base.v1beta1.Coin amount = 3;
* @return {!Array<!proto.cosmos.base.v1beta1.Coin>}
*/
proto.cosmos.gov.v1.Deposit.prototype.getAmountList = function() {
return /** @type{!Array<!proto.cosmos.base.v1beta1.Coin>} */ (
jspb.Message.getRepeatedWrapperField(this, cosmos_base_v1beta1_coin_pb.Coin, 3));
};
/**
* @param {!Array<!proto.cosmos.base.v1beta1.Coin>} value
* @return {!proto.cosmos.gov.v1.Deposit} returns this
*/
proto.cosmos.gov.v1.Deposit.prototype.setAmountList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 3, value);
};
/**
* @param {!proto.cosmos.base.v1beta1.Coin=} opt_value
* @param {number=} opt_index
* @return {!proto.cosmos.base.v1beta1.Coin}
*/
proto.cosmos.gov.v1.Deposit.prototype.addAmount = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.cosmos.base.v1beta1.Coin, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.cosmos.gov.v1.Deposit} returns this
*/
proto.cosmos.gov.v1.Deposit.prototype.clearAmountList = function() {
return this.setAmountList([]);
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.cosmos.gov.v1.Proposal.repeatedFields_ = [2,7];
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.cosmos.gov.v1.Proposal.prototype.toObject = function(opt_includeInstance) {
return proto.cosmos.gov.v1.Proposal.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.cosmos.gov.v1.Proposal} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cosmos.gov.v1.Proposal.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0),
messagesList: jspb.Message.toObjectList(msg.getMessagesList(),
google_protobuf_any_pb.Any.toObject, includeInstance),
status: jspb.Message.getFieldWithDefault(msg, 3, 0),
finalTallyResult: (f = msg.getFinalTallyResult()) && proto.cosmos.gov.v1.TallyResult.toObject(includeInstance, f),
submitTime: (f = msg.getSubmitTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
depositEndTime: (f = msg.getDepositEndTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
totalDepositList: jspb.Message.toObjectList(msg.getTotalDepositList(),
cosmos_base_v1beta1_coin_pb.Coin.toObject, includeInstance),
votingStartTime: (f = msg.getVotingStartTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
votingEndTime: (f = msg.getVotingEndTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
metadata: jspb.Message.getFieldWithDefault(msg, 10, ""),
title: jspb.Message.getFieldWithDefault(msg, 11, ""),
summary: jspb.Message.getFieldWithDefault(msg, 12, ""),
proposer: jspb.Message.getFieldWithDefault(msg, 13, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cosmos.gov.v1.Proposal}
*/
proto.cosmos.gov.v1.Proposal.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cosmos.gov.v1.Proposal;
return proto.cosmos.gov.v1.Proposal.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cosmos.gov.v1.Proposal} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cosmos.gov.v1.Proposal}
*/
proto.cosmos.gov.v1.Proposal.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
msg.setId(value);
break;
case 2:
var value = new google_protobuf_any_pb.Any;
reader.readMessage(value,google_protobuf_any_pb.Any.deserializeBinaryFromReader);
msg.addMessages(value);
break;
case 3:
var value = /** @type {!proto.cosmos.gov.v1.ProposalStatus} */ (reader.readEnum());
msg.setStatus(value);
break;
case 4:
var value = new proto.cosmos.gov.v1.TallyResult;
reader.readMessage(value,proto.cosmos.gov.v1.TallyResult.deserializeBinaryFromReader);
msg.setFinalTallyResult(value);
break;
case 5:
var value = new google_protobuf_timestamp_pb.Timestamp;
reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
msg.setSubmitTime(value);
break;
case 6:
var value = new google_protobuf_timestamp_pb.Timestamp;
reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
msg.setDepositEndTime(value);
break;
case 7:
var value = new cosmos_base_v1beta1_coin_pb.Coin;
reader.readMessage(value,cosmos_base_v1beta1_coin_pb.Coin.deserializeBinaryFromReader);
msg.addTotalDeposit(value);
break;
case 8:
var value = new google_protobuf_timestamp_pb.Timestamp;
reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
msg.setVotingStartTime(value);
break;
case 9:
var value = new google_protobuf_timestamp_pb.Timestamp;
reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
msg.setVotingEndTime(value);
break;
case 10:
var value = /** @type {string} */ (reader.readString());
msg.setMetadata(value);
break;
case 11:
var value = /** @type {string} */ (reader.readString());
msg.setTitle(value);
break;
case 12:
var value = /** @type {string} */ (reader.readString());
msg.setSummary(value);
break;
case 13:
var value = /** @type {string} */ (reader.readString());
msg.setProposer(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cosmos.gov.v1.Proposal.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cosmos.gov.v1.Proposal.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cosmos.gov.v1.Proposal} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cosmos.gov.v1.Proposal.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f !== 0) {
writer.writeUint64(
1,
f
);
}
f = message.getMessagesList();
if (f.length > 0) {
writer.writeRepeatedMessage(
2,
f,
google_protobuf_any_pb.Any.serializeBinaryToWriter
);
}
f = message.getStatus();
if (f !== 0.0) {
writer.writeEnum(
3,
f
);
}
f = message.getFinalTallyResult();
if (f != null) {
writer.writeMessage(
4,
f,
proto.cosmos.gov.v1.TallyResult.serializeBinaryToWriter
);
}
f = message.getSubmitTime();
if (f != null) {
writer.writeMessage(
5,
f,
google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
);
}
f = message.getDepositEndTime();
if (f != null) {
writer.writeMessage(
6,
f,
google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
);
}
f = message.getTotalDepositList();
if (f.length > 0) {
writer.writeRepeatedMessage(
7,
f,
cosmos_base_v1beta1_coin_pb.Coin.serializeBinaryToWriter
);
}
f = message.getVotingStartTime();
if (f != null) {
writer.writeMessage(
8,
f,
google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
);
}
f = message.getVotingEndTime();
if (f != null) {
writer.writeMessage(
9,
f,
google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
);
}
f = message.getMetadata();
if (f.length > 0) {
writer.writeString(
10,
f
);
}
f = message.getTitle();
if (f.length > 0) {
writer.writeString(
11,
f
);
}
f = message.getSummary();
if (f.length > 0) {
writer.writeString(
12,
f
);
}
f = message.getProposer();
if (f.length > 0) {
writer.writeString(
13,
f
);
}
};
/**
* optional uint64 id = 1;
* @return {number}
*/
proto.cosmos.gov.v1.Proposal.prototype.getId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};
/**
* repeated google.protobuf.Any messages = 2;
* @return {!Array<!proto.google.protobuf.Any>}
*/
proto.cosmos.gov.v1.Proposal.prototype.getMessagesList = function() {
return /** @type{!Array<!proto.google.protobuf.Any>} */ (
jspb.Message.getRepeatedWrapperField(this, google_protobuf_any_pb.Any, 2));
};
/**
* @param {!Array<!proto.google.protobuf.Any>} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setMessagesList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 2, value);
};
/**
* @param {!proto.google.protobuf.Any=} opt_value
* @param {number=} opt_index
* @return {!proto.google.protobuf.Any}
*/
proto.cosmos.gov.v1.Proposal.prototype.addMessages = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.google.protobuf.Any, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.clearMessagesList = function() {
return this.setMessagesList([]);
};
/**
* optional ProposalStatus status = 3;
* @return {!proto.cosmos.gov.v1.ProposalStatus}
*/
proto.cosmos.gov.v1.Proposal.prototype.getStatus = function() {
return /** @type {!proto.cosmos.gov.v1.ProposalStatus} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {!proto.cosmos.gov.v1.ProposalStatus} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setStatus = function(value) {
return jspb.Message.setProto3EnumField(this, 3, value);
};
/**
* optional TallyResult final_tally_result = 4;
* @return {?proto.cosmos.gov.v1.TallyResult}
*/
proto.cosmos.gov.v1.Proposal.prototype.getFinalTallyResult = function() {
return /** @type{?proto.cosmos.gov.v1.TallyResult} */ (
jspb.Message.getWrapperField(this, proto.cosmos.gov.v1.TallyResult, 4));
};
/**
* @param {?proto.cosmos.gov.v1.TallyResult|undefined} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setFinalTallyResult = function(value) {
return jspb.Message.setWrapperField(this, 4, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.clearFinalTallyResult = function() {
return this.setFinalTallyResult(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cosmos.gov.v1.Proposal.prototype.hasFinalTallyResult = function() {
return jspb.Message.getField(this, 4) != null;
};
/**
* optional google.protobuf.Timestamp submit_time = 5;
* @return {?proto.google.protobuf.Timestamp}
*/
proto.cosmos.gov.v1.Proposal.prototype.getSubmitTime = function() {
return /** @type{?proto.google.protobuf.Timestamp} */ (
jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 5));
};
/**
* @param {?proto.google.protobuf.Timestamp|undefined} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setSubmitTime = function(value) {
return jspb.Message.setWrapperField(this, 5, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.clearSubmitTime = function() {
return this.setSubmitTime(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cosmos.gov.v1.Proposal.prototype.hasSubmitTime = function() {
return jspb.Message.getField(this, 5) != null;
};
/**
* optional google.protobuf.Timestamp deposit_end_time = 6;
* @return {?proto.google.protobuf.Timestamp}
*/
proto.cosmos.gov.v1.Proposal.prototype.getDepositEndTime = function() {
return /** @type{?proto.google.protobuf.Timestamp} */ (
jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 6));
};
/**
* @param {?proto.google.protobuf.Timestamp|undefined} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setDepositEndTime = function(value) {
return jspb.Message.setWrapperField(this, 6, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.clearDepositEndTime = function() {
return this.setDepositEndTime(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cosmos.gov.v1.Proposal.prototype.hasDepositEndTime = function() {
return jspb.Message.getField(this, 6) != null;
};
/**
* repeated cosmos.base.v1beta1.Coin total_deposit = 7;
* @return {!Array<!proto.cosmos.base.v1beta1.Coin>}
*/
proto.cosmos.gov.v1.Proposal.prototype.getTotalDepositList = function() {
return /** @type{!Array<!proto.cosmos.base.v1beta1.Coin>} */ (
jspb.Message.getRepeatedWrapperField(this, cosmos_base_v1beta1_coin_pb.Coin, 7));
};
/**
* @param {!Array<!proto.cosmos.base.v1beta1.Coin>} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setTotalDepositList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 7, value);
};
/**
* @param {!proto.cosmos.base.v1beta1.Coin=} opt_value
* @param {number=} opt_index
* @return {!proto.cosmos.base.v1beta1.Coin}
*/
proto.cosmos.gov.v1.Proposal.prototype.addTotalDeposit = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 7, opt_value, proto.cosmos.base.v1beta1.Coin, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.clearTotalDepositList = function() {
return this.setTotalDepositList([]);
};
/**
* optional google.protobuf.Timestamp voting_start_time = 8;
* @return {?proto.google.protobuf.Timestamp}
*/
proto.cosmos.gov.v1.Proposal.prototype.getVotingStartTime = function() {
return /** @type{?proto.google.protobuf.Timestamp} */ (
jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 8));
};
/**
* @param {?proto.google.protobuf.Timestamp|undefined} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setVotingStartTime = function(value) {
return jspb.Message.setWrapperField(this, 8, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.clearVotingStartTime = function() {
return this.setVotingStartTime(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cosmos.gov.v1.Proposal.prototype.hasVotingStartTime = function() {
return jspb.Message.getField(this, 8) != null;
};
/**
* optional google.protobuf.Timestamp voting_end_time = 9;
* @return {?proto.google.protobuf.Timestamp}
*/
proto.cosmos.gov.v1.Proposal.prototype.getVotingEndTime = function() {
return /** @type{?proto.google.protobuf.Timestamp} */ (
jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 9));
};
/**
* @param {?proto.google.protobuf.Timestamp|undefined} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setVotingEndTime = function(value) {
return jspb.Message.setWrapperField(this, 9, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.clearVotingEndTime = function() {
return this.setVotingEndTime(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cosmos.gov.v1.Proposal.prototype.hasVotingEndTime = function() {
return jspb.Message.getField(this, 9) != null;
};
/**
* optional string metadata = 10;
* @return {string}
*/
proto.cosmos.gov.v1.Proposal.prototype.getMetadata = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setMetadata = function(value) {
return jspb.Message.setProto3StringField(this, 10, value);
};
/**
* optional string title = 11;
* @return {string}
*/
proto.cosmos.gov.v1.Proposal.prototype.getTitle = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 11, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setTitle = function(value) {
return jspb.Message.setProto3StringField(this, 11, value);
};
/**
* optional string summary = 12;
* @return {string}
*/
proto.cosmos.gov.v1.Proposal.prototype.getSummary = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setSummary = function(value) {
return jspb.Message.setProto3StringField(this, 12, value);
};
/**
* optional string proposer = 13;
* @return {string}
*/
proto.cosmos.gov.v1.Proposal.prototype.getProposer = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 13, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos.gov.v1.Proposal} returns this
*/
proto.cosmos.gov.v1.Proposal.prototype.setProposer = function(value) {
return jspb.Message.setProto3StringField(this, 13, value);
};
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.cosmos.gov.v1.TallyResult.prototype.toObject = function(opt_includeInstance) {
return proto.cosmos.gov.v1.TallyResult.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.cosmos.gov.v1.TallyResult} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cosmos.gov.v1.TallyResult.toObject = function(includeInstance, msg) {
var f, obj = {
yesCount: jspb.Message.getFieldWithDefault(msg, 1, ""),
abstainCount: jspb.Message.getFieldWithDefault(msg, 2, ""),
noCount: jspb.Message.getFieldWithDefault(msg, 3, ""),
noWithVetoCount: jspb.Message.getFieldWithDefault(msg, 4, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cosmos.gov.v1.TallyResult}
*/
proto.cosmos.gov.v1.TallyResult.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cosmos.gov.v1.TallyResult;
return proto.cosmos.gov.v1.TallyResult.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cosmos.gov.v1.TallyResult} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cosmos.gov.v1.TallyResult}
*/
proto.cosmos.gov.v1.TallyResult.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setYesCount(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setAbstainCount(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setNoCount(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setNoWithVetoCount(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cosmos.gov.v1.TallyResult.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cosmos.gov.v1.TallyResult.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cosmos.gov.v1.TallyResult} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cosmos.gov.v1.TallyResult.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getYesCount();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getAbstainCount();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getNoCount();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
f = message.getNoWithVetoCount();
if (f.length > 0) {
writer.writeString(
4,
f
);
}
};
/**
* optional string yes_count = 1;
* @return {string}
*/
proto.cosmos.gov.v1.TallyResult.prototype.getYesCount = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos.gov.v1.TallyResult} returns this
*/
proto.cosmos.gov.v1.TallyResult.prototype.setYesCount = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string abstain_count = 2;
* @return {string}
*/
proto.cosmos.gov.v1.TallyResult.prototype.getAbstainCount = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos.gov.v1.TallyResult} returns this
*/
proto.cosmos.gov.v1.TallyResult.prototype.setAbstainCount = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* optional string no_count = 3;
* @return {string}
*/
proto.cosmos.gov.v1.TallyResult.prototype.getNoCount = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos.gov.v1.TallyResult} returns this
*/
proto.cosmos.gov.v1.TallyResult.prototype.setNoCount = function(value) {
return jspb.Message.setProto3StringField(this, 3, value);
};
/**
* optional string no_with_veto_count = 4;
* @return {string}
*/
proto.cosmos.gov.v1.TallyResult.prototype.getNoWithVetoCount = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos.gov.v1.TallyResult} returns this
*/
proto.cosmos.gov.v1.TallyResult.prototype.setNoWithVetoCount = function(value) {
return jspb.Message.setProto3StringField(this, 4, value);
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.cosmos.gov.v1.Vote.repeatedFields_ = [4];
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.cosmos.gov.v1.Vote.prototype.toObject = function(opt_includeInstance) {
return proto.cosmos.gov.v1.Vote.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.cosmos.gov.v1.Vote} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cosmos.gov.v1.Vote.toObject = function(includeInstance, msg) {
var f, obj = {
proposalId: jspb.Message.getFieldWithDefault(msg, 1, 0),
voter: jspb.Message.getFieldWithDefault(msg, 2, ""),
optionsList: jspb.Message.toObjectList(msg.getOptionsList(),
proto.cosmos.gov.v1.WeightedVoteOption.toObject, includeInstance),
metadata: jspb.Message.getFieldWithDefault(msg, 5, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cosmos.gov.v1.Vote}
*/
proto.cosmos.gov.v1.Vote.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cosmos.gov.v1.Vote;
return proto.cosmos.gov.v1.Vote.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cosmos.gov.v1.Vote} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cosmos.gov.v1.Vote}
*/
proto.cosmos.gov.v1.Vote.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
msg.setProposalId(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setVoter(value);
break;
case 4:
var value = new proto.cosmos.gov.v1.WeightedVoteOption;
reader.readMessage(value,proto.cosmos.gov.v1.WeightedVoteOption.deserializeBinaryFromReader);
msg.addOptions(value);
break;
case 5:
var value = /** @type {string} */ (reader.readString());
msg.setMetadata(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cosmos.gov.v1.Vote.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cosmos.gov.v1.Vote.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cosmos.gov.v1.Vote} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cosmos.gov.v1.Vote.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getProposalId();
if (f !== 0) {
writer.writeUint64(
1,
f
);
}
f = message.getVoter();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getOptionsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
4,
f,
proto.cosmos.gov.v1.WeightedVoteOption.serializeBinaryToWriter
);
}
f = message.getMetadata();
if (f.length > 0) {
writer.writeString(
5,
f
);
}
};
/**
* optional uint64 proposal_id = 1;
* @return {number}
*/
proto.cosmos.gov.v1.Vote.prototype.getProposalId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.cosmos.gov.v1.Vote} returns this
*/
proto.cosmos.gov.v1.Vote.prototype.setProposalId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};
/**
* optional string voter = 2;
* @return {string}
*/
proto.cosmos.gov.v1.Vote.prototype.getVoter = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cosmos