"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ExercisedAmount = void 0;
var _coin = require("../cosmos/base/v1beta1/coin");
var _binary = require("../binary");
var _helpers = require("../helpers");
function createBaseExercisedAmount() {
  return {
    address: "",
    amount: _coin.Coin.fromPartial({})
  };
}
var ExercisedAmount = exports.ExercisedAmount = {
  typeUrl: "/gitopia.gitopia.gitopia.ExercisedAmount",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    if (message.amount !== undefined) {
      _coin.Coin.encode(message.amount, writer.uint32(18).fork()).ldelim();
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      address: (0, _helpers.isSet)(object.address) ? String(object.address) : "",
      amount: (0, _helpers.isSet)(object.amount) ? _coin.Coin.fromJSON(object.amount) : undefined
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$address;
    var message = createBaseExercisedAmount();
    message.address = (_object$address = object.address) !== null && _object$address !== void 0 ? _object$address : "";
    message.amount = object.amount !== undefined && object.amount !== null ? _coin.Coin.fromPartial(object.amount) : undefined;
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseExercisedAmount();
    if (object.address !== undefined && object.address !== null) {
      message.address = object.address;
    }
    if (object.amount !== undefined && object.amount !== null) {
      message.amount = _coin.Coin.fromAmino(object.amount);
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.address = message.address === "" ? undefined : message.address;
    obj.amount = message.amount ? _coin.Coin.toAmino(message.amount) : undefined;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return ExercisedAmount.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return ExercisedAmount.decode(message.value);
  },
  toProto: function toProto(message) {
    return ExercisedAmount.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.ExercisedAmount",
      value: ExercisedAmount.encode(message).finish()
    };
  }
};