mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-05-30 14:31:02 +00:00
1 line
14 KiB
Plaintext
1 line
14 KiB
Plaintext
{"dependencies":[{"name":"rxjs","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":5,"column":15,"index":147},"end":{"line":5,"column":30,"index":162}}],"key":"atDzfUGaJNRNtwyVumomzH/5ygw=","exportNames":["*"],"imports":1}},{"name":"@polkadot/util","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":6,"column":15,"index":179},"end":{"line":6,"column":40,"index":204}}],"key":"u0mzEw2nilnHoUWtEdZl0JKHutA=","exportNames":["*"],"imports":1}},{"name":"../util/index.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":7,"column":19,"index":225},"end":{"line":7,"column":46,"index":252}}],"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.account = void 0;\n exports.accounts = accounts;\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 const QUERY_OPTS = {\n withDestination: true,\n withLedger: true,\n withNominations: true,\n withPrefs: true\n };\n function groupByEra(list) {\n return list.reduce((map, {\n era,\n value\n }) => {\n const key = era.toString();\n map[key] = (map[key] || util_1.BN_ZERO).add(value.unwrap());\n return map;\n }, {});\n }\n function calculateUnlocking(api, stakingLedger, sessionInfo) {\n const results = Object.entries(groupByEra((stakingLedger?.unlocking || []).filter(({\n era\n }) => era.unwrap().gt(sessionInfo.activeEra)))).map(([eraString, value]) => ({\n remainingEras: new util_1.BN(eraString).isub(sessionInfo.activeEra),\n value: api.registry.createType('Balance', value)\n }));\n return results.length ? results : undefined;\n }\n function redeemableSum(api, stakingLedger, sessionInfo) {\n return api.registry.createType('Balance', (stakingLedger?.unlocking || []).reduce((total, {\n era,\n value\n }) => {\n // aligns with https://github.com/paritytech/substrate/blob/fdfdc73f9e64dc47934b72eb9af3e1989e4ba699/frame/staking/src/pallet/mod.rs#L973-L975\n // (ensure currentEra >= era passed, as per https://github.com/paritytech/substrate/blob/fdfdc73f9e64dc47934b72eb9af3e1989e4ba699/frame/staking/src/lib.rs#L477-L494)\n // NOTE: Previously we used activeEra >= era, which is incorrect for the last session\n return era.unwrap().gt(sessionInfo.currentEra) ? total : total.iadd(value.unwrap());\n }, new util_1.BN(0)));\n }\n function parseResult(api, sessionInfo, keys, query) {\n return (0, util_1.objectSpread)({}, keys, query, {\n redeemable: redeemableSum(api, query.stakingLedger, sessionInfo),\n unlocking: calculateUnlocking(api, query.stakingLedger, sessionInfo)\n });\n }\n /**\n * @name accounts\n * @param {(Uint8Array | string)[]} accountIds List of account stashes\n * @param {StakingQueryFlags} opts optional filtering flag\n * @description From a list of stashes, fill in all the relevant staking details\n * @example\n * ```javascript\n * const accounts = await api.derive.staking.accounts([\n * \"149B17nn7zVL4SkLSNmANupEkGexUBAxVrdk4bbWFZYibkFc\",\n * ]);\n * console.log(\"First account staking info:\", accounts[0]);\n * ```\n */\n function accounts(instanceId, api) {\n return (0, index_js_1.memo)(instanceId, (accountIds, opts = QUERY_OPTS) => api.derive.session.info().pipe((0, rxjs_1.switchMap)(sessionInfo => (0, rxjs_1.combineLatest)([api.derive.staking.keysMulti(accountIds), api.derive.staking.queryMulti(accountIds, opts)]).pipe((0, rxjs_1.map)(([keys, queries]) => queries.map((q, index) => parseResult(api, sessionInfo, keys[index], q)))))));\n }\n /**\n * @name account\n * @param {(Uint8Array | string)} accountId AccountId of the stash.\n * @param {StakingQueryFlags} opts (Optional) filtering flag.\n * @description From a stash, retrieve the controllerId and fill in all the relevant staking details.\n * @example\n * ```javascript\n * const accountStakingData = await api.derive.staking.account(\n * \"149B17nn7zVL4SkLSNmANupEkGexUBAxVrdk4bbWFZYibkFc\"\n * );\n * console.log(accountStakingData);\n * ```\n */\n exports.account = (0, index_js_1.firstMemo)((api, accountId, opts) => api.derive.staking.accounts([accountId], opts));\n});","lineCount":84,"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,"account"],[7,17,3,15],[7,20,3,18],[7,25,3,23],[7,26,3,24],[8,2,4,0,"exports"],[8,9,4,7],[8,10,4,8,"accounts"],[8,18,4,16],[8,21,4,19,"accounts"],[8,29,4,27],[9,2,5,0],[9,8,5,6,"rxjs_1"],[9,14,5,12],[9,17,5,15,"require"],[9,24,5,22],[9,25,5,22,"_dependencyMap"],[9,39,5,22],[9,50,5,29],[9,51,5,30],[10,2,6,0],[10,8,6,6,"util_1"],[10,14,6,12],[10,17,6,15,"require"],[10,24,6,22],[10,25,6,22,"_dependencyMap"],[10,39,6,22],[10,60,6,39],[10,61,6,40],[11,2,7,0],[11,8,7,6,"index_js_1"],[11,18,7,16],[11,21,7,19,"require"],[11,28,7,26],[11,29,7,26,"_dependencyMap"],[11,43,7,26],[11,66,7,45],[11,67,7,46],[12,2,8,0],[12,8,8,6,"QUERY_OPTS"],[12,18,8,16],[12,21,8,19],[13,4,9,4,"withDestination"],[13,19,9,19],[13,21,9,21],[13,25,9,25],[14,4,10,4,"withLedger"],[14,14,10,14],[14,16,10,16],[14,20,10,20],[15,4,11,4,"withNominations"],[15,19,11,19],[15,21,11,21],[15,25,11,25],[16,4,12,4,"withPrefs"],[16,13,12,13],[16,15,12,15],[17,2,13,0],[17,3,13,1],[18,2,14,0],[18,11,14,9,"groupByEra"],[18,21,14,19,"groupByEra"],[18,22,14,20,"list"],[18,26,14,24],[18,28,14,26],[19,4,15,4],[19,11,15,11,"list"],[19,15,15,15],[19,16,15,16,"reduce"],[19,22,15,22],[19,23,15,23],[19,24,15,24,"map"],[19,27,15,27],[19,29,15,29],[20,6,15,31,"era"],[20,9,15,34],[21,6,15,36,"value"],[22,4,15,42],[22,5,15,43],[22,10,15,48],[23,6,16,8],[23,12,16,14,"key"],[23,15,16,17],[23,18,16,20,"era"],[23,21,16,23],[23,22,16,24,"toString"],[23,30,16,32],[23,31,16,33],[23,32,16,34],[24,6,17,8,"map"],[24,9,17,11],[24,10,17,12,"key"],[24,13,17,15],[24,14,17,16],[24,17,17,19],[24,18,17,20,"map"],[24,21,17,23],[24,22,17,24,"key"],[24,25,17,27],[24,26,17,28],[24,30,17,32,"util_1"],[24,36,17,38],[24,37,17,39,"BN_ZERO"],[24,44,17,46],[24,46,17,48,"add"],[24,49,17,51],[24,50,17,52,"value"],[24,55,17,57],[24,56,17,58,"unwrap"],[24,62,17,64],[24,63,17,65],[24,64,17,66],[24,65,17,67],[25,6,18,8],[25,13,18,15,"map"],[25,16,18,18],[26,4,19,4],[26,5,19,5],[26,7,19,7],[26,8,19,8],[26,9,19,9],[26,10,19,10],[27,2,20,0],[28,2,21,0],[28,11,21,9,"calculateUnlocking"],[28,29,21,27,"calculateUnlocking"],[28,30,21,28,"api"],[28,33,21,31],[28,35,21,33,"stakingLedger"],[28,48,21,46],[28,50,21,48,"sessionInfo"],[28,61,21,59],[28,63,21,61],[29,4,22,4],[29,10,22,10,"results"],[29,17,22,17],[29,20,22,20,"Object"],[29,26,22,26],[29,27,23,9,"entries"],[29,34,23,16],[29,35,23,17,"groupByEra"],[29,45,23,27],[29,46,23,28],[29,47,23,29,"stakingLedger"],[29,60,23,42],[29,62,23,44,"unlocking"],[29,71,23,53],[29,75,23,57],[29,77,23,59],[29,79,23,61,"filter"],[29,85,23,67],[29,86,23,68],[29,87,23,69],[30,6,23,71,"era"],[31,4,23,75],[31,5,23,76],[31,10,23,81,"era"],[31,13,23,84],[31,14,23,85,"unwrap"],[31,20,23,91],[31,21,23,92],[31,22,23,93],[31,23,23,94,"gt"],[31,25,23,96],[31,26,23,97,"sessionInfo"],[31,37,23,108],[31,38,23,109,"activeEra"],[31,47,23,118],[31,48,23,119],[31,49,23,120],[31,50,23,121],[31,51,23,122],[31,52,24,9,"map"],[31,55,24,12],[31,56,24,13],[31,57,24,14],[31,58,24,15,"eraString"],[31,67,24,24],[31,69,24,26,"value"],[31,74,24,31],[31,75,24,32],[31,81,24,38],[32,6,25,8,"remainingEras"],[32,19,25,21],[32,21,25,23],[32,25,25,27,"util_1"],[32,31,25,33],[32,32,25,34,"BN"],[32,34,25,36],[32,35,25,37,"eraString"],[32,44,25,46],[32,45,25,47],[32,46,25,48,"isub"],[32,50,25,52],[32,51,25,53,"sessionInfo"],[32,62,25,64],[32,63,25,65,"activeEra"],[32,72,25,74],[32,73,25,75],[33,6,26,8,"value"],[33,11,26,13],[33,13,26,15,"api"],[33,16,26,18],[33,17,26,19,"registry"],[33,25,26,27],[33,26,26,28,"createType"],[33,36,26,38],[33,37,26,39],[33,46,26,48],[33,48,26,50,"value"],[33,53,26,55],[34,4,27,4],[34,5,27,5],[34,6,27,6],[34,7,27,7],[35,4,28,4],[35,11,28,11,"results"],[35,18,28,18],[35,19,28,19,"length"],[35,25,28,25],[35,28,29,10,"results"],[35,35,29,17],[35,38,30,10,"undefined"],[35,47,30,19],[36,2,31,0],[37,2,32,0],[37,11,32,9,"redeemableSum"],[37,24,32,22,"redeemableSum"],[37,25,32,23,"api"],[37,28,32,26],[37,30,32,28,"stakingLedger"],[37,43,32,41],[37,45,32,43,"sessionInfo"],[37,56,32,54],[37,58,32,56],[38,4,33,4],[38,11,33,11,"api"],[38,14,33,14],[38,15,33,15,"registry"],[38,23,33,23],[38,24,33,24,"createType"],[38,34,33,34],[38,35,33,35],[38,44,33,44],[38,46,33,46],[38,47,33,47,"stakingLedger"],[38,60,33,60],[38,62,33,62,"unlocking"],[38,71,33,71],[38,75,33,75],[38,77,33,77],[38,79,33,79,"reduce"],[38,85,33,85],[38,86,33,86],[38,87,33,87,"total"],[38,92,33,92],[38,94,33,94],[39,6,33,96,"era"],[39,9,33,99],[40,6,33,101,"value"],[41,4,33,107],[41,5,33,108],[41,10,33,113],[42,6,34,8],[43,6,35,8],[44,6,36,8],[45,6,37,8],[45,13,37,15,"era"],[45,16,37,18],[45,17,37,19,"unwrap"],[45,23,37,25],[45,24,37,26],[45,25,37,27],[45,26,37,28,"gt"],[45,28,37,30],[45,29,37,31,"sessionInfo"],[45,40,37,42],[45,41,37,43,"currentEra"],[45,51,37,53],[45,52,37,54],[45,55,38,14,"total"],[45,60,38,19],[45,63,39,14,"total"],[45,68,39,19],[45,69,39,20,"iadd"],[45,73,39,24],[45,74,39,25,"value"],[45,79,39,30],[45,80,39,31,"unwrap"],[45,86,39,37],[45,87,39,38],[45,88,39,39],[45,89,39,40],[46,4,40,4],[46,5,40,5],[46,7,40,7],[46,11,40,11,"util_1"],[46,17,40,17],[46,18,40,18,"BN"],[46,20,40,20],[46,21,40,21],[46,22,40,22],[46,23,40,23],[46,24,40,24],[46,25,40,25],[47,2,41,0],[48,2,42,0],[48,11,42,9,"parseResult"],[48,22,42,20,"parseResult"],[48,23,42,21,"api"],[48,26,42,24],[48,28,42,26,"sessionInfo"],[48,39,42,37],[48,41,42,39,"keys"],[48,45,42,43],[48,47,42,45,"query"],[48,52,42,50],[48,54,42,52],[49,4,43,4],[49,11,43,11],[49,12,43,12],[49,13,43,13],[49,15,43,15,"util_1"],[49,21,43,21],[49,22,43,22,"objectSpread"],[49,34,43,34],[49,36,43,36],[49,37,43,37],[49,38,43,38],[49,40,43,40,"keys"],[49,44,43,44],[49,46,43,46,"query"],[49,51,43,51],[49,53,43,53],[50,6,44,8,"redeemable"],[50,16,44,18],[50,18,44,20,"redeemableSum"],[50,31,44,33],[50,32,44,34,"api"],[50,35,44,37],[50,37,44,39,"query"],[50,42,44,44],[50,43,44,45,"stakingLedger"],[50,56,44,58],[50,58,44,60,"sessionInfo"],[50,69,44,71],[50,70,44,72],[51,6,45,8,"unlocking"],[51,15,45,17],[51,17,45,19,"calculateUnlocking"],[51,35,45,37],[51,36,45,38,"api"],[51,39,45,41],[51,41,45,43,"query"],[51,46,45,48],[51,47,45,49,"stakingLedger"],[51,60,45,62],[51,62,45,64,"sessionInfo"],[51,73,45,75],[52,4,46,4],[52,5,46,5],[52,6,46,6],[53,2,47,0],[54,2,48,0],[55,0,49,0],[56,0,50,0],[57,0,51,0],[58,0,52,0],[59,0,53,0],[60,0,54,0],[61,0,55,0],[62,0,56,0],[63,0,57,0],[64,0,58,0],[65,0,59,0],[66,0,60,0],[67,2,61,0],[67,11,61,9,"accounts"],[67,19,61,17,"accounts"],[67,20,61,18,"instanceId"],[67,30,61,28],[67,32,61,30,"api"],[67,35,61,33],[67,37,61,35],[68,4,62,4],[68,11,62,11],[68,12,62,12],[68,13,62,13],[68,15,62,15,"index_js_1"],[68,25,62,25],[68,26,62,26,"memo"],[68,30,62,30],[68,32,62,32,"instanceId"],[68,42,62,42],[68,44,62,44],[68,45,62,45,"accountIds"],[68,55,62,55],[68,57,62,57,"opts"],[68,61,62,61],[68,64,62,64,"QUERY_OPTS"],[68,74,62,74],[68,79,62,79,"api"],[68,82,62,82],[68,83,62,83,"derive"],[68,89,62,89],[68,90,62,90,"session"],[68,97,62,97],[68,98,62,98,"info"],[68,102,62,102],[68,103,62,103],[68,104,62,104],[68,105,62,105,"pipe"],[68,109,62,109],[68,110,62,110],[68,111,62,111],[68,112,62,112],[68,114,62,114,"rxjs_1"],[68,120,62,120],[68,121,62,121,"switchMap"],[68,130,62,130],[68,132,62,133,"sessionInfo"],[68,143,62,144],[68,147,62,149],[68,148,62,150],[68,149,62,151],[68,151,62,153,"rxjs_1"],[68,157,62,159],[68,158,62,160,"combineLatest"],[68,171,62,173],[68,173,62,175],[68,174,63,8,"api"],[68,177,63,11],[68,178,63,12,"derive"],[68,184,63,18],[68,185,63,19,"staking"],[68,192,63,26],[68,193,63,27,"keysMulti"],[68,202,63,36],[68,203,63,37,"accountIds"],[68,213,63,47],[68,214,63,48],[68,216,64,8,"api"],[68,219,64,11],[68,220,64,12,"derive"],[68,226,64,18],[68,227,64,19,"staking"],[68,234,64,26],[68,235,64,27,"queryMulti"],[68,245,64,37],[68,246,64,38,"accountIds"],[68,256,64,48],[68,258,64,50,"opts"],[68,262,64,54],[68,263,64,55],[68,264,65,5],[68,265,65,6],[68,266,65,7,"pipe"],[68,270,65,11],[68,271,65,12],[68,272,65,13],[68,273,65,14],[68,275,65,16,"rxjs_1"],[68,281,65,22],[68,282,65,23,"map"],[68,285,65,26],[68,287,65,28],[68,288,65,29],[68,289,65,30,"keys"],[68,293,65,34],[68,295,65,36,"queries"],[68,302,65,43],[68,303,65,44],[68,308,65,49,"queries"],[68,315,65,56],[68,316,65,57,"map"],[68,319,65,60],[68,320,65,61],[68,321,65,62,"q"],[68,322,65,63],[68,324,65,65,"index"],[68,329,65,70],[68,334,65,75,"parseResult"],[68,345,65,86],[68,346,65,87,"api"],[68,349,65,90],[68,351,65,92,"sessionInfo"],[68,362,65,103],[68,364,65,105,"keys"],[68,368,65,109],[68,369,65,110,"index"],[68,374,65,115],[68,375,65,116],[68,377,65,118,"q"],[68,378,65,119],[68,379,65,120],[68,380,65,121],[68,381,65,122],[68,382,65,123],[68,383,65,124],[68,384,65,125],[68,385,65,126],[69,2,66,0],[70,2,67,0],[71,0,68,0],[72,0,69,0],[73,0,70,0],[74,0,71,0],[75,0,72,0],[76,0,73,0],[77,0,74,0],[78,0,75,0],[79,0,76,0],[80,0,77,0],[81,0,78,0],[82,0,79,0],[83,2,80,0,"exports"],[83,9,80,7],[83,10,80,8,"account"],[83,17,80,15],[83,20,80,18],[83,21,80,19],[83,22,80,20],[83,24,80,22,"index_js_1"],[83,34,80,32],[83,35,80,33,"firstMemo"],[83,44,80,42],[83,46,80,44],[83,47,80,45,"api"],[83,50,80,48],[83,52,80,50,"accountId"],[83,61,80,59],[83,63,80,61,"opts"],[83,67,80,65],[83,72,80,70,"api"],[83,75,80,73],[83,76,80,74,"derive"],[83,82,80,80],[83,83,80,81,"staking"],[83,90,80,88],[83,91,80,89,"accounts"],[83,99,80,97],[83,100,80,98],[83,101,80,99,"accountId"],[83,110,80,108],[83,111,80,109],[83,113,80,111,"opts"],[83,117,80,115],[83,118,80,116],[83,119,80,117],[84,0,80,118],[84,3]],"functionMap":{"names":["<global>","groupByEra","list.reduce$argument_0","calculateUnlocking","filter$argument_0","Object.entries.map$argument_0","redeemableSum","reduce$argument_0","parseResult","accounts","<anonymous>","queries.map$argument_0"],"mappings":"AAA;ACa;uBCC;KDI;CDC;AGC;oECE,mDD;aEC;MFG;CHI;AMC;sFCC;KDO;CNC;AQC;CRK;ASc;4CCC;6DCG,2DD,KD;CTC;4CUc,wEV"},"hasCjsExports":true},"type":"js/module"}]} |