@paraspell/sdk-dedot 13.2.2 → 13.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +59 -16
  2. package/dist/index.mjs +224 -265
  3. package/package.json +5 -6
package/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
  <img alt="build" src="https://github.com/paraspell/xcm-tools/actions/workflows/ci.yml/badge.svg" />
15
15
  </a>
16
16
  </p>
17
- <p>Supporting every XCM Active Parachain <a href = "https://paraspell.github.io/docs/supported.html"\>[list]</p>
17
+ <p>Supporting every XCM Active Parachain <a href = "https://paraspell.github.io/docs/supported-chains.html"\>[list]</p>
18
18
  <p>SDK documentation <a href = "https://paraspell.github.io/docs/" \>[here]</p>
19
19
  </div>
20
20
 
@@ -41,9 +41,9 @@ npm install | pnpm add | yarn add dedot @polkadot/keyring
41
41
  npm install | pnpm add | yarn add @paraspell/sdk-dedot
42
42
  ```
43
43
 
44
- ### Install Swap extension
44
+ ### (OPTIONAL) Install Swap extension
45
45
 
46
- If you plan to [do Swap XCMs](https://paraspell.github.io/docs/sdk/xcmPallet.html#swap) you can install Swap package which allows you to do cross-chain swaps on popular Polkadot, Kusama, Paseo, Westend exchanges. Now available in all JS client versions of SDK.
46
+ If you plan to [do Swap XCMs](https://paraspell.github.io/docs/xcm-sdk/send-xcm.html#swap) you can install Swap package which allows you to do cross-chain swaps on popular Polkadot, Kusama, Paseo, Westend exchanges. Now available in all JS client versions of SDK.
47
47
 
48
48
  > [!IMPORTANT]
49
49
  > - ⚠️ **WebAssembly (Wasm) must be enabled in your project** because of the Hydration SDK (One of the exchanges implemented in XCM Router). Wasm can be enabled either through the web application configuration or through the appropriate plugin.
@@ -54,7 +54,7 @@ If you plan to [do Swap XCMs](https://paraspell.github.io/docs/sdk/xcmPallet.htm
54
54
  npm install | pnpm add | yarn add @paraspell/swap @galacticcouncil/api-augment
55
55
  ```
56
56
 
57
- ### Setup Swap extension
57
+ #### Setup Swap extension
58
58
 
59
59
  Add the `@paraspell/swap` import to your application's root component (Usually `App.tsx`). This ensures the extension is registered before using Builder.
60
60
 
@@ -67,6 +67,46 @@ export default function App() {
67
67
  }
68
68
  ```
69
69
 
70
+ ### (OPTIONAL) Install EVM extension
71
+ If you plan to [do EVM contract transfers](https://paraspell.github.io/docs/xcm-sdk/send-xcm.html#moonbeam-xtokens-smart-contract) you can install EVM package which allows you to interact with EVM contract based XCMs on Moonbeam, Moonriver and Darwinia. Available in **ALL** versions of SDK.
72
+
73
+ ```bash
74
+ npm install | pnpm add | yarn add @paraspell/evm
75
+ ```
76
+
77
+ #### Setup EVM extension
78
+
79
+ Add the `@paraspell/evm` import to your application's root component (Usually `App.tsx`). This ensures the extension is registered before using Builder.
80
+
81
+ ```ts
82
+ // Import EVM extension here
83
+ import '@paraspell/evm';
84
+
85
+ export default function App() {
86
+ return {/* Your app here */};
87
+ }
88
+ ```
89
+
90
+ ### (OPTIONAL) Install Snowbridge extension
91
+ If you plan to [do Snowbridge transfers from Ethereum](https://paraspell.github.io/docs/xcm-sdk/send-xcm.html#ethereum-polkadot-transfer) you can install Snowbridge package which allows you to input "Ethereum" as from chain parameter. Available in **ALL** versions of SDK.
92
+
93
+ ```bash
94
+ npm install | pnpm add | yarn add @paraspell/evm-snowbridge
95
+ ```
96
+
97
+ #### Setup Snowbridge extension
98
+
99
+ Add the `@paraspell/evm-snowbridge` import to your application's root component (Usually `App.tsx`). This ensures the extension is registered before using Builder.
100
+
101
+ ```ts
102
+ // Import Snowbridge extension here
103
+ import '@paraspell/evm-snowbridge';
104
+
105
+ export default function App() {
106
+ return {/* Your app here */};
107
+ }
108
+ ```
109
+
70
110
  ### Importing SDK Functionality
71
111
 
72
112
  Named import:
@@ -83,13 +123,16 @@ import * as paraspell from '@paraspell/sdk-dedot'
83
123
 
84
124
  ## Implementation
85
125
 
126
+ > [!NOTE]
86
127
  > **Latest news:**
87
128
  > - V12 > V13 Migration guide: https://paraspell.github.io/docs/migration/v12-to-v13.html
88
- > - Swap package is now available on every XCM SDK version: https://paraspell.github.io/docs/sdk/getting-started.html#install-swap-extension
89
- > - abstractDecimals is now turned on by default!
129
+ > - Swap extension is now available on every XCM SDK version: https://paraspell.github.io/docs/xcm-sdk/getting-started.html#install-swap-extension
130
+ > - EVM extension is now available: https://paraspell.github.io/docs/xcm-sdk/getting-started.html#install-evm-extension
131
+ > - Snowbridge extension is now available: https://paraspell.github.io/docs/xcm-sdk/getting-started.html#install-snowbridge-extension
132
+
90
133
 
91
134
  ### Sending XCM
92
- For full documentation on XCM Transfers head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
135
+ For full documentation on XCM Transfers head over to [official documentation](https://paraspell.github.io/docs/xcm-sdk/send-xcm.html).
93
136
 
94
137
  #### Transfer assets from Substrate to Substrate
95
138
 
@@ -168,7 +211,7 @@ await builder.disconnect()
168
211
 
169
212
  ```ts
170
213
  const builder = Builder(/*client | builder_config | ws_url | [ws_url, ws_url,..] - Optional*/)
171
- .from(TSubstrateChain) // 'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
214
+ .from(TSubstrateChain) // 'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/xcm-sdk/asset-package.html#import-chains-as-types
172
215
  .to(TChain) // Has to be same as origin (from)
173
216
  .currency(CURRENCY_SPEC) // Refer to currency spec options below
174
217
  .sender(sender | PAPI SIGNER)
@@ -187,8 +230,8 @@ await builder.disconnect()
187
230
 
188
231
  ```ts
189
232
  const builder = Builder(/*client | builder_config |ws_url | [ws_url, ws_url,..] - Optional*/)
190
- .from(TSubstrateChain) // 'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
191
- .to(TChain /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/) //'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
233
+ .from(TSubstrateChain) // 'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/xcm-sdk/asset-package.html#import-chains-as-types
234
+ .to(TChain /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/) //'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/xcm-sdk/asset-package.html#import-chains-as-types
192
235
  .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*/})
193
236
  .recipient(address | Location object /*If you are sending through xTokens, you need to pass the destination and address location in one object (x2)*/)
194
237
  .sender(address | PAPI_SIGNER /*Only in PAPI SDK*/ | {address, PJS_SIGNER} /*Only in PJS SDK*/) // - OPTIONAL but strongly recommended as it is automatically ignored when not needed - Used when origin is AssetHub/Hydration with feeAsset or when sending to AssetHub to prevent asset traps by auto-swapping to DOT to have DOT ED.
@@ -302,7 +345,7 @@ await builder.disconnect()
302
345
 
303
346
  ### XCM Fee queries
304
347
 
305
- For full documentation with output examples of XCM Fee queries, head to [official documentation](https://paraspell.github.io/docs/sdk/xcmUtils.html).
348
+ For full documentation with output examples of XCM Fee queries, head to [official documentation](https://paraspell.github.io/docs/xcm-sdk/xcm-utils.html).
306
349
 
307
350
  #### XCM Fee (Origin and Dest.)
308
351
 
@@ -418,8 +461,8 @@ const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
418
461
 
419
462
  ```ts
420
463
  const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
421
- .from(TSubstrateChain) //'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
422
- .to(TChain) //'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
464
+ .from(TSubstrateChain) //'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/xcm-sdk/asset-package.html#import-chains-as-types
465
+ .to(TChain) //'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/xcm-sdk/asset-package.html#import-chains-as-types
423
466
  .currency(CURRENCY_SPEC)
424
467
  .recipient(RECIPIENT_ADDRESS)
425
468
  .sender(SENDER_ADDRESS)
@@ -467,7 +510,7 @@ let result = convertSs58(ADDRESS, TChain) // returns converted address in string
467
510
 
468
511
  ### Asset queries:
469
512
 
470
- For full documentation with output examples of asset queries, head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
513
+ For full documentation with output examples of asset queries, head over to [official documentation](https://paraspell.github.io/docs/xcm-sdk/asset-package.html).
471
514
 
472
515
  ```ts
473
516
  import { getSupportedDestinations, getFeeAssets, getAssetsObject, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, getParaId, getTChain, getAssetLocation, CHAINS, findAssetInfo, findAssetInfoOrThrow } from '@paraspell/sdk-dedot'
@@ -517,7 +560,7 @@ CHAINS
517
560
 
518
561
  ### Parachain XCM Pallet queries
519
562
 
520
- For full documentation with output examples of pallet queries, head over to [official documentation](https://paraspell.github.io/docs/sdk/NodePallets.html).
563
+ For full documentation with output examples of pallet queries, head over to [official documentation](https://paraspell.github.io/docs/xcm-sdk/pallet-package.html).
521
564
 
522
565
  ```ts
523
566
  import { getDefaultPallet, getSupportedPallets, getPalletIndex, getNativeAssetsPallet, getOtherAssetsPallets, SUPPORTED_PALLETS } from '@paraspell/sdk-dedot';
@@ -603,7 +646,7 @@ console.log(CHAINS)
603
646
 
604
647
  ## Contribute to XCM Tools and earn rewards 💰
605
648
 
606
- We run an open Bug Bounty Program that rewards contributors for reporting and fixing bugs in the project. More information on bug bounty can be found in the [official documentation](https://paraspell.github.io/docs/contribution.html).
649
+ We run an open Bug Bounty Program that rewards contributors for reporting and fixing bugs in the project. More information on bug bounty can be found in the [official documentation](https://paraspell.github.io/docs/contribution-guidelines.html).
607
650
 
608
651
  ## Get Support 🚑
609
652
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getEvmPrivateKeyHex, getNativeAssetSymbol, getOtherAssets, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, findNativeAssetInfoOrThrow, getChainProviders, isSenderSigner, PolkadotApi, resolveChainApi, DEFAULT_TTL_MS, isExternalChain, UnsupportedOperationError, findAssetInfoOrThrow, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, createAssetId, addXcmVersionHeader, isAssetXcEqual, RELAY_LOCATION, getRelayChainOf, replaceBigInt, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, Builder as Builder$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
1
+ import { getEvmPrivateKeyHex, getNativeAssetSymbol, getOtherAssets, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, findNativeAssetInfoOrThrow, getChainProviders, isSenderSigner, PolkadotApi, UnsupportedOperationError, findAssetInfoOrThrow, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, createAssetId, addXcmVersionHeader, isAssetXcEqual, RELAY_LOCATION, getRelayChainOf, replaceBigInt, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, Builder as Builder$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
2
2
  export * from '@paraspell/sdk-core';
3
3
  import { stringPascalCase, isEvmAddress, decodeAddress, isHex, u8aToHex, hexToU8a, stringToU8a, blake2AsHex } from 'dedot/utils';
4
4
  import { Keyring } from '@polkadot/keyring';
@@ -655,9 +655,7 @@ var _transform = function transform(obj) {
655
655
  var v = obj[_key];
656
656
  var k = snakeToCamel(_key);
657
657
  if (_key === "call") {
658
- newObj[k] = {
659
- encoded: v
660
- };
658
+ newObj[k] = v;
661
659
  continue;
662
660
  }
663
661
  if (_key === "fee_item") {
@@ -753,7 +751,7 @@ var createDedotClient = /*#__PURE__*/function () {
753
751
  };
754
752
  }();
755
753
  var _createClientPoolHelp = createClientPoolHelpers(clientPool, createDedotClient),
756
- leaseClient = _createClientPoolHelp.leaseClient,
754
+ _leaseClient = _createClientPoolHelp.leaseClient,
757
755
  releaseClient = _createClientPoolHelp.releaseClient;
758
756
  var extractDryRunXcmFailureReason = function extractDryRunXcmFailureReason(result) {
759
757
  var _result$value, _executionResult$valu, _ref3, _ref4, _ref5, _error$error$type, _error$error, _error$value, _error$value2, _error$value3, _ref6, _result$value2;
@@ -778,44 +776,9 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
778
776
  }
779
777
  _inherits(DedotApi, _PolkadotApi);
780
778
  return _createClass(DedotApi, [{
781
- key: "init",
782
- value: function () {
783
- var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(chain) {
784
- var _this2 = this;
785
- var clientTtlMs,
786
- _args = arguments;
787
- return _regenerator().w(function (_context3) {
788
- while (1) switch (_context3.n) {
789
- case 0:
790
- clientTtlMs = _args.length > 1 && _args[1] !== undefined ? _args[1] : DEFAULT_TTL_MS;
791
- if (!(this._chain !== undefined || isExternalChain(chain))) {
792
- _context3.n = 1;
793
- break;
794
- }
795
- return _context3.a(2);
796
- case 1:
797
- this._ttlMs = clientTtlMs;
798
- this._chain = chain;
799
- _context3.n = 2;
800
- return resolveChainApi(this._config, chain, function (wsUrl) {
801
- return leaseClient(wsUrl, _this2._ttlMs);
802
- });
803
- case 2:
804
- this._api = _context3.v;
805
- case 3:
806
- return _context3.a(2);
807
- }
808
- }, _callee3, this);
809
- }));
810
- function init(_x3) {
811
- return _init.apply(this, arguments);
812
- }
813
- return init;
814
- }()
815
- }, {
816
- key: "createApiInstance",
817
- value: function createApiInstance(wsUrl) {
818
- return leaseClient(wsUrl, this._ttlMs);
779
+ key: "leaseClient",
780
+ value: function leaseClient(wsUrl, ttlMs) {
781
+ return _leaseClient(wsUrl, ttlMs);
819
782
  }
820
783
  }, {
821
784
  key: "accountToHex",
@@ -858,6 +821,18 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
858
821
  value: function txFromHex(hex) {
859
822
  return Promise.resolve(this.api.toTx(hex));
860
823
  }
824
+ }, {
825
+ key: "txToHex",
826
+ value: function txToHex(tx) {
827
+ return Promise.resolve(tx.callHex);
828
+ }
829
+ }, {
830
+ key: "encodeTx",
831
+ value: function encodeTx(hex) {
832
+ return {
833
+ encoded: hex
834
+ };
835
+ }
861
836
  }, {
862
837
  key: "queryState",
863
838
  value: function queryState(serialized) {
@@ -875,7 +850,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
875
850
  var _this$convertToDedotC3 = this.convertToDedotCall(serialized),
876
851
  module = _this$convertToDedotC3.module,
877
852
  method = _this$convertToDedotC3.method;
878
- return (_this$api$call$module = this.api.call[module])[method].apply(_this$api$call$module, _toConsumableArray(params));
853
+ return (_this$api$call$module = this.api.call[module])[method].apply(_this$api$call$module, _toConsumableArray(params.map(_transform)));
879
854
  }
880
855
  }, {
881
856
  key: "callBatchMethod",
@@ -919,43 +894,19 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
919
894
  }, {
920
895
  key: "getPaymentInfo",
921
896
  value: function () {
922
- var _getPaymentInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(tx, address) {
923
- return _regenerator().w(function (_context4) {
924
- while (1) switch (_context4.n) {
897
+ var _getPaymentInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(tx, address) {
898
+ return _regenerator().w(function (_context3) {
899
+ while (1) switch (_context3.n) {
925
900
  case 0:
926
- return _context4.a(2, tx.paymentInfo(address));
901
+ return _context3.a(2, tx.paymentInfo(address));
927
902
  }
928
- }, _callee4);
903
+ }, _callee3);
929
904
  }));
930
- function getPaymentInfo(_x4, _x5) {
905
+ function getPaymentInfo(_x3, _x4) {
931
906
  return _getPaymentInfo.apply(this, arguments);
932
907
  }
933
908
  return getPaymentInfo;
934
909
  }()
935
- }, {
936
- key: "quoteAhPrice",
937
- value: function () {
938
- var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(fromMl, toMl, amountIn) {
939
- var includeFee,
940
- quoted,
941
- _args3 = arguments;
942
- return _regenerator().w(function (_context5) {
943
- while (1) switch (_context5.n) {
944
- case 0:
945
- includeFee = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : true;
946
- _context5.n = 1;
947
- return this.api.call.assetConversionApi.quotePriceExactTokensForTokens(fromMl, toMl, amountIn, includeFee);
948
- case 1:
949
- quoted = _context5.v;
950
- return _context5.a(2, quoted !== undefined && quoted !== null ? BigInt(quoted) : undefined);
951
- }
952
- }, _callee5, this);
953
- }));
954
- function quoteAhPrice(_x6, _x7, _x8) {
955
- return _quoteAhPrice.apply(this, arguments);
956
- }
957
- return quoteAhPrice;
958
- }()
959
910
  }, {
960
911
  key: "getEvmStorage",
961
912
  value: function getEvmStorage(contract, slot) {
@@ -989,26 +940,26 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
989
940
  }, {
990
941
  key: "getFromRpc",
991
942
  value: function () {
992
- var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(module, method, key) {
943
+ var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(module, method, key) {
993
944
  var rpcModule;
994
- return _regenerator().w(function (_context6) {
995
- while (1) switch (_context6.n) {
945
+ return _regenerator().w(function (_context4) {
946
+ while (1) switch (_context4.n) {
996
947
  case 0:
997
948
  rpcModule = this.api.rpc["".concat(module, "_").concat(method)];
998
949
  if (!(!rpcModule || !rpcModule(key))) {
999
- _context6.n = 1;
950
+ _context4.n = 1;
1000
951
  break;
1001
952
  }
1002
953
  throw new UnsupportedOperationError("RPC method ".concat(module, ".").concat(method, " not available"));
1003
954
  case 1:
1004
- _context6.n = 2;
955
+ _context4.n = 2;
1005
956
  return rpcModule(key);
1006
957
  case 2:
1007
- return _context6.a(2, _context6.v);
958
+ return _context4.a(2, _context4.v);
1008
959
  }
1009
- }, _callee6, this);
960
+ }, _callee4, this);
1010
961
  }));
1011
- function getFromRpc(_x9, _x0, _x1) {
962
+ function getFromRpc(_x5, _x6, _x7) {
1012
963
  return _getFromRpc.apply(this, arguments);
1013
964
  }
1014
965
  return getFromRpc;
@@ -1026,20 +977,20 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1026
977
  }, {
1027
978
  key: "createApiForChain",
1028
979
  value: function () {
1029
- var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(chain) {
980
+ var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(chain) {
1030
981
  var api;
1031
- return _regenerator().w(function (_context7) {
1032
- while (1) switch (_context7.n) {
982
+ return _regenerator().w(function (_context5) {
983
+ while (1) switch (_context5.n) {
1033
984
  case 0:
1034
985
  api = new DedotApi(isConfig(this._config) ? this._config : undefined);
1035
- _context7.n = 1;
986
+ _context5.n = 1;
1036
987
  return api.init(chain);
1037
988
  case 1:
1038
- return _context7.a(2, api);
989
+ return _context5.a(2, api);
1039
990
  }
1040
- }, _callee7, this);
991
+ }, _callee5, this);
1041
992
  }));
1042
- function createApiForChain(_x10) {
993
+ function createApiForChain(_x8) {
1043
994
  return _createApiForChain.apply(this, arguments);
1044
995
  }
1045
996
  return createApiForChain;
@@ -1054,44 +1005,44 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1054
1005
  }, {
1055
1006
  key: "resolveFeeAsset",
1056
1007
  value: function () {
1057
- var _resolveFeeAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(options) {
1008
+ var _resolveFeeAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(options) {
1058
1009
  var chain, address, assetId;
1059
- return _regenerator().w(function (_context8) {
1060
- while (1) switch (_context8.n) {
1010
+ return _regenerator().w(function (_context6) {
1011
+ while (1) switch (_context6.n) {
1061
1012
  case 0:
1062
1013
  chain = options.chain, address = options.address;
1063
1014
  if (chain.startsWith("Hydration")) {
1064
- _context8.n = 1;
1015
+ _context6.n = 1;
1065
1016
  break;
1066
1017
  }
1067
- return _context8.a(2, {
1018
+ return _context6.a(2, {
1068
1019
  isCustomAsset: false,
1069
1020
  asset: this.resolveDefaultFeeAsset(options)
1070
1021
  });
1071
1022
  case 1:
1072
- _context8.n = 2;
1023
+ _context6.n = 2;
1073
1024
  return this.api.query.multiTransactionPayment.accountCurrencyMap(address);
1074
1025
  case 2:
1075
- assetId = _context8.v;
1026
+ assetId = _context6.v;
1076
1027
  if (!(assetId === null || assetId === undefined)) {
1077
- _context8.n = 3;
1028
+ _context6.n = 3;
1078
1029
  break;
1079
1030
  }
1080
- return _context8.a(2, {
1031
+ return _context6.a(2, {
1081
1032
  isCustomAsset: false,
1082
1033
  asset: this.resolveDefaultFeeAsset(options)
1083
1034
  });
1084
1035
  case 3:
1085
- return _context8.a(2, {
1036
+ return _context6.a(2, {
1086
1037
  isCustomAsset: true,
1087
1038
  asset: findAssetInfoOrThrow(chain, {
1088
1039
  id: assetId
1089
1040
  })
1090
1041
  });
1091
1042
  }
1092
- }, _callee8, this);
1043
+ }, _callee6, this);
1093
1044
  }));
1094
- function resolveFeeAsset(_x11) {
1045
+ function resolveFeeAsset(_x9) {
1095
1046
  return _resolveFeeAsset.apply(this, arguments);
1096
1047
  }
1097
1048
  return resolveFeeAsset;
@@ -1099,19 +1050,19 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1099
1050
  }, {
1100
1051
  key: "getDryRunCall",
1101
1052
  value: function () {
1102
- var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(options) {
1103
- var _this3 = this,
1053
+ var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
1054
+ var _this2 = this,
1104
1055
  _result,
1105
1056
  _resValue$executionRe,
1106
1057
  _execRes$actualWeight;
1107
1058
  var tx, address, feeAsset, chain, destination, version, _options$useRootOrigi, useRootOrigin, bypassOptions, _getAssetsObject, supportsDryRunApi, basePayload, resolvedTx, resolvedFeeAsset, performDryRunCall, findFailingEventInResult, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, resValue, execRes, forwardedXcms, actualWeight, weight, destParaId, localXcm, USE_XCM_PAYMENT_API_CHAINS, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t, _t2, _t3, _t4;
1108
- return _regenerator().w(function (_context9) {
1109
- while (1) switch (_context9.p = _context9.n) {
1059
+ return _regenerator().w(function (_context7) {
1060
+ while (1) switch (_context7.p = _context7.n) {
1110
1061
  case 0:
1111
1062
  tx = options.tx, address = options.address, feeAsset = options.feeAsset, chain = options.chain, destination = options.destination, version = options.version, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi, bypassOptions = options.bypassOptions;
1112
1063
  _getAssetsObject = getAssetsObject(chain), supportsDryRunApi = _getAssetsObject.supportsDryRunApi;
1113
1064
  if (supportsDryRunApi) {
1114
- _context9.n = 1;
1065
+ _context7.n = 1;
1115
1066
  break;
1116
1067
  }
1117
1068
  throw new RuntimeApiUnavailableError(chain, "DryRunApi");
@@ -1126,29 +1077,29 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1126
1077
  }
1127
1078
  };
1128
1079
  if (!useRootOrigin) {
1129
- _context9.n = 3;
1080
+ _context7.n = 3;
1130
1081
  break;
1131
1082
  }
1132
- _context9.n = 2;
1083
+ _context7.n = 2;
1133
1084
  return wrapTxBypass(_objectSpread2(_objectSpread2({}, options), {}, {
1134
1085
  api: this
1135
1086
  }), bypassOptions);
1136
1087
  case 2:
1137
- _t = _context9.v;
1138
- _context9.n = 4;
1088
+ _t = _context7.v;
1089
+ _context7.n = 4;
1139
1090
  break;
1140
1091
  case 3:
1141
1092
  _t = tx;
1142
1093
  case 4:
1143
1094
  resolvedTx = _t;
1144
- _context9.n = 5;
1095
+ _context7.n = 5;
1145
1096
  return this.resolveFeeAsset(options);
1146
1097
  case 5:
1147
- resolvedFeeAsset = _context9.v;
1098
+ resolvedFeeAsset = _context7.v;
1148
1099
  performDryRunCall = function performDryRunCall(includeVersion) {
1149
- var _this3$api$call$dryRu;
1100
+ var _this2$api$call$dryRu;
1150
1101
  var versionNum = Number(version.charAt(1));
1151
- return (_this3$api$call$dryRu = _this3.api.call.dryRunApi).dryRunCall.apply(_this3$api$call$dryRu, [basePayload, resolvedTx.call].concat(_toConsumableArray(includeVersion ? [versionNum] : [])));
1102
+ return (_this2$api$call$dryRu = _this2.api.call.dryRunApi).dryRunCall.apply(_this2$api$call$dryRu, [basePayload, resolvedTx.call].concat(_toConsumableArray(includeVersion ? [versionNum] : [])));
1152
1103
  };
1153
1104
  findFailingEventInResult = function findFailingEventInResult(res) {
1154
1105
  var _res$value;
@@ -1216,11 +1167,11 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1216
1167
  failureReason: ""
1217
1168
  };
1218
1169
  shouldRetryWithVersion = false;
1219
- _context9.p = 6;
1220
- _context9.n = 7;
1170
+ _context7.p = 6;
1171
+ _context7.n = 7;
1221
1172
  return performDryRunCall(false);
1222
1173
  case 7:
1223
- result = _context9.v;
1174
+ result = _context7.v;
1224
1175
  isSuccess = getExecutionSuccessFromResult(result);
1225
1176
  if (!isSuccess) {
1226
1177
  failureErr = extractFailureReasonFromResult(result);
@@ -1228,49 +1179,49 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1228
1179
  shouldRetryWithVersion = true;
1229
1180
  }
1230
1181
  }
1231
- _context9.n = 10;
1182
+ _context7.n = 10;
1232
1183
  break;
1233
1184
  case 8:
1234
- _context9.p = 8;
1235
- _t2 = _context9.v;
1185
+ _context7.p = 8;
1186
+ _t2 = _context7.v;
1236
1187
  msg = _t2 instanceof Error ? _t2.message : String(_t2);
1237
1188
  if (!msg.includes("Expected 3 parameters")) {
1238
- _context9.n = 9;
1189
+ _context7.n = 9;
1239
1190
  break;
1240
1191
  }
1241
1192
  shouldRetryWithVersion = true;
1242
- _context9.n = 10;
1193
+ _context7.n = 10;
1243
1194
  break;
1244
1195
  case 9:
1245
- return _context9.a(2, {
1196
+ return _context7.a(2, {
1246
1197
  success: false,
1247
1198
  failureReason: msg,
1248
1199
  asset: resolvedFeeAsset.asset
1249
1200
  });
1250
1201
  case 10:
1251
1202
  if (!shouldRetryWithVersion) {
1252
- _context9.n = 14;
1203
+ _context7.n = 14;
1253
1204
  break;
1254
1205
  }
1255
- _context9.p = 11;
1256
- _context9.n = 12;
1206
+ _context7.p = 11;
1207
+ _context7.n = 12;
1257
1208
  return performDryRunCall(true);
1258
1209
  case 12:
1259
- result = _context9.v;
1210
+ result = _context7.v;
1260
1211
  isSuccess = getExecutionSuccessFromResult(result);
1261
1212
  if (!isSuccess) {
1262
1213
  failureErr = extractFailureReasonFromResult(result);
1263
1214
  }
1264
- _context9.n = 14;
1215
+ _context7.n = 14;
1265
1216
  break;
1266
1217
  case 13:
1267
- _context9.p = 13;
1268
- _t3 = _context9.v;
1218
+ _context7.p = 13;
1219
+ _t3 = _context7.v;
1269
1220
  _msg = _t3 instanceof Error ? _t3.message : String(_t3);
1270
1221
  failureErr = failureErr || {
1271
1222
  failureReason: _msg
1272
1223
  };
1273
- return _context9.a(2, {
1224
+ return _context7.a(2, {
1274
1225
  success: false,
1275
1226
  failureReason: failureErr.failureReason,
1276
1227
  failureSubReason: failureErr.failureSubReason,
@@ -1278,10 +1229,10 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1278
1229
  });
1279
1230
  case 14:
1280
1231
  if (isSuccess) {
1281
- _context9.n = 15;
1232
+ _context7.n = 15;
1282
1233
  break;
1283
1234
  }
1284
- return _context9.a(2, {
1235
+ return _context7.a(2, {
1285
1236
  success: false,
1286
1237
  failureReason: failureErr.failureReason || "Unknown error",
1287
1238
  failureSubReason: failureErr.failureSubReason,
@@ -1297,32 +1248,32 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1297
1248
  localXcm = resValue === null || resValue === void 0 ? void 0 : resValue.localXcm;
1298
1249
  USE_XCM_PAYMENT_API_CHAINS = ["Astar"];
1299
1250
  if (!(hasXcmPaymentApiSupport(chain) && localXcm && (feeAsset || USE_XCM_PAYMENT_API_CHAINS.includes(chain) || chain.startsWith("AssetHub") && destination === "Ethereum") || resolvedFeeAsset.isCustomAsset)) {
1300
- _context9.n = 21;
1251
+ _context7.n = 21;
1301
1252
  break;
1302
1253
  }
1303
1254
  if (localXcm) {
1304
- _context9.n = 17;
1255
+ _context7.n = 17;
1305
1256
  break;
1306
1257
  }
1307
- _context9.n = 16;
1258
+ _context7.n = 16;
1308
1259
  return this.getPaymentInfo(tx, address);
1309
1260
  case 16:
1310
- _t4 = _context9.v.weight;
1311
- _context9.n = 18;
1261
+ _t4 = _context7.v.weight;
1262
+ _context7.n = 18;
1312
1263
  break;
1313
1264
  case 17:
1314
1265
  _t4 = undefined;
1315
1266
  case 18:
1316
1267
  overriddenWeight = _t4;
1317
- _context9.n = 19;
1268
+ _context7.n = 19;
1318
1269
  return this.getXcmPaymentApiFee(chain, localXcm, forwardedXcms, resolvedFeeAsset.asset, version, false, overriddenWeight);
1319
1270
  case 19:
1320
- xcmFee = _context9.v;
1271
+ xcmFee = _context7.v;
1321
1272
  if (!(typeof xcmFee === "bigint")) {
1322
- _context9.n = 20;
1273
+ _context7.n = 20;
1323
1274
  break;
1324
1275
  }
1325
- return _context9.a(2, {
1276
+ return _context7.a(2, {
1326
1277
  success: true,
1327
1278
  fee: xcmFee,
1328
1279
  asset: resolvedFeeAsset.asset,
@@ -1336,13 +1287,13 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1336
1287
  asset: this.resolveDefaultFeeAsset(options)
1337
1288
  };
1338
1289
  case 21:
1339
- _context9.n = 22;
1290
+ _context7.n = 22;
1340
1291
  return this.getPaymentInfo(tx, address);
1341
1292
  case 22:
1342
- _yield$this$getPaymen = _context9.v;
1293
+ _yield$this$getPaymen = _context7.v;
1343
1294
  executionFee = _yield$this$getPaymen.partialFee;
1344
1295
  fee = computeOriginFee(result, chain, executionFee);
1345
- return _context9.a(2, {
1296
+ return _context7.a(2, {
1346
1297
  success: true,
1347
1298
  fee: fee,
1348
1299
  asset: resolvedFeeAsset.asset,
@@ -1351,9 +1302,9 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1351
1302
  destParaId: destParaId
1352
1303
  });
1353
1304
  }
1354
- }, _callee9, this, [[11, 13], [6, 8]]);
1305
+ }, _callee7, this, [[11, 13], [6, 8]]);
1355
1306
  }));
1356
- function getDryRunCall(_x12) {
1307
+ function getDryRunCall(_x0) {
1357
1308
  return _getDryRunCall.apply(this, arguments);
1358
1309
  }
1359
1310
  return getDryRunCall;
@@ -1361,8 +1312,8 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1361
1312
  }, {
1362
1313
  key: "getXcmPaymentApiFee",
1363
1314
  value: function () {
1364
- var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(chain, localXcm, forwardedXcm, asset, version) {
1365
- var _this4 = this,
1315
+ var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(chain, localXcm, forwardedXcm, asset, version) {
1316
+ var _this3 = this,
1366
1317
  _execFeeRes$value;
1367
1318
  var transformXcm,
1368
1319
  overridenWeight,
@@ -1376,75 +1327,75 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1376
1327
  execFee,
1377
1328
  bridgeHubExecFee,
1378
1329
  deliveryFee,
1379
- _args9 = arguments,
1330
+ _args7 = arguments,
1380
1331
  _t5;
1381
- return _regenerator().w(function (_context1) {
1382
- while (1) switch (_context1.n) {
1332
+ return _regenerator().w(function (_context9) {
1333
+ while (1) switch (_context9.n) {
1383
1334
  case 0:
1384
- transformXcm = _args9.length > 5 && _args9[5] !== undefined ? _args9[5] : false;
1385
- overridenWeight = _args9.length > 6 ? _args9[6] : undefined;
1335
+ transformXcm = _args7.length > 5 && _args7[5] !== undefined ? _args7[5] : false;
1336
+ overridenWeight = _args7.length > 6 ? _args7[6] : undefined;
1386
1337
  transformedXcm = transformXcm ? _transform(localXcm) : localXcm;
1387
1338
  queryWeight = /*#__PURE__*/function () {
1388
- var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
1339
+ var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
1389
1340
  var weightRes;
1390
- return _regenerator().w(function (_context0) {
1391
- while (1) switch (_context0.n) {
1341
+ return _regenerator().w(function (_context8) {
1342
+ while (1) switch (_context8.n) {
1392
1343
  case 0:
1393
- _context0.n = 1;
1394
- return _this4.api.call.xcmPaymentApi.queryXcmWeight(transformedXcm);
1344
+ _context8.n = 1;
1345
+ return _this3.api.call.xcmPaymentApi.queryXcmWeight(transformedXcm);
1395
1346
  case 1:
1396
- weightRes = _context0.v;
1397
- return _context0.a(2, weightRes.value);
1347
+ weightRes = _context8.v;
1348
+ return _context8.a(2, weightRes.value);
1398
1349
  }
1399
- }, _callee0);
1350
+ }, _callee8);
1400
1351
  }));
1401
1352
  return function queryWeight() {
1402
1353
  return _ref1.apply(this, arguments);
1403
1354
  };
1404
1355
  }();
1405
1356
  if (!overridenWeight) {
1406
- _context1.n = 1;
1357
+ _context9.n = 1;
1407
1358
  break;
1408
1359
  }
1409
1360
  _t5 = overridenWeight;
1410
- _context1.n = 3;
1361
+ _context9.n = 3;
1411
1362
  break;
1412
1363
  case 1:
1413
- _context1.n = 2;
1364
+ _context9.n = 2;
1414
1365
  return queryWeight();
1415
1366
  case 2:
1416
- _t5 = _context1.v;
1367
+ _t5 = _context9.v;
1417
1368
  case 3:
1418
1369
  weight = _t5;
1419
1370
  assetLocalizedLoc = localizeLocation(chain, asset.location);
1420
1371
  assetId = createAssetId(version, assetLocalizedLoc);
1421
1372
  transformedAssetId = _transform(addXcmVersionHeader(assetId, version));
1422
- _context1.n = 4;
1373
+ _context9.n = 4;
1423
1374
  return this.api.call.xcmPaymentApi.queryWeightToAssetFee(weight, transformedAssetId);
1424
1375
  case 4:
1425
- execFeeRes = _context1.v;
1376
+ execFeeRes = _context9.v;
1426
1377
  execFee = typeof (execFeeRes === null || execFeeRes === void 0 ? void 0 : execFeeRes.value) === "bigint" ? execFeeRes.value : 0n;
1427
1378
  if (!(chain.startsWith("BridgeHub") && (execFeeRes === null || execFeeRes === void 0 ? void 0 : execFeeRes.success) === false && (execFeeRes === null || execFeeRes === void 0 || (_execFeeRes$value = execFeeRes.value) === null || _execFeeRes$value === void 0 ? void 0 : _execFeeRes$value.type) === "AssetNotFound")) {
1428
- _context1.n = 6;
1379
+ _context9.n = 6;
1429
1380
  break;
1430
1381
  }
1431
- _context1.n = 5;
1382
+ _context9.n = 5;
1432
1383
  return this.getBridgeHubFallbackExecFee(chain, weight, asset, version);
1433
1384
  case 5:
1434
- bridgeHubExecFee = _context1.v;
1385
+ bridgeHubExecFee = _context9.v;
1435
1386
  if (typeof bridgeHubExecFee === "bigint") {
1436
1387
  execFee = bridgeHubExecFee;
1437
1388
  }
1438
1389
  case 6:
1439
- _context1.n = 7;
1390
+ _context9.n = 7;
1440
1391
  return this.getDeliveryFee(chain, forwardedXcm, asset, assetLocalizedLoc, version);
1441
1392
  case 7:
1442
- deliveryFee = _context1.v;
1443
- return _context1.a(2, execFee + deliveryFee);
1393
+ deliveryFee = _context9.v;
1394
+ return _context9.a(2, execFee + deliveryFee);
1444
1395
  }
1445
- }, _callee1, this);
1396
+ }, _callee9, this);
1446
1397
  }));
1447
- function getXcmPaymentApiFee(_x13, _x14, _x15, _x16, _x17) {
1398
+ function getXcmPaymentApiFee(_x1, _x10, _x11, _x12, _x13) {
1448
1399
  return _getXcmPaymentApiFee.apply(this, arguments);
1449
1400
  }
1450
1401
  return getXcmPaymentApiFee;
@@ -1452,41 +1403,41 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1452
1403
  }, {
1453
1404
  key: "getDeliveryFee",
1454
1405
  value: function () {
1455
- var _getDeliveryFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(chain, forwardedXcm, asset, assetLocalizedLoc, version) {
1406
+ var _getDeliveryFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(chain, forwardedXcm, asset, assetLocalizedLoc, version) {
1456
1407
  var _deliveryFeeRes, _assets$0$fun$value, _assets$;
1457
1408
  var usedThirdParam, deliveryFeeRes, baseArgs, _this$api$call$xcmPay, message, _this$api$call$xcmPay2, assetId, versionedAssetLoc, assets, deliveryFeeResolved, nativeAsset, res, _t6;
1458
- return _regenerator().w(function (_context10) {
1459
- while (1) switch (_context10.p = _context10.n) {
1409
+ return _regenerator().w(function (_context0) {
1410
+ while (1) switch (_context0.p = _context0.n) {
1460
1411
  case 0:
1461
1412
  usedThirdParam = false;
1462
1413
  if (!(forwardedXcm.length > 0)) {
1463
- _context10.n = 6;
1414
+ _context0.n = 6;
1464
1415
  break;
1465
1416
  }
1466
1417
  baseArgs = [forwardedXcm[0], forwardedXcm[1][0]];
1467
- _context10.p = 1;
1468
- _context10.n = 2;
1418
+ _context0.p = 1;
1419
+ _context0.n = 2;
1469
1420
  return (_this$api$call$xcmPay = this.api.call.xcmPaymentApi).queryDeliveryFees.apply(_this$api$call$xcmPay, baseArgs);
1470
1421
  case 2:
1471
- deliveryFeeRes = _context10.v;
1472
- _context10.n = 6;
1422
+ deliveryFeeRes = _context0.v;
1423
+ _context0.n = 6;
1473
1424
  break;
1474
1425
  case 3:
1475
- _context10.p = 3;
1476
- _t6 = _context10.v;
1426
+ _context0.p = 3;
1427
+ _t6 = _context0.v;
1477
1428
  message = _t6 instanceof Error ? _t6.message : String(_t6);
1478
1429
  if (!message.includes("Expected 3 parameters")) {
1479
- _context10.n = 5;
1430
+ _context0.n = 5;
1480
1431
  break;
1481
1432
  }
1482
1433
  usedThirdParam = true;
1483
1434
  assetId = createAssetId(version, assetLocalizedLoc);
1484
1435
  versionedAssetLoc = _transform(addXcmVersionHeader(assetId, version));
1485
- _context10.n = 4;
1436
+ _context0.n = 4;
1486
1437
  return (_this$api$call$xcmPay2 = this.api.call.xcmPaymentApi).queryDeliveryFees.apply(_this$api$call$xcmPay2, baseArgs.concat([versionedAssetLoc]));
1487
1438
  case 4:
1488
- deliveryFeeRes = _context10.v;
1489
- _context10.n = 6;
1439
+ deliveryFeeRes = _context0.v;
1440
+ _context0.n = 6;
1490
1441
  break;
1491
1442
  case 5:
1492
1443
  throw _t6;
@@ -1495,25 +1446,29 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1495
1446
  deliveryFeeResolved = deliveryFeeRes && (assets === null || assets === void 0 ? void 0 : assets.length) > 0 ? (_assets$0$fun$value = (_assets$ = assets[0]) === null || _assets$ === void 0 || (_assets$ = _assets$.fun) === null || _assets$ === void 0 ? void 0 : _assets$.value) !== null && _assets$0$fun$value !== void 0 ? _assets$0$fun$value : 0n : 0n;
1496
1447
  nativeAsset = findNativeAssetInfoOrThrow(chain);
1497
1448
  if (!(isAssetXcEqual(asset, nativeAsset) || usedThirdParam)) {
1498
- _context10.n = 7;
1449
+ _context0.n = 7;
1499
1450
  break;
1500
1451
  }
1501
- return _context10.a(2, deliveryFeeResolved);
1452
+ return _context0.a(2, deliveryFeeResolved);
1502
1453
  case 7:
1503
- _context10.p = 7;
1504
- _context10.n = 8;
1505
- return this.quoteAhPrice(localizeLocation(chain, nativeAsset.location), assetLocalizedLoc, deliveryFeeResolved, false);
1454
+ _context0.p = 7;
1455
+ _context0.n = 8;
1456
+ return this.queryRuntimeApi({
1457
+ module: "AssetConversionApi",
1458
+ method: "quote_price_exact_tokens_for_tokens",
1459
+ params: [localizeLocation(chain, nativeAsset.location), assetLocalizedLoc, deliveryFeeResolved, false]
1460
+ });
1506
1461
  case 8:
1507
- res = _context10.v;
1508
- return _context10.a(2, res !== null && res !== void 0 ? res : 0n);
1462
+ res = _context0.v;
1463
+ return _context0.a(2, res !== null && res !== void 0 ? res : 0n);
1509
1464
  case 9:
1510
- _context10.p = 9;
1511
- _context10.v;
1512
- return _context10.a(2, 0n);
1465
+ _context0.p = 9;
1466
+ _context0.v;
1467
+ return _context0.a(2, 0n);
1513
1468
  }
1514
- }, _callee10, this, [[7, 9], [1, 3]]);
1469
+ }, _callee0, this, [[7, 9], [1, 3]]);
1515
1470
  }));
1516
- function getDeliveryFee(_x18, _x19, _x20, _x21, _x22) {
1471
+ function getDeliveryFee(_x14, _x15, _x16, _x17, _x18) {
1517
1472
  return _getDeliveryFee.apply(this, arguments);
1518
1473
  }
1519
1474
  return getDeliveryFee;
@@ -1521,44 +1476,48 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1521
1476
  }, {
1522
1477
  key: "getBridgeHubFallbackExecFee",
1523
1478
  value: function () {
1524
- var _getBridgeHubFallbackExecFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(chain, weightValue, asset, version) {
1479
+ var _getBridgeHubFallbackExecFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(chain, weightValue, asset, version) {
1525
1480
  var fallbackExecFeeRes, fallbackOk, fallbackExecFee, ahApi, assetHubChain, ahLocalizedLoc, convertedExecFee;
1526
- return _regenerator().w(function (_context11) {
1527
- while (1) switch (_context11.n) {
1481
+ return _regenerator().w(function (_context1) {
1482
+ while (1) switch (_context1.n) {
1528
1483
  case 0:
1529
- _context11.n = 1;
1484
+ _context1.n = 1;
1530
1485
  return this.api.call.xcmPaymentApi.queryWeightToAssetFee(weightValue, addXcmVersionHeader(RELAY_LOCATION, version));
1531
1486
  case 1:
1532
- fallbackExecFeeRes = _context11.v;
1487
+ fallbackExecFeeRes = _context1.v;
1533
1488
  fallbackOk = fallbackExecFeeRes === null || fallbackExecFeeRes === void 0 ? void 0 : fallbackExecFeeRes.value;
1534
1489
  fallbackExecFee = typeof fallbackOk === "bigint" ? fallbackOk : typeof fallbackOk === "string" || typeof fallbackOk === "number" ? BigInt(fallbackOk) : undefined;
1535
1490
  if (!(fallbackExecFee === undefined)) {
1536
- _context11.n = 2;
1491
+ _context1.n = 2;
1537
1492
  break;
1538
1493
  }
1539
- return _context11.a(2, undefined);
1494
+ return _context1.a(2, undefined);
1540
1495
  case 2:
1541
1496
  ahApi = this.clone();
1542
1497
  assetHubChain = "AssetHub".concat(getRelayChainOf(chain));
1543
- _context11.n = 3;
1498
+ _context1.n = 3;
1544
1499
  return ahApi.init(assetHubChain);
1545
1500
  case 3:
1546
1501
  ahLocalizedLoc = localizeLocation(assetHubChain, asset.location);
1547
- _context11.n = 4;
1548
- return ahApi.quoteAhPrice(RELAY_LOCATION, ahLocalizedLoc, fallbackExecFee, false);
1502
+ _context1.n = 4;
1503
+ return ahApi.queryRuntimeApi({
1504
+ module: "AssetConversionApi",
1505
+ method: "quote_price_exact_tokens_for_tokens",
1506
+ params: [RELAY_LOCATION, ahLocalizedLoc, fallbackExecFee, false]
1507
+ });
1549
1508
  case 4:
1550
- convertedExecFee = _context11.v;
1509
+ convertedExecFee = _context1.v;
1551
1510
  if (!(typeof convertedExecFee === "bigint")) {
1552
- _context11.n = 5;
1511
+ _context1.n = 5;
1553
1512
  break;
1554
1513
  }
1555
- return _context11.a(2, convertedExecFee);
1514
+ return _context1.a(2, convertedExecFee);
1556
1515
  case 5:
1557
- return _context11.a(2, undefined);
1516
+ return _context1.a(2, undefined);
1558
1517
  }
1559
- }, _callee11, this);
1518
+ }, _callee1, this);
1560
1519
  }));
1561
- function getBridgeHubFallbackExecFee(_x23, _x24, _x25, _x26) {
1520
+ function getBridgeHubFallbackExecFee(_x19, _x20, _x21, _x22) {
1562
1521
  return _getBridgeHubFallbackExecFee.apply(this, arguments);
1563
1522
  }
1564
1523
  return getBridgeHubFallbackExecFee;
@@ -1566,25 +1525,25 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1566
1525
  }, {
1567
1526
  key: "getXcmWeight",
1568
1527
  value: function () {
1569
- var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(xcm) {
1528
+ var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(xcm) {
1570
1529
  var _okValue$refTime, _okValue$proofSize;
1571
1530
  var result, okValue;
1572
- return _regenerator().w(function (_context12) {
1573
- while (1) switch (_context12.n) {
1531
+ return _regenerator().w(function (_context10) {
1532
+ while (1) switch (_context10.n) {
1574
1533
  case 0:
1575
- _context12.n = 1;
1534
+ _context10.n = 1;
1576
1535
  return this.api.call.xcmPaymentApi.queryXcmWeight(!xcm.type ? _transform(xcm) : xcm);
1577
1536
  case 1:
1578
- result = _context12.v;
1537
+ result = _context10.v;
1579
1538
  okValue = result === null || result === void 0 ? void 0 : result.value;
1580
- return _context12.a(2, {
1539
+ return _context10.a(2, {
1581
1540
  refTime: BigInt((_okValue$refTime = okValue === null || okValue === void 0 ? void 0 : okValue.refTime) !== null && _okValue$refTime !== void 0 ? _okValue$refTime : 0),
1582
1541
  proofSize: BigInt((_okValue$proofSize = okValue === null || okValue === void 0 ? void 0 : okValue.proofSize) !== null && _okValue$proofSize !== void 0 ? _okValue$proofSize : 0)
1583
1542
  });
1584
1543
  }
1585
- }, _callee12, this);
1544
+ }, _callee10, this);
1586
1545
  }));
1587
- function getXcmWeight(_x27) {
1546
+ function getXcmWeight(_x23) {
1588
1547
  return _getXcmWeight.apply(this, arguments);
1589
1548
  }
1590
1549
  return getXcmWeight;
@@ -1600,32 +1559,32 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1600
1559
  }, {
1601
1560
  key: "getDryRunXcm",
1602
1561
  value: function () {
1603
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(_ref10) {
1562
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(_ref10) {
1604
1563
  var _result$value5;
1605
1564
  var originLocation, xcm, asset, chain, version, _getAssetsObject2, supportsDryRunApi, transformedOriginLocation, result, executionResult, isSuccess, actualWeight, weight, forwardedXcms, destParaId, fee;
1606
- return _regenerator().w(function (_context13) {
1607
- while (1) switch (_context13.n) {
1565
+ return _regenerator().w(function (_context11) {
1566
+ while (1) switch (_context11.n) {
1608
1567
  case 0:
1609
1568
  originLocation = _ref10.originLocation, xcm = _ref10.xcm, asset = _ref10.asset, chain = _ref10.chain, version = _ref10.version;
1610
1569
  _getAssetsObject2 = getAssetsObject(chain), supportsDryRunApi = _getAssetsObject2.supportsDryRunApi;
1611
1570
  if (supportsDryRunApi) {
1612
- _context13.n = 1;
1571
+ _context11.n = 1;
1613
1572
  break;
1614
1573
  }
1615
1574
  throw new RuntimeApiUnavailableError(chain, "DryRunApi");
1616
1575
  case 1:
1617
1576
  transformedOriginLocation = _transform(originLocation);
1618
- _context13.n = 2;
1577
+ _context11.n = 2;
1619
1578
  return this.api.call.dryRunApi.dryRunXcm(transformedOriginLocation, xcm);
1620
1579
  case 2:
1621
- result = _context13.v;
1580
+ result = _context11.v;
1622
1581
  executionResult = result === null || result === void 0 || (_result$value5 = result.value) === null || _result$value5 === void 0 ? void 0 : _result$value5.executionResult;
1623
1582
  isSuccess = result.isOk && executionResult.type === "Complete";
1624
1583
  if (isSuccess) {
1625
- _context13.n = 3;
1584
+ _context11.n = 3;
1626
1585
  break;
1627
1586
  }
1628
- return _context13.a(2, {
1587
+ return _context11.a(2, {
1629
1588
  success: false,
1630
1589
  failureReason: extractDryRunXcmFailureReason(result),
1631
1590
  asset: asset
@@ -1636,24 +1595,24 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1636
1595
  forwardedXcms = result.value.forwardedXcms.length > 0 ? result.value.forwardedXcms[0] : [];
1637
1596
  destParaId = this.extractDestParaId(forwardedXcms);
1638
1597
  if (!hasXcmPaymentApiSupport(chain)) {
1639
- _context13.n = 6;
1598
+ _context11.n = 6;
1640
1599
  break;
1641
1600
  }
1642
- _context13.n = 4;
1601
+ _context11.n = 4;
1643
1602
  return this.getXcmPaymentApiFee(chain, xcm, forwardedXcms, asset, version);
1644
1603
  case 4:
1645
- fee = _context13.v;
1604
+ fee = _context11.v;
1646
1605
  if (!(typeof fee !== "bigint")) {
1647
- _context13.n = 5;
1606
+ _context11.n = 5;
1648
1607
  break;
1649
1608
  }
1650
- return _context13.a(2, {
1609
+ return _context11.a(2, {
1651
1610
  success: false,
1652
1611
  failureReason: "Failed to retrieve fee from XcmPaymentApi",
1653
1612
  asset: asset
1654
1613
  });
1655
1614
  case 5:
1656
- return _context13.a(2, {
1615
+ return _context11.a(2, {
1657
1616
  success: true,
1658
1617
  fee: fee,
1659
1618
  asset: asset,
@@ -1662,15 +1621,15 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1662
1621
  destParaId: destParaId
1663
1622
  });
1664
1623
  case 6:
1665
- return _context13.a(2, {
1624
+ return _context11.a(2, {
1666
1625
  success: false,
1667
1626
  failureReason: "Cannot determine destination fee. XcmPaymentApi is not supported by this chain",
1668
1627
  asset: asset
1669
1628
  });
1670
1629
  }
1671
- }, _callee13, this);
1630
+ }, _callee11, this);
1672
1631
  }));
1673
- function getDryRunXcm(_x28) {
1632
+ function getDryRunXcm(_x24) {
1674
1633
  return _getDryRunXcm.apply(this, arguments);
1675
1634
  }
1676
1635
  return getDryRunXcm;
@@ -1678,18 +1637,18 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1678
1637
  }, {
1679
1638
  key: "getBridgeStatus",
1680
1639
  value: function () {
1681
- var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
1640
+ var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
1682
1641
  var outboundOperatingMode;
1683
- return _regenerator().w(function (_context14) {
1684
- while (1) switch (_context14.n) {
1642
+ return _regenerator().w(function (_context12) {
1643
+ while (1) switch (_context12.n) {
1685
1644
  case 0:
1686
- _context14.n = 1;
1645
+ _context12.n = 1;
1687
1646
  return this.api.query.ethereumOutboundQueue.operatingMode();
1688
1647
  case 1:
1689
- outboundOperatingMode = _context14.v;
1690
- return _context14.a(2, outboundOperatingMode);
1648
+ outboundOperatingMode = _context12.v;
1649
+ return _context12.a(2, outboundOperatingMode);
1691
1650
  }
1692
- }, _callee14, this);
1651
+ }, _callee12, this);
1693
1652
  }));
1694
1653
  function getBridgeStatus() {
1695
1654
  return _getBridgeStatus.apply(this, arguments);
@@ -1740,20 +1699,20 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1740
1699
  }, {
1741
1700
  key: "signAndSubmit",
1742
1701
  value: function () {
1743
- var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(tx, sender) {
1702
+ var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(tx, sender) {
1744
1703
  var account;
1745
- return _regenerator().w(function (_context15) {
1746
- while (1) switch (_context15.n) {
1704
+ return _regenerator().w(function (_context13) {
1705
+ while (1) switch (_context13.n) {
1747
1706
  case 0:
1748
1707
  account = isSenderSigner(sender) ? sender : createKeyringPair(sender);
1749
- _context15.n = 1;
1708
+ _context13.n = 1;
1750
1709
  return tx.signAndSend(account);
1751
1710
  case 1:
1752
- return _context15.a(2, _context15.v);
1711
+ return _context13.a(2, _context13.v);
1753
1712
  }
1754
- }, _callee15);
1713
+ }, _callee13);
1755
1714
  }));
1756
- function signAndSubmit(_x29, _x30) {
1715
+ function signAndSubmit(_x25, _x26) {
1757
1716
  return _signAndSubmit.apply(this, arguments);
1758
1717
  }
1759
1718
  return signAndSubmit;
@@ -1761,21 +1720,21 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
1761
1720
  }, {
1762
1721
  key: "signAndSubmitFinalized",
1763
1722
  value: function () {
1764
- var _signAndSubmitFinalized = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(tx, sender) {
1723
+ var _signAndSubmitFinalized = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(tx, sender) {
1765
1724
  var account, result;
1766
- return _regenerator().w(function (_context16) {
1767
- while (1) switch (_context16.n) {
1725
+ return _regenerator().w(function (_context14) {
1726
+ while (1) switch (_context14.n) {
1768
1727
  case 0:
1769
1728
  account = isSenderSigner(sender) ? sender : createKeyringPair(sender);
1770
- _context16.n = 1;
1729
+ _context14.n = 1;
1771
1730
  return tx.signAndSend(account).untilFinalized();
1772
1731
  case 1:
1773
- result = _context16.v;
1774
- return _context16.a(2, result.txHash);
1732
+ result = _context14.v;
1733
+ return _context14.a(2, result.txHash);
1775
1734
  }
1776
- }, _callee16);
1735
+ }, _callee14);
1777
1736
  }));
1778
- function signAndSubmitFinalized(_x31, _x32) {
1737
+ function signAndSubmitFinalized(_x27, _x28) {
1779
1738
  return _signAndSubmitFinalized.apply(this, arguments);
1780
1739
  }
1781
1740
  return signAndSubmitFinalized;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-dedot",
3
- "version": "13.2.2",
3
+ "version": "13.4.0",
4
4
  "description": "Dedot-based SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,21 +12,20 @@
12
12
  "exports": {
13
13
  ".": {
14
14
  "types": "./dist/index.d.ts",
15
- "import": "./dist/index.mjs",
16
- "require": "./dist/index.cjs"
15
+ "import": "./dist/index.mjs"
17
16
  }
18
17
  },
19
- "main": "dist/index.cjs",
18
+ "main": "dist/index.mjs",
20
19
  "module": "dist/index.mjs",
21
20
  "types": "dist/index.d.ts",
22
21
  "files": [
23
22
  "dist"
24
23
  ],
25
24
  "dependencies": {
26
- "@paraspell/sdk-core": "13.2.2"
25
+ "@paraspell/sdk-core": "13.4.0"
27
26
  },
28
27
  "peerDependencies": {
29
- "dedot": ">= 1.2.0",
28
+ "dedot": ">= 1.3.0",
30
29
  "@polkadot/keyring": ">= 13"
31
30
  },
32
31
  "devDependencies": {