@paraspell/sdk-pjs 10.10.10 → 10.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -4
- package/dist/index.cjs +231 -211
- package/dist/index.mjs +232 -212
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, getNode, isForeignAsset, InvalidParameterError, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, NodeNotSupportedError, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, convertSs58 as convertSs58$1, getParaId, ETH_CHAIN_ID, InvalidCurrencyError, isOverrideMultiLocationSpecifier, transferMoonbeamEvm, transferMoonbeamToEth, validateAddress, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, getBridgeStatus as getBridgeStatus$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
|
|
1
|
+
import { isConfig, BatchMode, MissingChainApiError, createApiInstanceForNode as createApiInstanceForNode$1, getNode, isForeignAsset, InvalidParameterError, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, NodeNotSupportedError, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, convertSs58 as convertSs58$1, getParaId, ETH_CHAIN_ID, InvalidCurrencyError, isOverrideMultiLocationSpecifier, transferMoonbeamEvm, transferMoonbeamToEth, validateAddress, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, getBridgeStatus as getBridgeStatus$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
4
4
|
import { u32 } from '@polkadot/types';
|
|
@@ -275,20 +275,16 @@ var snakeToCamel = function snakeToCamel(str) {
|
|
|
275
275
|
});
|
|
276
276
|
};
|
|
277
277
|
var PolkadotJsApi = /*#__PURE__*/function () {
|
|
278
|
-
function PolkadotJsApi() {
|
|
278
|
+
function PolkadotJsApi(config) {
|
|
279
279
|
_classCallCheck(this, PolkadotJsApi);
|
|
280
280
|
this.initialized = false;
|
|
281
281
|
this.disconnectAllowed = true;
|
|
282
|
+
this._config = config;
|
|
282
283
|
}
|
|
283
284
|
return _createClass(PolkadotJsApi, [{
|
|
284
|
-
key: "
|
|
285
|
-
value: function
|
|
286
|
-
this.
|
|
287
|
-
}
|
|
288
|
-
}, {
|
|
289
|
-
key: "getApiOrUrl",
|
|
290
|
-
value: function getApiOrUrl() {
|
|
291
|
-
return this._api;
|
|
285
|
+
key: "getConfig",
|
|
286
|
+
value: function getConfig() {
|
|
287
|
+
return this._config;
|
|
292
288
|
}
|
|
293
289
|
}, {
|
|
294
290
|
key: "getApi",
|
|
@@ -298,45 +294,31 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
298
294
|
}, {
|
|
299
295
|
key: "init",
|
|
300
296
|
value: function () {
|
|
301
|
-
var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(
|
|
302
|
-
var
|
|
297
|
+
var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, _clientTtlMs) {
|
|
298
|
+
var apiConfig;
|
|
303
299
|
return _regenerator().w(function (_context) {
|
|
304
300
|
while (1) switch (_context.n) {
|
|
305
301
|
case 0:
|
|
306
|
-
if (!(this.initialized ||
|
|
302
|
+
if (!(this.initialized || chain === 'Ethereum')) {
|
|
307
303
|
_context.n = 1;
|
|
308
304
|
break;
|
|
309
305
|
}
|
|
310
306
|
return _context.a(2);
|
|
311
307
|
case 1:
|
|
312
|
-
|
|
313
|
-
|
|
308
|
+
this._node = chain;
|
|
309
|
+
apiConfig = this.getApiConfigForChain(chain);
|
|
310
|
+
if (!(isConfig(this._config) && this._config.development && !apiConfig)) {
|
|
311
|
+
_context.n = 2;
|
|
314
312
|
break;
|
|
315
313
|
}
|
|
316
|
-
|
|
317
|
-
return this.createApiInstance(this._api);
|
|
314
|
+
throw new MissingChainApiError(chain);
|
|
318
315
|
case 2:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
break;
|
|
316
|
+
_context.n = 3;
|
|
317
|
+
return this.resolveApi(apiConfig, chain);
|
|
322
318
|
case 3:
|
|
323
|
-
|
|
324
|
-
_context.n = 4;
|
|
325
|
-
break;
|
|
326
|
-
}
|
|
327
|
-
_t = _this$_api;
|
|
328
|
-
_context.n = 6;
|
|
329
|
-
break;
|
|
330
|
-
case 4:
|
|
331
|
-
_context.n = 5;
|
|
332
|
-
return createApiInstanceForNode$1(this, node);
|
|
333
|
-
case 5:
|
|
334
|
-
_t = _context.v;
|
|
335
|
-
case 6:
|
|
336
|
-
this.api = _t;
|
|
337
|
-
case 7:
|
|
319
|
+
this.api = _context.v;
|
|
338
320
|
this.initialized = true;
|
|
339
|
-
case
|
|
321
|
+
case 4:
|
|
340
322
|
return _context.a(2);
|
|
341
323
|
}
|
|
342
324
|
}, _callee, this);
|
|
@@ -347,21 +329,58 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
347
329
|
return init;
|
|
348
330
|
}()
|
|
349
331
|
}, {
|
|
350
|
-
key: "
|
|
332
|
+
key: "getApiConfigForChain",
|
|
333
|
+
value: function getApiConfigForChain(chain) {
|
|
334
|
+
if (isConfig(this._config)) {
|
|
335
|
+
var _this$_config$apiOver;
|
|
336
|
+
return (_this$_config$apiOver = this._config.apiOverrides) === null || _this$_config$apiOver === void 0 ? void 0 : _this$_config$apiOver[chain];
|
|
337
|
+
}
|
|
338
|
+
return this._config;
|
|
339
|
+
}
|
|
340
|
+
}, {
|
|
341
|
+
key: "resolveApi",
|
|
351
342
|
value: function () {
|
|
352
|
-
var
|
|
353
|
-
var wsProvider;
|
|
343
|
+
var _resolveApi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(apiConfig, chain) {
|
|
354
344
|
return _regenerator().w(function (_context2) {
|
|
355
345
|
while (1) switch (_context2.n) {
|
|
346
|
+
case 0:
|
|
347
|
+
if (apiConfig) {
|
|
348
|
+
_context2.n = 1;
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
return _context2.a(2, createApiInstanceForNode$1(this, chain));
|
|
352
|
+
case 1:
|
|
353
|
+
if (!(typeof apiConfig === 'string' || apiConfig instanceof Array)) {
|
|
354
|
+
_context2.n = 2;
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
return _context2.a(2, this.createApiInstance(apiConfig));
|
|
358
|
+
case 2:
|
|
359
|
+
return _context2.a(2, apiConfig);
|
|
360
|
+
}
|
|
361
|
+
}, _callee2, this);
|
|
362
|
+
}));
|
|
363
|
+
function resolveApi(_x3, _x4) {
|
|
364
|
+
return _resolveApi.apply(this, arguments);
|
|
365
|
+
}
|
|
366
|
+
return resolveApi;
|
|
367
|
+
}()
|
|
368
|
+
}, {
|
|
369
|
+
key: "createApiInstance",
|
|
370
|
+
value: function () {
|
|
371
|
+
var _createApiInstance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(wsUrl) {
|
|
372
|
+
var wsProvider;
|
|
373
|
+
return _regenerator().w(function (_context3) {
|
|
374
|
+
while (1) switch (_context3.n) {
|
|
356
375
|
case 0:
|
|
357
376
|
wsProvider = new WsProvider(wsUrl);
|
|
358
|
-
return
|
|
377
|
+
return _context3.a(2, ApiPromise.create({
|
|
359
378
|
provider: wsProvider
|
|
360
379
|
}));
|
|
361
380
|
}
|
|
362
|
-
},
|
|
381
|
+
}, _callee3);
|
|
363
382
|
}));
|
|
364
|
-
function createApiInstance(
|
|
383
|
+
function createApiInstance(_x5) {
|
|
365
384
|
return _createApiInstance.apply(this, arguments);
|
|
366
385
|
}
|
|
367
386
|
return createApiInstance;
|
|
@@ -415,21 +434,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
415
434
|
}, {
|
|
416
435
|
key: "calculateTransactionFee",
|
|
417
436
|
value: function () {
|
|
418
|
-
var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
437
|
+
var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(tx, address) {
|
|
419
438
|
var _yield$tx$paymentInfo, partialFee;
|
|
420
|
-
return _regenerator().w(function (
|
|
421
|
-
while (1) switch (
|
|
439
|
+
return _regenerator().w(function (_context4) {
|
|
440
|
+
while (1) switch (_context4.n) {
|
|
422
441
|
case 0:
|
|
423
|
-
|
|
442
|
+
_context4.n = 1;
|
|
424
443
|
return tx.paymentInfo(address);
|
|
425
444
|
case 1:
|
|
426
|
-
_yield$tx$paymentInfo =
|
|
445
|
+
_yield$tx$paymentInfo = _context4.v;
|
|
427
446
|
partialFee = _yield$tx$paymentInfo.partialFee;
|
|
428
|
-
return
|
|
447
|
+
return _context4.a(2, partialFee.toBigInt());
|
|
429
448
|
}
|
|
430
|
-
},
|
|
449
|
+
}, _callee4);
|
|
431
450
|
}));
|
|
432
|
-
function calculateTransactionFee(
|
|
451
|
+
function calculateTransactionFee(_x6, _x7) {
|
|
433
452
|
return _calculateTransactionFee.apply(this, arguments);
|
|
434
453
|
}
|
|
435
454
|
return calculateTransactionFee;
|
|
@@ -437,23 +456,23 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
437
456
|
}, {
|
|
438
457
|
key: "quoteAhPrice",
|
|
439
458
|
value: function () {
|
|
440
|
-
var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
459
|
+
var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(fromMl, toMl, amountIn) {
|
|
441
460
|
var includeFee,
|
|
442
461
|
quoted,
|
|
443
|
-
|
|
444
|
-
return _regenerator().w(function (
|
|
445
|
-
while (1) switch (
|
|
462
|
+
_args5 = arguments;
|
|
463
|
+
return _regenerator().w(function (_context5) {
|
|
464
|
+
while (1) switch (_context5.n) {
|
|
446
465
|
case 0:
|
|
447
|
-
includeFee =
|
|
448
|
-
|
|
466
|
+
includeFee = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : true;
|
|
467
|
+
_context5.n = 1;
|
|
449
468
|
return this.api.call.assetConversionApi.quotePriceExactTokensForTokens(fromMl, toMl, amountIn.toString(), includeFee);
|
|
450
469
|
case 1:
|
|
451
|
-
quoted =
|
|
452
|
-
return
|
|
470
|
+
quoted = _context5.v;
|
|
471
|
+
return _context5.a(2, quoted.toJSON() !== null ? BigInt(quoted.toString()) : undefined);
|
|
453
472
|
}
|
|
454
|
-
},
|
|
473
|
+
}, _callee5, this);
|
|
455
474
|
}));
|
|
456
|
-
function quoteAhPrice(
|
|
475
|
+
function quoteAhPrice(_x8, _x9, _x0) {
|
|
457
476
|
return _quoteAhPrice.apply(this, arguments);
|
|
458
477
|
}
|
|
459
478
|
return quoteAhPrice;
|
|
@@ -461,20 +480,20 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
461
480
|
}, {
|
|
462
481
|
key: "getBalanceNative",
|
|
463
482
|
value: function () {
|
|
464
|
-
var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
483
|
+
var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(address) {
|
|
465
484
|
var response;
|
|
466
|
-
return _regenerator().w(function (
|
|
467
|
-
while (1) switch (
|
|
485
|
+
return _regenerator().w(function (_context6) {
|
|
486
|
+
while (1) switch (_context6.n) {
|
|
468
487
|
case 0:
|
|
469
|
-
|
|
488
|
+
_context6.n = 1;
|
|
470
489
|
return this.api.query.system.account(address);
|
|
471
490
|
case 1:
|
|
472
|
-
response =
|
|
473
|
-
return
|
|
491
|
+
response = _context6.v;
|
|
492
|
+
return _context6.a(2, response.data.free.toBigInt());
|
|
474
493
|
}
|
|
475
|
-
},
|
|
494
|
+
}, _callee6, this);
|
|
476
495
|
}));
|
|
477
|
-
function getBalanceNative(
|
|
496
|
+
function getBalanceNative(_x1) {
|
|
478
497
|
return _getBalanceNative.apply(this, arguments);
|
|
479
498
|
}
|
|
480
499
|
return getBalanceNative;
|
|
@@ -482,22 +501,22 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
482
501
|
}, {
|
|
483
502
|
key: "getBalanceForeignPolkadotXcm",
|
|
484
503
|
value: function () {
|
|
485
|
-
var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
504
|
+
var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(address, id) {
|
|
486
505
|
var parsedId, response, obj;
|
|
487
|
-
return _regenerator().w(function (
|
|
488
|
-
while (1) switch (
|
|
506
|
+
return _regenerator().w(function (_context7) {
|
|
507
|
+
while (1) switch (_context7.n) {
|
|
489
508
|
case 0:
|
|
490
509
|
parsedId = new u32(this.api.registry, id);
|
|
491
|
-
|
|
510
|
+
_context7.n = 1;
|
|
492
511
|
return this.api.query.assets.account(parsedId, address);
|
|
493
512
|
case 1:
|
|
494
|
-
response =
|
|
513
|
+
response = _context7.v;
|
|
495
514
|
obj = response.toJSON();
|
|
496
|
-
return
|
|
515
|
+
return _context7.a(2, obj.balance ? BigInt(obj.balance) : 0n);
|
|
497
516
|
}
|
|
498
|
-
},
|
|
517
|
+
}, _callee7, this);
|
|
499
518
|
}));
|
|
500
|
-
function getBalanceForeignPolkadotXcm(
|
|
519
|
+
function getBalanceForeignPolkadotXcm(_x10, _x11) {
|
|
501
520
|
return _getBalanceForeignPolkadotXcm.apply(this, arguments);
|
|
502
521
|
}
|
|
503
522
|
return getBalanceForeignPolkadotXcm;
|
|
@@ -505,21 +524,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
505
524
|
}, {
|
|
506
525
|
key: "getMythosForeignBalance",
|
|
507
526
|
value: function () {
|
|
508
|
-
var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
527
|
+
var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(address) {
|
|
509
528
|
var response, obj;
|
|
510
|
-
return _regenerator().w(function (
|
|
511
|
-
while (1) switch (
|
|
529
|
+
return _regenerator().w(function (_context8) {
|
|
530
|
+
while (1) switch (_context8.n) {
|
|
512
531
|
case 0:
|
|
513
|
-
|
|
532
|
+
_context8.n = 1;
|
|
514
533
|
return this.api.query.balances.account(address);
|
|
515
534
|
case 1:
|
|
516
|
-
response =
|
|
535
|
+
response = _context8.v;
|
|
517
536
|
obj = response.toJSON();
|
|
518
|
-
return
|
|
537
|
+
return _context8.a(2, obj.free ? BigInt(obj.free) : 0n);
|
|
519
538
|
}
|
|
520
|
-
},
|
|
539
|
+
}, _callee8, this);
|
|
521
540
|
}));
|
|
522
|
-
function getMythosForeignBalance(
|
|
541
|
+
function getMythosForeignBalance(_x12) {
|
|
523
542
|
return _getMythosForeignBalance.apply(this, arguments);
|
|
524
543
|
}
|
|
525
544
|
return getMythosForeignBalance;
|
|
@@ -527,21 +546,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
527
546
|
}, {
|
|
528
547
|
key: "getBalanceForeignAssetsPallet",
|
|
529
548
|
value: function () {
|
|
530
|
-
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
549
|
+
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(address, multiLocation) {
|
|
531
550
|
var response, obj;
|
|
532
|
-
return _regenerator().w(function (
|
|
533
|
-
while (1) switch (
|
|
551
|
+
return _regenerator().w(function (_context9) {
|
|
552
|
+
while (1) switch (_context9.n) {
|
|
534
553
|
case 0:
|
|
535
|
-
|
|
554
|
+
_context9.n = 1;
|
|
536
555
|
return this.api.query.foreignAssets.account(multiLocation, address);
|
|
537
556
|
case 1:
|
|
538
|
-
response =
|
|
557
|
+
response = _context9.v;
|
|
539
558
|
obj = response.toJSON();
|
|
540
|
-
return
|
|
559
|
+
return _context9.a(2, BigInt(obj === null || !obj.balance ? 0 : obj.balance));
|
|
541
560
|
}
|
|
542
|
-
},
|
|
561
|
+
}, _callee9, this);
|
|
543
562
|
}));
|
|
544
|
-
function getBalanceForeignAssetsPallet(
|
|
563
|
+
function getBalanceForeignAssetsPallet(_x13, _x14) {
|
|
545
564
|
return _getBalanceForeignAssetsPallet.apply(this, arguments);
|
|
546
565
|
}
|
|
547
566
|
return getBalanceForeignAssetsPallet;
|
|
@@ -549,21 +568,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
549
568
|
}, {
|
|
550
569
|
key: "getForeignAssetsByIdBalance",
|
|
551
570
|
value: function () {
|
|
552
|
-
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
571
|
+
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(address, assetId) {
|
|
553
572
|
var response, obj;
|
|
554
|
-
return _regenerator().w(function (
|
|
555
|
-
while (1) switch (
|
|
573
|
+
return _regenerator().w(function (_context0) {
|
|
574
|
+
while (1) switch (_context0.n) {
|
|
556
575
|
case 0:
|
|
557
|
-
|
|
576
|
+
_context0.n = 1;
|
|
558
577
|
return this.api.query.foreignAssets.account(assetId, address);
|
|
559
578
|
case 1:
|
|
560
|
-
response =
|
|
579
|
+
response = _context0.v;
|
|
561
580
|
obj = response.toJSON();
|
|
562
|
-
return
|
|
581
|
+
return _context0.a(2, BigInt(obj === null || !obj.balance ? 0 : obj.balance));
|
|
563
582
|
}
|
|
564
|
-
},
|
|
583
|
+
}, _callee0, this);
|
|
565
584
|
}));
|
|
566
|
-
function getForeignAssetsByIdBalance(
|
|
585
|
+
function getForeignAssetsByIdBalance(_x15, _x16) {
|
|
567
586
|
return _getForeignAssetsByIdBalance.apply(this, arguments);
|
|
568
587
|
}
|
|
569
588
|
return getForeignAssetsByIdBalance;
|
|
@@ -571,22 +590,22 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
571
590
|
}, {
|
|
572
591
|
key: "getBalanceForeignBifrost",
|
|
573
592
|
value: function () {
|
|
574
|
-
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
593
|
+
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(address, asset) {
|
|
575
594
|
var currencySelection, response, accountData;
|
|
576
|
-
return _regenerator().w(function (
|
|
577
|
-
while (1) switch (
|
|
595
|
+
return _regenerator().w(function (_context1) {
|
|
596
|
+
while (1) switch (_context1.n) {
|
|
578
597
|
case 0:
|
|
579
598
|
currencySelection = getNode('BifrostPolkadot').getCurrencySelection(asset);
|
|
580
|
-
|
|
599
|
+
_context1.n = 1;
|
|
581
600
|
return this.api.query.tokens.accounts(address, currencySelection);
|
|
582
601
|
case 1:
|
|
583
|
-
response =
|
|
602
|
+
response = _context1.v;
|
|
584
603
|
accountData = response ? response : null;
|
|
585
|
-
return
|
|
604
|
+
return _context1.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
586
605
|
}
|
|
587
|
-
},
|
|
606
|
+
}, _callee1, this);
|
|
588
607
|
}));
|
|
589
|
-
function getBalanceForeignBifrost(
|
|
608
|
+
function getBalanceForeignBifrost(_x17, _x18) {
|
|
590
609
|
return _getBalanceForeignBifrost.apply(this, arguments);
|
|
591
610
|
}
|
|
592
611
|
return getBalanceForeignBifrost;
|
|
@@ -594,23 +613,23 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
594
613
|
}, {
|
|
595
614
|
key: "getBalanceNativeAcala",
|
|
596
615
|
value: function () {
|
|
597
|
-
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
616
|
+
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(address, symbol) {
|
|
598
617
|
var response, accountData;
|
|
599
|
-
return _regenerator().w(function (
|
|
600
|
-
while (1) switch (
|
|
618
|
+
return _regenerator().w(function (_context10) {
|
|
619
|
+
while (1) switch (_context10.n) {
|
|
601
620
|
case 0:
|
|
602
|
-
|
|
621
|
+
_context10.n = 1;
|
|
603
622
|
return this.api.query.tokens.accounts(address, {
|
|
604
623
|
Token: symbol
|
|
605
624
|
});
|
|
606
625
|
case 1:
|
|
607
|
-
response =
|
|
626
|
+
response = _context10.v;
|
|
608
627
|
accountData = response ? response : null;
|
|
609
|
-
return
|
|
628
|
+
return _context10.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
610
629
|
}
|
|
611
|
-
},
|
|
630
|
+
}, _callee10, this);
|
|
612
631
|
}));
|
|
613
|
-
function getBalanceNativeAcala(
|
|
632
|
+
function getBalanceNativeAcala(_x19, _x20) {
|
|
614
633
|
return _getBalanceNativeAcala.apply(this, arguments);
|
|
615
634
|
}
|
|
616
635
|
return getBalanceNativeAcala;
|
|
@@ -618,19 +637,19 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
618
637
|
}, {
|
|
619
638
|
key: "getBalanceForeignXTokens",
|
|
620
639
|
value: function () {
|
|
621
|
-
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
640
|
+
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(node, address, asset) {
|
|
622
641
|
var pallet, response, entry, accountData;
|
|
623
|
-
return _regenerator().w(function (
|
|
624
|
-
while (1) switch (
|
|
642
|
+
return _regenerator().w(function (_context11) {
|
|
643
|
+
while (1) switch (_context11.n) {
|
|
625
644
|
case 0:
|
|
626
645
|
pallet = 'tokens';
|
|
627
646
|
if (node === 'Centrifuge' || node === 'Altair') {
|
|
628
647
|
pallet = 'ormlTokens';
|
|
629
648
|
}
|
|
630
|
-
|
|
649
|
+
_context11.n = 1;
|
|
631
650
|
return this.api.query[pallet].accounts.entries(address);
|
|
632
651
|
case 1:
|
|
633
|
-
response =
|
|
652
|
+
response = _context11.v;
|
|
634
653
|
entry = response.find(function (_ref2) {
|
|
635
654
|
var _asset$symbol, _asset$assetId, _assetItem$toHuman, _asset$symbol2, _assetItem$toHuman2, _asset$assetId2;
|
|
636
655
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
@@ -642,11 +661,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
642
661
|
return assetSymbol === ((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toLowerCase()) || isForeignAsset(asset) && assetSymbol === ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.toLowerCase()) || Object.values((_assetItem$toHuman = assetItem.toHuman()) !== null && _assetItem$toHuman !== void 0 ? _assetItem$toHuman : {}).toString().toLowerCase() === ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === void 0 ? void 0 : _asset$symbol2.toLowerCase()) || isForeignAsset(asset) && Object.values((_assetItem$toHuman2 = assetItem.toHuman()) !== null && _assetItem$toHuman2 !== void 0 ? _assetItem$toHuman2 : {}).toString().toLowerCase() === ((_asset$assetId2 = asset.assetId) === null || _asset$assetId2 === void 0 ? void 0 : _asset$assetId2.toLowerCase());
|
|
643
662
|
});
|
|
644
663
|
accountData = entry ? entry[1] : null;
|
|
645
|
-
return
|
|
664
|
+
return _context11.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
646
665
|
}
|
|
647
|
-
},
|
|
666
|
+
}, _callee11, this);
|
|
648
667
|
}));
|
|
649
|
-
function getBalanceForeignXTokens(
|
|
668
|
+
function getBalanceForeignXTokens(_x21, _x22, _x23) {
|
|
650
669
|
return _getBalanceForeignXTokens.apply(this, arguments);
|
|
651
670
|
}
|
|
652
671
|
return getBalanceForeignXTokens;
|
|
@@ -654,21 +673,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
654
673
|
}, {
|
|
655
674
|
key: "getBalanceAssetsPallet",
|
|
656
675
|
value: function () {
|
|
657
|
-
var _getBalanceAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
676
|
+
var _getBalanceAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(address, assetId) {
|
|
658
677
|
var response, obj;
|
|
659
|
-
return _regenerator().w(function (
|
|
660
|
-
while (1) switch (
|
|
678
|
+
return _regenerator().w(function (_context12) {
|
|
679
|
+
while (1) switch (_context12.n) {
|
|
661
680
|
case 0:
|
|
662
|
-
|
|
681
|
+
_context12.n = 1;
|
|
663
682
|
return this.api.query.assets.account(assetId, address);
|
|
664
683
|
case 1:
|
|
665
|
-
response =
|
|
684
|
+
response = _context12.v;
|
|
666
685
|
obj = response.toJSON();
|
|
667
|
-
return
|
|
686
|
+
return _context12.a(2, BigInt(obj === null || !obj.balance ? 0 : obj.balance));
|
|
668
687
|
}
|
|
669
|
-
},
|
|
688
|
+
}, _callee12, this);
|
|
670
689
|
}));
|
|
671
|
-
function getBalanceAssetsPallet(
|
|
690
|
+
function getBalanceAssetsPallet(_x24, _x25) {
|
|
672
691
|
return _getBalanceAssetsPallet.apply(this, arguments);
|
|
673
692
|
}
|
|
674
693
|
return getBalanceAssetsPallet;
|
|
@@ -681,27 +700,27 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
681
700
|
}, {
|
|
682
701
|
key: "getFromRpc",
|
|
683
702
|
value: function () {
|
|
684
|
-
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
703
|
+
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(module, method, key) {
|
|
685
704
|
var rpcModule, response;
|
|
686
|
-
return _regenerator().w(function (
|
|
687
|
-
while (1) switch (
|
|
705
|
+
return _regenerator().w(function (_context13) {
|
|
706
|
+
while (1) switch (_context13.n) {
|
|
688
707
|
case 0:
|
|
689
708
|
rpcModule = this.api.rpc[module];
|
|
690
709
|
if (!(!rpcModule || !rpcModule[method])) {
|
|
691
|
-
|
|
710
|
+
_context13.n = 1;
|
|
692
711
|
break;
|
|
693
712
|
}
|
|
694
713
|
throw new InvalidParameterError("RPC method ".concat(module, ".").concat(method, " not available"));
|
|
695
714
|
case 1:
|
|
696
|
-
|
|
715
|
+
_context13.n = 2;
|
|
697
716
|
return rpcModule[method](key);
|
|
698
717
|
case 2:
|
|
699
|
-
response =
|
|
700
|
-
return
|
|
718
|
+
response = _context13.v;
|
|
719
|
+
return _context13.a(2, response.toHex());
|
|
701
720
|
}
|
|
702
|
-
},
|
|
721
|
+
}, _callee13, this);
|
|
703
722
|
}));
|
|
704
|
-
function getFromRpc(
|
|
723
|
+
function getFromRpc(_x26, _x27, _x28) {
|
|
705
724
|
return _getFromRpc.apply(this, arguments);
|
|
706
725
|
}
|
|
707
726
|
return getFromRpc;
|
|
@@ -714,25 +733,25 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
714
733
|
}, {
|
|
715
734
|
key: "clone",
|
|
716
735
|
value: function clone() {
|
|
717
|
-
return new PolkadotJsApi();
|
|
736
|
+
return new PolkadotJsApi(isConfig(this._config) ? this._config : undefined);
|
|
718
737
|
}
|
|
719
738
|
}, {
|
|
720
739
|
key: "createApiForNode",
|
|
721
740
|
value: function () {
|
|
722
|
-
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
741
|
+
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(node) {
|
|
723
742
|
var api;
|
|
724
|
-
return _regenerator().w(function (
|
|
725
|
-
while (1) switch (
|
|
743
|
+
return _regenerator().w(function (_context14) {
|
|
744
|
+
while (1) switch (_context14.n) {
|
|
726
745
|
case 0:
|
|
727
746
|
api = new PolkadotJsApi();
|
|
728
|
-
|
|
747
|
+
_context14.n = 1;
|
|
729
748
|
return api.init(node);
|
|
730
749
|
case 1:
|
|
731
|
-
return
|
|
750
|
+
return _context14.a(2, api);
|
|
732
751
|
}
|
|
733
|
-
},
|
|
752
|
+
}, _callee14);
|
|
734
753
|
}));
|
|
735
|
-
function createApiForNode(
|
|
754
|
+
function createApiForNode(_x29) {
|
|
736
755
|
return _createApiForNode.apply(this, arguments);
|
|
737
756
|
}
|
|
738
757
|
return createApiForNode;
|
|
@@ -740,16 +759,16 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
740
759
|
}, {
|
|
741
760
|
key: "getDryRunCall",
|
|
742
761
|
value: function () {
|
|
743
|
-
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
762
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref4) {
|
|
744
763
|
var _this$api$call$dryRun;
|
|
745
764
|
var tx, address, node, supportsDryRunApi, nodesRequiringVersionParam, needsVersionParam, DEFAULT_XCM_VERSION, response, result, resultJson, isSuccess, moduleError, failureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
746
|
-
return _regenerator().w(function (
|
|
747
|
-
while (1) switch (
|
|
765
|
+
return _regenerator().w(function (_context15) {
|
|
766
|
+
while (1) switch (_context15.n) {
|
|
748
767
|
case 0:
|
|
749
768
|
tx = _ref4.tx, address = _ref4.address, node = _ref4.node;
|
|
750
769
|
supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
|
|
751
770
|
if (supportsDryRunApi) {
|
|
752
|
-
|
|
771
|
+
_context15.n = 1;
|
|
753
772
|
break;
|
|
754
773
|
}
|
|
755
774
|
throw new NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
@@ -757,32 +776,32 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
757
776
|
nodesRequiringVersionParam = ['BifrostPolkadot', 'BifrostKusama', 'AssetHubKusama', 'AssetHubPolkadot', 'Kusama', 'Polkadot', 'Polimec', 'Astar'];
|
|
758
777
|
needsVersionParam = nodesRequiringVersionParam.includes(node);
|
|
759
778
|
DEFAULT_XCM_VERSION = 3;
|
|
760
|
-
|
|
779
|
+
_context15.n = 2;
|
|
761
780
|
return (_this$api$call$dryRun = this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [{
|
|
762
781
|
system: {
|
|
763
782
|
Signed: address
|
|
764
783
|
}
|
|
765
784
|
}, tx].concat(_toConsumableArray(needsVersionParam ? [DEFAULT_XCM_VERSION] : [])));
|
|
766
785
|
case 2:
|
|
767
|
-
response =
|
|
786
|
+
response = _context15.v;
|
|
768
787
|
result = response.toHuman();
|
|
769
788
|
resultJson = response.toJSON();
|
|
770
789
|
isSuccess = result.Ok && result.Ok.executionResult.Ok;
|
|
771
790
|
if (isSuccess) {
|
|
772
|
-
|
|
791
|
+
_context15.n = 3;
|
|
773
792
|
break;
|
|
774
793
|
}
|
|
775
794
|
moduleError = result.Ok.executionResult.Err.error.Module;
|
|
776
795
|
failureReason = resolveModuleError(node, moduleError);
|
|
777
|
-
return
|
|
796
|
+
return _context15.a(2, {
|
|
778
797
|
success: false,
|
|
779
798
|
failureReason: failureReason
|
|
780
799
|
});
|
|
781
800
|
case 3:
|
|
782
|
-
|
|
801
|
+
_context15.n = 4;
|
|
783
802
|
return this.calculateTransactionFee(tx, address);
|
|
784
803
|
case 4:
|
|
785
|
-
executionFee =
|
|
804
|
+
executionFee = _context15.v;
|
|
786
805
|
fee = computeFeeFromDryRunPjs(result, node, executionFee);
|
|
787
806
|
actualWeight = resultJson.ok.executionResult.ok.actualWeight;
|
|
788
807
|
weight = actualWeight ? {
|
|
@@ -793,7 +812,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
793
812
|
destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref5) {
|
|
794
813
|
return i.here === null ? 0 : (_ref5 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref5 === void 0 ? void 0 : _ref5.parachain;
|
|
795
814
|
}(Object.values(forwardedXcms[0])[0].interior);
|
|
796
|
-
return
|
|
815
|
+
return _context15.a(2, {
|
|
797
816
|
success: true,
|
|
798
817
|
fee: fee,
|
|
799
818
|
weight: weight,
|
|
@@ -801,9 +820,9 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
801
820
|
destParaId: destParaId
|
|
802
821
|
});
|
|
803
822
|
}
|
|
804
|
-
},
|
|
823
|
+
}, _callee15, this);
|
|
805
824
|
}));
|
|
806
|
-
function getDryRunCall(
|
|
825
|
+
function getDryRunCall(_x30) {
|
|
807
826
|
return _getDryRunCall.apply(this, arguments);
|
|
808
827
|
}
|
|
809
828
|
return getDryRunCall;
|
|
@@ -811,21 +830,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
811
830
|
}, {
|
|
812
831
|
key: "getXcmWeight",
|
|
813
832
|
value: function () {
|
|
814
|
-
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
833
|
+
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(xcm) {
|
|
815
834
|
var result, resultJson;
|
|
816
|
-
return _regenerator().w(function (
|
|
817
|
-
while (1) switch (
|
|
835
|
+
return _regenerator().w(function (_context16) {
|
|
836
|
+
while (1) switch (_context16.n) {
|
|
818
837
|
case 0:
|
|
819
|
-
|
|
838
|
+
_context16.n = 1;
|
|
820
839
|
return this.api.call.xcmPaymentApi.queryXcmWeight(xcm);
|
|
821
840
|
case 1:
|
|
822
|
-
result =
|
|
841
|
+
result = _context16.v;
|
|
823
842
|
resultJson = result.toJSON();
|
|
824
|
-
return
|
|
843
|
+
return _context16.a(2, resultJson.ok);
|
|
825
844
|
}
|
|
826
|
-
},
|
|
845
|
+
}, _callee16, this);
|
|
827
846
|
}));
|
|
828
|
-
function getXcmWeight(
|
|
847
|
+
function getXcmWeight(_x31) {
|
|
829
848
|
return _getXcmWeight.apply(this, arguments);
|
|
830
849
|
}
|
|
831
850
|
return getXcmWeight;
|
|
@@ -833,33 +852,33 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
833
852
|
}, {
|
|
834
853
|
key: "getDryRunXcm",
|
|
835
854
|
value: function () {
|
|
836
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
855
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(_ref6) {
|
|
837
856
|
var _ref7, _ref8, _ref9;
|
|
838
857
|
var originLocation, xcm, node, origin, supportsDryRunApi, response, result, resultJson, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
839
|
-
return _regenerator().w(function (
|
|
840
|
-
while (1) switch (
|
|
858
|
+
return _regenerator().w(function (_context17) {
|
|
859
|
+
while (1) switch (_context17.n) {
|
|
841
860
|
case 0:
|
|
842
861
|
originLocation = _ref6.originLocation, xcm = _ref6.xcm, node = _ref6.node, origin = _ref6.origin;
|
|
843
862
|
supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
|
|
844
863
|
if (supportsDryRunApi) {
|
|
845
|
-
|
|
864
|
+
_context17.n = 1;
|
|
846
865
|
break;
|
|
847
866
|
}
|
|
848
867
|
throw new NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
849
868
|
case 1:
|
|
850
|
-
|
|
869
|
+
_context17.n = 2;
|
|
851
870
|
return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
|
|
852
871
|
case 2:
|
|
853
|
-
response =
|
|
872
|
+
response = _context17.v;
|
|
854
873
|
result = response.toHuman();
|
|
855
874
|
resultJson = response.toJSON();
|
|
856
875
|
isSuccess = result.Ok && result.Ok.executionResult.Complete;
|
|
857
876
|
if (isSuccess) {
|
|
858
|
-
|
|
877
|
+
_context17.n = 3;
|
|
859
878
|
break;
|
|
860
879
|
}
|
|
861
880
|
failureReason = result.Ok.executionResult.Incomplete.error;
|
|
862
|
-
return
|
|
881
|
+
return _context17.a(2, {
|
|
863
882
|
success: false,
|
|
864
883
|
failureReason: failureReason
|
|
865
884
|
});
|
|
@@ -881,10 +900,10 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
881
900
|
return ['currencies', 'tokens'].includes(event.section) && event.method === 'Deposited';
|
|
882
901
|
});
|
|
883
902
|
if (feeEvent) {
|
|
884
|
-
|
|
903
|
+
_context17.n = 4;
|
|
885
904
|
break;
|
|
886
905
|
}
|
|
887
|
-
return
|
|
906
|
+
return _context17.a(2, Promise.resolve({
|
|
888
907
|
success: false,
|
|
889
908
|
failureReason: 'Cannot determine destination fee. No Issued event found'
|
|
890
909
|
}));
|
|
@@ -900,7 +919,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
900
919
|
destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref0) {
|
|
901
920
|
return i.Here ? 0 : (_ref0 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref0 === void 0 ? void 0 : _ref0.parachain;
|
|
902
921
|
}(Object.values(forwardedXcms[0])[0].interior);
|
|
903
|
-
return
|
|
922
|
+
return _context17.a(2, {
|
|
904
923
|
success: true,
|
|
905
924
|
fee: fee,
|
|
906
925
|
weight: weight,
|
|
@@ -908,9 +927,9 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
908
927
|
destParaId: destParaId
|
|
909
928
|
});
|
|
910
929
|
}
|
|
911
|
-
},
|
|
930
|
+
}, _callee17, this);
|
|
912
931
|
}));
|
|
913
|
-
function getDryRunXcm(
|
|
932
|
+
function getDryRunXcm(_x32) {
|
|
914
933
|
return _getDryRunXcm.apply(this, arguments);
|
|
915
934
|
}
|
|
916
935
|
return getDryRunXcm;
|
|
@@ -918,18 +937,18 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
918
937
|
}, {
|
|
919
938
|
key: "getBridgeStatus",
|
|
920
939
|
value: function () {
|
|
921
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
940
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
922
941
|
var outboundOperatingMode;
|
|
923
|
-
return _regenerator().w(function (
|
|
924
|
-
while (1) switch (
|
|
942
|
+
return _regenerator().w(function (_context18) {
|
|
943
|
+
while (1) switch (_context18.n) {
|
|
925
944
|
case 0:
|
|
926
|
-
|
|
945
|
+
_context18.n = 1;
|
|
927
946
|
return this.api.query.ethereumOutboundQueue.operatingMode();
|
|
928
947
|
case 1:
|
|
929
|
-
outboundOperatingMode =
|
|
930
|
-
return
|
|
948
|
+
outboundOperatingMode = _context18.v;
|
|
949
|
+
return _context18.a(2, outboundOperatingMode.toPrimitive());
|
|
931
950
|
}
|
|
932
|
-
},
|
|
951
|
+
}, _callee18, this);
|
|
933
952
|
}));
|
|
934
953
|
function getBridgeStatus() {
|
|
935
954
|
return _getBridgeStatus.apply(this, arguments);
|
|
@@ -949,35 +968,38 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
949
968
|
}, {
|
|
950
969
|
key: "disconnect",
|
|
951
970
|
value: function () {
|
|
952
|
-
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
971
|
+
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
|
|
972
|
+
var _this$_config$apiOver2;
|
|
953
973
|
var force,
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
974
|
+
api,
|
|
975
|
+
_args19 = arguments;
|
|
976
|
+
return _regenerator().w(function (_context19) {
|
|
977
|
+
while (1) switch (_context19.n) {
|
|
957
978
|
case 0:
|
|
958
|
-
force =
|
|
979
|
+
force = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : false;
|
|
959
980
|
if (this.initialized) {
|
|
960
|
-
|
|
981
|
+
_context19.n = 1;
|
|
961
982
|
break;
|
|
962
983
|
}
|
|
963
|
-
return
|
|
984
|
+
return _context19.a(2, Promise.resolve());
|
|
964
985
|
case 1:
|
|
965
986
|
if (!(!force && !this.disconnectAllowed)) {
|
|
966
|
-
|
|
987
|
+
_context19.n = 2;
|
|
967
988
|
break;
|
|
968
989
|
}
|
|
969
|
-
return
|
|
990
|
+
return _context19.a(2);
|
|
970
991
|
case 2:
|
|
971
|
-
|
|
972
|
-
|
|
992
|
+
api = isConfig(this._config) ? (_this$_config$apiOver2 = this._config.apiOverrides) === null || _this$_config$apiOver2 === void 0 ? void 0 : _this$_config$apiOver2[this._node] : this._config; // Disconnect api only if it was created automatically
|
|
993
|
+
if (!(force || typeof api === 'string' || api === undefined)) {
|
|
994
|
+
_context19.n = 3;
|
|
973
995
|
break;
|
|
974
996
|
}
|
|
975
|
-
|
|
997
|
+
_context19.n = 3;
|
|
976
998
|
return this.api.disconnect();
|
|
977
999
|
case 3:
|
|
978
|
-
return
|
|
1000
|
+
return _context19.a(2);
|
|
979
1001
|
}
|
|
980
|
-
},
|
|
1002
|
+
}, _callee19, this);
|
|
981
1003
|
}));
|
|
982
1004
|
function disconnect() {
|
|
983
1005
|
return _disconnect.apply(this, arguments);
|
|
@@ -998,8 +1020,7 @@ var createPolkadotJsApiCall = function createPolkadotJsApiCall(apiCall) {
|
|
|
998
1020
|
return _regenerator().w(function (_context) {
|
|
999
1021
|
while (1) switch (_context.n) {
|
|
1000
1022
|
case 0:
|
|
1001
|
-
pjsApi = new PolkadotJsApi();
|
|
1002
|
-
pjsApi.setApi(options.api);
|
|
1023
|
+
pjsApi = new PolkadotJsApi(options.api);
|
|
1003
1024
|
optionsWithApi = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1004
1025
|
api: pjsApi
|
|
1005
1026
|
});
|
|
@@ -1542,6 +1563,8 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1542
1563
|
_yield$transferEthToP = _context.v;
|
|
1543
1564
|
response = _yield$transferEthToP.response;
|
|
1544
1565
|
return _context.a(2, response.hash);
|
|
1566
|
+
case 6:
|
|
1567
|
+
return _context.a(2);
|
|
1545
1568
|
}
|
|
1546
1569
|
}, _callee, this);
|
|
1547
1570
|
}));
|
|
@@ -1572,8 +1595,7 @@ var EvmBuilder$1 = function EvmBuilder(api, provider) {
|
|
|
1572
1595
|
* @returns A new Builder instance.
|
|
1573
1596
|
*/
|
|
1574
1597
|
var Builder = function Builder(api) {
|
|
1575
|
-
var pjsApi = new PolkadotJsApi();
|
|
1576
|
-
pjsApi.setApi(api);
|
|
1598
|
+
var pjsApi = new PolkadotJsApi(api);
|
|
1577
1599
|
return Builder$1(pjsApi);
|
|
1578
1600
|
};
|
|
1579
1601
|
var EvmBuilder = function EvmBuilder(provider) {
|
|
@@ -1600,8 +1622,7 @@ var getParaEthTransferFees = /*#__PURE__*/function () {
|
|
|
1600
1622
|
return _regenerator().w(function (_context) {
|
|
1601
1623
|
while (1) switch (_context.n) {
|
|
1602
1624
|
case 0:
|
|
1603
|
-
pjsApi = new PolkadotJsApi();
|
|
1604
|
-
pjsApi.setApi(api);
|
|
1625
|
+
pjsApi = new PolkadotJsApi(api);
|
|
1605
1626
|
_context.n = 1;
|
|
1606
1627
|
return pjsApi.init('AssetHubPolkadot', DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
1607
1628
|
case 1:
|
|
@@ -1622,8 +1643,7 @@ var getBridgeStatus = /*#__PURE__*/function () {
|
|
|
1622
1643
|
return _regenerator().w(function (_context2) {
|
|
1623
1644
|
while (1) switch (_context2.n) {
|
|
1624
1645
|
case 0:
|
|
1625
|
-
pjsApi = new PolkadotJsApi();
|
|
1626
|
-
pjsApi.setApi(api);
|
|
1646
|
+
pjsApi = new PolkadotJsApi(api);
|
|
1627
1647
|
return _context2.a(2, getBridgeStatus$1(pjsApi));
|
|
1628
1648
|
}
|
|
1629
1649
|
}, _callee2);
|