@paraspell/sdk 12.1.2 → 12.2.1

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.
Files changed (3) hide show
  1. package/README.md +4 -1
  2. package/dist/index.mjs +179 -342
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -309,9 +309,12 @@ const builder = await Builder({
309
309
  .from(TSubstrateChain)
310
310
  .to(TChain)
311
311
  .currency({id: currencyID, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: currencySymbol, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Native('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Foreign('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: ForeignAbstract('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {location: AssetLocationString, amount: amount /*Use "ALL" to transfer everything*/ | AssetLocationJson, amount: amount /*Use "ALL" to transfer everything*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/} | [{currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or Location: Location*/, amount: amount /*Use "ALL" to transfer everything*/}])
312
- .address(address)
312
+ .address(address) //You can also use prederived accounts - //Alice, //Bob... //Alith, //Balthathar...
313
+ .senderAddress(address) //You can also use prederived accounts //Alice, //Bob... //Alith, //Balthathar...
313
314
 
314
315
  const tx = await builder.build()
316
+ //Or if you use prederived account as senderAddress:
317
+ //await builder.signAndSubmit()
315
318
 
316
319
  //Disconnect API after TX
317
320
  await builder.disconnect()
package/dist/index.mjs CHANGED
@@ -1,21 +1,23 @@
1
- import { NumberFormatError, isConfig, InvalidAddressError, BatchMode, findNativeAssetInfoOrThrow, getChainProviders, MissingChainApiError, Parents, Version, findAssetInfoOrThrow, computeFeeFromDryRun, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, assertHasLocation, localizeLocation, isAssetXcEqual, RELAY_LOCATION, getRelayChainOf, padValueBy, isRelayChain, isAssetEqual, createChainClient as createChainClient$1, getBalance as getBalance$1, claimAssets as claimAssets$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, getXcmFee as getXcmFee$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1 } from '@paraspell/sdk-core';
1
+ import { getEvmPrivateKeyHex, NumberFormatError, createClientCache, createClientPoolHelpers, isConfig, getChainProviders, InvalidAddressError, BatchMode, findNativeAssetInfoOrThrow, MissingChainApiError, Parents, Version, findAssetInfoOrThrow, computeFeeFromDryRun, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, assertHasLocation, localizeLocation, isAssetXcEqual, RELAY_LOCATION, getRelayChainOf, padValueBy, isRelayChain, isAssetEqual, createChainClient as createChainClient$1, getBalance as getBalance$1, claimAssets as claimAssets$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, getXcmFee as getXcmFee$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1 } from '@paraspell/sdk-core';
2
2
  export * from '@paraspell/sdk-core';
3
+ import { secp256k1 } from '@noble/curves/secp256k1.js';
4
+ import { keccak_256 } from '@noble/hashes/sha3.js';
5
+ import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js';
6
+ import { sr25519CreateDerive } from '@polkadot-labs/hdkd';
7
+ import { entropyToMiniSecret, mnemonicToEntropy, DEV_PHRASE } from '@polkadot-labs/hdkd-helpers';
8
+ import { AccountId, Binary, FixedSizeBinary, getSs58AddressInfo, createClient } from 'polkadot-api';
9
+ import { getPolkadotSigner } from 'polkadot-api/signer';
3
10
  import { blake2b } from '@noble/hashes/blake2.js';
4
- import { bytesToHex } from '@noble/hashes/utils.js';
5
11
  import { withLegacy } from '@polkadot-api/legacy-provider';
6
- import { Binary, FixedSizeBinary, getSs58AddressInfo, AccountId, createClient } from 'polkadot-api';
7
12
  import { withPolkadotSdkCompat } from 'polkadot-api/polkadot-sdk-compat';
8
13
  import { getWsProvider } from 'polkadot-api/ws-provider';
9
- import { isAddress } from 'viem';
14
+ import { isAddress, isHex } from 'viem';
10
15
 
11
16
  function _arrayLikeToArray(r, a) {
12
17
  (null == a || a > r.length) && (a = r.length);
13
18
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
14
19
  return n;
15
20
  }
16
- function _arrayWithHoles(r) {
17
- if (Array.isArray(r)) return r;
18
- }
19
21
  function _arrayWithoutHoles(r) {
20
22
  if (Array.isArray(r)) return _arrayLikeToArray(r);
21
23
  }
@@ -117,33 +119,6 @@ function _defineProperty(e, r, t) {
117
119
  function _iterableToArray(r) {
118
120
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
119
121
  }
120
- function _iterableToArrayLimit(r, l) {
121
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
122
- if (null != t) {
123
- var e,
124
- n,
125
- i,
126
- u,
127
- a = [],
128
- f = true,
129
- o = false;
130
- try {
131
- 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);
132
- } catch (r) {
133
- o = true, n = r;
134
- } finally {
135
- try {
136
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
137
- } finally {
138
- if (o) throw n;
139
- }
140
- }
141
- return a;
142
- }
143
- }
144
- function _nonIterableRest() {
145
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
146
- }
147
122
  function _nonIterableSpread() {
148
123
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
149
124
  }
@@ -276,9 +251,6 @@ function _regeneratorDefine(e, r, n, t) {
276
251
  }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
277
252
  }, _regeneratorDefine(e, r, n, t);
278
253
  }
279
- function _slicedToArray(r, e) {
280
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
281
- }
282
254
  function _toConsumableArray(r) {
283
255
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
284
256
  }
@@ -313,6 +285,51 @@ function _unsupportedIterableToArray(r, a) {
313
285
  }
314
286
  }
315
287
 
288
+ var signEcdsa = function signEcdsa(input, privateKey) {
289
+ var signature = secp256k1.sign(keccak_256(input), privateKey, {
290
+ prehash: false,
291
+ format: 'recovered'
292
+ });
293
+ return Uint8Array.from([].concat(_toConsumableArray(signature.slice(1)), [signature[0]]));
294
+ };
295
+ var createSr25519Keypair = function createSr25519Keypair(path) {
296
+ var miniSecret = entropyToMiniSecret(mnemonicToEntropy(DEV_PHRASE));
297
+ var derive = sr25519CreateDerive(miniSecret);
298
+ return derive(path);
299
+ };
300
+ var createSr25519Signer = function createSr25519Signer(path) {
301
+ var keyPair = createSr25519Keypair(path);
302
+ return getPolkadotSigner(keyPair.publicKey, 'Sr25519', keyPair.sign);
303
+ };
304
+ var resolveEcdsaAddress = function resolveEcdsaAddress(privateKey) {
305
+ return keccak_256(secp256k1.getPublicKey(privateKey, false).slice(1)).slice(-20);
306
+ };
307
+ var createEcdsaSigner = function createEcdsaSigner(privateKey) {
308
+ var publicAddress = resolveEcdsaAddress(privateKey);
309
+ return getPolkadotSigner(publicAddress, 'Ecdsa', function (input) {
310
+ return signEcdsa(input, privateKey);
311
+ });
312
+ };
313
+ var getEvmPrivateKey = function getEvmPrivateKey(path) {
314
+ var pkHex = getEvmPrivateKeyHex(path);
315
+ if (pkHex) return hexToBytes(pkHex.slice(2));
316
+ return undefined;
317
+ };
318
+ var createDevSigner = function createDevSigner(path) {
319
+ var evmPrivateKey = getEvmPrivateKey(path);
320
+ if (evmPrivateKey) return createEcdsaSigner(evmPrivateKey);
321
+ return createSr25519Signer(path);
322
+ };
323
+ var deriveAddress = function deriveAddress(path) {
324
+ var evmPrivateKey = getEvmPrivateKey(path);
325
+ if (evmPrivateKey) {
326
+ var address = resolveEcdsaAddress(evmPrivateKey);
327
+ return "0x".concat(bytesToHex(address));
328
+ }
329
+ var keyPair = createSr25519Keypair(path);
330
+ return AccountId().dec(keyPair.publicKey);
331
+ };
332
+
316
333
  var LEGACY_CHAINS = ['Interlay', 'CrustShadow', 'Kintsugi', 'RobonomicsPolkadot', 'Pendulum'];
317
334
  // Cache settings
318
335
  var DEFAULT_TTL_MS = 60000; // 1 minute
@@ -551,180 +568,24 @@ var _transform = function transform(obj) {
551
568
  }
552
569
  };
553
570
 
554
- function createClientCache(maxSize, onEviction) {
555
- var extensionMs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5 * 60000;
556
- var data = new Map();
557
- var timers = new Map();
558
- var now = function now() {
559
- return Date.now();
560
- };
561
- var timeLeft = function timeLeft(w) {
562
- return Math.max(w.expireAt - now(), 0);
563
- };
564
- var schedule = function schedule(k, delay) {
565
- if (timers.has(k)) clearTimeout(timers.get(k));
566
- timers.set(k, setTimeout(function () {
567
- return handleTimeout(k);
568
- }, delay));
569
- };
570
- var handleTimeout = function handleTimeout(k) {
571
- var w = data.get(k);
572
- if (!w) return;
573
- if (!w.extended && w.value.refs > 0) {
574
- // first expiry while still in use - Extend grace period
575
- // Call rpc.properties to keep the connection alive
576
- void _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
577
- return _regenerator().w(function (_context) {
578
- while (1) switch (_context.p = _context.n) {
579
- case 0:
580
- _context.p = 0;
581
- _context.n = 1;
582
- return w.value.client.getChainSpecData();
583
- case 1:
584
- _context.n = 3;
585
- break;
586
- case 2:
587
- _context.p = 2;
588
- _context.v;
589
- case 3:
590
- return _context.a(2);
591
- }
592
- }, _callee, null, [[0, 2]]);
593
- }))();
594
- w.value.destroyWanted = true;
595
- w.extended = true;
596
- w.expireAt = now() + extensionMs;
597
- schedule(k, extensionMs);
598
- return;
599
- }
600
- evict(k); // second expiry or unused - real eviction
601
- };
602
- var evict = function evict(k) {
603
- var w = data.get(k);
604
- if (!w) return;
605
- clearTimeout(timers.get(k));
606
- timers["delete"](k);
607
- data["delete"](k);
608
- onEviction === null || onEviction === void 0 || onEviction(k, w.value);
609
- };
610
- var evictIfNeeded = function evictIfNeeded() {
611
- if (data.size <= maxSize) return;
612
- var victimKey;
613
- var victim;
614
- var _iterator = _createForOfIteratorHelper(data),
615
- _step;
616
- try {
617
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
618
- var _step$value = _slicedToArray(_step.value, 2),
619
- k = _step$value[0],
620
- w = _step$value[1];
621
- if (!victim) {
622
- victimKey = k;
623
- victim = w;
624
- continue;
625
- }
626
- var better = w.extended && !victim.extended ||
627
- // Prefer extended over normal
628
- w.extended === victim.extended && w.value.destroyWanted && !victim.value.destroyWanted || w.extended === victim.extended && w.value.destroyWanted === victim.value.destroyWanted && timeLeft(w) < timeLeft(victim) || w.extended === victim.extended && w.value.destroyWanted === victim.value.destroyWanted && timeLeft(w) === timeLeft(victim) && w.value.refs < victim.value.refs; // Prefer with less refs
629
- if (better) {
630
- victimKey = k;
631
- victim = w;
632
- }
633
- }
634
- } catch (err) {
635
- _iterator.e(err);
636
- } finally {
637
- _iterator.f();
638
- }
639
- if (victimKey !== undefined) evict(victimKey);
640
- };
641
- var set = function set(k, v, ttl) {
642
- var existing = data.get(k);
643
- if (existing) {
644
- existing.value = v;
645
- existing.ttl = ttl;
646
- existing.extended = false;
647
- existing.expireAt = now() + ttl;
648
- schedule(k, ttl);
649
- } else {
650
- data.set(k, {
651
- value: v,
652
- ttl: ttl,
653
- extended: false,
654
- expireAt: now() + ttl
655
- });
656
- schedule(k, ttl);
657
- }
658
- evictIfNeeded();
659
- };
660
- var get = function get(k) {
661
- var w = data.get(k);
662
- if (!w) return undefined;
663
- if (!w.extended && timeLeft(w) < w.ttl) {
664
- w.expireAt = now() + w.ttl; // refresh normal life
665
- schedule(k, w.ttl);
666
- }
667
- return w.value;
668
- };
669
- var revive = function revive(k, ttl) {
670
- var w = data.get(k);
671
- if (!w) return;
672
- var remaining = timeLeft(w);
673
- w.extended = false;
674
- if (ttl < remaining) {
675
- w.ttl = ttl;
676
- w.expireAt = now() + ttl;
677
- schedule(k, ttl);
678
- }
679
- // if ttl ≥ remaining - keep current timer
680
- };
681
- var del = function del(k) {
682
- if (!data.has(k)) return false;
683
- evict(k);
684
- return true;
685
- };
686
- var clear = function clear() {
687
- var _iterator2 = _createForOfIteratorHelper(timers.values()),
688
- _step2;
689
- try {
690
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
691
- var t = _step2.value;
692
- clearTimeout(t);
571
+ var clientPool = createClientCache(MAX_CLIENTS, /*#__PURE__*/function () {
572
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(client) {
573
+ return _regenerator().w(function (_context) {
574
+ while (1) switch (_context.n) {
575
+ case 0:
576
+ _context.n = 1;
577
+ return client.getChainSpecData();
578
+ case 1:
579
+ return _context.a(2);
693
580
  }
694
- } catch (err) {
695
- _iterator2.e(err);
696
- } finally {
697
- _iterator2.f();
698
- }
699
- timers.clear();
700
- data.clear();
701
- };
702
- return {
703
- set: set,
704
- get: get,
705
- "delete": del,
706
- has: function has(k) {
707
- return data.has(k);
708
- },
709
- clear: clear,
710
- peek: function peek(k) {
711
- var _data$get;
712
- return (_data$get = data.get(k)) === null || _data$get === void 0 ? void 0 : _data$get.value;
713
- },
714
- remainingTtl: function remainingTtl(k) {
715
- var w = data.get(k);
716
- return w ? timeLeft(w) : undefined;
717
- },
718
- revive: revive
581
+ }, _callee);
582
+ }));
583
+ return function (_x) {
584
+ return _ref.apply(this, arguments);
719
585
  };
720
- }
721
-
722
- var clientPool = createClientCache(MAX_CLIENTS, function (_key, entry) {
586
+ }(), function (_key, entry) {
723
587
  entry.client.destroy();
724
588
  }, EXTENSION_MS);
725
- var keyFromWs = function keyFromWs(ws) {
726
- return Array.isArray(ws) ? JSON.stringify(ws) : ws;
727
- };
728
589
  var createPolkadotClient = function createPolkadotClient(ws, useLegacy) {
729
590
  var options = useLegacy ? {
730
591
  innerEnhancer: withLegacy()
@@ -732,48 +593,21 @@ var createPolkadotClient = function createPolkadotClient(ws, useLegacy) {
732
593
  var provider = getWsProvider(ws, options);
733
594
  return createClient(useLegacy ? provider : withPolkadotSdkCompat(provider));
734
595
  };
735
- var leasePolkadotClient = function leasePolkadotClient(ws, ttlMs, useLegacy) {
736
- var key = keyFromWs(ws);
737
- var entry = clientPool.peek(key);
738
- if (!entry) {
739
- entry = {
740
- client: createPolkadotClient(ws, useLegacy),
741
- refs: 0,
742
- destroyWanted: false
743
- };
744
- clientPool.set(key, entry, ttlMs);
745
- }
746
- entry.refs += 1;
747
- clientPool.revive(key, ttlMs);
748
- entry.destroyWanted = false;
749
- return entry.client;
750
- };
751
- var releasePolkadotClient = function releasePolkadotClient(ws) {
752
- var key = keyFromWs(ws);
753
- var entry = clientPool.peek(key);
754
- if (!entry) {
755
- return;
756
- }
757
- entry.refs -= 1;
758
- if (entry.refs === 0 && entry.destroyWanted) {
759
- clientPool["delete"](key);
760
- }
761
- };
762
- var isHex = function isHex(str) {
763
- return typeof str === 'string' && /^0x[0-9a-fA-F]+$/.test(str);
764
- };
596
+ var _createClientPoolHelp = createClientPoolHelpers(clientPool, createPolkadotClient),
597
+ leaseClient = _createClientPoolHelp.leaseClient,
598
+ releaseClient = _createClientPoolHelp.releaseClient;
765
599
  var extractDryRunXcmFailureReason = function extractDryRunXcmFailureReason(result) {
766
- var _result$value, _executionResult$valu, _ref, _ref2, _ref3, _error$error$type, _error$error, _error$value, _error$value2, _error$value3, _ref4, _result$value2;
600
+ var _result$value, _executionResult$valu, _ref2, _ref3, _ref4, _error$error$type, _error$error, _error$value, _error$value2, _error$value3, _ref5, _result$value2;
767
601
  var executionResult = result === null || result === void 0 || (_result$value = result.value) === null || _result$value === void 0 ? void 0 : _result$value.execution_result;
768
602
  var error = executionResult === null || executionResult === void 0 || (_executionResult$valu = executionResult.value) === null || _executionResult$valu === void 0 ? void 0 : _executionResult$valu.error;
769
- var failureType = (_ref = (_ref2 = (_ref3 = (_error$error$type = error === null || error === void 0 || (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.type) !== null && _error$error$type !== void 0 ? _error$error$type : error === null || error === void 0 || (_error$value = error.value) === null || _error$value === void 0 || (_error$value = _error$value.error) === null || _error$value === void 0 ? void 0 : _error$value.type) !== null && _ref3 !== void 0 ? _ref3 : error === null || error === void 0 || (_error$value2 = error.value) === null || _error$value2 === void 0 || (_error$value2 = _error$value2.value) === null || _error$value2 === void 0 ? void 0 : _error$value2.type) !== null && _ref2 !== void 0 ? _ref2 : error === null || error === void 0 || (_error$value3 = error.value) === null || _error$value3 === void 0 ? void 0 : _error$value3.type) !== null && _ref !== void 0 ? _ref : error === null || error === void 0 ? void 0 : error.type;
603
+ var failureType = (_ref2 = (_ref3 = (_ref4 = (_error$error$type = error === null || error === void 0 || (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.type) !== null && _error$error$type !== void 0 ? _error$error$type : error === null || error === void 0 || (_error$value = error.value) === null || _error$value === void 0 || (_error$value = _error$value.error) === null || _error$value === void 0 ? void 0 : _error$value.type) !== null && _ref4 !== void 0 ? _ref4 : error === null || error === void 0 || (_error$value2 = error.value) === null || _error$value2 === void 0 || (_error$value2 = _error$value2.value) === null || _error$value2 === void 0 ? void 0 : _error$value2.type) !== null && _ref3 !== void 0 ? _ref3 : error === null || error === void 0 || (_error$value3 = error.value) === null || _error$value3 === void 0 ? void 0 : _error$value3.type) !== null && _ref2 !== void 0 ? _ref2 : error === null || error === void 0 ? void 0 : error.type;
770
604
  if (typeof failureType === 'string') {
771
605
  return failureType;
772
606
  }
773
607
  if (typeof (executionResult === null || executionResult === void 0 ? void 0 : executionResult.type) === 'string') {
774
608
  return executionResult.type;
775
609
  }
776
- return JSON.stringify((_ref4 = (_result$value2 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value2 !== void 0 ? _result$value2 : result) !== null && _ref4 !== void 0 ? _ref4 : 'Unknown error structure', replaceBigInt);
610
+ return JSON.stringify((_ref5 = (_result$value2 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value2 !== void 0 ? _result$value2 : result) !== null && _ref5 !== void 0 ? _ref5 : 'Unknown error structure', replaceBigInt);
777
611
  };
778
612
  var PapiApi = /*#__PURE__*/function () {
779
613
  function PapiApi(config) {
@@ -796,40 +630,40 @@ var PapiApi = /*#__PURE__*/function () {
796
630
  }, {
797
631
  key: "init",
798
632
  value: function () {
799
- var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain) {
633
+ var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(chain) {
800
634
  var clientTtlMs,
801
635
  apiConfig,
802
636
  _args = arguments;
803
- return _regenerator().w(function (_context) {
804
- while (1) switch (_context.n) {
637
+ return _regenerator().w(function (_context2) {
638
+ while (1) switch (_context2.n) {
805
639
  case 0:
806
640
  clientTtlMs = _args.length > 1 && _args[1] !== undefined ? _args[1] : DEFAULT_TTL_MS;
807
641
  if (!(this.initialized || chain === 'Ethereum')) {
808
- _context.n = 1;
642
+ _context2.n = 1;
809
643
  break;
810
644
  }
811
- return _context.a(2);
645
+ return _context2.a(2);
812
646
  case 1:
813
647
  this._ttlMs = clientTtlMs;
814
648
  this._chain = chain;
815
649
  apiConfig = this.getApiConfigForChain(chain); // For development mode, api for each used chain must be provided
816
650
  if (!(isConfig(this._config) && this._config.development && !apiConfig)) {
817
- _context.n = 2;
651
+ _context2.n = 2;
818
652
  break;
819
653
  }
820
654
  throw new MissingChainApiError(chain);
821
655
  case 2:
822
- _context.n = 3;
656
+ _context2.n = 3;
823
657
  return this.resolveApi(apiConfig, chain);
824
658
  case 3:
825
- this.api = _context.v;
659
+ this.api = _context2.v;
826
660
  this.initialized = true;
827
661
  case 4:
828
- return _context.a(2);
662
+ return _context2.a(2);
829
663
  }
830
- }, _callee, this);
664
+ }, _callee2, this);
831
665
  }));
832
- function init(_x) {
666
+ function init(_x2) {
833
667
  return _init.apply(this, arguments);
834
668
  }
835
669
  return init;
@@ -845,39 +679,21 @@ var PapiApi = /*#__PURE__*/function () {
845
679
  }
846
680
  }, {
847
681
  key: "resolveApi",
848
- value: function () {
849
- var _resolveApi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(apiConfig, chain) {
850
- var wsUrl;
851
- return _regenerator().w(function (_context2) {
852
- while (1) switch (_context2.n) {
853
- case 0:
854
- if (apiConfig) {
855
- _context2.n = 1;
856
- break;
857
- }
858
- wsUrl = getChainProviders(chain);
859
- return _context2.a(2, this.createApiInstance(wsUrl, chain));
860
- case 1:
861
- if (!(typeof apiConfig === 'string' || apiConfig instanceof Array)) {
862
- _context2.n = 2;
863
- break;
864
- }
865
- return _context2.a(2, this.createApiInstance(apiConfig, chain));
866
- case 2:
867
- return _context2.a(2, apiConfig);
868
- }
869
- }, _callee2, this);
870
- }));
871
- function resolveApi(_x2, _x3) {
872
- return _resolveApi.apply(this, arguments);
682
+ value: function resolveApi(apiConfig, chain) {
683
+ if (!apiConfig) {
684
+ var wsUrl = getChainProviders(chain);
685
+ return this.createApiInstance(wsUrl, chain);
873
686
  }
874
- return resolveApi;
875
- }()
687
+ if (typeof apiConfig === 'string' || apiConfig instanceof Array) {
688
+ return this.createApiInstance(apiConfig, chain);
689
+ }
690
+ return Promise.resolve(apiConfig);
691
+ }
876
692
  }, {
877
693
  key: "createApiInstance",
878
694
  value: function createApiInstance(wsUrl, chain) {
879
695
  var useLegacy = LEGACY_CHAINS.includes(chain);
880
- return Promise.resolve(leasePolkadotClient(wsUrl, this._ttlMs, useLegacy));
696
+ return Promise.resolve(leaseClient(wsUrl, this._ttlMs, useLegacy));
881
697
  }
882
698
  }, {
883
699
  key: "accountToHex",
@@ -904,29 +720,29 @@ var PapiApi = /*#__PURE__*/function () {
904
720
  }
905
721
  }, {
906
722
  key: "deserializeExtrinsics",
907
- value: function deserializeExtrinsics(_ref5) {
908
- var module = _ref5.module,
909
- method = _ref5.method,
910
- params = _ref5.params;
723
+ value: function deserializeExtrinsics(_ref6) {
724
+ var module = _ref6.module,
725
+ method = _ref6.method,
726
+ params = _ref6.params;
911
727
  var transformedParams = _transform(params);
912
728
  return this.api.getUnsafeApi().tx[module][method](transformedParams);
913
729
  }
914
730
  }, {
915
731
  key: "queryState",
916
- value: function queryState(_ref6) {
732
+ value: function queryState(_ref7) {
917
733
  var _this$api$getUnsafeAp;
918
- var module = _ref6.module,
919
- method = _ref6.method,
920
- params = _ref6.params;
734
+ var module = _ref7.module,
735
+ method = _ref7.method,
736
+ params = _ref7.params;
921
737
  return (_this$api$getUnsafeAp = this.api.getUnsafeApi().query[module][method]).getValue.apply(_this$api$getUnsafeAp, _toConsumableArray(params.map(_transform)));
922
738
  }
923
739
  }, {
924
740
  key: "queryRuntimeApi",
925
- value: function queryRuntimeApi(_ref7) {
741
+ value: function queryRuntimeApi(_ref8) {
926
742
  var _this$api$getUnsafeAp2;
927
- var module = _ref7.module,
928
- method = _ref7.method,
929
- params = _ref7.params;
743
+ var module = _ref8.module,
744
+ method = _ref8.method,
745
+ params = _ref8.params;
930
746
  return (_this$api$getUnsafeAp2 = this.api.getUnsafeApi().apis[module])[method].apply(_this$api$getUnsafeAp2, _toConsumableArray(params.map(_transform)));
931
747
  }
932
748
  }, {
@@ -986,7 +802,7 @@ var PapiApi = /*#__PURE__*/function () {
986
802
  }
987
803
  }, _callee3, this);
988
804
  }));
989
- function objectToHex(_x4) {
805
+ function objectToHex(_x3) {
990
806
  return _objectToHex.apply(this, arguments);
991
807
  }
992
808
  return objectToHex;
@@ -1034,7 +850,7 @@ var PapiApi = /*#__PURE__*/function () {
1034
850
  }
1035
851
  }, _callee4, this, [[0, 2]]);
1036
852
  }));
1037
- function hasMethod(_x5, _x6) {
853
+ function hasMethod(_x4, _x5) {
1038
854
  return _hasMethod.apply(this, arguments);
1039
855
  }
1040
856
  return hasMethod;
@@ -1061,7 +877,7 @@ var PapiApi = /*#__PURE__*/function () {
1061
877
  }
1062
878
  }, _callee5);
1063
879
  }));
1064
- function calculateTransactionFee(_x7, _x8) {
880
+ function calculateTransactionFee(_x6, _x7) {
1065
881
  return _calculateTransactionFee.apply(this, arguments);
1066
882
  }
1067
883
  return calculateTransactionFee;
@@ -1074,11 +890,11 @@ var PapiApi = /*#__PURE__*/function () {
1074
890
  transformedFromMl,
1075
891
  transformedToMl,
1076
892
  response,
1077
- _args6 = arguments;
893
+ _args5 = arguments;
1078
894
  return _regenerator().w(function (_context6) {
1079
895
  while (1) switch (_context6.n) {
1080
896
  case 0:
1081
- includeFee = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : true;
897
+ includeFee = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : true;
1082
898
  transformedFromMl = _transform(fromMl);
1083
899
  transformedToMl = _transform(toMl);
1084
900
  _context6.n = 1;
@@ -1089,7 +905,7 @@ var PapiApi = /*#__PURE__*/function () {
1089
905
  }
1090
906
  }, _callee6, this);
1091
907
  }));
1092
- function quoteAhPrice(_x9, _x0, _x1) {
908
+ function quoteAhPrice(_x8, _x9, _x0) {
1093
909
  return _quoteAhPrice.apply(this, arguments);
1094
910
  }
1095
911
  return quoteAhPrice;
@@ -1103,20 +919,19 @@ var PapiApi = /*#__PURE__*/function () {
1103
919
  key: "getFromRpc",
1104
920
  value: function () {
1105
921
  var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(module, method, key) {
1106
- var toSS58, value;
922
+ var value;
1107
923
  return _regenerator().w(function (_context7) {
1108
924
  while (1) switch (_context7.n) {
1109
925
  case 0:
1110
- toSS58 = AccountId().dec;
1111
926
  _context7.n = 1;
1112
- return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) && !isAddress(key) ? toSS58(key) : key]);
927
+ return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) && !isAddress(key) ? AccountId().dec(key) : key]);
1113
928
  case 1:
1114
929
  value = _context7.v;
1115
930
  return _context7.a(2, isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
1116
931
  }
1117
932
  }, _callee7, this);
1118
933
  }));
1119
- function getFromRpc(_x10, _x11, _x12) {
934
+ function getFromRpc(_x1, _x10, _x11) {
1120
935
  return _getFromRpc.apply(this, arguments);
1121
936
  }
1122
937
  return getFromRpc;
@@ -1142,16 +957,16 @@ var PapiApi = /*#__PURE__*/function () {
1142
957
  }
1143
958
  }, _callee8);
1144
959
  }));
1145
- function createApiForChain(_x13) {
960
+ function createApiForChain(_x12) {
1146
961
  return _createApiForChain.apply(this, arguments);
1147
962
  }
1148
963
  return createApiForChain;
1149
964
  }()
1150
965
  }, {
1151
966
  key: "resolveDefaultFeeAsset",
1152
- value: function resolveDefaultFeeAsset(_ref8) {
1153
- var chain = _ref8.chain,
1154
- feeAsset = _ref8.feeAsset;
967
+ value: function resolveDefaultFeeAsset(_ref9) {
968
+ var chain = _ref9.chain,
969
+ feeAsset = _ref9.feeAsset;
1155
970
  return feeAsset !== null && feeAsset !== void 0 ? feeAsset : findNativeAssetInfoOrThrow(chain);
1156
971
  }
1157
972
  }, {
@@ -1194,7 +1009,7 @@ var PapiApi = /*#__PURE__*/function () {
1194
1009
  }
1195
1010
  }, _callee9, this);
1196
1011
  }));
1197
- function resolveFeeAsset(_x14) {
1012
+ function resolveFeeAsset(_x13) {
1198
1013
  return _resolveFeeAsset.apply(this, arguments);
1199
1014
  }
1200
1015
  return resolveFeeAsset;
@@ -1243,7 +1058,7 @@ var PapiApi = /*#__PURE__*/function () {
1243
1058
  case 4:
1244
1059
  resolvedTx = _t2;
1245
1060
  performDryRunCall = /*#__PURE__*/function () {
1246
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(includeVersion) {
1061
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(includeVersion) {
1247
1062
  var _this$api$getUnsafeAp3;
1248
1063
  var callArgs;
1249
1064
  return _regenerator().w(function (_context0) {
@@ -1257,8 +1072,8 @@ var PapiApi = /*#__PURE__*/function () {
1257
1072
  }
1258
1073
  }, _callee0);
1259
1074
  }));
1260
- return function performDryRunCall(_x16) {
1261
- return _ref9.apply(this, arguments);
1075
+ return function performDryRunCall(_x15) {
1076
+ return _ref0.apply(this, arguments);
1262
1077
  };
1263
1078
  }();
1264
1079
  getExecutionSuccessFromResult = function getExecutionSuccessFromResult(result) {
@@ -1287,7 +1102,7 @@ var PapiApi = /*#__PURE__*/function () {
1287
1102
  return result;
1288
1103
  };
1289
1104
  extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
1290
- var _obj$value, _ref0, _result$value6;
1105
+ var _obj$value, _ref1, _result$value6;
1291
1106
  var obj = findFailureObjectFromResult(result);
1292
1107
  if (obj !== null && obj !== void 0 && obj.type && obj !== null && obj !== void 0 && (_obj$value = obj.value) !== null && _obj$value !== void 0 && (_obj$value = _obj$value.error) !== null && _obj$value !== void 0 && _obj$value.type) {
1293
1108
  return {
@@ -1301,7 +1116,7 @@ var PapiApi = /*#__PURE__*/function () {
1301
1116
  };
1302
1117
  }
1303
1118
  return {
1304
- failureReason: JSON.stringify((_ref0 = (_result$value6 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value6 !== void 0 ? _result$value6 : result) !== null && _ref0 !== void 0 ? _ref0 : 'Unknown error structure', replaceBigInt)
1119
+ failureReason: JSON.stringify((_ref1 = (_result$value6 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value6 !== void 0 ? _result$value6 : result) !== null && _ref1 !== void 0 ? _ref1 : 'Unknown error structure', replaceBigInt)
1305
1120
  };
1306
1121
  };
1307
1122
  failureOutputReason = {
@@ -1364,7 +1179,7 @@ var PapiApi = /*#__PURE__*/function () {
1364
1179
  break;
1365
1180
  }
1366
1181
  getPaymentInfoWeight = /*#__PURE__*/function () {
1367
- var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
1182
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
1368
1183
  var _yield$tx$getPaymentI, weight;
1369
1184
  return _regenerator().w(function (_context1) {
1370
1185
  while (1) switch (_context1.n) {
@@ -1379,7 +1194,7 @@ var PapiApi = /*#__PURE__*/function () {
1379
1194
  }, _callee1);
1380
1195
  }));
1381
1196
  return function getPaymentInfoWeight() {
1382
- return _ref1.apply(this, arguments);
1197
+ return _ref10.apply(this, arguments);
1383
1198
  };
1384
1199
  }();
1385
1200
  if (result.value.local_xcm) {
@@ -1434,7 +1249,7 @@ var PapiApi = /*#__PURE__*/function () {
1434
1249
  }
1435
1250
  }, _callee10, this);
1436
1251
  }));
1437
- function getDryRunCall(_x15) {
1252
+ function getDryRunCall(_x14) {
1438
1253
  return _getDryRunCall.apply(this, arguments);
1439
1254
  }
1440
1255
  return getDryRunCall;
@@ -1459,7 +1274,7 @@ var PapiApi = /*#__PURE__*/function () {
1459
1274
  }
1460
1275
  }, _callee11, this);
1461
1276
  }));
1462
- function getXcmWeight(_x17) {
1277
+ function getXcmWeight(_x16) {
1463
1278
  return _getXcmWeight.apply(this, arguments);
1464
1279
  }
1465
1280
  return getXcmWeight;
@@ -1487,18 +1302,18 @@ var PapiApi = /*#__PURE__*/function () {
1487
1302
  nativeAsset,
1488
1303
  deliveryFee,
1489
1304
  res,
1490
- _args13 = arguments,
1305
+ _args12 = arguments,
1491
1306
  _t4,
1492
1307
  _t5,
1493
1308
  _t6;
1494
1309
  return _regenerator().w(function (_context13) {
1495
1310
  while (1) switch (_context13.p = _context13.n) {
1496
1311
  case 0:
1497
- transformXcm = _args13.length > 4 && _args13[4] !== undefined ? _args13[4] : false;
1498
- overridenWeight = _args13.length > 5 ? _args13[5] : undefined;
1312
+ transformXcm = _args12.length > 4 && _args12[4] !== undefined ? _args12[4] : false;
1313
+ overridenWeight = _args12.length > 5 ? _args12[5] : undefined;
1499
1314
  transformedXcm = transformXcm ? _transform(localXcm) : localXcm;
1500
1315
  queryWeight = /*#__PURE__*/function () {
1501
- var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
1316
+ var _ref11 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
1502
1317
  var weightRes;
1503
1318
  return _regenerator().w(function (_context12) {
1504
1319
  while (1) switch (_context12.n) {
@@ -1512,7 +1327,7 @@ var PapiApi = /*#__PURE__*/function () {
1512
1327
  }, _callee12);
1513
1328
  }));
1514
1329
  return function queryWeight() {
1515
- return _ref10.apply(this, arguments);
1330
+ return _ref11.apply(this, arguments);
1516
1331
  };
1517
1332
  }();
1518
1333
  if (!(overridenWeight !== null && overridenWeight !== void 0)) {
@@ -1598,7 +1413,7 @@ var PapiApi = /*#__PURE__*/function () {
1598
1413
  }
1599
1414
  }, _callee13, this, [[10, 12]]);
1600
1415
  }));
1601
- function getXcmPaymentApiFee(_x18, _x19, _x20, _x21) {
1416
+ function getXcmPaymentApiFee(_x17, _x18, _x19, _x20) {
1602
1417
  return _getXcmPaymentApiFee.apply(this, arguments);
1603
1418
  }
1604
1419
  return getXcmPaymentApiFee;
@@ -1645,7 +1460,7 @@ var PapiApi = /*#__PURE__*/function () {
1645
1460
  }
1646
1461
  }, _callee14, this);
1647
1462
  }));
1648
- function getBridgeHubFallbackExecFee(_x22, _x23, _x24) {
1463
+ function getBridgeHubFallbackExecFee(_x21, _x22, _x23) {
1649
1464
  return _getBridgeHubFallbackExecFee.apply(this, arguments);
1650
1465
  }
1651
1466
  return getBridgeHubFallbackExecFee;
@@ -1653,13 +1468,13 @@ var PapiApi = /*#__PURE__*/function () {
1653
1468
  }, {
1654
1469
  key: "getDryRunXcm",
1655
1470
  value: function () {
1656
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref11) {
1657
- var _ref12, _processAssetsDeposit, _ref13, _ref14, _ref15, _ref16, _ref17;
1471
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref12) {
1472
+ var _ref13, _processAssetsDeposit, _ref14, _ref15, _ref16, _ref17, _ref18;
1658
1473
  var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, fee, processedFee;
1659
1474
  return _regenerator().w(function (_context15) {
1660
1475
  while (1) switch (_context15.n) {
1661
1476
  case 0:
1662
- originLocation = _ref11.originLocation, xcm = _ref11.xcm, chain = _ref11.chain, origin = _ref11.origin, asset = _ref11.asset, feeAsset = _ref11.feeAsset, originFee = _ref11.originFee, amount = _ref11.amount;
1477
+ originLocation = _ref12.originLocation, xcm = _ref12.xcm, chain = _ref12.chain, origin = _ref12.origin, asset = _ref12.asset, feeAsset = _ref12.feeAsset, originFee = _ref12.originFee, amount = _ref12.amount;
1663
1478
  supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
1664
1479
  if (supportsDryRunApi) {
1665
1480
  _context15.n = 1;
@@ -1716,15 +1531,15 @@ var PapiApi = /*#__PURE__*/function () {
1716
1531
  reversedEvents = _toConsumableArray(emitted).reverse();
1717
1532
  palletsWithIssued = ['Balances', 'ForeignAssets', 'Assets'];
1718
1533
  isFeeAsset = origin === 'AssetHubPolkadot' && feeAsset && asset && isAssetEqual(feeAsset, asset);
1719
- feeAssetFeeEvent = (_ref12 = isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1534
+ feeAssetFeeEvent = (_ref13 = isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1720
1535
  return (event.type === 'ForeignAssets' || event.type === 'Assets') && event.value.type === 'Issued';
1721
- }) : undefined) !== null && _ref12 !== void 0 ? _ref12 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1536
+ }) : undefined) !== null && _ref13 !== void 0 ? _ref13 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1722
1537
  return event.type === 'Tokens' && event.value.type === 'Deposited';
1723
1538
  }) : undefined;
1724
1539
  processedAssetsAmount = chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? processAssetsDepositedEvents(emitted, amount, 'Assets', 'Deposited', true) : (_processAssetsDeposit = processAssetsDepositedEvents(emitted, amount, 'Balances', 'Minted', false)) !== null && _processAssetsDeposit !== void 0 ? _processAssetsDeposit : processAssetsDepositedEvents(emitted, amount, 'Balances', 'Issued', false);
1725
- feeEvent = (_ref13 = (_ref14 = (_ref15 = (_ref16 = (_ref17 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent :
1726
- //
1727
- processedAssetsAmount !== undefined ? {
1540
+ feeEvent = (_ref14 = (_ref15 = (_ref16 = (_ref17 = (_ref18 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent : chain === 'Mythos' ? reversedEvents.find(function (event) {
1541
+ return event.type === 'Balances' && event.value.type === 'Issued';
1542
+ }) : undefined) !== null && _ref18 !== void 0 ? _ref18 : processedAssetsAmount !== undefined ? {
1728
1543
  type: 'Assets',
1729
1544
  value: {
1730
1545
  type: 'Deposited',
@@ -1732,23 +1547,17 @@ var PapiApi = /*#__PURE__*/function () {
1732
1547
  amount: processedAssetsAmount
1733
1548
  }
1734
1549
  }
1735
- } : undefined) !== null && _ref17 !== void 0 ? _ref17 :
1736
- //
1737
- chain === 'Mythos' ? reversedEvents.find(function (event) {
1738
- return event.type === 'Balances' && event.value.type === 'Issued';
1739
- }) : undefined) !== null && _ref16 !== void 0 ? _ref16 :
1740
- //
1741
- origin === 'Mythos' || chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
1550
+ } : undefined) !== null && _ref17 !== void 0 ? _ref17 : origin === 'Mythos' || chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
1742
1551
  return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
1743
- }) : undefined) !== null && _ref15 !== void 0 ? _ref15 :
1552
+ }) : undefined) !== null && _ref16 !== void 0 ? _ref16 :
1744
1553
  // Prefer to Minted event
1745
1554
  reversedEvents.find(function (event) {
1746
1555
  return ['Balances', 'ForeignAssets'].includes(event.type) && event.value.type === 'Minted';
1747
- })) !== null && _ref14 !== void 0 ? _ref14 :
1556
+ })) !== null && _ref15 !== void 0 ? _ref15 :
1748
1557
  // Fallback an Issued event
1749
1558
  reversedEvents.find(function (event) {
1750
1559
  return palletsWithIssued.includes(event.type) && event.value.type === 'Issued';
1751
- })) !== null && _ref13 !== void 0 ? _ref13 : reversedEvents.find(function (event) {
1560
+ })) !== null && _ref14 !== void 0 ? _ref14 : reversedEvents.find(function (event) {
1752
1561
  return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
1753
1562
  });
1754
1563
  if (feeEvent) {
@@ -1777,7 +1586,7 @@ var PapiApi = /*#__PURE__*/function () {
1777
1586
  }
1778
1587
  }, _callee15, this);
1779
1588
  }));
1780
- function getDryRunXcm(_x25) {
1589
+ function getDryRunXcm(_x24) {
1781
1590
  return _getDryRunXcm.apply(this, arguments);
1782
1591
  }
1783
1592
  return getDryRunXcm;
@@ -1831,11 +1640,39 @@ var PapiApi = /*#__PURE__*/function () {
1831
1640
  this.api.destroy();
1832
1641
  } else {
1833
1642
  var key = api === undefined ? getChainProviders(this._chain) : api;
1834
- releasePolkadotClient(key);
1643
+ releaseClient(key);
1835
1644
  }
1836
1645
  }
1837
1646
  return Promise.resolve();
1838
1647
  }
1648
+ }, {
1649
+ key: "deriveAddress",
1650
+ value: function deriveAddress$1(path) {
1651
+ return deriveAddress(path);
1652
+ }
1653
+ }, {
1654
+ key: "signAndSubmit",
1655
+ value: function () {
1656
+ var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(tx, path) {
1657
+ var signer, _yield$tx$signAndSubm, txHash;
1658
+ return _regenerator().w(function (_context17) {
1659
+ while (1) switch (_context17.n) {
1660
+ case 0:
1661
+ signer = createDevSigner(path);
1662
+ _context17.n = 1;
1663
+ return tx.signAndSubmit(signer);
1664
+ case 1:
1665
+ _yield$tx$signAndSubm = _context17.v;
1666
+ txHash = _yield$tx$signAndSubm.txHash;
1667
+ return _context17.a(2, txHash);
1668
+ }
1669
+ }, _callee17);
1670
+ }));
1671
+ function signAndSubmit(_x25, _x26) {
1672
+ return _signAndSubmit.apply(this, arguments);
1673
+ }
1674
+ return signAndSubmit;
1675
+ }()
1839
1676
  }]);
1840
1677
  }();
1841
1678
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "12.1.2",
3
+ "version": "12.2.1",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,8 +25,10 @@
25
25
  "dependencies": {
26
26
  "@noble/hashes": "^2.0.1",
27
27
  "@polkadot-api/legacy-provider": "^0.3.6",
28
+ "@polkadot-labs/hdkd": "^0.0.26",
29
+ "@polkadot-labs/hdkd-helpers": "^0.0.27",
28
30
  "viem": "2.40.3",
29
- "@paraspell/sdk-core": "12.1.2"
31
+ "@paraspell/sdk-core": "12.2.1"
30
32
  },
31
33
  "peerDependencies": {
32
34
  "polkadot-api": ">= 1.23.1 < 2"
@@ -36,8 +38,6 @@
36
38
  "@babel/preset-env": "^7.28.5",
37
39
  "@codecov/rollup-plugin": "^1.9.1",
38
40
  "@noble/curves": "^2.0.1",
39
- "@polkadot-labs/hdkd": "^0.0.26",
40
- "@polkadot-labs/hdkd-helpers": "^0.0.27",
41
41
  "@rollup/plugin-babel": "^6.1.0",
42
42
  "@rollup/plugin-json": "^6.1.0",
43
43
  "@rollup/plugin-typescript": "^12.3.0",