mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-05-30 05:21:02 +00:00
1 line
16 KiB
Plaintext
1 line
16 KiB
Plaintext
{"dependencies":[{"name":"@polkadot/util","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":4,"column":15,"index":121},"end":{"line":4,"column":40,"index":146}}],"key":"u0mzEw2nilnHoUWtEdZl0JKHutA=","exportNames":["*"],"imports":1}},{"name":"../base/index.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":5,"column":19,"index":167},"end":{"line":5,"column":46,"index":194}}],"key":"6LGhkk8t77NLLcuOWVqakFlZ26o=","exportNames":["*"],"imports":1}},{"name":"./Combinator.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":6,"column":24,"index":220},"end":{"line":6,"column":50,"index":246}}],"key":"rnp/HW898LCa4xyDKkBYssgo3Fo=","exportNames":["*"],"imports":1}},{"name":"./decorateMethod.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":7,"column":28,"index":276},"end":{"line":7,"column":58,"index":306}}],"key":"UpHug+leW+HiuYrFQEdxS5jlXD8=","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.ApiPromise = void 0;\n const util_1 = require(_dependencyMap[0], \"@polkadot/util\");\n const index_js_1 = require(_dependencyMap[1], \"../base/index.js\");\n const Combinator_js_1 = require(_dependencyMap[2], \"./Combinator.js\");\n const decorateMethod_js_1 = require(_dependencyMap[3], \"./decorateMethod.js\");\n /**\n * # @polkadot/api/promise\n *\n * ## Overview\n *\n * @name ApiPromise\n * @description\n * ApiPromise is a standard JavaScript wrapper around the RPC and interfaces on the Polkadot network. As a full Promise-based, all interface calls return Promises, including the static `.create(...)`. Subscription calls utilise `(value) => {}` callbacks to pass through the latest values.\n *\n * The API is well suited to real-time applications where either the single-shot state is needed or use is to be made of the subscription-based features of Polkadot (and Substrate) clients.\n *\n * @see [[ApiRx]]\n *\n * ## Usage\n *\n * Making rpc calls -\n * <BR>\n *\n * ```javascript\n * import ApiPromise from '@polkadot/api/promise';\n *\n * // initialise via static create\n * const api = await ApiPromise.create();\n *\n * // make a subscription to the network head\n * api.rpc.chain.subscribeNewHeads((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 { ApiPromise, WsProvider } from '@polkadot/api';\n *\n * // initialise a provider with a specific endpoint\n * const provider = new WsProvider('wss://example.com:9944')\n *\n * // initialise via isReady & new with specific provider\n * const api = await new ApiPromise({ provider }).isReady;\n *\n * // retrieve the block target time\n * const blockPeriod = await api.query.timestamp.blockPeriod().toNumber();\n * let last = 0;\n *\n * // subscribe to the current block timestamp, updates automatically (callback provided)\n * api.query.timestamp.now((timestamp) => {\n * const elapsed = last\n * ? `, ${timestamp.toNumber() - last}s since last`\n * : '';\n *\n * last = timestamp.toNumber();\n * console.log(`timestamp ${timestamp}${elapsed} (${blockPeriod}s target)`);\n * });\n * ```\n * <BR>\n *\n * Submitting a transaction -\n * <BR>\n *\n * ```javascript\n * import ApiPromise from '@polkadot/api/promise';\n *\n * ApiPromise.create().then((api) => {\n * const [nonce] = await api.query.system.account(keyring.alice.address);\n *\n * api.tx.balances\n * // create transfer\n * transfer(keyring.bob.address, 12345)\n * // sign the transcation\n * .sign(keyring.alice, { nonce })\n * // send the transaction (optional status callback)\n * .send((status) => {\n * console.log(`current status ${status.type}`);\n * })\n * // retrieve the submitted extrinsic hash\n * .then((hash) => {\n * console.log(`submitted with hash ${hash}`);\n * });\n * });\n * ```\n */\n class ApiPromise extends index_js_1.ApiBase {\n #isReadyPromise;\n #isReadyOrErrorPromise;\n /**\n * @description Creates an instance of the ApiPromise class\n * @param options Options to create an instance. This can be either [[ApiOptions]] or\n * an [[WsProvider]].\n * @example\n * <BR>\n *\n * ```javascript\n * import Api from '@polkadot/api/promise';\n *\n * new Api().isReady.then((api) => {\n * api.rpc.subscribeNewHeads((header) => {\n * console.log(`new block #${header.number.toNumber()}`);\n * });\n * });\n * ```\n */\n constructor(options) {\n super(options, 'promise', decorateMethod_js_1.toPromiseMethod);\n this.#isReadyPromise = new Promise(resolve => {\n super.once('ready', () => resolve(this));\n });\n this.#isReadyOrErrorPromise = new Promise((resolve, reject) => {\n const tracker = (0, decorateMethod_js_1.promiseTracker)(resolve, reject);\n super.once('ready', () => tracker.resolve(this));\n super.once('error', error => tracker.reject(error));\n });\n }\n /**\n * @description Creates an ApiPromise instance using the supplied provider. Returns an Promise containing the actual Api instance.\n * @param options options that is passed to the class contructor. Can be either [[ApiOptions]] or a\n * provider (see the constructor arguments)\n * @example\n * <BR>\n *\n * ```javascript\n * import Api from '@polkadot/api/promise';\n *\n * Api.create().then(async (api) => {\n * const timestamp = await api.query.timestamp.now();\n *\n * console.log(`lastest block timestamp ${timestamp}`);\n * });\n * ```\n */\n static create(options) {\n const instance = new ApiPromise(options);\n if (options && options.throwOnConnect) {\n return instance.isReadyOrError;\n }\n // Swallow any rejections on isReadyOrError\n // (in Node 15.x this creates issues, when not being looked at)\n instance.isReadyOrError.catch(util_1.noop);\n return instance.isReady;\n }\n /**\n * @description Promise that resolves the first time we are connected and loaded\n */\n get isReady() {\n return this.#isReadyPromise;\n }\n /**\n * @description Promise that resolves if we can connect, or reject if there is an error\n */\n get isReadyOrError() {\n return this.#isReadyOrErrorPromise;\n }\n /**\n * @description Returns a clone of this ApiPromise instance (new underlying provider connection)\n */\n clone() {\n return new ApiPromise((0, util_1.objectSpread)({}, this._options, {\n source: this\n }));\n }\n /**\n * @description Creates a combinator that can be used to combine the latest results from multiple subscriptions\n * @param fns An array of function to combine, each in the form of `(cb: (value: void)) => void`\n * @param callback A callback that will return an Array of all the values this combinator has been applied to\n * @example\n * <BR>\n *\n * ```javascript\n * const address = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFacT7';\n *\n * // combines values from balance & nonce as it updates\n * api.combineLatest([\n * api.rpc.chain.subscribeNewHeads,\n * (cb) => api.query.system.account(address, cb)\n * ], ([head, [balance, nonce]]) => {\n * console.log(`#${head.number}: You have ${balance.free} units, with ${nonce} transactions sent`);\n * });\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/require-await\n async combineLatest(fns, callback) {\n const combinator = new Combinator_js_1.Combinator(fns, callback);\n return () => {\n combinator.unsubscribe();\n };\n }\n }\n exports.ApiPromise = ApiPromise;\n});","lineCount":202,"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,"ApiPromise"],[7,20,3,18],[7,23,3,21],[7,28,3,26],[7,29,3,27],[8,2,4,0],[8,8,4,6,"util_1"],[8,14,4,12],[8,17,4,15,"require"],[8,24,4,22],[8,25,4,22,"_dependencyMap"],[8,39,4,22],[8,60,4,39],[8,61,4,40],[9,2,5,0],[9,8,5,6,"index_js_1"],[9,18,5,16],[9,21,5,19,"require"],[9,28,5,26],[9,29,5,26,"_dependencyMap"],[9,43,5,26],[9,66,5,45],[9,67,5,46],[10,2,6,0],[10,8,6,6,"Combinator_js_1"],[10,23,6,21],[10,26,6,24,"require"],[10,33,6,31],[10,34,6,31,"_dependencyMap"],[10,48,6,31],[10,70,6,49],[10,71,6,50],[11,2,7,0],[11,8,7,6,"decorateMethod_js_1"],[11,27,7,25],[11,30,7,28,"require"],[11,37,7,35],[11,38,7,35,"_dependencyMap"],[11,52,7,35],[11,78,7,57],[11,79,7,58],[12,2,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,0,16,0],[21,0,17,0],[22,0,18,0],[23,0,19,0],[24,0,20,0],[25,0,21,0],[26,0,22,0],[27,0,23,0],[28,0,24,0],[29,0,25,0],[30,0,26,0],[31,0,27,0],[32,0,28,0],[33,0,29,0],[34,0,30,0],[35,0,31,0],[36,0,32,0],[37,0,33,0],[38,0,34,0],[39,0,35,0],[40,0,36,0],[41,0,37,0],[42,0,38,0],[43,0,39,0],[44,0,40,0],[45,0,41,0],[46,0,42,0],[47,0,43,0],[48,0,44,0],[49,0,45,0],[50,0,46,0],[51,0,47,0],[52,0,48,0],[53,0,49,0],[54,0,50,0],[55,0,51,0],[56,0,52,0],[57,0,53,0],[58,0,54,0],[59,0,55,0],[60,0,56,0],[61,0,57,0],[62,0,58,0],[63,0,59,0],[64,0,60,0],[65,0,61,0],[66,0,62,0],[67,0,63,0],[68,0,64,0],[69,0,65,0],[70,0,66,0],[71,0,67,0],[72,0,68,0],[73,0,69,0],[74,0,70,0],[75,0,71,0],[76,0,72,0],[77,0,73,0],[78,0,74,0],[79,0,75,0],[80,0,76,0],[81,0,77,0],[82,0,78,0],[83,0,79,0],[84,0,80,0],[85,0,81,0],[86,0,82,0],[87,0,83,0],[88,0,84,0],[89,0,85,0],[90,0,86,0],[91,0,87,0],[92,0,88,0],[93,0,89,0],[94,0,90,0],[95,0,91,0],[96,2,92,0],[96,8,92,6,"ApiPromise"],[96,18,92,16],[96,27,92,25,"index_js_1"],[96,37,92,35],[96,38,92,36,"ApiBase"],[96,45,92,43],[96,46,92,44],[97,4,93,4],[97,5,93,5,"isReadyPromise"],[97,19,93,19],[98,4,94,4],[98,5,94,5,"isReadyOrErrorPromise"],[98,26,94,26],[99,4,95,4],[100,0,96,0],[101,0,97,0],[102,0,98,0],[103,0,99,0],[104,0,100,0],[105,0,101,0],[106,0,102,0],[107,0,103,0],[108,0,104,0],[109,0,105,0],[110,0,106,0],[111,0,107,0],[112,0,108,0],[113,0,109,0],[114,0,110,0],[115,0,111,0],[116,4,112,4,"constructor"],[116,15,112,15,"constructor"],[116,16,112,16,"options"],[116,23,112,23],[116,25,112,25],[117,6,113,8],[117,11,113,13],[117,12,113,14,"options"],[117,19,113,21],[117,21,113,23],[117,30,113,32],[117,32,113,34,"decorateMethod_js_1"],[117,51,113,53],[117,52,113,54,"toPromiseMethod"],[117,67,113,69],[117,68,113,70],[118,6,114,8],[118,10,114,12],[118,11,114,13],[118,12,114,14,"isReadyPromise"],[118,26,114,28],[118,29,114,31],[118,33,114,35,"Promise"],[118,40,114,42],[118,41,114,44,"resolve"],[118,48,114,51],[118,52,114,56],[119,8,115,12],[119,13,115,17],[119,14,115,18,"once"],[119,18,115,22],[119,19,115,23],[119,26,115,30],[119,28,115,32],[119,34,115,38,"resolve"],[119,41,115,45],[119,42,115,46],[119,46,115,50],[119,47,115,51],[119,48,115,52],[120,6,116,8],[120,7,116,9],[120,8,116,10],[121,6,117,8],[121,10,117,12],[121,11,117,13],[121,12,117,14,"isReadyOrErrorPromise"],[121,33,117,35],[121,36,117,38],[121,40,117,42,"Promise"],[121,47,117,49],[121,48,117,50],[121,49,117,51,"resolve"],[121,56,117,58],[121,58,117,60,"reject"],[121,64,117,66],[121,69,117,71],[122,8,118,12],[122,14,118,18,"tracker"],[122,21,118,25],[122,24,118,28],[122,25,118,29],[122,26,118,30],[122,28,118,32,"decorateMethod_js_1"],[122,47,118,51],[122,48,118,52,"promiseTracker"],[122,62,118,66],[122,64,118,68,"resolve"],[122,71,118,75],[122,73,118,77,"reject"],[122,79,118,83],[122,80,118,84],[123,8,119,12],[123,13,119,17],[123,14,119,18,"once"],[123,18,119,22],[123,19,119,23],[123,26,119,30],[123,28,119,32],[123,34,119,38,"tracker"],[123,41,119,45],[123,42,119,46,"resolve"],[123,49,119,53],[123,50,119,54],[123,54,119,58],[123,55,119,59],[123,56,119,60],[124,8,120,12],[124,13,120,17],[124,14,120,18,"once"],[124,18,120,22],[124,19,120,23],[124,26,120,30],[124,28,120,33,"error"],[124,33,120,38],[124,37,120,43,"tracker"],[124,44,120,50],[124,45,120,51,"reject"],[124,51,120,57],[124,52,120,58,"error"],[124,57,120,63],[124,58,120,64],[124,59,120,65],[125,6,121,8],[125,7,121,9],[125,8,121,10],[126,4,122,4],[127,4,123,4],[128,0,124,0],[129,0,125,0],[130,0,126,0],[131,0,127,0],[132,0,128,0],[133,0,129,0],[134,0,130,0],[135,0,131,0],[136,0,132,0],[137,0,133,0],[138,0,134,0],[139,0,135,0],[140,0,136,0],[141,0,137,0],[142,0,138,0],[143,0,139,0],[144,4,140,4],[144,11,140,11,"create"],[144,17,140,17,"create"],[144,18,140,18,"options"],[144,25,140,25],[144,27,140,27],[145,6,141,8],[145,12,141,14,"instance"],[145,20,141,22],[145,23,141,25],[145,27,141,29,"ApiPromise"],[145,37,141,39],[145,38,141,40,"options"],[145,45,141,47],[145,46,141,48],[146,6,142,8],[146,10,142,12,"options"],[146,17,142,19],[146,21,142,23,"options"],[146,28,142,30],[146,29,142,31,"throwOnConnect"],[146,43,142,45],[146,45,142,47],[147,8,143,12],[147,15,143,19,"instance"],[147,23,143,27],[147,24,143,28,"isReadyOrError"],[147,38,143,42],[148,6,144,8],[149,6,145,8],[150,6,146,8],[151,6,147,8,"instance"],[151,14,147,16],[151,15,147,17,"isReadyOrError"],[151,29,147,31],[151,30,147,32,"catch"],[151,35,147,37],[151,36,147,38,"util_1"],[151,42,147,44],[151,43,147,45,"noop"],[151,47,147,49],[151,48,147,50],[152,6,148,8],[152,13,148,15,"instance"],[152,21,148,23],[152,22,148,24,"isReady"],[152,29,148,31],[153,4,149,4],[154,4,150,4],[155,0,151,0],[156,0,152,0],[157,4,153,4],[157,8,153,8,"isReady"],[157,15,153,15,"isReady"],[157,16,153,15],[157,18,153,18],[158,6,154,8],[158,13,154,15],[158,17,154,19],[158,18,154,20],[158,19,154,21,"isReadyPromise"],[158,33,154,35],[159,4,155,4],[160,4,156,4],[161,0,157,0],[162,0,158,0],[163,4,159,4],[163,8,159,8,"isReadyOrError"],[163,22,159,22,"isReadyOrError"],[163,23,159,22],[163,25,159,25],[164,6,160,8],[164,13,160,15],[164,17,160,19],[164,18,160,20],[164,19,160,21,"isReadyOrErrorPromise"],[164,40,160,42],[165,4,161,4],[166,4,162,4],[167,0,163,0],[168,0,164,0],[169,4,165,4,"clone"],[169,9,165,9,"clone"],[169,10,165,9],[169,12,165,12],[170,6,166,8],[170,13,166,15],[170,17,166,19,"ApiPromise"],[170,27,166,29],[170,28,166,30],[170,29,166,31],[170,30,166,32],[170,32,166,34,"util_1"],[170,38,166,40],[170,39,166,41,"objectSpread"],[170,51,166,53],[170,53,166,55],[170,54,166,56],[170,55,166,57],[170,57,166,59],[170,61,166,63],[170,62,166,64,"_options"],[170,70,166,72],[170,72,166,74],[171,8,166,76,"source"],[171,14,166,82],[171,16,166,84],[172,6,166,89],[172,7,166,90],[172,8,166,91],[172,9,166,92],[173,4,167,4],[174,4,168,4],[175,0,169,0],[176,0,170,0],[177,0,171,0],[178,0,172,0],[179,0,173,0],[180,0,174,0],[181,0,175,0],[182,0,176,0],[183,0,177,0],[184,0,178,0],[185,0,179,0],[186,0,180,0],[187,0,181,0],[188,0,182,0],[189,0,183,0],[190,0,184,0],[191,0,185,0],[192,0,186,0],[193,4,187,4],[194,4,188,4],[194,10,188,10,"combineLatest"],[194,23,188,23,"combineLatest"],[194,24,188,24,"fns"],[194,27,188,27],[194,29,188,29,"callback"],[194,37,188,37],[194,39,188,39],[195,6,189,8],[195,12,189,14,"combinator"],[195,22,189,24],[195,25,189,27],[195,29,189,31,"Combinator_js_1"],[195,44,189,46],[195,45,189,47,"Combinator"],[195,55,189,57],[195,56,189,58,"fns"],[195,59,189,61],[195,61,189,63,"callback"],[195,69,189,71],[195,70,189,72],[196,6,190,8],[196,13,190,15],[196,19,190,21],[197,8,191,12,"combinator"],[197,18,191,22],[197,19,191,23,"unsubscribe"],[197,30,191,34],[197,31,191,35],[197,32,191,36],[198,6,192,8],[198,7,192,9],[199,4,193,4],[200,2,194,0],[201,2,195,0,"exports"],[201,9,195,7],[201,10,195,8,"ApiPromise"],[201,20,195,18],[201,23,195,21,"ApiPromise"],[201,33,195,31],[202,0,195,32],[202,3]],"functionMap":{"names":["<global>","ApiPromise","ApiPromise#constructor","Promise$argument_0","once$argument_1","ApiPromise.create","ApiPromise#get__isReady","ApiPromise#get__isReadyOrError","ApiPromise#clone","ApiPromise#combineLatest","<anonymous>"],"mappings":"AAA;AC2F;ICoB;2CCE;gCCC,mBD;SDC;kDCC;gCCE,2BD;gCCC,gCD;SDC;KDC;IIkB;KJS;IKI;KLE;IMI;KNE;IOI;KPE;IQqB;eCE;SDE;KRC;CDC"},"hasCjsExports":true},"type":"js/module"}]} |