mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-05-30 05:21:02 +00:00
1 line
12 KiB
Plaintext
1 line
12 KiB
Plaintext
{"dependencies":[{"name":"rxjs","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":28,"index":28}}],"key":"PnOMrhZAPWoeW3ygrvUJ7ff768Y=","exportNames":["*"],"imports":1}},{"name":"@polkadot/util","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":2,"column":0,"index":29},"end":{"line":2,"column":46,"index":75}}],"key":"ISHU1ovvPMrCldqRjtd1JhW9dyo=","exportNames":["*"],"imports":1}},{"name":"../base/index.js","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":3,"column":0,"index":76},"end":{"line":3,"column":43,"index":119}}],"key":"F7yfqO9kbR/r5udcI7E6w0J8QfU=","exportNames":["*"],"imports":1}},{"name":"./decorateMethod.js","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":4,"column":0,"index":120},"end":{"line":4,"column":49,"index":169}}],"key":"guYLkGE+pB1ArcvHIuuZ3j4O5Zw=","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 Object.defineProperty(exports, \"ApiRx\", {\n enumerable: true,\n get: function () {\n return ApiRx;\n }\n });\n var _rxjs = require(_dependencyMap[0], \"rxjs\");\n var _polkadotUtil = require(_dependencyMap[1], \"@polkadot/util\");\n var _baseIndexJs = require(_dependencyMap[2], \"../base/index.js\");\n var _decorateMethodJs = require(_dependencyMap[3], \"./decorateMethod.js\");\n /**\n * # @polkadot/api/rx\n *\n * ## Overview\n *\n * @name ApiRx\n *\n * @description\n * ApiRx is a powerful RxJS Observable wrapper around the RPC and interfaces on the Polkadot network. As a full Observable API, all interface calls return RxJS Observables, including the static `.create(...)`. In the same fashion and subscription-based methods return long-running Observables that update with the latest values.\n *\n * The API is well suited to real-time applications where the latest state is needed, unlocking the subscription-based features of Polkadot (and Substrate) clients. Some familiarity with RxJS is a requirement to use the API, however just understanding `.subscribe` and `.pipe` on Observables will unlock full-scale use thereof.\n *\n * @see [[ApiPromise]]\n *\n * ## Usage\n *\n * Making rpc calls -\n * <BR>\n *\n * ```javascript\n * import ApiRx from '@polkadot/api/rx';\n *\n * // initialize via Promise & static create\n * const api = await ApiRx.create().toPromise();\n *\n * // make a call to retrieve the current network head\n * api.rpc.chain.subscribeNewHeads().subscribe((header) => {\n * console.log(`Chain is at #${header.number}`);\n * });\n * ```\n * <BR>\n *\n * Subscribing to chain state -\n * <BR>\n *\n * ```javascript\n * import { combineLatest, pairwise, switchMap } from 'rxjs';\n * import { ApiRx, WsProvider } from '@polkadot/api';\n *\n *\n * // initialize a provider with a specific endpoint\n * const provider = new WsProvider('wss://example.com:9944')\n *\n * // initialize via isReady & new with specific provider\n * new ApiRx({ provider })\n * .isReady\n * .pipe(\n * switchMap((api) =>\n * combineLatest([\n * api.query.timestamp.blockPeriod(),\n * api.query.timestamp.now().pipe(pairwise())\n * ])\n * )\n * )\n * .subscribe(([blockPeriod, timestamp]) => {\n * const elapsed = timestamp[1].toNumber() - timestamp[0].toNumber();\n * console.log(`timestamp ${timestamp[1]} \\nelapsed ${elapsed} \\n(${blockPeriod}s target)`);\n * });\n * ```\n * <BR>\n *\n * Submitting a transaction -\n * <BR>\n *\n * ```javascript\n * import { first, switchMap } from 'rxjs';\n * import ApiRx from '@polkadot/api/rx';\n *\n * // import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)\n * import testingPairs from '@polkadot/keyring/testingPairs';\n * const keyring = testingPairs();\n *\n * // get api via Promise\n * const api = await ApiRx.create().toPromise();\n *\n * // retrieve nonce for the account\n * api.query.system\n * .account(keyring.alice.address)\n * .pipe(\n * first(),\n * // pipe nonce into transfer\n * switchMap(([nonce]) =>\n * api.tx.balances\n * // create transfer\n * .transferAllowDeath(keyring.bob.address, 12345)\n * // sign the transaction\n * .sign(keyring.alice, { nonce })\n * // send the transaction\n * .send()\n * )\n * )\n * // subscribe to overall result\n * .subscribe(({ status }) => {\n * if (status.isInBlock) {\n * console.log('Completed at block hash', status.asFinalized.toHex());\n * }\n * });\n * ```\n */\n class ApiRx extends _baseIndexJs.ApiBase {\n #isReadyRx;\n /**\n * @description Create an instance of the ApiRx class\n * @param options Options to create an instance. Can be either [[ApiOptions]] or [[WsProvider]]\n * @example\n * <BR>\n *\n * ```javascript\n * import { switchMap } from 'rxjs';\n * import Api from '@polkadot/api/rx';\n *\n * new Api().isReady\n * .pipe(\n * switchMap((api) =>\n * api.rpc.chain.subscribeNewHeads()\n * ))\n * .subscribe((header) => {\n * console.log(`new block #${header.number.toNumber()}`);\n * });\n * ```\n */\n constructor(options) {\n super(options, 'rxjs', _decorateMethodJs.toRxMethod);\n this.#isReadyRx = (0, _rxjs.from)(\n // You can create an observable from an event, however my mind groks this form better\n new Promise(resolve => {\n super.on('ready', () => resolve(this));\n }));\n }\n /**\n * @description Creates an ApiRx instance using the supplied provider. Returns an Observable containing the actual Api instance.\n * @param options options that is passed to the class constructor. Can be either [[ApiOptions]] or [[WsProvider]]\n * @example\n * <BR>\n *\n * ```javascript\n * import { switchMap } from 'rxjs';\n * import Api from '@polkadot/api/rx';\n *\n * Api.create()\n * .pipe(\n * switchMap((api) =>\n * api.rpc.chain.subscribeNewHeads()\n * ))\n * .subscribe((header) => {\n * console.log(`new block #${header.number.toNumber()}`);\n * });\n * ```\n */\n static create(options) {\n return new ApiRx(options).isReady;\n }\n /**\n * @description Observable that returns the first time we are connected and loaded\n */\n get isReady() {\n return this.#isReadyRx;\n }\n /**\n * @description Returns a clone of this ApiRx instance (new underlying provider connection)\n */\n clone() {\n return new ApiRx((0, _polkadotUtil.objectSpread)({}, this._options, {\n source: this\n }));\n }\n }\n});","lineCount":184,"map":[[7,2,104,0,"Object"],[7,8,104,0],[7,9,104,0,"defineProperty"],[7,23,104,0],[7,24,104,0,"exports"],[7,31,104,0],[8,4,104,0,"enumerable"],[8,14,104,0],[9,4,104,0,"get"],[9,7,104,0],[9,18,104,0,"get"],[9,19,104,0],[10,6,104,0],[10,13,104,0,"ApiRx"],[10,18,104,0],[11,4,104,0],[12,2,104,0],[13,2,1,0],[13,6,1,0,"_rxjs"],[13,11,1,0],[13,14,1,0,"require"],[13,21,1,0],[13,22,1,0,"_dependencyMap"],[13,36,1,0],[14,2,2,0],[14,6,2,0,"_polkadotUtil"],[14,19,2,0],[14,22,2,0,"require"],[14,29,2,0],[14,30,2,0,"_dependencyMap"],[14,44,2,0],[15,2,3,0],[15,6,3,0,"_baseIndexJs"],[15,18,3,0],[15,21,3,0,"require"],[15,28,3,0],[15,29,3,0,"_dependencyMap"],[15,43,3,0],[16,2,4,0],[16,6,4,0,"_decorateMethodJs"],[16,23,4,0],[16,26,4,0,"require"],[16,33,4,0],[16,34,4,0,"_dependencyMap"],[16,48,4,0],[17,2,5,0],[18,0,6,0],[19,0,7,0],[20,0,8,0],[21,0,9,0],[22,0,10,0],[23,0,11,0],[24,0,12,0],[25,0,13,0],[26,0,14,0],[27,0,15,0],[28,0,16,0],[29,0,17,0],[30,0,18,0],[31,0,19,0],[32,0,20,0],[33,0,21,0],[34,0,22,0],[35,0,23,0],[36,0,24,0],[37,0,25,0],[38,0,26,0],[39,0,27,0],[40,0,28,0],[41,0,29,0],[42,0,30,0],[43,0,31,0],[44,0,32,0],[45,0,33,0],[46,0,34,0],[47,0,35,0],[48,0,36,0],[49,0,37,0],[50,0,38,0],[51,0,39,0],[52,0,40,0],[53,0,41,0],[54,0,42,0],[55,0,43,0],[56,0,44,0],[57,0,45,0],[58,0,46,0],[59,0,47,0],[60,0,48,0],[61,0,49,0],[62,0,50,0],[63,0,51,0],[64,0,52,0],[65,0,53,0],[66,0,54,0],[67,0,55,0],[68,0,56,0],[69,0,57,0],[70,0,58,0],[71,0,59,0],[72,0,60,0],[73,0,61,0],[74,0,62,0],[75,0,63,0],[76,0,64,0],[77,0,65,0],[78,0,66,0],[79,0,67,0],[80,0,68,0],[81,0,69,0],[82,0,70,0],[83,0,71,0],[84,0,72,0],[85,0,73,0],[86,0,74,0],[87,0,75,0],[88,0,76,0],[89,0,77,0],[90,0,78,0],[91,0,79,0],[92,0,80,0],[93,0,81,0],[94,0,82,0],[95,0,83,0],[96,0,84,0],[97,0,85,0],[98,0,86,0],[99,0,87,0],[100,0,88,0],[101,0,89,0],[102,0,90,0],[103,0,91,0],[104,0,92,0],[105,0,93,0],[106,0,94,0],[107,0,95,0],[108,0,96,0],[109,0,97,0],[110,0,98,0],[111,0,99,0],[112,0,100,0],[113,0,101,0],[114,0,102,0],[115,0,103,0],[116,2,104,7],[116,8,104,13,"ApiRx"],[116,13,104,18],[116,22,104,27,"ApiBase"],[116,34,104,34],[116,35,104,34,"ApiBase"],[116,42,104,34],[116,43,104,35],[117,4,105,4],[117,5,105,5,"isReadyRx"],[117,14,105,14],[118,4,106,4],[119,0,107,0],[120,0,108,0],[121,0,109,0],[122,0,110,0],[123,0,111,0],[124,0,112,0],[125,0,113,0],[126,0,114,0],[127,0,115,0],[128,0,116,0],[129,0,117,0],[130,0,118,0],[131,0,119,0],[132,0,120,0],[133,0,121,0],[134,0,122,0],[135,0,123,0],[136,0,124,0],[137,0,125,0],[138,4,126,4,"constructor"],[138,15,126,15,"constructor"],[138,16,126,16,"options"],[138,23,126,23],[138,25,126,25],[139,6,127,8],[139,11,127,13],[139,12,127,14,"options"],[139,19,127,21],[139,21,127,23],[139,27,127,29],[139,29,127,31,"toRxMethod"],[139,46,127,41],[139,47,127,41,"toRxMethod"],[139,57,127,41],[139,58,127,42],[140,6,128,8],[140,10,128,12],[140,11,128,13],[140,12,128,14,"isReadyRx"],[140,21,128,23],[140,24,128,26],[140,28,128,26,"from"],[140,33,128,30],[140,34,128,30,"from"],[140,38,128,30],[141,6,129,8],[142,6,130,8],[142,10,130,12,"Promise"],[142,17,130,19],[142,18,130,21,"resolve"],[142,25,130,28],[142,29,130,33],[143,8,131,12],[143,13,131,17],[143,14,131,18,"on"],[143,16,131,20],[143,17,131,21],[143,24,131,28],[143,26,131,30],[143,32,131,36,"resolve"],[143,39,131,43],[143,40,131,44],[143,44,131,48],[143,45,131,49],[143,46,131,50],[144,6,132,8],[144,7,132,9],[144,8,132,10],[144,9,132,11],[145,4,133,4],[146,4,134,4],[147,0,135,0],[148,0,136,0],[149,0,137,0],[150,0,138,0],[151,0,139,0],[152,0,140,0],[153,0,141,0],[154,0,142,0],[155,0,143,0],[156,0,144,0],[157,0,145,0],[158,0,146,0],[159,0,147,0],[160,0,148,0],[161,0,149,0],[162,0,150,0],[163,0,151,0],[164,0,152,0],[165,0,153,0],[166,4,154,4],[166,11,154,11,"create"],[166,17,154,17,"create"],[166,18,154,18,"options"],[166,25,154,25],[166,27,154,27],[167,6,155,8],[167,13,155,15],[167,17,155,19,"ApiRx"],[167,22,155,24],[167,23,155,25,"options"],[167,30,155,32],[167,31,155,33],[167,32,155,34,"isReady"],[167,39,155,41],[168,4,156,4],[169,4,157,4],[170,0,158,0],[171,0,159,0],[172,4,160,4],[172,8,160,8,"isReady"],[172,15,160,15,"isReady"],[172,16,160,15],[172,18,160,18],[173,6,161,8],[173,13,161,15],[173,17,161,19],[173,18,161,20],[173,19,161,21,"isReadyRx"],[173,28,161,30],[174,4,162,4],[175,4,163,4],[176,0,164,0],[177,0,165,0],[178,4,166,4,"clone"],[178,9,166,9,"clone"],[178,10,166,9],[178,12,166,12],[179,6,167,8],[179,13,167,15],[179,17,167,19,"ApiRx"],[179,22,167,24],[179,23,167,25],[179,27,167,25,"objectSpread"],[179,40,167,37],[179,41,167,37,"objectSpread"],[179,53,167,37],[179,55,167,38],[179,56,167,39],[179,57,167,40],[179,59,167,42],[179,63,167,46],[179,64,167,47,"_options"],[179,72,167,55],[179,74,167,57],[180,8,167,59,"source"],[180,14,167,65],[180,16,167,67],[181,6,167,72],[181,7,167,73],[181,8,167,74],[181,9,167,75],[182,4,168,4],[183,2,169,0],[184,0,169,1],[184,3]],"functionMap":{"names":["<global>","ApiRx","ApiRx#constructor","Promise$argument_0","on$argument_1","ApiRx.create","ApiRx#get__isReady","ApiRx#clone"],"mappings":"AAA;OCuG;ICsB;oBCI;8BCC,mBD;SDC;KDC;IIqB;KJE;IKI;KLE;IMI;KNE;CDC"},"hasCjsExports":false},"type":"js/module"}]} |