{"dependencies":[{"name":"rxjs","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":4,"column":15,"index":141},"end":{"line":4,"column":30,"index":156}}],"key":"atDzfUGaJNRNtwyVumomzH/5ygw=","exportNames":["*"],"imports":1}},{"name":"../util/index.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":5,"column":19,"index":177},"end":{"line":5,"column":46,"index":204}}],"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.subscribeNewBlocks = subscribeNewBlocks;\n var rxjs_1 = require(_dependencyMap[0], \"rxjs\");\n var index_js_1 = require(_dependencyMap[1], \"../util/index.js\");\n /**\n * @name subscribeNewBlocks\n * @returns The latest block & events for that block\n * @example\n * ```javascript\n * const unsub = await api.derive.chain.subscribeNewBlocks((newBlock) => {\n * console.log(`Block Hash: ${newBlock.hash}`);\n * });\n * ```\n */\n function subscribeNewBlocks(instanceId, api) {\n return (0, index_js_1.memo)(instanceId, function () {\n return api.derive.chain.subscribeNewHeads().pipe((0, rxjs_1.switchMap)(function (header) {\n return api.derive.chain.getBlock(header.createdAtHash || header.hash);\n }));\n });\n }\n});","lineCount":27,"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,"subscribeNewBlocks"],[7,28,3,26],[7,31,3,29,"subscribeNewBlocks"],[7,49,3,47],[8,2,4,0],[8,6,4,6,"rxjs_1"],[8,12,4,12],[8,15,4,15,"require"],[8,22,4,22],[8,23,4,22,"_dependencyMap"],[8,37,4,22],[8,48,4,29],[8,49,4,30],[9,2,5,0],[9,6,5,6,"index_js_1"],[9,16,5,16],[9,19,5,19,"require"],[9,26,5,26],[9,27,5,26,"_dependencyMap"],[9,41,5,26],[9,64,5,45],[9,65,5,46],[10,2,6,0],[11,0,7,0],[12,0,8,0],[13,0,9,0],[14,0,10,0],[15,0,11,0],[16,0,12,0],[17,0,13,0],[18,0,14,0],[19,0,15,0],[20,2,16,0],[20,11,16,9,"subscribeNewBlocks"],[20,29,16,27,"subscribeNewBlocks"],[20,30,16,28,"instanceId"],[20,40,16,38],[20,42,16,40,"api"],[20,45,16,43],[20,47,16,45],[21,4,17,4],[21,11,17,11],[21,12,17,12],[21,13,17,13],[21,15,17,15,"index_js_1"],[21,25,17,25],[21,26,17,26,"memo"],[21,30,17,30],[21,32,17,32,"instanceId"],[21,42,17,42],[21,44,17,44],[22,6,17,44],[22,13,17,50,"api"],[22,16,17,53],[22,17,17,54,"derive"],[22,23,17,60],[22,24,17,61,"chain"],[22,29,17,66],[22,30,17,67,"subscribeNewHeads"],[22,47,17,84],[22,48,17,85],[22,49,17,86],[22,50,17,87,"pipe"],[22,54,17,91],[22,55,17,92],[22,56,17,93],[22,57,17,94],[22,59,17,96,"rxjs_1"],[22,65,17,102],[22,66,17,103,"switchMap"],[22,75,17,112],[22,77,17,114],[22,87,17,115,"header"],[22,93,17,121],[23,8,17,121],[23,15,17,126,"api"],[23,18,17,129],[23,19,17,130,"derive"],[23,25,17,136],[23,26,17,137,"chain"],[23,31,17,142],[23,32,17,143,"getBlock"],[23,40,17,151],[23,41,17,152,"header"],[23,47,17,158],[23,48,17,159,"createdAtHash"],[23,61,17,172],[23,65,17,176,"header"],[23,71,17,182],[23,72,17,183,"hash"],[23,76,17,187],[23,77,17,188],[24,6,17,188],[24,8,17,189],[24,9,17,190],[25,4,17,190],[25,6,17,191],[26,2,18,0],[27,0,18,1],[27,3]],"functionMap":{"names":["","subscribeNewBlocks",""],"mappings":"AAA;ACe;4CCC,kJD;CDC"},"hasCjsExports":true},"type":"js/module"}]}