"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Record_Offline = exports.Record_Multi = exports.Record_Local = exports.Record_Ledger = exports.Record = void 0;
var _any = require("../../../../google/protobuf/any");
var _hd = require("../../hd/v1/hd");
var _binary = require("../../../../binary");
var _helpers = require("../../../../helpers");
/** Record is used for representing a key in the keyring. */

/** Record is used for representing a key in the keyring. */

/** Record is used for representing a key in the keyring. */

/**
 * Item is a keyring item stored in a keyring backend.
 * Local item
 */

/**
 * Item is a keyring item stored in a keyring backend.
 * Local item
 */

/**
 * Item is a keyring item stored in a keyring backend.
 * Local item
 */

/** Ledger item */

/** Ledger item */

/** Ledger item */

/** Multi item */

/** Multi item */

/** Multi item */

/** Offline item */

/** Offline item */

/** Offline item */

function createBaseRecord() {
  return {
    name: "",
    pubKey: undefined,
    local: undefined,
    ledger: undefined,
    multi: undefined,
    offline: undefined
  };
}
var Record = exports.Record = {
  typeUrl: "/cosmos.crypto.keyring.v1.Record",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.name !== "") {
      writer.uint32(10).string(message.name);
    }
    if (message.pubKey !== undefined) {
      _any.Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim();
    }
    if (message.local !== undefined) {
      Record_Local.encode(message.local, writer.uint32(26).fork()).ldelim();
    }
    if (message.ledger !== undefined) {
      Record_Ledger.encode(message.ledger, writer.uint32(34).fork()).ldelim();
    }
    if (message.multi !== undefined) {
      Record_Multi.encode(message.multi, writer.uint32(42).fork()).ldelim();
    }
    if (message.offline !== undefined) {
      Record_Offline.encode(message.offline, writer.uint32(50).fork()).ldelim();
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : "",
      pubKey: (0, _helpers.isSet)(object.pubKey) ? _any.Any.fromJSON(object.pubKey) : undefined,
      local: (0, _helpers.isSet)(object.local) ? Record_Local.fromJSON(object.local) : undefined,
      ledger: (0, _helpers.isSet)(object.ledger) ? Record_Ledger.fromJSON(object.ledger) : undefined,
      multi: (0, _helpers.isSet)(object.multi) ? Record_Multi.fromJSON(object.multi) : undefined,
      offline: (0, _helpers.isSet)(object.offline) ? Record_Offline.fromJSON(object.offline) : undefined
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$name;
    var message = createBaseRecord();
    message.name = (_object$name = object.name) !== null && _object$name !== void 0 ? _object$name : "";
    message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? _any.Any.fromPartial(object.pubKey) : undefined;
    message.local = object.local !== undefined && object.local !== null ? Record_Local.fromPartial(object.local) : undefined;
    message.ledger = object.ledger !== undefined && object.ledger !== null ? Record_Ledger.fromPartial(object.ledger) : undefined;
    message.multi = object.multi !== undefined && object.multi !== null ? Record_Multi.fromPartial(object.multi) : undefined;
    message.offline = object.offline !== undefined && object.offline !== null ? Record_Offline.fromPartial(object.offline) : undefined;
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseRecord();
    if (object.name !== undefined && object.name !== null) {
      message.name = object.name;
    }
    if (object.pub_key !== undefined && object.pub_key !== null) {
      message.pubKey = _any.Any.fromAmino(object.pub_key);
    }
    if (object.local !== undefined && object.local !== null) {
      message.local = Record_Local.fromAmino(object.local);
    }
    if (object.ledger !== undefined && object.ledger !== null) {
      message.ledger = Record_Ledger.fromAmino(object.ledger);
    }
    if (object.multi !== undefined && object.multi !== null) {
      message.multi = Record_Multi.fromAmino(object.multi);
    }
    if (object.offline !== undefined && object.offline !== null) {
      message.offline = Record_Offline.fromAmino(object.offline);
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.name = message.name === "" ? undefined : message.name;
    obj.pub_key = message.pubKey ? _any.Any.toAmino(message.pubKey) : undefined;
    obj.local = message.local ? Record_Local.toAmino(message.local) : undefined;
    obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined;
    obj.multi = message.multi ? Record_Multi.toAmino(message.multi) : undefined;
    obj.offline = message.offline ? Record_Offline.toAmino(message.offline) : undefined;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return Record.fromAmino(object.value);
  },
  toAminoMsg: function toAminoMsg(message) {
    return {
      type: "cosmos-sdk/Record",
      value: Record.toAmino(message)
    };
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return Record.decode(message.value);
  },
  toProto: function toProto(message) {
    return Record.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/cosmos.crypto.keyring.v1.Record",
      value: Record.encode(message).finish()
    };
  }
};
function createBaseRecord_Local() {
  return {
    privKey: undefined
  };
}
var Record_Local = exports.Record_Local = {
  typeUrl: "/cosmos.crypto.keyring.v1.Local",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.privKey !== undefined) {
      _any.Any.encode(message.privKey, writer.uint32(10).fork()).ldelim();
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      privKey: (0, _helpers.isSet)(object.privKey) ? _any.Any.fromJSON(object.privKey) : undefined
    };
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseRecord_Local();
    message.privKey = object.privKey !== undefined && object.privKey !== null ? _any.Any.fromPartial(object.privKey) : undefined;
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseRecord_Local();
    if (object.priv_key !== undefined && object.priv_key !== null) {
      message.privKey = _any.Any.fromAmino(object.priv_key);
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.priv_key = message.privKey ? _any.Any.toAmino(message.privKey) : undefined;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return Record_Local.fromAmino(object.value);
  },
  toAminoMsg: function toAminoMsg(message) {
    return {
      type: "cosmos-sdk/Local",
      value: Record_Local.toAmino(message)
    };
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return Record_Local.decode(message.value);
  },
  toProto: function toProto(message) {
    return Record_Local.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/cosmos.crypto.keyring.v1.Local",
      value: Record_Local.encode(message).finish()
    };
  }
};
function createBaseRecord_Ledger() {
  return {
    path: undefined
  };
}
var Record_Ledger = exports.Record_Ledger = {
  typeUrl: "/cosmos.crypto.keyring.v1.Ledger",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.path !== undefined) {
      _hd.BIP44Params.encode(message.path, writer.uint32(10).fork()).ldelim();
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      path: (0, _helpers.isSet)(object.path) ? _hd.BIP44Params.fromJSON(object.path) : undefined
    };
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseRecord_Ledger();
    message.path = object.path !== undefined && object.path !== null ? _hd.BIP44Params.fromPartial(object.path) : undefined;
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseRecord_Ledger();
    if (object.path !== undefined && object.path !== null) {
      message.path = _hd.BIP44Params.fromAmino(object.path);
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.path = message.path ? _hd.BIP44Params.toAmino(message.path) : undefined;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return Record_Ledger.fromAmino(object.value);
  },
  toAminoMsg: function toAminoMsg(message) {
    return {
      type: "cosmos-sdk/Ledger",
      value: Record_Ledger.toAmino(message)
    };
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return Record_Ledger.decode(message.value);
  },
  toProto: function toProto(message) {
    return Record_Ledger.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/cosmos.crypto.keyring.v1.Ledger",
      value: Record_Ledger.encode(message).finish()
    };
  }
};
function createBaseRecord_Multi() {
  return {};
}
var Record_Multi = exports.Record_Multi = {
  typeUrl: "/cosmos.crypto.keyring.v1.Multi",
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    return writer;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseRecord_Multi();
    return message;
  },
  fromAmino: function fromAmino(_) {
    var message = createBaseRecord_Multi();
    return message;
  },
  toAmino: function toAmino(_) {
    var obj = {};
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return Record_Multi.fromAmino(object.value);
  },
  toAminoMsg: function toAminoMsg(message) {
    return {
      type: "cosmos-sdk/Multi",
      value: Record_Multi.toAmino(message)
    };
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return Record_Multi.decode(message.value);
  },
  toProto: function toProto(message) {
    return Record_Multi.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/cosmos.crypto.keyring.v1.Multi",
      value: Record_Multi.encode(message).finish()
    };
  }
};
function createBaseRecord_Offline() {
  return {};
}
var Record_Offline = exports.Record_Offline = {
  typeUrl: "/cosmos.crypto.keyring.v1.Offline",
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    return writer;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseRecord_Offline();
    return message;
  },
  fromAmino: function fromAmino(_) {
    var message = createBaseRecord_Offline();
    return message;
  },
  toAmino: function toAmino(_) {
    var obj = {};
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return Record_Offline.fromAmino(object.value);
  },
  toAminoMsg: function toAminoMsg(message) {
    return {
      type: "cosmos-sdk/Offline",
      value: Record_Offline.toAmino(message)
    };
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return Record_Offline.decode(message.value);
  },
  toProto: function toProto(message) {
    return Record_Offline.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/cosmos.crypto.keyring.v1.Offline",
      value: Record_Offline.encode(message).finish()
    };
  }
};