UNPKG

@reef-defi/api

Version:
58 lines (44 loc) 3.5 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.options = exports.defaultOptions = void 0; var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); var _ormlApiDerive = require("@open-web3/orml-api-derive"); var _apiDerive = require("@reef-defi/api-derive"); var _types = require("@reef-defi/types"); const _excluded = ["types", "rpc", "typesAlias", "typesBundle", "signedExtensions"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } const defaultOptions = { types: _types.types, rpc: _types.rpc }; exports.defaultOptions = defaultOptions; const options = (_ref = {}) => { var _acalaTypesBundle$spe, _typesBundle$spec, _acalaTypesBundle$spe2, _typesBundle$spec2; let { types = {}, rpc = {}, typesAlias = {}, typesBundle = {}, signedExtensions } = _ref, otherOptions = (0, _objectWithoutProperties2.default)(_ref, _excluded); return _objectSpread({ types: _objectSpread(_objectSpread({}, _types.types), types), rpc: _objectSpread(_objectSpread({}, _types.rpc), rpc), typesAlias: _objectSpread(_objectSpread({}, _types.typesAlias), typesAlias), derives: _objectSpread(_objectSpread({}, _ormlApiDerive.derive), _apiDerive.derive), typesBundle: _objectSpread(_objectSpread({}, typesBundle), {}, { spec: _objectSpread(_objectSpread({}, typesBundle.spec), {}, { acala: _objectSpread(_objectSpread({}, _types.typesBundle === null || _types.typesBundle === void 0 ? void 0 : (_acalaTypesBundle$spe = _types.typesBundle.spec) === null || _acalaTypesBundle$spe === void 0 ? void 0 : _acalaTypesBundle$spe.acala), typesBundle === null || typesBundle === void 0 ? void 0 : (_typesBundle$spec = typesBundle.spec) === null || _typesBundle$spec === void 0 ? void 0 : _typesBundle$spec.acala), mandala: _objectSpread(_objectSpread({}, _types.typesBundle === null || _types.typesBundle === void 0 ? void 0 : (_acalaTypesBundle$spe2 = _types.typesBundle.spec) === null || _acalaTypesBundle$spe2 === void 0 ? void 0 : _acalaTypesBundle$spe2.mandala), typesBundle === null || typesBundle === void 0 ? void 0 : (_typesBundle$spec2 = typesBundle.spec) === null || _typesBundle$spec2 === void 0 ? void 0 : _typesBundle$spec2.mandala) }) }), signedExtensions: _objectSpread(_objectSpread({}, _types.signedExtensions), signedExtensions) }, otherOptions); }; exports.options = options;