text: /* eslint-disable */
  import { Reader, util, configure, Writer } from 'protobufjs/minimal';
  import * as Long from 'long';
  import { Coin } from '../../base/v1beta1/coin';
  export const protobufPackage = 'cosmos.vesting.v1beta1';
  const baseMsgCreateVestingAccount = {
      fromAddress: '',
      toAddress: '',
      endTime: 0,
      delayed: false
  };
  export const MsgCreateVestingAccount = {
      encode(message, writer = Writer.create()) {
          if (message.fromAddress !== '') {
              writer.uint32(10).string(message.fromAddress);
          }
          if (message.toAddress !== '') {
              writer.uint32(18).string(message.toAddress);
          }
          for (const v of message.amount) {
              Coin.encode(v, writer.uint32(26).fork()).ldelim();
          }
          if (message.endTime !== 0) {
              writer.uint32(32).int64(message.endTime);
          }
          if (message.delayed === true) {
              writer.uint32(40).bool(message.delayed);
          }
          return writer;
      },
      decode(input, length) {
          const reader = input instanceof Uint8Array ? new Reader(input) : input;
          let end = length === undefined ? reader.len : reader.pos + length;
          const message = {
              ...baseMsgCreateVestingAccount
          };
          message.amount = [];
          while (reader.pos < end) {
              const tag = reader.uint32();
              switch (tag >>> 3) {
                  case 1:
                      message.fromAddress = reader.string();
                      break;
                  case 2:
                      message.toAddress = reader.string();
                      break;
                  case 3:
                      message.amount.push(Coin.decode(reader, reader.uint32()));
                      break;
                  case 4:
                      message.endTime = longToNumber(reader.int64());
                      break;
                  case 5:
                      message.delayed = reader.bool();
                      break;
                  default:
                      reader.skipType(tag & 7);
                      break;
              }
          }
          return message;
      },
      fromJSON(object) {
          const message = {
              ...baseMsgCreateVestingAccount
          };
          message.amount = [];
          if (object.fromAddress !== undefined && object.fromAddress !== null) {
              message.fromAddress = String(object.fromAddress);
          }
          else {
              message.fromAddress = '';
          }
          if (object.toAddress !== undefined && object.toAddress !== null) {
              message.toAddress = String(object.toAddress);
          }
          else {
              message.toAddress = '';
          }
          if (object.amount !== undefined && object.amount !== null) {
              for (const e of object.amount) {
                  message.amount.push(Coin.fromJSON(e));
              }
          }
          if (object.endTime !== undefined && object.endTime !== null) {
              message.endTime = Number(object.endTime);
          }
          else {
              message.endTime = 0;
          }
          if (object.delayed !== undefined && object.delayed !== null) {
              message.delayed = Boolean(object.delayed);
          }
          else {
              message.delayed = false;
          }
          return message;
      },
      toJSON(message) {
          const obj = {};
          message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress);
          message.toAddress !== undefined && (obj.toAddress = message.toAddress);
          if (message.amount) {
              obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined));
          }
          else {
              obj.amount = [];
          }
          message.endTime !== undefined && (obj.endTime = message.endTime);
          message.delayed !== undefined && (obj.delayed = message.delayed);
          return obj;
      },
      fromPartial(object) {
          const message = {
              ...baseMsgCreateVestingAccount
          };
          message.amount = [];
          if (object.fromAddress !== undefined && object.fromAddress !== null) {
              message.fromAddress = object.fromAddress;
          }
          else {
              message.fromAddress = '';
          }
          if (object.toAddress !== undefined && object.toAddress !== null) {
              message.toAddress = object.toAddress;
          }
          else {
              message.toAddress = '';
          }
          if (object.amount !== undefined && object.amount !== null) {
              for (const e of object.amount) {
                  message.amount.push(Coin.fromPartial(e));
              }
          }
          if (object.endTime !== undefined && object.endTime !== null) {
              message.endTime = object.endTime;
          }
          else {
              message.endTime = 0;
          }
          if (object.delayed !== undefined && object.delayed !== null) {
              message.delayed = object.delayed;
          }
          else {
              message.delayed = false;
          }
          return message;
      }
  };
  const baseMsgCreateVestingAccountResponse = {};
  export const MsgCreateVestingAccountResponse = {
      encode(_, writer = Writer.create()) {
          return writer;
      },
      decode(input, length) {
          const reader = input instanceof Uint8Array ? new Reader(input) : input;
          let end = length === undefined ? reader.len : reader.pos + length;
          const message = {
              ...baseMsgCreateVestingAccountResponse
          };
          while (reader.pos < end) {
              const tag = reader.uint32();
              switch (tag >>> 3) {
                  default:
                      reader.skipType(tag & 7);
                      break;
              }
          }
          return message;
      },
      fromJSON(_) {
          const message = {
              ...baseMsgCreateVestingAccountResponse
          };
          return message;
      },
      toJSON(_) {
          const obj = {};
          return obj;
      },
      fromPartial(_) {
          const message = {
              ...baseMsgCreateVestingAccountResponse
          };
          return message;
      }
  };
  export class MsgClientImpl {
      constructor(rpc) {
          this.rpc = rpc;
      }
      CreateVestingAccount(request) {
          const data = MsgCreateVestingAccount.encode(request).finish();
          const promise = this.rpc.request('cosmos.vesting.v1beta1.Msg', 'CreateVestingAccount', data);
          return promise.then((data) => MsgCreateVestingAccountResponse.decode(new Reader(data)));
      }
  }
  var globalThis = (() => {
      if (typeof globalThis !== 'undefined')
          return globalThis;
      if (typeof self !== 'undefined')
          return self;
      if (typeof window !== 'undefined')
          return window;
      if (typeof global !== 'undefined')
          return global;
      throw 'Unable to locate global object';
  })();
  function longToNumber(long) {
      if (long.gt(Number.MAX_SAFE_INTEGER)) {
          throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER');
      }
      return long.toNumber();
  }
  if (util.Long !== Long) {
      util.Long = Long;
      configure();
  }
  