{"dependencies":[{"name":"rxjs","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":4,"column":15,"index":129},"end":{"line":4,"column":30,"index":144}}],"key":"atDzfUGaJNRNtwyVumomzH/5ygw=","exportNames":["*"],"imports":1}},{"name":"@polkadot/util","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":5,"column":15,"index":161},"end":{"line":5,"column":40,"index":186}}],"key":"u0mzEw2nilnHoUWtEdZl0JKHutA=","exportNames":["*"],"imports":1}},{"name":"../util/index.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":6,"column":19,"index":207},"end":{"line":6,"column":46,"index":234}}],"key":"H94lp+EitftSFqDHaenrSs5zKB0=","exportNames":["*"],"imports":1}}],"output":[{"data":{"code":"__d(function (global, require, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {\n \"use strict\";\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.erasHistoric = erasHistoric;\n const rxjs_1 = require(_dependencyMap[0], \"rxjs\");\n const util_1 = require(_dependencyMap[1], \"@polkadot/util\");\n const index_js_1 = require(_dependencyMap[2], \"../util/index.js\");\n /**\n * @name erasHistoric\n * @param {boolean} withActive? (Optional) Whether to include the active era in the result.\n */\n function erasHistoric(instanceId, api) {\n return (0, index_js_1.memo)(instanceId, withActive => (0, rxjs_1.combineLatest)([api.query.staking.activeEra(), api.consts.staking.historyDepth ? (0, rxjs_1.of)(api.consts.staking.historyDepth) : api.query.staking['historyDepth']()]).pipe((0, rxjs_1.map)(([activeEraOpt, historyDepth]) => {\n const result = [];\n const max = historyDepth.toNumber();\n const activeEra = activeEraOpt.unwrapOrDefault().index;\n let lastEra = activeEra;\n while (lastEra.gte(util_1.BN_ZERO) && result.length < max) {\n if (lastEra !== activeEra || withActive === true) {\n result.push(api.registry.createType('EraIndex', lastEra));\n }\n lastEra = lastEra.sub(util_1.BN_ONE);\n }\n // go from oldest to newest\n return result.reverse();\n })));\n }\n});","lineCount":31,"map":[[2,2,1,0],[2,14,1,12],[4,2,2,0,"Object"],[4,8,2,6],[4,9,2,7,"defineProperty"],[4,23,2,21],[4,24,2,22,"exports"],[4,31,2,29],[4,33,2,31],[4,45,2,43],[4,47,2,45],[5,4,2,47,"value"],[5,9,2,52],[5,11,2,54],[6,2,2,59],[6,3,2,60],[6,4,2,61],[7,2,3,0,"exports"],[7,9,3,7],[7,10,3,8,"erasHistoric"],[7,22,3,20],[7,25,3,23,"erasHistoric"],[7,37,3,35],[8,2,4,0],[8,8,4,6,"rxjs_1"],[8,14,4,12],[8,17,4,15,"require"],[8,24,4,22],[8,25,4,22,"_dependencyMap"],[8,39,4,22],[8,50,4,29],[8,51,4,30],[9,2,5,0],[9,8,5,6,"util_1"],[9,14,5,12],[9,17,5,15,"require"],[9,24,5,22],[9,25,5,22,"_dependencyMap"],[9,39,5,22],[9,60,5,39],[9,61,5,40],[10,2,6,0],[10,8,6,6,"index_js_1"],[10,18,6,16],[10,21,6,19,"require"],[10,28,6,26],[10,29,6,26,"_dependencyMap"],[10,43,6,26],[10,66,6,45],[10,67,6,46],[11,2,7,0],[12,0,8,0],[13,0,9,0],[14,0,10,0],[15,2,11,0],[15,11,11,9,"erasHistoric"],[15,23,11,21,"erasHistoric"],[15,24,11,22,"instanceId"],[15,34,11,32],[15,36,11,34,"api"],[15,39,11,37],[15,41,11,39],[16,4,12,4],[16,11,12,11],[16,12,12,12],[16,13,12,13],[16,15,12,15,"index_js_1"],[16,25,12,25],[16,26,12,26,"memo"],[16,30,12,30],[16,32,12,32,"instanceId"],[16,42,12,42],[16,44,12,45,"withActive"],[16,54,12,55],[16,58,12,60],[16,59,12,61],[16,60,12,62],[16,62,12,64,"rxjs_1"],[16,68,12,70],[16,69,12,71,"combineLatest"],[16,82,12,84],[16,84,12,86],[16,85,13,8,"api"],[16,88,13,11],[16,89,13,12,"query"],[16,94,13,17],[16,95,13,18,"staking"],[16,102,13,25],[16,103,13,26,"activeEra"],[16,112,13,35],[16,113,13,36],[16,114,13,37],[16,116,14,8,"api"],[16,119,14,11],[16,120,14,12,"consts"],[16,126,14,18],[16,127,14,19,"staking"],[16,134,14,26],[16,135,14,27,"historyDepth"],[16,147,14,39],[16,150,15,14],[16,151,15,15],[16,152,15,16],[16,154,15,18,"rxjs_1"],[16,160,15,24],[16,161,15,25,"of"],[16,163,15,27],[16,165,15,29,"api"],[16,168,15,32],[16,169,15,33,"consts"],[16,175,15,39],[16,176,15,40,"staking"],[16,183,15,47],[16,184,15,48,"historyDepth"],[16,196,15,60],[16,197,15,61],[16,200,16,14,"api"],[16,203,16,17],[16,204,16,18,"query"],[16,209,16,23],[16,210,16,24,"staking"],[16,217,16,31],[16,218,16,32],[16,232,16,46],[16,233,16,47],[16,234,16,48],[16,235,16,49],[16,236,17,5],[16,237,17,6],[16,238,17,7,"pipe"],[16,242,17,11],[16,243,17,12],[16,244,17,13],[16,245,17,14],[16,247,17,16,"rxjs_1"],[16,253,17,22],[16,254,17,23,"map"],[16,257,17,26],[16,259,17,28],[16,260,17,29],[16,261,17,30,"activeEraOpt"],[16,273,17,42],[16,275,17,44,"historyDepth"],[16,287,17,56],[16,288,17,57],[16,293,17,62],[17,6,18,8],[17,12,18,14,"result"],[17,18,18,20],[17,21,18,23],[17,23,18,25],[18,6,19,8],[18,12,19,14,"max"],[18,15,19,17],[18,18,19,20,"historyDepth"],[18,30,19,32],[18,31,19,33,"toNumber"],[18,39,19,41],[18,40,19,42],[18,41,19,43],[19,6,20,8],[19,12,20,14,"activeEra"],[19,21,20,23],[19,24,20,26,"activeEraOpt"],[19,36,20,38],[19,37,20,39,"unwrapOrDefault"],[19,52,20,54],[19,53,20,55],[19,54,20,56],[19,55,20,57,"index"],[19,60,20,62],[20,6,21,8],[20,10,21,12,"lastEra"],[20,17,21,19],[20,20,21,22,"activeEra"],[20,29,21,31],[21,6,22,8],[21,13,22,15,"lastEra"],[21,20,22,22],[21,21,22,23,"gte"],[21,24,22,26],[21,25,22,27,"util_1"],[21,31,22,33],[21,32,22,34,"BN_ZERO"],[21,39,22,41],[21,40,22,42],[21,44,22,47,"result"],[21,50,22,53],[21,51,22,54,"length"],[21,57,22,60],[21,60,22,63,"max"],[21,63,22,67],[21,65,22,69],[22,8,23,12],[22,12,23,17,"lastEra"],[22,19,23,24],[22,24,23,29,"activeEra"],[22,33,23,38],[22,37,23,44,"withActive"],[22,47,23,54],[22,52,23,59],[22,56,23,64],[22,58,23,66],[23,10,24,16,"result"],[23,16,24,22],[23,17,24,23,"push"],[23,21,24,27],[23,22,24,28,"api"],[23,25,24,31],[23,26,24,32,"registry"],[23,34,24,40],[23,35,24,41,"createType"],[23,45,24,51],[23,46,24,52],[23,56,24,62],[23,58,24,64,"lastEra"],[23,65,24,71],[23,66,24,72],[23,67,24,73],[24,8,25,12],[25,8,26,12,"lastEra"],[25,15,26,19],[25,18,26,22,"lastEra"],[25,25,26,29],[25,26,26,30,"sub"],[25,29,26,33],[25,30,26,34,"util_1"],[25,36,26,40],[25,37,26,41,"BN_ONE"],[25,43,26,47],[25,44,26,48],[26,6,27,8],[27,6,28,8],[28,6,29,8],[28,13,29,15,"result"],[28,19,29,21],[28,20,29,22,"reverse"],[28,27,29,29],[28,28,29,30],[28,29,29,31],[29,4,30,4],[29,5,30,5],[29,6,30,6],[29,7,30,7],[29,8,30,8],[30,2,31,0],[31,0,31,1],[31,3]],"functionMap":{"names":["","erasHistoric",""],"mappings":"AAA;ACU;4CCC;ODkB;CDC"},"hasCjsExports":true},"type":"js/module"}]}