"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getSigningCosmosClientOptions = exports.getSigningCosmosClient = exports.cosmosProtoRegistry = exports.cosmosAminoConverters = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _protoSigning = require("@cosmjs/proto-signing");
var _stargate = require("@cosmjs/stargate");
var cosmosAuthzV1beta1TxRegistry = _interopRequireWildcard(require("./authz/v1beta1/tx.registry"));
var cosmosBankV1beta1TxRegistry = _interopRequireWildcard(require("./bank/v1beta1/tx.registry"));
var cosmosCrisisV1beta1TxRegistry = _interopRequireWildcard(require("./crisis/v1beta1/tx.registry"));
var cosmosDistributionV1beta1TxRegistry = _interopRequireWildcard(require("./distribution/v1beta1/tx.registry"));
var cosmosEvidenceV1beta1TxRegistry = _interopRequireWildcard(require("./evidence/v1beta1/tx.registry"));
var cosmosFeegrantV1beta1TxRegistry = _interopRequireWildcard(require("./feegrant/v1beta1/tx.registry"));
var cosmosGovV1TxRegistry = _interopRequireWildcard(require("./gov/v1/tx.registry"));
var cosmosGovV1beta1TxRegistry = _interopRequireWildcard(require("./gov/v1beta1/tx.registry"));
var cosmosGroupV1TxRegistry = _interopRequireWildcard(require("./group/v1/tx.registry"));
var cosmosNftV1beta1TxRegistry = _interopRequireWildcard(require("./nft/v1beta1/tx.registry"));
var cosmosSlashingV1beta1TxRegistry = _interopRequireWildcard(require("./slashing/v1beta1/tx.registry"));
var cosmosStakingV1beta1TxRegistry = _interopRequireWildcard(require("./staking/v1beta1/tx.registry"));
var cosmosUpgradeV1beta1TxRegistry = _interopRequireWildcard(require("./upgrade/v1beta1/tx.registry"));
var cosmosVestingV1beta1TxRegistry = _interopRequireWildcard(require("./vesting/v1beta1/tx.registry"));
var cosmosAuthzV1beta1TxAmino = _interopRequireWildcard(require("./authz/v1beta1/tx.amino"));
var cosmosBankV1beta1TxAmino = _interopRequireWildcard(require("./bank/v1beta1/tx.amino"));
var cosmosCrisisV1beta1TxAmino = _interopRequireWildcard(require("./crisis/v1beta1/tx.amino"));
var cosmosDistributionV1beta1TxAmino = _interopRequireWildcard(require("./distribution/v1beta1/tx.amino"));
var cosmosEvidenceV1beta1TxAmino = _interopRequireWildcard(require("./evidence/v1beta1/tx.amino"));
var cosmosFeegrantV1beta1TxAmino = _interopRequireWildcard(require("./feegrant/v1beta1/tx.amino"));
var cosmosGovV1TxAmino = _interopRequireWildcard(require("./gov/v1/tx.amino"));
var cosmosGovV1beta1TxAmino = _interopRequireWildcard(require("./gov/v1beta1/tx.amino"));
var cosmosGroupV1TxAmino = _interopRequireWildcard(require("./group/v1/tx.amino"));
var cosmosNftV1beta1TxAmino = _interopRequireWildcard(require("./nft/v1beta1/tx.amino"));
var cosmosSlashingV1beta1TxAmino = _interopRequireWildcard(require("./slashing/v1beta1/tx.amino"));
var cosmosStakingV1beta1TxAmino = _interopRequireWildcard(require("./staking/v1beta1/tx.amino"));
var cosmosUpgradeV1beta1TxAmino = _interopRequireWildcard(require("./upgrade/v1beta1/tx.amino"));
var cosmosVestingV1beta1TxAmino = _interopRequireWildcard(require("./vesting/v1beta1/tx.amino"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var cosmosAminoConverters = exports.cosmosAminoConverters = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, cosmosAuthzV1beta1TxAmino.AminoConverter), cosmosBankV1beta1TxAmino.AminoConverter), cosmosCrisisV1beta1TxAmino.AminoConverter), cosmosDistributionV1beta1TxAmino.AminoConverter), cosmosEvidenceV1beta1TxAmino.AminoConverter), cosmosFeegrantV1beta1TxAmino.AminoConverter), cosmosGovV1TxAmino.AminoConverter), cosmosGovV1beta1TxAmino.AminoConverter), cosmosGroupV1TxAmino.AminoConverter), cosmosNftV1beta1TxAmino.AminoConverter), cosmosSlashingV1beta1TxAmino.AminoConverter), cosmosStakingV1beta1TxAmino.AminoConverter), cosmosUpgradeV1beta1TxAmino.AminoConverter), cosmosVestingV1beta1TxAmino.AminoConverter);
var cosmosProtoRegistry = exports.cosmosProtoRegistry = [].concat((0, _toConsumableArray2["default"])(cosmosAuthzV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosBankV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosCrisisV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosDistributionV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosEvidenceV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosFeegrantV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosGovV1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosGovV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosGroupV1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosNftV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosSlashingV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosStakingV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosUpgradeV1beta1TxRegistry.registry), (0, _toConsumableArray2["default"])(cosmosVestingV1beta1TxRegistry.registry));
var getSigningCosmosClientOptions = exports.getSigningCosmosClientOptions = function getSigningCosmosClientOptions() {
  var registry = new _protoSigning.Registry((0, _toConsumableArray2["default"])(cosmosProtoRegistry));
  var aminoTypes = new _stargate.AminoTypes(_objectSpread({}, cosmosAminoConverters));
  return {
    registry: registry,
    aminoTypes: aminoTypes
  };
};
var getSigningCosmosClient = exports.getSigningCosmosClient = /*#__PURE__*/function () {
  var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref) {
    var rpcEndpoint, signer, _getSigningCosmosClie, registry, aminoTypes, client;
    return _regenerator["default"].wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          rpcEndpoint = _ref.rpcEndpoint, signer = _ref.signer;
          _getSigningCosmosClie = getSigningCosmosClientOptions(), registry = _getSigningCosmosClie.registry, aminoTypes = _getSigningCosmosClie.aminoTypes;
          _context.next = 4;
          return _stargate.SigningStargateClient.connectWithSigner(rpcEndpoint, signer, {
            registry: registry,
            aminoTypes: aminoTypes
          });
        case 4:
          client = _context.sent;
          return _context.abrupt("return", client);
        case 6:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
  return function getSigningCosmosClient(_x) {
    return _ref2.apply(this, arguments);
  };
}();