@paraspell/sdk-pjs 11.14.3 → 11.14.5

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/dist/index.cjs CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  var sdkCore = require('@paraspell/sdk-core');
4
4
  var api = require('@polkadot/api');
5
- var types = require('@polkadot/types');
6
5
  var util = require('@polkadot/util');
7
6
  var utilCrypto = require('@polkadot/util-crypto');
8
7
  var api$1 = require('@snowbridge/api');
@@ -13,9 +12,6 @@ function _arrayLikeToArray(r, a) {
13
12
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
14
13
  return n;
15
14
  }
16
- function _arrayWithHoles(r) {
17
- if (Array.isArray(r)) return r;
18
- }
19
15
  function _arrayWithoutHoles(r) {
20
16
  if (Array.isArray(r)) return _arrayLikeToArray(r);
21
17
  }
@@ -69,33 +65,6 @@ function _defineProperty(e, r, t) {
69
65
  function _iterableToArray(r) {
70
66
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
71
67
  }
72
- function _iterableToArrayLimit(r, l) {
73
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
74
- if (null != t) {
75
- var e,
76
- n,
77
- i,
78
- u,
79
- a = [],
80
- f = true,
81
- o = false;
82
- try {
83
- if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
84
- } catch (r) {
85
- o = true, n = r;
86
- } finally {
87
- try {
88
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
89
- } finally {
90
- if (o) throw n;
91
- }
92
- }
93
- return a;
94
- }
95
- }
96
- function _nonIterableRest() {
97
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
98
- }
99
68
  function _nonIterableSpread() {
100
69
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
101
70
  }
@@ -228,9 +197,6 @@ function _regeneratorDefine(e, r, n, t) {
228
197
  }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
229
198
  }, _regeneratorDefine(e, r, n, t);
230
199
  }
231
- function _slicedToArray(r, e) {
232
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
233
- }
234
200
  function _toConsumableArray(r) {
235
201
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
236
202
  }
@@ -400,16 +366,59 @@ var PolkadotJsApi = /*#__PURE__*/function () {
400
366
  return utilCrypto.decodeAddress(address);
401
367
  }
402
368
  }, {
403
- key: "callTxMethod",
404
- value: function callTxMethod(_ref) {
405
- var _this$api$tx$moduleLo;
369
+ key: "convertToPjsCall",
370
+ value: function convertToPjsCall(_ref) {
406
371
  var module = _ref.module,
407
- method = _ref.method,
408
- parameters = _ref.parameters;
409
- var values = Object.values(parameters);
410
- var moduleLowerCase = lowercaseFirstLetter(module);
411
- var methodCamelCase = snakeToCamel(method);
412
- return (_this$api$tx$moduleLo = this.api.tx[moduleLowerCase])[methodCamelCase].apply(_this$api$tx$moduleLo, values);
372
+ method = _ref.method;
373
+ return {
374
+ module: lowercaseFirstLetter(module),
375
+ method: snakeToCamel(method)
376
+ };
377
+ }
378
+ }, {
379
+ key: "deserializeExtrinsics",
380
+ value: function deserializeExtrinsics(serialized) {
381
+ var _this$api$tx$module;
382
+ var params = serialized.params;
383
+ var values = Object.values(params);
384
+ var _this$convertToPjsCal = this.convertToPjsCall(serialized),
385
+ module = _this$convertToPjsCal.module,
386
+ method = _this$convertToPjsCal.method;
387
+ return (_this$api$tx$module = this.api.tx[module])[method].apply(_this$api$tx$module, values);
388
+ }
389
+ }, {
390
+ key: "queryState",
391
+ value: function () {
392
+ var _queryState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(serialized) {
393
+ var _this$api$query$modul;
394
+ var params, _this$convertToPjsCal2, module, method, res;
395
+ return _regenerator().w(function (_context4) {
396
+ while (1) switch (_context4.n) {
397
+ case 0:
398
+ params = serialized.params;
399
+ _this$convertToPjsCal2 = this.convertToPjsCall(serialized), module = _this$convertToPjsCal2.module, method = _this$convertToPjsCal2.method;
400
+ _context4.n = 1;
401
+ return (_this$api$query$modul = this.api.query[module])[method].apply(_this$api$query$modul, _toConsumableArray(params));
402
+ case 1:
403
+ res = _context4.v;
404
+ return _context4.a(2, res.toJSON());
405
+ }
406
+ }, _callee4, this);
407
+ }));
408
+ function queryState(_x7) {
409
+ return _queryState.apply(this, arguments);
410
+ }
411
+ return queryState;
412
+ }()
413
+ }, {
414
+ key: "queryRuntimeApi",
415
+ value: function queryRuntimeApi(serialized) {
416
+ var _this$api$call$module;
417
+ var params = serialized.params;
418
+ var _this$convertToPjsCal3 = this.convertToPjsCall(serialized),
419
+ module = _this$convertToPjsCal3.module,
420
+ method = _this$convertToPjsCal3.method;
421
+ return (_this$api$call$module = this.api.call[module])[method].apply(_this$api$call$module, _toConsumableArray(params));
413
422
  }
414
423
  }, {
415
424
  key: "callBatchMethod",
@@ -445,21 +454,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
445
454
  }, {
446
455
  key: "calculateTransactionFee",
447
456
  value: function () {
448
- var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(tx, address) {
457
+ var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(tx, address) {
449
458
  var _yield$tx$paymentInfo, partialFee;
450
- return _regenerator().w(function (_context4) {
451
- while (1) switch (_context4.n) {
459
+ return _regenerator().w(function (_context5) {
460
+ while (1) switch (_context5.n) {
452
461
  case 0:
453
- _context4.n = 1;
462
+ _context5.n = 1;
454
463
  return tx.paymentInfo(address);
455
464
  case 1:
456
- _yield$tx$paymentInfo = _context4.v;
465
+ _yield$tx$paymentInfo = _context5.v;
457
466
  partialFee = _yield$tx$paymentInfo.partialFee;
458
- return _context4.a(2, partialFee.toBigInt());
467
+ return _context5.a(2, partialFee.toBigInt());
459
468
  }
460
- }, _callee4);
469
+ }, _callee5);
461
470
  }));
462
- function calculateTransactionFee(_x7, _x8) {
471
+ function calculateTransactionFee(_x8, _x9) {
463
472
  return _calculateTransactionFee.apply(this, arguments);
464
473
  }
465
474
  return calculateTransactionFee;
@@ -467,23 +476,23 @@ var PolkadotJsApi = /*#__PURE__*/function () {
467
476
  }, {
468
477
  key: "quoteAhPrice",
469
478
  value: function () {
470
- var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(fromMl, toMl, amountIn) {
479
+ var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(fromMl, toMl, amountIn) {
471
480
  var includeFee,
472
481
  quoted,
473
- _args5 = arguments;
474
- return _regenerator().w(function (_context5) {
475
- while (1) switch (_context5.n) {
482
+ _args6 = arguments;
483
+ return _regenerator().w(function (_context6) {
484
+ while (1) switch (_context6.n) {
476
485
  case 0:
477
- includeFee = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : true;
478
- _context5.n = 1;
486
+ includeFee = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : true;
487
+ _context6.n = 1;
479
488
  return this.api.call.assetConversionApi.quotePriceExactTokensForTokens(fromMl, toMl, amountIn.toString(), includeFee);
480
489
  case 1:
481
- quoted = _context5.v;
482
- return _context5.a(2, quoted.toJSON() !== null ? BigInt(quoted.toString()) : undefined);
490
+ quoted = _context6.v;
491
+ return _context6.a(2, quoted.toJSON() !== null ? BigInt(quoted.toString()) : undefined);
483
492
  }
484
- }, _callee5, this);
493
+ }, _callee6, this);
485
494
  }));
486
- function quoteAhPrice(_x9, _x0, _x1) {
495
+ function quoteAhPrice(_x0, _x1, _x10) {
487
496
  return _quoteAhPrice.apply(this, arguments);
488
497
  }
489
498
  return quoteAhPrice;
@@ -493,222 +502,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
493
502
  value: function getEvmStorage(contract, slot) {
494
503
  return Promise.resolve(this.api.query.evm.accountStorages.key(contract, slot));
495
504
  }
496
- }, {
497
- key: "getBalanceNative",
498
- value: function () {
499
- var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(address) {
500
- var response;
501
- return _regenerator().w(function (_context6) {
502
- while (1) switch (_context6.n) {
503
- case 0:
504
- _context6.n = 1;
505
- return this.api.query.system.account(address);
506
- case 1:
507
- response = _context6.v;
508
- return _context6.a(2, response.data.free.toBigInt());
509
- }
510
- }, _callee6, this);
511
- }));
512
- function getBalanceNative(_x10) {
513
- return _getBalanceNative.apply(this, arguments);
514
- }
515
- return getBalanceNative;
516
- }()
517
- }, {
518
- key: "getBalanceForeignPolkadotXcm",
519
- value: function () {
520
- var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(_chain, address, asset) {
521
- var parsedId, response, obj;
522
- return _regenerator().w(function (_context7) {
523
- while (1) switch (_context7.n) {
524
- case 0:
525
- sdkCore.assertHasId(asset);
526
- parsedId = new types.u32(this.api.registry, asset.assetId);
527
- _context7.n = 1;
528
- return this.api.query.assets.account(parsedId, address);
529
- case 1:
530
- response = _context7.v;
531
- obj = response.toJSON();
532
- return _context7.a(2, obj.balance ? BigInt(obj.balance) : 0n);
533
- }
534
- }, _callee7, this);
535
- }));
536
- function getBalanceForeignPolkadotXcm(_x11, _x12, _x13) {
537
- return _getBalanceForeignPolkadotXcm.apply(this, arguments);
538
- }
539
- return getBalanceForeignPolkadotXcm;
540
- }()
541
- }, {
542
- key: "getMythosForeignBalance",
543
- value: function () {
544
- var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(address) {
545
- var response, obj;
546
- return _regenerator().w(function (_context8) {
547
- while (1) switch (_context8.n) {
548
- case 0:
549
- _context8.n = 1;
550
- return this.api.query.balances.account(address);
551
- case 1:
552
- response = _context8.v;
553
- obj = response.toJSON();
554
- return _context8.a(2, obj.free ? BigInt(obj.free) : 0n);
555
- }
556
- }, _callee8, this);
557
- }));
558
- function getMythosForeignBalance(_x14) {
559
- return _getMythosForeignBalance.apply(this, arguments);
560
- }
561
- return getMythosForeignBalance;
562
- }()
563
- }, {
564
- key: "getBalanceForeignAssetsPallet",
565
- value: function () {
566
- var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(address, location) {
567
- var response, obj;
568
- return _regenerator().w(function (_context9) {
569
- while (1) switch (_context9.n) {
570
- case 0:
571
- _context9.n = 1;
572
- return this.api.query.foreignAssets.account(location, address);
573
- case 1:
574
- response = _context9.v;
575
- obj = response.toJSON();
576
- return _context9.a(2, BigInt(obj === null || !obj.balance ? 0 : obj.balance));
577
- }
578
- }, _callee9, this);
579
- }));
580
- function getBalanceForeignAssetsPallet(_x15, _x16) {
581
- return _getBalanceForeignAssetsPallet.apply(this, arguments);
582
- }
583
- return getBalanceForeignAssetsPallet;
584
- }()
585
- }, {
586
- key: "getForeignAssetsByIdBalance",
587
- value: function () {
588
- var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(address, assetId) {
589
- var response, obj;
590
- return _regenerator().w(function (_context0) {
591
- while (1) switch (_context0.n) {
592
- case 0:
593
- _context0.n = 1;
594
- return this.api.query.foreignAssets.account(assetId, address);
595
- case 1:
596
- response = _context0.v;
597
- obj = response.toJSON();
598
- return _context0.a(2, BigInt(obj === null || !obj.balance ? 0 : obj.balance));
599
- }
600
- }, _callee0, this);
601
- }));
602
- function getForeignAssetsByIdBalance(_x17, _x18) {
603
- return _getForeignAssetsByIdBalance.apply(this, arguments);
604
- }
605
- return getForeignAssetsByIdBalance;
606
- }()
607
- }, {
608
- key: "getBalanceForeignBifrost",
609
- value: function () {
610
- var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(address, asset) {
611
- var currencySelection, response, accountData;
612
- return _regenerator().w(function (_context1) {
613
- while (1) switch (_context1.n) {
614
- case 0:
615
- currencySelection = sdkCore.getChain('BifrostPolkadot').getCurrencySelection(asset);
616
- _context1.n = 1;
617
- return this.api.query.tokens.accounts(address, currencySelection);
618
- case 1:
619
- response = _context1.v;
620
- accountData = response ? response : null;
621
- return _context1.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
622
- }
623
- }, _callee1, this);
624
- }));
625
- function getBalanceForeignBifrost(_x19, _x20) {
626
- return _getBalanceForeignBifrost.apply(this, arguments);
627
- }
628
- return getBalanceForeignBifrost;
629
- }()
630
- }, {
631
- key: "getBalanceNativeAcala",
632
- value: function () {
633
- var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(address, symbol) {
634
- var response, accountData;
635
- return _regenerator().w(function (_context10) {
636
- while (1) switch (_context10.n) {
637
- case 0:
638
- _context10.n = 1;
639
- return this.api.query.tokens.accounts(address, {
640
- Token: symbol
641
- });
642
- case 1:
643
- response = _context10.v;
644
- accountData = response ? response : null;
645
- return _context10.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
646
- }
647
- }, _callee10, this);
648
- }));
649
- function getBalanceNativeAcala(_x21, _x22) {
650
- return _getBalanceNativeAcala.apply(this, arguments);
651
- }
652
- return getBalanceNativeAcala;
653
- }()
654
- }, {
655
- key: "getBalanceForeignXTokens",
656
- value: function () {
657
- var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(chain, address, asset) {
658
- var pallet, response, entry, accountData;
659
- return _regenerator().w(function (_context11) {
660
- while (1) switch (_context11.n) {
661
- case 0:
662
- pallet = 'tokens';
663
- if (chain === 'Centrifuge' || chain === 'Altair') {
664
- pallet = 'ormlTokens';
665
- }
666
- _context11.n = 1;
667
- return this.api.query[pallet].accounts.entries(address);
668
- case 1:
669
- response = _context11.v;
670
- entry = response.find(function (_ref2) {
671
- var _asset$symbol, _asset$assetId, _assetItem$toHuman, _asset$symbol2, _assetItem$toHuman2, _asset$assetId2;
672
- var _ref3 = _slicedToArray(_ref2, 2),
673
- _ref3$0$args = _slicedToArray(_ref3[0].args, 2);
674
- _ref3$0$args[0];
675
- var assetItem = _ref3$0$args[1];
676
- _ref3[1];
677
- var assetSymbol = assetItem.toString().toLowerCase();
678
- return assetSymbol === ((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toLowerCase()) || sdkCore.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()) || sdkCore.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());
679
- });
680
- accountData = entry ? entry[1] : null;
681
- return _context11.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
682
- }
683
- }, _callee11, this);
684
- }));
685
- function getBalanceForeignXTokens(_x23, _x24, _x25) {
686
- return _getBalanceForeignXTokens.apply(this, arguments);
687
- }
688
- return getBalanceForeignXTokens;
689
- }()
690
- }, {
691
- key: "getBalanceAssetsPallet",
692
- value: function () {
693
- var _getBalanceAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(address, assetId) {
694
- var response, obj;
695
- return _regenerator().w(function (_context12) {
696
- while (1) switch (_context12.n) {
697
- case 0:
698
- _context12.n = 1;
699
- return this.api.query.assets.account(assetId, address);
700
- case 1:
701
- response = _context12.v;
702
- obj = response.toJSON();
703
- return _context12.a(2, BigInt(obj === null || !obj.balance ? 0 : obj.balance));
704
- }
705
- }, _callee12, this);
706
- }));
707
- function getBalanceAssetsPallet(_x26, _x27) {
708
- return _getBalanceAssetsPallet.apply(this, arguments);
709
- }
710
- return getBalanceAssetsPallet;
711
- }()
712
505
  }, {
713
506
  key: "getMethod",
714
507
  value: function getMethod(tx) {
@@ -732,27 +525,27 @@ var PolkadotJsApi = /*#__PURE__*/function () {
732
525
  }, {
733
526
  key: "getFromRpc",
734
527
  value: function () {
735
- var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(module, method, key) {
528
+ var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(module, method, key) {
736
529
  var rpcModule, response;
737
- return _regenerator().w(function (_context13) {
738
- while (1) switch (_context13.n) {
530
+ return _regenerator().w(function (_context7) {
531
+ while (1) switch (_context7.n) {
739
532
  case 0:
740
533
  rpcModule = this.api.rpc[module];
741
534
  if (!(!rpcModule || !rpcModule[method])) {
742
- _context13.n = 1;
535
+ _context7.n = 1;
743
536
  break;
744
537
  }
745
538
  throw new sdkCore.InvalidParameterError("RPC method ".concat(module, ".").concat(method, " not available"));
746
539
  case 1:
747
- _context13.n = 2;
540
+ _context7.n = 2;
748
541
  return rpcModule[method](key);
749
542
  case 2:
750
- response = _context13.v;
751
- return _context13.a(2, response.toHex());
543
+ response = _context7.v;
544
+ return _context7.a(2, response.toHex());
752
545
  }
753
- }, _callee13, this);
546
+ }, _callee7, this);
754
547
  }));
755
- function getFromRpc(_x28, _x29, _x30) {
548
+ function getFromRpc(_x11, _x12, _x13) {
756
549
  return _getFromRpc.apply(this, arguments);
757
550
  }
758
551
  return getFromRpc;
@@ -770,20 +563,20 @@ var PolkadotJsApi = /*#__PURE__*/function () {
770
563
  }, {
771
564
  key: "createApiForChain",
772
565
  value: function () {
773
- var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(chain) {
566
+ var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(chain) {
774
567
  var api;
775
- return _regenerator().w(function (_context14) {
776
- while (1) switch (_context14.n) {
568
+ return _regenerator().w(function (_context8) {
569
+ while (1) switch (_context8.n) {
777
570
  case 0:
778
571
  api = new PolkadotJsApi();
779
- _context14.n = 1;
572
+ _context8.n = 1;
780
573
  return api.init(chain);
781
574
  case 1:
782
- return _context14.a(2, api);
575
+ return _context8.a(2, api);
783
576
  }
784
- }, _callee14);
577
+ }, _callee8);
785
578
  }));
786
- function createApiForChain(_x31) {
579
+ function createApiForChain(_x14) {
787
580
  return _createApiForChain.apply(this, arguments);
788
581
  }
789
582
  return createApiForChain;
@@ -791,16 +584,16 @@ var PolkadotJsApi = /*#__PURE__*/function () {
791
584
  }, {
792
585
  key: "getDryRunCall",
793
586
  value: function () {
794
- var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(options) {
587
+ var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
795
588
  var _this = this;
796
589
  var tx, address, feeAsset, chain, destination, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, usedAsset, usedSymbol, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, forwardedXcms, actualWeight, weight, nativeAsset, hasLocation, destParaId, xcmFee, executionFee, fee, _t, _t2, _t3;
797
- return _regenerator().w(function (_context16) {
798
- while (1) switch (_context16.p = _context16.n) {
590
+ return _regenerator().w(function (_context0) {
591
+ while (1) switch (_context0.p = _context0.n) {
799
592
  case 0:
800
593
  tx = options.tx, address = options.address, feeAsset = options.feeAsset, chain = options.chain, destination = options.destination, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi, bypassOptions = options.bypassOptions;
801
594
  supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
802
595
  if (supportsDryRunApi) {
803
- _context16.n = 1;
596
+ _context0.n = 1;
804
597
  break;
805
598
  }
806
599
  throw new sdkCore.ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
@@ -816,16 +609,16 @@ var PolkadotJsApi = /*#__PURE__*/function () {
816
609
  }
817
610
  };
818
611
  if (!useRootOrigin) {
819
- _context16.n = 3;
612
+ _context0.n = 3;
820
613
  break;
821
614
  }
822
- _context16.n = 2;
615
+ _context0.n = 2;
823
616
  return sdkCore.wrapTxBypass(_objectSpread2(_objectSpread2({}, options), {}, {
824
617
  api: this
825
618
  }), bypassOptions);
826
619
  case 2:
827
- _t = _context16.v;
828
- _context16.n = 4;
620
+ _t = _context0.v;
621
+ _context0.n = 4;
829
622
  break;
830
623
  case 3:
831
624
  _t = tx;
@@ -834,17 +627,17 @@ var PolkadotJsApi = /*#__PURE__*/function () {
834
627
  usedAsset = feeAsset !== null && feeAsset !== void 0 ? feeAsset : sdkCore.findNativeAssetInfoOrThrow(chain);
835
628
  usedSymbol = usedAsset.symbol;
836
629
  performDryRunCall = /*#__PURE__*/function () {
837
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(includeVersion) {
630
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(includeVersion) {
838
631
  var _this$api$call$dryRun;
839
- return _regenerator().w(function (_context15) {
840
- while (1) switch (_context15.n) {
632
+ return _regenerator().w(function (_context9) {
633
+ while (1) switch (_context9.n) {
841
634
  case 0:
842
- return _context15.a(2, (_this$api$call$dryRun = _this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [basePayload, resolvedTx].concat(_toConsumableArray(includeVersion ? [DEFAULT_XCM_VERSION] : []))));
635
+ return _context9.a(2, (_this$api$call$dryRun = _this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [basePayload, resolvedTx].concat(_toConsumableArray(includeVersion ? [DEFAULT_XCM_VERSION] : []))));
843
636
  }
844
- }, _callee15);
637
+ }, _callee9);
845
638
  }));
846
- return function performDryRunCall(_x33) {
847
- return _ref4.apply(this, arguments);
639
+ return function performDryRunCall(_x16) {
640
+ return _ref2.apply(this, arguments);
848
641
  };
849
642
  }();
850
643
  getExecutionSuccessFromResult = function getExecutionSuccessFromResult(resultHuman) {
@@ -852,7 +645,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
852
645
  return Boolean((resultHuman === null || resultHuman === void 0 ? void 0 : resultHuman.Ok) && ((_resultHuman$Ok$execu = resultHuman.Ok.executionResult) === null || _resultHuman$Ok$execu === void 0 ? void 0 : _resultHuman$Ok$execu.Ok));
853
646
  };
854
647
  extractFailureReasonFromResult = function extractFailureReasonFromResult(resultHuman, resultJson) {
855
- var _resultHuman$Ok, _resultHuman$Ok2, _resultJson$ok, _ref5;
648
+ var _resultHuman$Ok, _resultHuman$Ok2, _resultJson$ok, _ref3;
856
649
  var modErrHuman = resultHuman === null || resultHuman === void 0 || (_resultHuman$Ok = resultHuman.Ok) === null || _resultHuman$Ok === void 0 || (_resultHuman$Ok = _resultHuman$Ok.executionResult) === null || _resultHuman$Ok === void 0 || (_resultHuman$Ok = _resultHuman$Ok.Err) === null || _resultHuman$Ok === void 0 || (_resultHuman$Ok = _resultHuman$Ok.error) === null || _resultHuman$Ok === void 0 ? void 0 : _resultHuman$Ok.Module;
857
650
  if (modErrHuman) {
858
651
  return sdkCore.resolveModuleError(chain, modErrHuman);
@@ -873,7 +666,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
873
666
  };
874
667
  }
875
668
  return {
876
- failureReason: JSON.stringify((_ref5 = resultJson !== null && resultJson !== void 0 ? resultJson : resultHuman) !== null && _ref5 !== void 0 ? _ref5 : 'Unknown error')
669
+ failureReason: JSON.stringify((_ref3 = resultJson !== null && resultJson !== void 0 ? resultJson : resultHuman) !== null && _ref3 !== void 0 ? _ref3 : 'Unknown error')
877
670
  };
878
671
  }; // Attempt 1: WITHOUT version
879
672
  isSuccess = false;
@@ -881,11 +674,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
881
674
  failureReason: ''
882
675
  };
883
676
  shouldRetryWithVersion = false;
884
- _context16.p = 5;
885
- _context16.n = 6;
677
+ _context0.p = 5;
678
+ _context0.n = 6;
886
679
  return performDryRunCall(false);
887
680
  case 6:
888
- response = _context16.v;
681
+ response = _context0.v;
889
682
  resultHuman = response.toHuman();
890
683
  resultJson = response.toJSON();
891
684
  isSuccess = getExecutionSuccessFromResult(resultHuman);
@@ -895,21 +688,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
895
688
  shouldRetryWithVersion = true;
896
689
  }
897
690
  }
898
- _context16.n = 9;
691
+ _context0.n = 9;
899
692
  break;
900
693
  case 7:
901
- _context16.p = 7;
902
- _t2 = _context16.v;
694
+ _context0.p = 7;
695
+ _t2 = _context0.v;
903
696
  msg = _t2 instanceof Error ? _t2.message : String(_t2);
904
697
  if (!msg.includes('Expected 3 arguments')) {
905
- _context16.n = 8;
698
+ _context0.n = 8;
906
699
  break;
907
700
  }
908
701
  shouldRetryWithVersion = true;
909
- _context16.n = 9;
702
+ _context0.n = 9;
910
703
  break;
911
704
  case 8:
912
- return _context16.a(2, {
705
+ return _context0.a(2, {
913
706
  success: false,
914
707
  failureReason: msg,
915
708
  currency: usedSymbol,
@@ -917,28 +710,28 @@ var PolkadotJsApi = /*#__PURE__*/function () {
917
710
  });
918
711
  case 9:
919
712
  if (!shouldRetryWithVersion) {
920
- _context16.n = 13;
713
+ _context0.n = 13;
921
714
  break;
922
715
  }
923
- _context16.p = 10;
924
- _context16.n = 11;
716
+ _context0.p = 10;
717
+ _context0.n = 11;
925
718
  return performDryRunCall(true);
926
719
  case 11:
927
- response = _context16.v;
720
+ response = _context0.v;
928
721
  resultHuman = response.toHuman();
929
722
  resultJson = response.toJSON();
930
723
  isSuccess = getExecutionSuccessFromResult(resultHuman);
931
724
  if (!isSuccess) {
932
725
  failureErr = extractFailureReasonFromResult(resultHuman, resultJson);
933
726
  }
934
- _context16.n = 13;
727
+ _context0.n = 13;
935
728
  break;
936
729
  case 12:
937
- _context16.p = 12;
938
- _t3 = _context16.v;
730
+ _context0.p = 12;
731
+ _t3 = _context0.v;
939
732
  _msg = _t3 instanceof Error ? _t3.message : String(_t3);
940
733
  failureErr = failureErr || _msg;
941
- return _context16.a(2, {
734
+ return _context0.a(2, {
942
735
  success: false,
943
736
  failureReason: failureErr.failureReason,
944
737
  failureSubReason: failureErr.failureSubReason,
@@ -947,10 +740,10 @@ var PolkadotJsApi = /*#__PURE__*/function () {
947
740
  });
948
741
  case 13:
949
742
  if (isSuccess) {
950
- _context16.n = 14;
743
+ _context0.n = 14;
951
744
  break;
952
745
  }
953
- return _context16.a(2, {
746
+ return _context0.a(2, {
954
747
  success: false,
955
748
  failureReason: failureErr.failureReason || 'Unknown error',
956
749
  failureSubReason: failureErr.failureSubReason,
@@ -966,22 +759,22 @@ var PolkadotJsApi = /*#__PURE__*/function () {
966
759
  } : undefined;
967
760
  nativeAsset = sdkCore.findNativeAssetInfoOrThrow(chain);
968
761
  hasLocation = feeAsset ? Boolean(feeAsset.location) : Boolean(nativeAsset === null || nativeAsset === void 0 ? void 0 : nativeAsset.location);
969
- destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref6) {
970
- return i.here === null ? 0 : (_ref6 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref6 === void 0 ? void 0 : _ref6.parachain;
762
+ destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref4) {
763
+ return i.here === null ? 0 : (_ref4 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref4 === void 0 ? void 0 : _ref4.parachain;
971
764
  }(Object.values(forwardedXcms[0])[0].interior);
972
765
  if (!(sdkCore.hasXcmPaymentApiSupport(chain) && resultJson.ok.local_xcm && hasLocation && (feeAsset || chain.startsWith('AssetHub') && destination === 'Ethereum'))) {
973
- _context16.n = 16;
766
+ _context0.n = 16;
974
767
  break;
975
768
  }
976
- _context16.n = 15;
769
+ _context0.n = 15;
977
770
  return this.getXcmPaymentApiFee(chain, resultJson.ok.local_xcm, forwardedXcms, feeAsset !== null && feeAsset !== void 0 ? feeAsset : nativeAsset);
978
771
  case 15:
979
- xcmFee = _context16.v;
772
+ xcmFee = _context0.v;
980
773
  if (!(typeof xcmFee === 'bigint')) {
981
- _context16.n = 16;
774
+ _context0.n = 16;
982
775
  break;
983
776
  }
984
- return _context16.a(2, Promise.resolve({
777
+ return _context0.a(2, Promise.resolve({
985
778
  success: true,
986
779
  fee: xcmFee,
987
780
  currency: usedSymbol,
@@ -991,12 +784,12 @@ var PolkadotJsApi = /*#__PURE__*/function () {
991
784
  destParaId: destParaId
992
785
  }));
993
786
  case 16:
994
- _context16.n = 17;
787
+ _context0.n = 17;
995
788
  return this.calculateTransactionFee(tx, address);
996
789
  case 17:
997
- executionFee = _context16.v;
790
+ executionFee = _context0.v;
998
791
  fee = sdkCore.computeFeeFromDryRunPjs(resultHuman, chain, executionFee);
999
- return _context16.a(2, {
792
+ return _context0.a(2, {
1000
793
  success: true,
1001
794
  fee: fee,
1002
795
  currency: usedSymbol,
@@ -1006,9 +799,9 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1006
799
  destParaId: destParaId
1007
800
  });
1008
801
  }
1009
- }, _callee16, this, [[10, 12], [5, 7]]);
802
+ }, _callee0, this, [[10, 12], [5, 7]]);
1010
803
  }));
1011
- function getDryRunCall(_x32) {
804
+ function getDryRunCall(_x15) {
1012
805
  return _getDryRunCall.apply(this, arguments);
1013
806
  }
1014
807
  return getDryRunCall;
@@ -1016,68 +809,68 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1016
809
  }, {
1017
810
  key: "getXcmPaymentApiFee",
1018
811
  value: function () {
1019
- var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(chain, localXcm, forwardedXcm, asset) {
1020
- var _ref7, _deliveryFeeResJson$o, _deliveryFeeResJson$o2, _deliveryFeeResJson$o3, _ref8, _deliveryFeeResJson$o4, _deliveryFeeResJson$o5, _deliveryFeeResJson$o6;
812
+ var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(chain, localXcm, forwardedXcm, asset) {
813
+ var _ref5, _deliveryFeeResJson$o, _deliveryFeeResJson$o2, _deliveryFeeResJson$o3, _ref6, _deliveryFeeResJson$o4, _deliveryFeeResJson$o5, _deliveryFeeResJson$o6;
1021
814
  var weight, assetLocalizedLoc, feeResult, execFeeRes, execFee, deliveryFeeRes, deliveryFeeResJson, deliveryFeeResolved, nativeAsset, deliveryFee, res, _t4;
1022
- return _regenerator().w(function (_context17) {
1023
- while (1) switch (_context17.p = _context17.n) {
815
+ return _regenerator().w(function (_context1) {
816
+ while (1) switch (_context1.p = _context1.n) {
1024
817
  case 0:
1025
- _context17.n = 1;
818
+ _context1.n = 1;
1026
819
  return this.getXcmWeight(localXcm);
1027
820
  case 1:
1028
- weight = _context17.v;
821
+ weight = _context1.v;
1029
822
  sdkCore.assertHasLocation(asset);
1030
823
  assetLocalizedLoc = sdkCore.localizeLocation(chain, asset.location);
1031
- _context17.n = 2;
824
+ _context1.n = 2;
1032
825
  return this.api.call.xcmPaymentApi.queryWeightToAssetFee(weight, sdkCore.addXcmVersionHeader(assetLocalizedLoc, sdkCore.Version.V4));
1033
826
  case 2:
1034
- feeResult = _context17.v;
827
+ feeResult = _context1.v;
1035
828
  execFeeRes = feeResult.toJSON();
1036
829
  execFee = BigInt(execFeeRes.ok);
1037
830
  if (!(forwardedXcm.length > 0)) {
1038
- _context17.n = 4;
831
+ _context1.n = 4;
1039
832
  break;
1040
833
  }
1041
- _context17.n = 3;
834
+ _context1.n = 3;
1042
835
  return this.api.call.xcmPaymentApi.queryDeliveryFees(forwardedXcm[0], forwardedXcm[1][0]);
1043
836
  case 3:
1044
- _t4 = _context17.v;
1045
- _context17.n = 5;
837
+ _t4 = _context1.v;
838
+ _context1.n = 5;
1046
839
  break;
1047
840
  case 4:
1048
841
  _t4 = undefined;
1049
842
  case 5:
1050
843
  deliveryFeeRes = _t4;
1051
844
  deliveryFeeResJson = deliveryFeeRes === null || deliveryFeeRes === void 0 ? void 0 : deliveryFeeRes.toJSON();
1052
- deliveryFeeResolved = deliveryFeeRes && ((_ref7 = (_deliveryFeeResJson$o = (_deliveryFeeResJson$o2 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o2 === void 0 ? void 0 : _deliveryFeeResJson$o2.v4) !== null && _deliveryFeeResJson$o !== void 0 ? _deliveryFeeResJson$o : (_deliveryFeeResJson$o3 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o3 === void 0 ? void 0 : _deliveryFeeResJson$o3.v3) === null || _ref7 === void 0 ? void 0 : _ref7.length) > 0 ? BigInt((_ref8 = (_deliveryFeeResJson$o4 = deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o5 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o5 === void 0 ? void 0 : _deliveryFeeResJson$o5.v4) !== null && _deliveryFeeResJson$o4 !== void 0 ? _deliveryFeeResJson$o4 : deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o6 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o6 === void 0 ? void 0 : _deliveryFeeResJson$o6.v3) === null || _ref8 === void 0 || (_ref8 = _ref8[0]) === null || _ref8 === void 0 || (_ref8 = _ref8.fun) === null || _ref8 === void 0 ? void 0 : _ref8.fungible) : 0n;
845
+ deliveryFeeResolved = deliveryFeeRes && ((_ref5 = (_deliveryFeeResJson$o = (_deliveryFeeResJson$o2 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o2 === void 0 ? void 0 : _deliveryFeeResJson$o2.v4) !== null && _deliveryFeeResJson$o !== void 0 ? _deliveryFeeResJson$o : (_deliveryFeeResJson$o3 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o3 === void 0 ? void 0 : _deliveryFeeResJson$o3.v3) === null || _ref5 === void 0 ? void 0 : _ref5.length) > 0 ? BigInt((_ref6 = (_deliveryFeeResJson$o4 = deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o5 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o5 === void 0 ? void 0 : _deliveryFeeResJson$o5.v4) !== null && _deliveryFeeResJson$o4 !== void 0 ? _deliveryFeeResJson$o4 : deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o6 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o6 === void 0 ? void 0 : _deliveryFeeResJson$o6.v3) === null || _ref6 === void 0 || (_ref6 = _ref6[0]) === null || _ref6 === void 0 || (_ref6 = _ref6.fun) === null || _ref6 === void 0 ? void 0 : _ref6.fungible) : 0n;
1053
846
  nativeAsset = sdkCore.findNativeAssetInfoOrThrow(chain);
1054
847
  if (!sdkCore.isAssetXcEqual(asset, nativeAsset)) {
1055
- _context17.n = 6;
848
+ _context1.n = 6;
1056
849
  break;
1057
850
  }
1058
851
  deliveryFee = deliveryFeeResolved;
1059
- _context17.n = 9;
852
+ _context1.n = 9;
1060
853
  break;
1061
854
  case 6:
1062
- _context17.p = 6;
855
+ _context1.p = 6;
1063
856
  sdkCore.assertHasLocation(nativeAsset);
1064
- _context17.n = 7;
857
+ _context1.n = 7;
1065
858
  return this.quoteAhPrice(sdkCore.localizeLocation(chain, nativeAsset.location), assetLocalizedLoc, deliveryFeeResolved, false);
1066
859
  case 7:
1067
- res = _context17.v;
860
+ res = _context1.v;
1068
861
  deliveryFee = res !== null && res !== void 0 ? res : 0n;
1069
- _context17.n = 9;
862
+ _context1.n = 9;
1070
863
  break;
1071
864
  case 8:
1072
- _context17.p = 8;
1073
- _context17.v;
865
+ _context1.p = 8;
866
+ _context1.v;
1074
867
  deliveryFee = 0n;
1075
868
  case 9:
1076
- return _context17.a(2, execFee + deliveryFee);
869
+ return _context1.a(2, execFee + deliveryFee);
1077
870
  }
1078
- }, _callee17, this, [[6, 8]]);
871
+ }, _callee1, this, [[6, 8]]);
1079
872
  }));
1080
- function getXcmPaymentApiFee(_x34, _x35, _x36, _x37) {
873
+ function getXcmPaymentApiFee(_x17, _x18, _x19, _x20) {
1081
874
  return _getXcmPaymentApiFee.apply(this, arguments);
1082
875
  }
1083
876
  return getXcmPaymentApiFee;
@@ -1085,21 +878,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1085
878
  }, {
1086
879
  key: "getXcmWeight",
1087
880
  value: function () {
1088
- var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(xcm) {
881
+ var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(xcm) {
1089
882
  var result, resultJson;
1090
- return _regenerator().w(function (_context18) {
1091
- while (1) switch (_context18.n) {
883
+ return _regenerator().w(function (_context10) {
884
+ while (1) switch (_context10.n) {
1092
885
  case 0:
1093
- _context18.n = 1;
886
+ _context10.n = 1;
1094
887
  return this.api.call.xcmPaymentApi.queryXcmWeight(xcm);
1095
888
  case 1:
1096
- result = _context18.v;
889
+ result = _context10.v;
1097
890
  resultJson = result.toJSON();
1098
- return _context18.a(2, resultJson.ok);
891
+ return _context10.a(2, resultJson.ok);
1099
892
  }
1100
- }, _callee18, this);
893
+ }, _callee10, this);
1101
894
  }));
1102
- function getXcmWeight(_x38) {
895
+ function getXcmWeight(_x21) {
1103
896
  return _getXcmWeight.apply(this, arguments);
1104
897
  }
1105
898
  return getXcmWeight;
@@ -1107,35 +900,35 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1107
900
  }, {
1108
901
  key: "getDryRunXcm",
1109
902
  value: function () {
1110
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref9) {
1111
- var _ref1, _ref10, _ref11;
903
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(_ref7) {
904
+ var _ref9, _ref0, _ref1;
1112
905
  var originLocation, xcm, asset, chain, origin, supportsDryRunApi, response, result, resultJson, symbol, isSuccess, error, failureReason, forwardedXcms, actualWeight, weight, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee;
1113
- return _regenerator().w(function (_context19) {
1114
- while (1) switch (_context19.n) {
906
+ return _regenerator().w(function (_context11) {
907
+ while (1) switch (_context11.n) {
1115
908
  case 0:
1116
- originLocation = _ref9.originLocation, xcm = _ref9.xcm, asset = _ref9.asset, chain = _ref9.chain, origin = _ref9.origin;
909
+ originLocation = _ref7.originLocation, xcm = _ref7.xcm, asset = _ref7.asset, chain = _ref7.chain, origin = _ref7.origin;
1117
910
  supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
1118
911
  if (supportsDryRunApi) {
1119
- _context19.n = 1;
912
+ _context11.n = 1;
1120
913
  break;
1121
914
  }
1122
915
  throw new sdkCore.ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
1123
916
  case 1:
1124
- _context19.n = 2;
917
+ _context11.n = 2;
1125
918
  return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
1126
919
  case 2:
1127
- response = _context19.v;
920
+ response = _context11.v;
1128
921
  result = response.toHuman();
1129
922
  resultJson = response.toJSON();
1130
923
  symbol = asset.symbol;
1131
924
  isSuccess = result.Ok && result.Ok.executionResult.Complete;
1132
925
  if (isSuccess) {
1133
- _context19.n = 3;
926
+ _context11.n = 3;
1134
927
  break;
1135
928
  }
1136
929
  error = result.Ok.executionResult.Incomplete.error;
1137
930
  failureReason = typeof error === 'string' ? error : error.error;
1138
- return _context19.a(2, {
931
+ return _context11.a(2, {
1139
932
  success: false,
1140
933
  failureReason: failureReason,
1141
934
  currency: symbol,
@@ -1148,22 +941,22 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1148
941
  refTime: BigInt(actualWeight.refTime),
1149
942
  proofSize: BigInt(actualWeight.proofSize)
1150
943
  } : undefined;
1151
- destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref0) {
1152
- return i.Here ? 0 : (_ref0 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref0 === void 0 ? void 0 : _ref0.parachain;
944
+ destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref8) {
945
+ return i.Here ? 0 : (_ref8 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref8 === void 0 ? void 0 : _ref8.parachain;
1153
946
  }(Object.values(forwardedXcms[0])[0].interior);
1154
947
  if (!(sdkCore.hasXcmPaymentApiSupport(chain) && asset)) {
1155
- _context19.n = 5;
948
+ _context11.n = 5;
1156
949
  break;
1157
950
  }
1158
- _context19.n = 4;
951
+ _context11.n = 4;
1159
952
  return this.getXcmPaymentApiFee(chain, xcm, forwardedXcms, asset);
1160
953
  case 4:
1161
- _fee = _context19.v;
954
+ _fee = _context11.v;
1162
955
  if (!(typeof _fee === 'bigint')) {
1163
- _context19.n = 5;
956
+ _context11.n = 5;
1164
957
  break;
1165
958
  }
1166
- return _context19.a(2, {
959
+ return _context11.a(2, {
1167
960
  success: true,
1168
961
  fee: _fee,
1169
962
  currency: symbol,
@@ -1176,24 +969,24 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1176
969
  emitted = result.Ok.emittedEvents; // We want to look for the last event
1177
970
  reversedEvents = _toConsumableArray(emitted).reverse();
1178
971
  palletsWithIssued = ['balances', 'foreignAssets', 'assets'];
1179
- feeEvent = (_ref1 = (_ref10 = (_ref11 = origin === 'Mythos' ? reversedEvents.find(function (event) {
972
+ feeEvent = (_ref9 = (_ref0 = (_ref1 = origin === 'Mythos' ? reversedEvents.find(function (event) {
1180
973
  return event.section === 'assetConversion' && event.method === 'SwapCreditExecuted';
1181
- }) : undefined) !== null && _ref11 !== void 0 ? _ref11 :
974
+ }) : undefined) !== null && _ref1 !== void 0 ? _ref1 :
1182
975
  // Prefer an Issued event
1183
976
  reversedEvents.find(function (event) {
1184
977
  return palletsWithIssued.includes(event.section) && event.method === 'Issued';
1185
- })) !== null && _ref10 !== void 0 ? _ref10 :
978
+ })) !== null && _ref0 !== void 0 ? _ref0 :
1186
979
  // Fallback to Minted event
1187
980
  reversedEvents.find(function (event) {
1188
981
  return ['balances', 'foreignAssets'].includes(event.section) && event.method === 'Minted';
1189
- })) !== null && _ref1 !== void 0 ? _ref1 : reversedEvents.find(function (event) {
982
+ })) !== null && _ref9 !== void 0 ? _ref9 : reversedEvents.find(function (event) {
1190
983
  return ['currencies', 'tokens'].includes(event.section) && event.method === 'Deposited';
1191
984
  });
1192
985
  if (feeEvent) {
1193
- _context19.n = 6;
986
+ _context11.n = 6;
1194
987
  break;
1195
988
  }
1196
- return _context19.a(2, Promise.resolve({
989
+ return _context11.a(2, Promise.resolve({
1197
990
  success: false,
1198
991
  failureReason: 'Cannot determine destination fee. No Issued event found',
1199
992
  currency: symbol,
@@ -1202,7 +995,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1202
995
  case 6:
1203
996
  feeAmount = feeEvent.section === 'assetConversion' ? feeEvent.data.amountIn : feeEvent.data.amount;
1204
997
  fee = BigInt(feeAmount.replace(/,/g, ''));
1205
- return _context19.a(2, {
998
+ return _context11.a(2, {
1206
999
  success: true,
1207
1000
  fee: fee,
1208
1001
  currency: symbol,
@@ -1212,9 +1005,9 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1212
1005
  destParaId: destParaId
1213
1006
  });
1214
1007
  }
1215
- }, _callee19, this);
1008
+ }, _callee11, this);
1216
1009
  }));
1217
- function getDryRunXcm(_x39) {
1010
+ function getDryRunXcm(_x22) {
1218
1011
  return _getDryRunXcm.apply(this, arguments);
1219
1012
  }
1220
1013
  return getDryRunXcm;
@@ -1222,18 +1015,18 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1222
1015
  }, {
1223
1016
  key: "getBridgeStatus",
1224
1017
  value: function () {
1225
- var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
1018
+ var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
1226
1019
  var outboundOperatingMode;
1227
- return _regenerator().w(function (_context20) {
1228
- while (1) switch (_context20.n) {
1020
+ return _regenerator().w(function (_context12) {
1021
+ while (1) switch (_context12.n) {
1229
1022
  case 0:
1230
- _context20.n = 1;
1023
+ _context12.n = 1;
1231
1024
  return this.api.query.ethereumOutboundQueue.operatingMode();
1232
1025
  case 1:
1233
- outboundOperatingMode = _context20.v;
1234
- return _context20.a(2, outboundOperatingMode.toPrimitive());
1026
+ outboundOperatingMode = _context12.v;
1027
+ return _context12.a(2, outboundOperatingMode.toPrimitive());
1235
1028
  }
1236
- }, _callee20, this);
1029
+ }, _callee12, this);
1237
1030
  }));
1238
1031
  function getBridgeStatus() {
1239
1032
  return _getBridgeStatus.apply(this, arguments);
@@ -1250,69 +1043,57 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1250
1043
  value: function getDisconnectAllowed() {
1251
1044
  return this.disconnectAllowed;
1252
1045
  }
1253
- }, {
1254
- key: "convertLocationToAccount",
1255
- value: function () {
1256
- var _convertLocationToAccount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(location) {
1257
- var res, jsonRes;
1258
- return _regenerator().w(function (_context21) {
1259
- while (1) switch (_context21.n) {
1260
- case 0:
1261
- _context21.n = 1;
1262
- return this.api.call.locationToAccountApi.convertLocation(location);
1263
- case 1:
1264
- res = _context21.v;
1265
- jsonRes = res.toJSON();
1266
- return _context21.a(2, jsonRes.ok ? jsonRes.ok.toString() : undefined);
1267
- }
1268
- }, _callee21, this);
1269
- }));
1270
- function convertLocationToAccount(_x40) {
1271
- return _convertLocationToAccount.apply(this, arguments);
1272
- }
1273
- return convertLocationToAccount;
1274
- }()
1275
1046
  }, {
1276
1047
  key: "disconnect",
1277
1048
  value: function () {
1278
- var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
1049
+ var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
1279
1050
  var _this$_config$apiOver2;
1280
1051
  var force,
1281
1052
  api,
1282
- _args22 = arguments;
1283
- return _regenerator().w(function (_context22) {
1284
- while (1) switch (_context22.n) {
1053
+ _args13 = arguments;
1054
+ return _regenerator().w(function (_context13) {
1055
+ while (1) switch (_context13.n) {
1285
1056
  case 0:
1286
- force = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : false;
1057
+ force = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : false;
1287
1058
  if (this.initialized) {
1288
- _context22.n = 1;
1059
+ _context13.n = 1;
1289
1060
  break;
1290
1061
  }
1291
- return _context22.a(2, Promise.resolve());
1062
+ return _context13.a(2, Promise.resolve());
1292
1063
  case 1:
1293
1064
  if (!(!force && !this.disconnectAllowed)) {
1294
- _context22.n = 2;
1065
+ _context13.n = 2;
1295
1066
  break;
1296
1067
  }
1297
- return _context22.a(2);
1068
+ return _context13.a(2);
1298
1069
  case 2:
1299
1070
  api = sdkCore.isConfig(this._config) ? (_this$_config$apiOver2 = this._config.apiOverrides) === null || _this$_config$apiOver2 === void 0 ? void 0 : _this$_config$apiOver2[this._chain] : this._config; // Disconnect api only if it was created automatically
1300
1071
  if (!(force || typeof api === 'string' || api === undefined)) {
1301
- _context22.n = 3;
1072
+ _context13.n = 3;
1302
1073
  break;
1303
1074
  }
1304
- _context22.n = 3;
1075
+ _context13.n = 3;
1305
1076
  return this.api.disconnect();
1306
1077
  case 3:
1307
- return _context22.a(2);
1078
+ return _context13.a(2);
1308
1079
  }
1309
- }, _callee22, this);
1080
+ }, _callee13, this);
1310
1081
  }));
1311
1082
  function disconnect() {
1312
1083
  return _disconnect.apply(this, arguments);
1313
1084
  }
1314
1085
  return disconnect;
1315
1086
  }()
1087
+ }, {
1088
+ key: "validateSubstrateAddress",
1089
+ value: function validateSubstrateAddress(address) {
1090
+ try {
1091
+ utilCrypto.validateAddress(address);
1092
+ return true;
1093
+ } catch (_unused) {
1094
+ return false;
1095
+ }
1096
+ }
1316
1097
  }]);
1317
1098
  }();
1318
1099
 
@@ -1355,13 +1136,13 @@ var getBalanceNative = createPolkadotJsApiCall(sdkCore.getBalanceNative);
1355
1136
  *
1356
1137
  * @returns The balance of the foreign asset as a bigint, or null if not found.
1357
1138
  */
1358
- var getBalanceForeign = createPolkadotJsApiCall(sdkCore.getBalanceForeign);
1139
+ var getBalanceForeign = createPolkadotJsApiCall(sdkCore.getBalance);
1359
1140
  /**
1360
1141
  * Retrieves the asset balance for a given account on a specified chain.
1361
1142
  *
1362
1143
  * @returns The asset balance as a bigint.
1363
1144
  */
1364
- var getAssetBalance = createPolkadotJsApiCall(sdkCore.getAssetBalance);
1145
+ var getAssetBalance = createPolkadotJsApiCall(sdkCore.getBalance);
1365
1146
  /**
1366
1147
  * Claims assets from a parachain.
1367
1148
  *
@@ -1811,12 +1592,12 @@ var EvmBuilderCore = /*#__PURE__*/function () {
1811
1592
  key: "build",
1812
1593
  value: (function () {
1813
1594
  var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
1814
- var _this$_options, from, to, address, signer, _yield$transferEthToP, response;
1595
+ var _this$_options, from, to, address, signer, api, _yield$transferEthToP, response;
1815
1596
  return _regenerator().w(function (_context) {
1816
1597
  while (1) switch (_context.n) {
1817
1598
  case 0:
1818
- _this$_options = this._options, from = _this$_options.from, to = _this$_options.to, address = _this$_options.address, signer = _this$_options.signer;
1819
- sdkCore.validateAddress(address, to);
1599
+ _this$_options = this._options, from = _this$_options.from, to = _this$_options.to, address = _this$_options.address, signer = _this$_options.signer, api = _this$_options.api;
1600
+ sdkCore.validateAddress(api, address, to);
1820
1601
  if (!(from === 'Moonbeam' && to === 'Ethereum')) {
1821
1602
  _context.n = 2;
1822
1603
  break;