@paraspell/sdk 13.10.1 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,7 +33,7 @@ ParaSpell XCM SDK is the 🥇 in the ecosystem to support **PolkadotJS**, **Dedo
33
33
 
34
34
  ```bash
35
35
  #Polkadot API peer dependencies
36
- npm install | pnpm add | yarn add polkadot-api
36
+ npm install | pnpm add | yarn add polkadot-api @paraspell/descriptors
37
37
  ```
38
38
 
39
39
  ### Install SDK
@@ -127,10 +127,7 @@ import * as paraspell from '@paraspell/sdk'
127
127
 
128
128
  > [!NOTE]
129
129
  > **Latest news:**
130
- > - V12 > V13 Migration guide: https://paraspell.github.io/docs/migration/v12-to-v13.html
131
- > - Swap extension is now available on every XCM SDK version: https://paraspell.github.io/docs/xcm-sdk/getting-started.html#install-swap-extension
132
- > - EVM extension is now available: https://paraspell.github.io/docs/xcm-sdk/getting-started.html#install-evm-extension
133
- > - Snowbridge extension is now available: https://paraspell.github.io/docs/xcm-sdk/getting-started.html#install-snowbridge-extension
130
+ > - V13 > V14 Migration guide: https://paraspell.github.io/docs/migration/v13-to-v14.html
134
131
 
135
132
 
136
133
 
@@ -345,7 +342,7 @@ SDK features ability to add custom chain and/or custom assets simply by adding i
345
342
  {
346
343
  symbol: 'USDC',
347
344
  decimals: 6,
348
- existentialDeposit: 0.1,
345
+ existentialDeposit: 100000000, //Needs to be in plancks
349
346
  location: {
350
347
  parents: 1,
351
348
  interior: { X3: [{ Parachain: 1000 }, { PalletInstance: 50 }, {
@@ -364,7 +361,7 @@ SDK features ability to add custom chain and/or custom assets simply by adding i
364
361
  symbol: 'MYNEWUSD',
365
362
  decimals: 6,
366
363
  assetId: '9999',
367
- existentialDeposit: 0.1,
364
+ existentialDeposit: 100000000, //Needs to be in plancks
368
365
  location: {
369
366
  parents: 0,
370
367
  interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: 9999 }] }
@@ -375,7 +372,7 @@ SDK features ability to add custom chain and/or custom assets simply by adding i
375
372
  symbol: 'USDT',
376
373
  decimals: 6,
377
374
  assetId: '1984',
378
- existentialDeposit: 0.1,
375
+ existentialDeposit: 100000000, //Needs to be in plancks
379
376
  location: {
380
377
  parents: 0,
381
378
  interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: 1984 }] }
package/dist/index.d.ts CHANGED
@@ -1,14 +1,13 @@
1
1
  import * as _paraspell_sdk_core from '@paraspell/sdk-core';
2
- import { TChain, TSwapEvent as TSwapEvent$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TEvmTransferOptions, TCurrencyInputWithAmount, TBuilderOptions, TApiOrUrl, GeneralBuilder as GeneralBuilder$1, TCustomChainFrom, TTransferBaseOptions, TCustomChainInput, TChainAssetsInfo, TGetXcmFeeBaseOptions, TCreateBaseSwapXcmOptions } from '@paraspell/sdk-core';
2
+ import { TSwapEvent as TSwapEvent$1, Foreign, ForeignAbstract, Native, findAssetInfo, getAllAssetsSymbols, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, isChainEvm, TSubstrateChain, TBuilderOptions, TApiOrUrl, GeneralBuilder as GeneralBuilder$1, TCustomChainFrom, TTransferBaseOptions, TCustomChainInput, TChainAssetsInfo, TGetXcmFeeBaseOptions, TCreateBaseSwapXcmOptions } from '@paraspell/sdk-core';
3
3
  export * from '@paraspell/sdk-core';
4
4
  import * as polkadot_api from 'polkadot-api';
5
5
  import { PolkadotClient, Transaction, PolkadotSigner } from 'polkadot-api';
6
- import { WalletClient } from 'viem';
6
+ import * as _paraspell_descriptors from '@paraspell/descriptors';
7
7
 
8
8
  type TPapiApi = PolkadotClient;
9
9
  type TPapiSigner = PolkadotSigner;
10
10
  type TPapiTransaction = Transaction<any, any>;
11
- type TEvmChainFrom = Extract<TChain, 'Moonbeam' | 'Moonriver' | 'Darwinia'>;
12
11
  type TSwapEvent = TSwapEvent$1<TPapiApi, TPapiTransaction>;
13
12
 
14
13
  /**
@@ -25,11 +24,8 @@ declare const getBalance: (options: _paraspell_sdk_core.TGetBalanceCommonOptions
25
24
  declare const assets_Foreign: typeof Foreign;
26
25
  declare const assets_ForeignAbstract: typeof ForeignAbstract;
27
26
  declare const assets_Native: typeof Native;
28
- declare const assets_Override: typeof Override;
29
27
  declare const assets_findAssetInfo: typeof findAssetInfo;
30
28
  declare const assets_getAllAssetsSymbols: typeof getAllAssetsSymbols;
31
- declare const assets_getAssetDecimals: typeof getAssetDecimals;
32
- declare const assets_getAssetId: typeof getAssetId;
33
29
  declare const assets_getAssets: typeof getAssets;
34
30
  declare const assets_getAssetsObject: typeof getAssetsObject;
35
31
  declare const assets_getBalance: typeof getBalance;
@@ -40,18 +36,14 @@ declare const assets_getOtherAssets: typeof getOtherAssets;
40
36
  declare const assets_getRelayChainSymbol: typeof getRelayChainSymbol;
41
37
  declare const assets_getSupportedAssets: typeof getSupportedAssets;
42
38
  declare const assets_getTChain: typeof getTChain;
43
- declare const assets_hasSupportForAsset: typeof hasSupportForAsset;
44
39
  declare const assets_isChainEvm: typeof isChainEvm;
45
40
  declare namespace assets {
46
41
  export {
47
42
  assets_Foreign as Foreign,
48
43
  assets_ForeignAbstract as ForeignAbstract,
49
44
  assets_Native as Native,
50
- assets_Override as Override,
51
45
  assets_findAssetInfo as findAssetInfo,
52
46
  assets_getAllAssetsSymbols as getAllAssetsSymbols,
53
- assets_getAssetDecimals as getAssetDecimals,
54
- assets_getAssetId as getAssetId,
55
47
  assets_getAssets as getAssets,
56
48
  assets_getAssetsObject as getAssetsObject,
57
49
  assets_getBalance as getBalance,
@@ -62,77 +54,12 @@ declare namespace assets {
62
54
  assets_getRelayChainSymbol as getRelayChainSymbol,
63
55
  assets_getSupportedAssets as getSupportedAssets,
64
56
  assets_getTChain as getTChain,
65
- assets_hasSupportForAsset as hasSupportForAsset,
66
57
  assets_isChainEvm as isChainEvm,
67
58
  };
68
59
  }
69
60
 
70
61
  declare const convertSs58: (address: string, chain: TSubstrateChain) => string;
71
62
 
72
- /**
73
- * Builder class for constructing transfers from Ethereum to Polkadot.
74
- *
75
- * @deprecated EvmBuilder is deprecated. Please use the Builder class instead.
76
- */
77
- declare class EvmBuilderCore<TApi, TRes, TSigner, T extends Partial<TEvmTransferOptions<TApi, TRes, TSigner>> = object> {
78
- protected readonly _options: T;
79
- constructor(options: T);
80
- from(chain: TEvmChainFrom): EvmBuilderCore<TApi, TRes, TSigner, T & {
81
- from: TEvmChainFrom;
82
- }>;
83
- /**
84
- * Specifies the destination chain on Polkadot.
85
- *
86
- * @param chain - The Polkadot chain to which the transfer will be made.
87
- * @returns An instance of EvmBuilder
88
- */
89
- to(chain: TChain): EvmBuilderCore<TApi, TRes, TSigner, T & {
90
- to: TChain;
91
- }>;
92
- /**
93
- * Specifies the currency to transfer.
94
- *
95
- * @param currency - The currency to be transferred.
96
- * @returns An instance of EvmBuilder
97
- */
98
- currency(currency: TCurrencyInputWithAmount): EvmBuilderCore<TApi, TRes, TSigner, T & {
99
- currency: TCurrencyInputWithAmount;
100
- }>;
101
- /**
102
- * Specifies the recipient address on Polkadot.
103
- *
104
- * @param address - The Polkadot address to receive the transfer.
105
- * @returns An instance of EvmBuilder
106
- */
107
- recipient(address: string): EvmBuilderCore<TApi, TRes, TSigner, T & {
108
- recipient: string;
109
- }>;
110
- /**
111
- * Sets the asset hub address. This is used for transfers that go through the Asset Hub.
112
- *
113
- * @param address - The address to be used.
114
- * @returns An instance of EvmBuilder
115
- */
116
- ahAddress(address: string | undefined): EvmBuilderCore<unknown, unknown, unknown, T & {
117
- ahAddress: string | undefined;
118
- }>;
119
- /**
120
- * Specifies the signer for the Ethereum transaction.
121
- *
122
- * @param signer - The Ethereum signer to authorize the transfer.
123
- * @returns An instance of EvmBuilder
124
- */
125
- signer(signer: WalletClient): EvmBuilderCore<TApi, TRes, TSigner, T & {
126
- signer: WalletClient;
127
- }>;
128
- /**
129
- * Builds and executes the transfer from Ethereum to Polkadot.
130
- *
131
- * @throws Error if any required parameters are missing.
132
- */
133
- build(this: EvmBuilderCore<TApi, TRes, TSigner, TEvmTransferOptions<TApi, TRes, TSigner>>): Promise<string>;
134
- }
135
-
136
63
  /**
137
64
  * Creates a new Builder instance.
138
65
  *
@@ -141,23 +68,12 @@ declare class EvmBuilderCore<TApi, TRes, TSigner, T extends Partial<TEvmTransfer
141
68
  */
142
69
  declare const Builder: <const TOpts extends TBuilderOptions<TApiOrUrl<TPapiApi>>>(options?: TOpts) => GeneralBuilder$1<PolkadotClient, TPapiTransaction, PolkadotSigner, object, TCustomChainFrom<TOpts>>;
143
70
  type GeneralBuilder<T extends Partial<TTransferBaseOptions<TPapiApi, TPapiTransaction, TPapiSigner>> = object, TCustomChain extends string = never> = GeneralBuilder$1<PolkadotClient, TPapiTransaction, PolkadotSigner, T, TCustomChain>;
144
- /** @deprecated EvmBuilder is deprecated. Please use the Builder class instead. */
145
- declare const EvmBuilder: (api?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => EvmBuilderCore<unknown, unknown, unknown, {
146
- api: _paraspell_sdk_core.PolkadotApi<PolkadotClient, polkadot_api.Transaction<any, Record<string, {
147
- value: any;
148
- additionalSigned: any;
149
- } | {
150
- value: any;
151
- } | {
152
- additionalSigned: any;
153
- }> | Partial<any>>, any, never>;
154
- }>;
155
71
 
156
72
  declare const hydrateCustomChain: <TCustomChain extends string>(name: TCustomChain, input: TCustomChainInput) => Promise<TChainAssetsInfo>;
157
73
 
158
74
  declare const dryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<TPapiTransaction, never> & {
159
75
  api?: TApiOrUrl<TPapiApi>;
160
- }) => Promise<_paraspell_sdk_core.TDryRunResult>;
76
+ }) => Promise<_paraspell_sdk_core.TDryRunResult<never>>;
161
77
  declare const dryRunOrigin: (options: _paraspell_sdk_core.TDryRunCallBaseOptions<TPapiTransaction, never> & {
162
78
  api?: TApiOrUrl<TPapiApi>;
163
79
  }) => Promise<_paraspell_sdk_core.TDryRunChainResult>;
@@ -169,15 +85,11 @@ declare const getBridgeStatus: (ahApi?: TApiOrUrl<TPapiApi>) => Promise<_paraspe
169
85
  declare const getOriginXcmFee: (options: _paraspell_sdk_core.TGetOriginXcmFeeBaseOptions<TPapiTransaction, boolean, never> & {
170
86
  api?: TApiOrUrl<TPapiApi>;
171
87
  }) => Promise<_paraspell_sdk_core.TXcmFeeDetailWithForwardedXcm<boolean>>;
172
- declare const getXcmFee: <TDisableFallback extends boolean>(options: TGetXcmFeeBaseOptions<TPapiTransaction, TDisableFallback>, builderOptions?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<_paraspell_sdk_core.TGetXcmFeeResult<TDisableFallback>>;
173
- declare const handleSwapExecuteTransfer: (options: TCreateBaseSwapXcmOptions, builderOptions?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<polkadot_api.Transaction<any, Record<string, {
174
- value: any;
175
- additionalSigned: any;
176
- } | {
177
- value: any;
178
- } | {
179
- additionalSigned: any;
180
- }> | Partial<any>>>;
88
+ declare const getXcmFee: <TDisableFallback extends boolean>(options: TGetXcmFeeBaseOptions<TPapiTransaction, TDisableFallback>, builderOptions?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<_paraspell_sdk_core.TGetXcmFeeResult<TDisableFallback, never>>;
89
+ declare const handleSwapExecuteTransfer: (options: TCreateBaseSwapXcmOptions, builderOptions?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<polkadot_api.Transaction<{
90
+ parents: number;
91
+ interior: _paraspell_descriptors.XcmV5Junctions;
92
+ } | undefined, Partial<_paraspell_descriptors.AhpExtensions>>>;
181
93
 
182
94
  declare const transfer_dryRun: typeof dryRun;
183
95
  declare const transfer_dryRunOrigin: typeof dryRunOrigin;
@@ -203,5 +115,5 @@ declare const createChainClient: (chain: TSubstrateChain, api?: TBuilderOptions<
203
115
  declare const checkAndConvertToNumberOrBigInt: (input: string) => number | bigint;
204
116
  declare const transform: (obj: any) => any;
205
117
 
206
- export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, hydrateCustomChain, transform, transfer as xcmPallet };
207
- export type { GeneralBuilder, TEvmChainFrom, TPapiApi, TPapiSigner, TPapiTransaction, TSwapEvent };
118
+ export { Builder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, hydrateCustomChain, transform, transfer as xcmPallet };
119
+ export type { GeneralBuilder, TPapiApi, TPapiSigner, TPapiTransaction, TSwapEvent };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getNativeAssetSymbol, getOtherAssets, isSenderSigner, getEvmPrivateKeyHex, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, InvalidAddressError, BatchMode, isConfig, findNativeAssetInfoOrThrowImpl, isCustomChain, getChainProvidersImpl, PolkadotApi, Parents, findAssetInfoOrThrowImpl, hasXcmPaymentApiSupportImpl, replaceBigInt, hasDryRunSupportImpl, RuntimeApiUnavailableError, wrapTxBypass, RuntimeApiError, localizeLocation, isAssetEqual, createAssetId, addXcmVersionHeader, RELAY_LOCATION, getRelayChainOfImpl, isRelayChain, padValueBy, SubmitTransactionError, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, CustomChainInvalidError, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, getXcmFee as getXcmFee$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1 } from '@paraspell/sdk-core';
1
+ import { getNativeAssetSymbol, getOtherAssets, isSenderSigner, getEvmPrivateKeyHex, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, InvalidAddressError, BatchMode, isConfig, isCustomChain, PolkadotApi, Parents, buildDryRunError, replaceBigInt, RuntimeApiUnavailableError, wrapTxBypass, RuntimeApiError, localizeLocation, isAssetEqual, createAssetId, addXcmVersionHeader, RELAY_LOCATION, isRelayChain, padValueBy, SubmitTransactionError, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, findAssetInfo, getAllAssetsSymbols, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, isChainEvm, convertSs58 as convertSs58$1, Builder as Builder$1, CustomChainInvalidError, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, getXcmFee as getXcmFee$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
3
  import { secp256k1 } from '@noble/curves/secp256k1.js';
4
4
  import { keccak_256 } from '@noble/hashes/sha3.js';
@@ -8,6 +8,7 @@ import { entropyToMiniSecret, mnemonicToEntropy, DEV_PHRASE } from '@polkadot-la
8
8
  import { AccountId, Binary, getSs58AddressInfo } from 'polkadot-api';
9
9
  import { getPolkadotSigner } from 'polkadot-api/signer';
10
10
  import { blake2b } from '@noble/hashes/blake2.js';
11
+ import { hydration } from '@paraspell/descriptors';
11
12
  import { unifyMetadata, decAnyMetadata } from '@polkadot-api/substrate-bindings';
12
13
  import { toHex } from 'polkadot-api/utils';
13
14
  import { createWsClient } from 'polkadot-api/ws';
@@ -750,22 +751,22 @@ var extractDryRunXcmFailureReason = function extractDryRunXcmFailureReason(resul
750
751
  var executionResult = result === null || result === void 0 || (_result$value = result.value) === null || _result$value === void 0 ? void 0 : _result$value.execution_result;
751
752
  var error = executionResult === null || executionResult === void 0 || (_executionResult$valu = executionResult.value) === null || _executionResult$valu === void 0 ? void 0 : _executionResult$valu.error;
752
753
  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;
753
- var failureIndex = typeof (error === null || error === void 0 ? void 0 : error.index) === 'number' ? error.index : undefined;
754
+ var instructionIndex = typeof (error === null || error === void 0 ? void 0 : error.index) === 'number' ? error.index : undefined;
754
755
  if (typeof failureType === 'string') {
755
756
  return {
756
- failureReason: failureType,
757
- failureIndex: failureIndex
757
+ reason: failureType,
758
+ instructionIndex: instructionIndex
758
759
  };
759
760
  }
760
761
  if (typeof (executionResult === null || executionResult === void 0 ? void 0 : executionResult.type) === 'string') {
761
762
  return {
762
- failureReason: executionResult.type,
763
- failureIndex: failureIndex
763
+ reason: executionResult.type,
764
+ instructionIndex: instructionIndex
764
765
  };
765
766
  }
766
767
  return {
767
- failureReason: 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),
768
- failureIndex: failureIndex
768
+ reason: 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),
769
+ instructionIndex: instructionIndex
769
770
  };
770
771
  };
771
772
  var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
@@ -774,7 +775,6 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
774
775
  _classCallCheck(this, PapiApi);
775
776
  _this = _callSuper(this, PapiApi, arguments);
776
777
  _this.type = 'PAPI';
777
- _this._untypedApi = null;
778
778
  return _this;
779
779
  }
780
780
  _inherits(PapiApi, _PolkadotApi);
@@ -786,8 +786,32 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
786
786
  }, {
787
787
  key: "untypedApi",
788
788
  get: function get() {
789
- if (!this._untypedApi) this._untypedApi = this.api.getUnsafeApi();
790
- return this._untypedApi;
789
+ var _this$_untypedApi;
790
+ return (_this$_untypedApi = this._untypedApi) !== null && _this$_untypedApi !== void 0 ? _this$_untypedApi : this._untypedApi = this.api.getUnsafeApi();
791
+ }
792
+ }, {
793
+ key: "ahpApi",
794
+ get: function get() {
795
+ var _this$_ahpApi;
796
+ return (_this$_ahpApi = this._ahpApi) !== null && _this$_ahpApi !== void 0 ? _this$_ahpApi : this._ahpApi = this.api.getUnsafeApi();
797
+ }
798
+ }, {
799
+ key: "bridgeHubApi",
800
+ get: function get() {
801
+ var _this$_bridgeHubApi;
802
+ return (_this$_bridgeHubApi = this._bridgeHubApi) !== null && _this$_bridgeHubApi !== void 0 ? _this$_bridgeHubApi : this._bridgeHubApi = this.api.getUnsafeApi();
803
+ }
804
+ }, {
805
+ key: "hydrationApi",
806
+ get: function get() {
807
+ var _this$_hydrationApi;
808
+ return (_this$_hydrationApi = this._hydrationApi) !== null && _this$_hydrationApi !== void 0 ? _this$_hydrationApi : this._hydrationApi = this.api.getTypedApi(hydration);
809
+ }
810
+ }, {
811
+ key: "moonbeamApi",
812
+ get: function get() {
813
+ var _this$_moonbeamApi;
814
+ return (_this$_moonbeamApi = this._moonbeamApi) !== null && _this$_moonbeamApi !== void 0 ? _this$_moonbeamApi : this._moonbeamApi = this.api.getUnsafeApi();
791
815
  }
792
816
  }, {
793
817
  key: "accountToHex",
@@ -875,7 +899,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
875
899
  key: "callBatchMethod",
876
900
  value: function callBatchMethod(calls, mode) {
877
901
  var method = mode === BatchMode.BATCH_ALL ? 'batch_all' : 'batch';
878
- return this.untypedApi.tx.Utility[method]({
902
+ return this.ahpApi.tx.Utility[method]({
879
903
  calls: calls.map(function (_ref9) {
880
904
  var decodedCall = _ref9.decodedCall;
881
905
  return decodedCall;
@@ -886,15 +910,14 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
886
910
  key: "callDispatchAsMethod",
887
911
  value: function callDispatchAsMethod(_ref0, address) {
888
912
  var decodedCall = _ref0.decodedCall;
889
- var origin = {
890
- type: 'system',
891
- value: {
892
- type: 'Signed',
893
- value: address
894
- }
895
- };
896
- return this.untypedApi.tx.Utility.dispatch_as({
897
- as_origin: origin,
913
+ return this.ahpApi.tx.Utility.dispatch_as({
914
+ as_origin: {
915
+ type: 'system',
916
+ value: {
917
+ type: 'Signed',
918
+ value: address
919
+ }
920
+ },
898
921
  call: decodedCall
899
922
  });
900
923
  }
@@ -907,13 +930,14 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
907
930
  while (1) switch (_context3.n) {
908
931
  case 0:
909
932
  transformedObj = _transform(obj);
910
- tx = this.untypedApi.tx.PolkadotXcm.send({
933
+ tx = this.ahpApi.tx.PolkadotXcm.send({
911
934
  dest: {
912
935
  type: version,
913
936
  value: {
914
937
  parents: Parents.ZERO,
915
938
  interior: {
916
- type: 'Here'
939
+ type: 'Here',
940
+ value: undefined
917
941
  }
918
942
  }
919
943
  },
@@ -1104,7 +1128,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1104
1128
  }, {
1105
1129
  key: "getEvmStorage",
1106
1130
  value: function getEvmStorage(contract, slot) {
1107
- return this.untypedApi.query.EVM.AccountStorages.getKey(contract, slot);
1131
+ return this.moonbeamApi.query.EVM.AccountStorages.getKey(contract, slot);
1108
1132
  }
1109
1133
  }, {
1110
1134
  key: "getFromRpc",
@@ -1158,7 +1182,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1158
1182
  value: function resolveDefaultFeeAsset(_ref1) {
1159
1183
  var chain = _ref1.chain,
1160
1184
  feeAsset = _ref1.feeAsset;
1161
- return feeAsset !== null && feeAsset !== void 0 ? feeAsset : findNativeAssetInfoOrThrowImpl(chain, this._customCtx);
1185
+ return feeAsset !== null && feeAsset !== void 0 ? feeAsset : this.findNativeAssetInfoOrThrow(chain);
1162
1186
  }
1163
1187
  }, {
1164
1188
  key: "resolveFeeAsset",
@@ -1179,7 +1203,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1179
1203
  });
1180
1204
  case 1:
1181
1205
  _context1.n = 2;
1182
- return this.untypedApi.query.MultiTransactionPayment.AccountCurrencyMap.getValue(address);
1206
+ return this.hydrationApi.query.MultiTransactionPayment.AccountCurrencyMap.getValue(address);
1183
1207
  case 2:
1184
1208
  assetId = _context1.v;
1185
1209
  if (!(assetId === undefined)) {
@@ -1193,9 +1217,9 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1193
1217
  case 3:
1194
1218
  return _context1.a(2, {
1195
1219
  isCustomAsset: true,
1196
- asset: findAssetInfoOrThrowImpl(chain, {
1220
+ asset: this.findAssetInfoOrThrow(chain, {
1197
1221
  id: assetId
1198
- }, undefined, this._customCtx)
1222
+ })
1199
1223
  });
1200
1224
  }
1201
1225
  }, _callee1, this);
@@ -1210,12 +1234,12 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1210
1234
  value: function () {
1211
1235
  var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(options) {
1212
1236
  var _this2 = this;
1213
- var tx, chain, destination, address, feeAsset, bypassOptions, version, _options$useRootOrigi, useRootOrigin, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, findFailureObjectFromResult, extractFailureReasonFromResult, result, message, isSuccess, resolvedFeeAsset, failureOutputReason, actualWeight, weight, forwardedXcms, destParaId, USE_XCM_PAYMENT_API_CHAINS, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t3, _t4, _t5;
1237
+ var tx, chain, destination, address, feeAsset, bypassOptions, version, _options$useRootOrigi, useRootOrigin, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, findFailureObjectFromResult, extractFailureReasonFromResult, result, message, isSuccess, resolvedFeeAsset, _result2, failure, actualWeight, weight, forwardedXcms, destParaId, USE_XCM_PAYMENT_API_CHAINS, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t3, _t4, _t5;
1214
1238
  return _regenerator().w(function (_context10) {
1215
1239
  while (1) switch (_context10.p = _context10.n) {
1216
1240
  case 0:
1217
1241
  tx = options.tx, chain = options.chain, destination = options.destination, address = options.address, feeAsset = options.feeAsset, bypassOptions = options.bypassOptions, version = options.version, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi;
1218
- if (hasDryRunSupportImpl(chain, this._customCtx)) {
1242
+ if (this.hasDryRunSupport(chain)) {
1219
1243
  _context10.n = 1;
1220
1244
  break;
1221
1245
  }
@@ -1286,22 +1310,22 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1286
1310
  extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
1287
1311
  var _obj$value, _obj$value2, _ref10, _result$value6;
1288
1312
  var obj = findFailureObjectFromResult(result);
1289
- var failureIndex = typeof (obj === null || obj === void 0 || (_obj$value = obj.value) === null || _obj$value === void 0 ? void 0 : _obj$value.index) === 'number' ? obj.value.index : undefined;
1313
+ var instructionIndex = typeof (obj === null || obj === void 0 || (_obj$value = obj.value) === null || _obj$value === void 0 ? void 0 : _obj$value.index) === 'number' ? obj.value.index : undefined;
1290
1314
  if (obj !== null && obj !== void 0 && obj.type && obj !== null && obj !== void 0 && (_obj$value2 = obj.value) !== null && _obj$value2 !== void 0 && (_obj$value2 = _obj$value2.error) !== null && _obj$value2 !== void 0 && _obj$value2.type) {
1291
1315
  return {
1292
- failureReason: obj.type,
1293
- failureSubReason: obj.value.error.type,
1294
- failureIndex: failureIndex
1316
+ reason: obj.type,
1317
+ subReason: obj.value.error.type,
1318
+ instructionIndex: instructionIndex
1295
1319
  };
1296
1320
  }
1297
1321
  if (obj !== null && obj !== void 0 && obj.type) {
1298
1322
  return {
1299
- failureReason: obj.type,
1300
- failureIndex: failureIndex
1323
+ reason: obj.type,
1324
+ instructionIndex: instructionIndex
1301
1325
  };
1302
1326
  }
1303
1327
  return {
1304
- failureReason: JSON.stringify((_ref10 = (_result$value6 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value6 !== void 0 ? _result$value6 : result) !== null && _ref10 !== void 0 ? _ref10 : 'Unknown error structure', replaceBigInt)
1328
+ reason: JSON.stringify((_ref10 = (_result$value6 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value6 !== void 0 ? _result$value6 : result) !== null && _ref10 !== void 0 ? _ref10 : 'Unknown error structure', replaceBigInt)
1305
1329
  };
1306
1330
  };
1307
1331
  _context10.p = 5;
@@ -1337,12 +1361,10 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1337
1361
  _context10.n = 12;
1338
1362
  break;
1339
1363
  }
1340
- failureOutputReason = extractFailureReasonFromResult(result);
1364
+ failure = extractFailureReasonFromResult(result);
1341
1365
  return _context10.a(2, Promise.resolve({
1342
1366
  success: false,
1343
- failureReason: failureOutputReason.failureReason,
1344
- failureSubReason: failureOutputReason.failureSubReason,
1345
- failureIndex: failureOutputReason.failureIndex,
1367
+ dryRunError: buildDryRunError(failure, (_result2 = result) === null || _result2 === void 0 || (_result2 = _result2.value) === null || _result2 === void 0 ? void 0 : _result2.local_xcm),
1346
1368
  asset: resolvedFeeAsset.asset
1347
1369
  }));
1348
1370
  case 12:
@@ -1354,8 +1376,8 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1354
1376
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1355
1377
  destParaId = extractDestParaId(forwardedXcms);
1356
1378
  USE_XCM_PAYMENT_API_CHAINS = ['Astar'];
1357
- if (!(hasXcmPaymentApiSupportImpl(chain, this._customCtx) && result.value.local_xcm && (feeAsset || USE_XCM_PAYMENT_API_CHAINS.includes(chain) || chain.startsWith('AssetHub') && destination === 'Ethereum') || resolvedFeeAsset.isCustomAsset)) {
1358
- _context10.n = 18;
1379
+ if (!(this.hasXcmPaymentApiSupport(chain) && result.value.local_xcm && (feeAsset || USE_XCM_PAYMENT_API_CHAINS.includes(chain) || chain.startsWith('AssetHub') && destination === 'Ethereum') || resolvedFeeAsset.isCustomAsset)) {
1380
+ _context10.n = 17;
1359
1381
  break;
1360
1382
  }
1361
1383
  if (result.value.local_xcm) {
@@ -1376,10 +1398,6 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1376
1398
  return this.getXcmPaymentApiFee(chain, result.value.local_xcm, forwardedXcms, resolvedFeeAsset.asset, version, false, overriddenWeight);
1377
1399
  case 16:
1378
1400
  xcmFee = _context10.v;
1379
- if (!(typeof xcmFee === 'bigint')) {
1380
- _context10.n = 17;
1381
- break;
1382
- }
1383
1401
  return _context10.a(2, Promise.resolve({
1384
1402
  success: true,
1385
1403
  fee: xcmFee,
@@ -1389,14 +1407,9 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1389
1407
  destParaId: destParaId
1390
1408
  }));
1391
1409
  case 17:
1392
- resolvedFeeAsset = {
1393
- isCustomAsset: false,
1394
- asset: this.resolveDefaultFeeAsset(options)
1395
- };
1396
- case 18:
1397
- _context10.n = 19;
1410
+ _context10.n = 18;
1398
1411
  return this.getPaymentInfo(tx, address);
1399
- case 19:
1412
+ case 18:
1400
1413
  _yield$this$getPaymen = _context10.v;
1401
1414
  executionFee = _yield$this$getPaymen.partialFee;
1402
1415
  fee = computeOriginFee(result, chain, executionFee, !!feeAsset);
@@ -1420,22 +1433,21 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1420
1433
  key: "getXcmWeight",
1421
1434
  value: function () {
1422
1435
  var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(xcm) {
1423
- var weightRes, success, value, ref_time, proof_size;
1436
+ var weightRes, _weightRes$value, ref_time, proof_size;
1424
1437
  return _regenerator().w(function (_context11) {
1425
1438
  while (1) switch (_context11.n) {
1426
1439
  case 0:
1427
1440
  _context11.n = 1;
1428
- return this.untypedApi.apis.XcmPaymentApi.query_xcm_weight(!xcm.type ? _transform(xcm) : xcm);
1441
+ return this.ahpApi.apis.XcmPaymentApi.query_xcm_weight(!xcm.type ? _transform(xcm) : xcm);
1429
1442
  case 1:
1430
1443
  weightRes = _context11.v;
1431
- success = weightRes.success, value = weightRes.value;
1432
- if (success) {
1444
+ if (weightRes.success) {
1433
1445
  _context11.n = 2;
1434
1446
  break;
1435
1447
  }
1436
- throw new RuntimeApiError("Failed to get XCM weight for payment fee calculation. Reason: ".concat(JSON.stringify(value)));
1448
+ throw new RuntimeApiError("Failed to get XCM weight for payment fee calculation. Reason: ".concat(JSON.stringify(weightRes.value)));
1437
1449
  case 2:
1438
- ref_time = value.ref_time, proof_size = value.proof_size;
1450
+ _weightRes$value = weightRes.value, ref_time = _weightRes$value.ref_time, proof_size = _weightRes$value.proof_size;
1439
1451
  return _context11.a(2, {
1440
1452
  refTime: ref_time,
1441
1453
  proofSize: proof_size
@@ -1498,7 +1510,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1498
1510
  return _context12.a(2, 0n);
1499
1511
  case 7:
1500
1512
  deliveryFeeResolved = ((_deliveryFeeRes2 = deliveryFeeRes) === null || _deliveryFeeRes2 === void 0 || (_deliveryFeeRes2 = _deliveryFeeRes2.value) === null || _deliveryFeeRes2 === void 0 ? void 0 : _deliveryFeeRes2.value.length) > 0 ? (_deliveryFeeRes3 = deliveryFeeRes) === null || _deliveryFeeRes3 === void 0 || (_deliveryFeeRes3 = _deliveryFeeRes3.value) === null || _deliveryFeeRes3 === void 0 ? void 0 : _deliveryFeeRes3.value[0].fun.value : 0n;
1501
- nativeAsset = findNativeAssetInfoOrThrowImpl(chain, this._customCtx);
1513
+ nativeAsset = this.findNativeAssetInfoOrThrow(chain);
1502
1514
  if (!(isAssetEqual(asset, nativeAsset) || usedThirdParam)) {
1503
1515
  _context12.n = 8;
1504
1516
  break;
@@ -1507,11 +1519,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1507
1519
  case 8:
1508
1520
  _context12.p = 8;
1509
1521
  _context12.n = 9;
1510
- return this.queryRuntimeApi({
1511
- module: 'AssetConversionApi',
1512
- method: 'quote_price_exact_tokens_for_tokens',
1513
- params: [localizeLocation(chain, nativeAsset.location), assetLocalizedLoc, deliveryFeeResolved, false]
1514
- });
1522
+ return this.ahpApi.apis.AssetConversionApi.quote_price_exact_tokens_for_tokens(_transform(localizeLocation(chain, nativeAsset.location)), _transform(assetLocalizedLoc), deliveryFeeResolved, false);
1515
1523
  case 9:
1516
1524
  res = _context12.v;
1517
1525
  return _context12.a(2, res !== null && res !== void 0 ? res : 0n);
@@ -1539,8 +1547,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1539
1547
  key: "getXcmPaymentApiFee",
1540
1548
  value: function () {
1541
1549
  var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(chain, localXcm, forwardedXcm, asset, version) {
1542
- var _this3 = this,
1543
- _execFeeRes$value;
1550
+ var _this3 = this;
1544
1551
  var transformXcm,
1545
1552
  overridenWeight,
1546
1553
  transformedXcm,
@@ -1552,7 +1559,6 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1552
1559
  transformedAssetLoc,
1553
1560
  execFeeRes,
1554
1561
  execFee,
1555
- bridgeHubExecFee,
1556
1562
  deliveryFee,
1557
1563
  _args13 = arguments,
1558
1564
  _t8;
@@ -1569,7 +1575,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1569
1575
  while (1) switch (_context13.n) {
1570
1576
  case 0:
1571
1577
  _context13.n = 1;
1572
- return _this3.untypedApi.apis.XcmPaymentApi.query_xcm_weight(transformedXcm);
1578
+ return _this3.ahpApi.apis.XcmPaymentApi.query_xcm_weight(transformedXcm);
1573
1579
  case 1:
1574
1580
  weightRes = _context13.v;
1575
1581
  if (weightRes.success) {
@@ -1591,8 +1597,8 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1591
1597
  break;
1592
1598
  }
1593
1599
  _t8 = {
1594
- proof_size: overridenWeight === null || overridenWeight === void 0 ? void 0 : overridenWeight.proofSize,
1595
- ref_time: overridenWeight === null || overridenWeight === void 0 ? void 0 : overridenWeight.refTime
1600
+ proof_size: overridenWeight.proofSize,
1601
+ ref_time: overridenWeight.refTime
1596
1602
  };
1597
1603
  _context14.n = 3;
1598
1604
  break;
@@ -1608,21 +1614,18 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1608
1614
  versionedAssetId = addXcmVersionHeader(assetId, version);
1609
1615
  transformedAssetLoc = _transform(versionedAssetId);
1610
1616
  _context14.n = 4;
1611
- return this.untypedApi.apis.XcmPaymentApi.query_weight_to_asset_fee(weight, transformedAssetLoc);
1617
+ return this.ahpApi.apis.XcmPaymentApi.query_weight_to_asset_fee(weight, transformedAssetLoc);
1612
1618
  case 4:
1613
1619
  execFeeRes = _context14.v;
1614
- execFee = typeof (execFeeRes === null || execFeeRes === void 0 ? void 0 : execFeeRes.value) === 'bigint' ? execFeeRes.value : 0n;
1615
- 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')) {
1620
+ execFee = execFeeRes.success ? execFeeRes.value : 0n;
1621
+ if (!(chain.startsWith('BridgeHub') && execFeeRes.success === false && execFeeRes.value.type === 'AssetNotFound')) {
1616
1622
  _context14.n = 6;
1617
1623
  break;
1618
1624
  }
1619
1625
  _context14.n = 5;
1620
1626
  return this.getBridgeHubFallbackExecFee(chain, weight, asset, version);
1621
1627
  case 5:
1622
- bridgeHubExecFee = _context14.v;
1623
- if (typeof bridgeHubExecFee === 'bigint') {
1624
- execFee = bridgeHubExecFee;
1625
- }
1628
+ execFee = _context14.v;
1626
1629
  case 6:
1627
1630
  _context14.n = 7;
1628
1631
  return this.getDeliveryFee(chain, forwardedXcm, asset, assetLocalizedLoc, version);
@@ -1646,39 +1649,29 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1646
1649
  while (1) switch (_context15.n) {
1647
1650
  case 0:
1648
1651
  _context15.n = 1;
1649
- return this.untypedApi.apis.XcmPaymentApi.query_weight_to_asset_fee(weightValue, {
1652
+ return this.ahpApi.apis.XcmPaymentApi.query_weight_to_asset_fee(weightValue, {
1650
1653
  type: version,
1651
1654
  value: _transform(RELAY_LOCATION)
1652
1655
  });
1653
1656
  case 1:
1654
1657
  fallbackExecFeeRes = _context15.v;
1655
- if (!(typeof (fallbackExecFeeRes === null || fallbackExecFeeRes === void 0 ? void 0 : fallbackExecFeeRes.value) !== 'bigint')) {
1658
+ if (fallbackExecFeeRes.success) {
1656
1659
  _context15.n = 2;
1657
1660
  break;
1658
1661
  }
1659
- return _context15.a(2, undefined);
1662
+ return _context15.a(2, 0n);
1660
1663
  case 2:
1661
1664
  ahApi = this.clone();
1662
- assetHubChain = "AssetHub".concat(getRelayChainOfImpl(this, chain));
1665
+ assetHubChain = "AssetHub".concat(this.getRelayChainOf(chain));
1663
1666
  _context15.n = 3;
1664
1667
  return ahApi.init(assetHubChain);
1665
1668
  case 3:
1666
1669
  ahLocalizedLoc = localizeLocation(assetHubChain, asset.location);
1667
1670
  _context15.n = 4;
1668
- return ahApi.queryRuntimeApi({
1669
- module: 'AssetConversionApi',
1670
- method: 'quote_price_exact_tokens_for_tokens',
1671
- params: [RELAY_LOCATION, ahLocalizedLoc, fallbackExecFeeRes.value, false]
1672
- });
1671
+ return ahApi.ahpApi.apis.AssetConversionApi.quote_price_exact_tokens_for_tokens(_transform(RELAY_LOCATION), _transform(ahLocalizedLoc), fallbackExecFeeRes.value, false);
1673
1672
  case 4:
1674
1673
  convertedExecFee = _context15.v;
1675
- if (!(convertedExecFee !== undefined)) {
1676
- _context15.n = 5;
1677
- break;
1678
- }
1679
- return _context15.a(2, convertedExecFee);
1680
- case 5:
1681
- return _context15.a(2, undefined);
1674
+ return _context15.a(2, convertedExecFee !== null && convertedExecFee !== void 0 ? convertedExecFee : 0n);
1682
1675
  }
1683
1676
  }, _callee15, this);
1684
1677
  }));
@@ -1692,12 +1685,12 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1692
1685
  value: function () {
1693
1686
  var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(_ref12) {
1694
1687
  var _ref13, _processAssetsDeposit, _ref14, _ref15, _ref16, _ref17, _ref18;
1695
- var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, version, transformedOriginLocation, result, isSuccess, _extractDryRunXcmFail, failureReason, failureIndex, execResult, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, feeEventValue, fee, processedFee;
1688
+ var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, version, transformedOriginLocation, result, isSuccess, failure, execResult, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, feeEventValue, fee, processedFee;
1696
1689
  return _regenerator().w(function (_context16) {
1697
1690
  while (1) switch (_context16.n) {
1698
1691
  case 0:
1699
1692
  originLocation = _ref12.originLocation, xcm = _ref12.xcm, chain = _ref12.chain, origin = _ref12.origin, asset = _ref12.asset, feeAsset = _ref12.feeAsset, originFee = _ref12.originFee, amount = _ref12.amount, version = _ref12.version;
1700
- if (hasDryRunSupportImpl(chain, this._customCtx)) {
1693
+ if (this.hasDryRunSupport(chain)) {
1701
1694
  _context16.n = 1;
1702
1695
  break;
1703
1696
  }
@@ -1705,7 +1698,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1705
1698
  case 1:
1706
1699
  transformedOriginLocation = _transform(originLocation);
1707
1700
  _context16.n = 2;
1708
- return this.untypedApi.apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
1701
+ return this.ahpApi.apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
1709
1702
  case 2:
1710
1703
  result = _context16.v;
1711
1704
  isSuccess = result.success && result.value.execution_result.type === 'Complete';
@@ -1713,11 +1706,10 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1713
1706
  _context16.n = 3;
1714
1707
  break;
1715
1708
  }
1716
- _extractDryRunXcmFail = extractDryRunXcmFailureReason(result), failureReason = _extractDryRunXcmFail.failureReason, failureIndex = _extractDryRunXcmFail.failureIndex;
1709
+ failure = extractDryRunXcmFailureReason(result);
1717
1710
  return _context16.a(2, {
1718
1711
  success: false,
1719
- failureReason: failureReason,
1720
- failureIndex: failureIndex,
1712
+ dryRunError: buildDryRunError(failure, xcm),
1721
1713
  asset: asset
1722
1714
  });
1723
1715
  case 3:
@@ -1728,7 +1720,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1728
1720
  } : undefined;
1729
1721
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1730
1722
  destParaId = extractDestParaId(forwardedXcms);
1731
- if (!(hasXcmPaymentApiSupportImpl(chain, this._customCtx) && asset)) {
1723
+ if (!(this.hasXcmPaymentApiSupport(chain) && asset)) {
1732
1724
  _context16.n = 5;
1733
1725
  break;
1734
1726
  }
@@ -1736,10 +1728,6 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1736
1728
  return this.getXcmPaymentApiFee(chain, xcm, forwardedXcms, asset, version);
1737
1729
  case 4:
1738
1730
  _fee = _context16.v;
1739
- if (!(typeof _fee === 'bigint')) {
1740
- _context16.n = 5;
1741
- break;
1742
- }
1743
1731
  return _context16.a(2, {
1744
1732
  success: true,
1745
1733
  fee: _fee,
@@ -1788,7 +1776,9 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1788
1776
  }
1789
1777
  return _context16.a(2, Promise.resolve({
1790
1778
  success: false,
1791
- failureReason: 'Cannot determine destination fee. No fee event found',
1779
+ dryRunError: {
1780
+ reason: 'Cannot determine destination fee. No fee event found'
1781
+ },
1792
1782
  asset: asset
1793
1783
  }));
1794
1784
  case 6:
@@ -1818,15 +1808,16 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1818
1808
  key: "getBridgeStatus",
1819
1809
  value: function () {
1820
1810
  var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
1821
- var mode;
1811
+ var _yield$this$bridgeHub, type;
1822
1812
  return _regenerator().w(function (_context17) {
1823
1813
  while (1) switch (_context17.n) {
1824
1814
  case 0:
1825
1815
  _context17.n = 1;
1826
- return this.untypedApi.query.EthereumOutboundQueue.OperatingMode.getValue();
1816
+ return this.bridgeHubApi.query.EthereumOutboundQueue.OperatingMode.getValue();
1827
1817
  case 1:
1828
- mode = _context17.v;
1829
- return _context17.a(2, mode.type);
1818
+ _yield$this$bridgeHub = _context17.v;
1819
+ type = _yield$this$bridgeHub.type;
1820
+ return _context17.a(2, type);
1830
1821
  }
1831
1822
  }, _callee17, this);
1832
1823
  }));
@@ -1903,7 +1894,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1903
1894
  if (force) {
1904
1895
  this.api.destroy();
1905
1896
  } else {
1906
- var key = api === undefined ? getChainProvidersImpl(chain, this._customCtx) : api;
1897
+ var key = api === undefined ? this.getChainProviders(chain) : api;
1907
1898
  releaseClient(key);
1908
1899
  }
1909
1900
  }
@@ -2025,11 +2016,8 @@ var assets = /*#__PURE__*/Object.freeze({
2025
2016
  Foreign: Foreign,
2026
2017
  ForeignAbstract: ForeignAbstract,
2027
2018
  Native: Native,
2028
- Override: Override,
2029
2019
  findAssetInfo: findAssetInfo,
2030
2020
  getAllAssetsSymbols: getAllAssetsSymbols,
2031
- getAssetDecimals: getAssetDecimals,
2032
- getAssetId: getAssetId,
2033
2021
  getAssets: getAssets,
2034
2022
  getAssetsObject: getAssetsObject,
2035
2023
  getBalance: getBalance,
@@ -2040,7 +2028,6 @@ var assets = /*#__PURE__*/Object.freeze({
2040
2028
  getRelayChainSymbol: getRelayChainSymbol,
2041
2029
  getSupportedAssets: getSupportedAssets,
2042
2030
  getTChain: getTChain,
2043
- hasSupportForAsset: hasSupportForAsset,
2044
2031
  isChainEvm: isChainEvm
2045
2032
  });
2046
2033
 
@@ -2049,133 +2036,6 @@ var convertSs58 = function convertSs58(address, chain) {
2049
2036
  return convertSs58$1(papiApi, address, chain);
2050
2037
  };
2051
2038
 
2052
- /**
2053
- * Builder class for constructing transfers from Ethereum to Polkadot.
2054
- *
2055
- * @deprecated EvmBuilder is deprecated. Please use the Builder class instead.
2056
- */
2057
- var EvmBuilderCore = /*#__PURE__*/function () {
2058
- function EvmBuilderCore(options) {
2059
- _classCallCheck(this, EvmBuilderCore);
2060
- this._options = options;
2061
- }
2062
- return _createClass(EvmBuilderCore, [{
2063
- key: "from",
2064
- value: function from(chain) {
2065
- return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
2066
- from: chain
2067
- }));
2068
- }
2069
- /**
2070
- * Specifies the destination chain on Polkadot.
2071
- *
2072
- * @param chain - The Polkadot chain to which the transfer will be made.
2073
- * @returns An instance of EvmBuilder
2074
- */
2075
- }, {
2076
- key: "to",
2077
- value: function to(chain) {
2078
- return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
2079
- to: chain
2080
- }));
2081
- }
2082
- /**
2083
- * Specifies the currency to transfer.
2084
- *
2085
- * @param currency - The currency to be transferred.
2086
- * @returns An instance of EvmBuilder
2087
- */
2088
- }, {
2089
- key: "currency",
2090
- value: function currency(_currency) {
2091
- return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
2092
- currency: _currency
2093
- }));
2094
- }
2095
- /**
2096
- * Specifies the recipient address on Polkadot.
2097
- *
2098
- * @param address - The Polkadot address to receive the transfer.
2099
- * @returns An instance of EvmBuilder
2100
- */
2101
- }, {
2102
- key: "recipient",
2103
- value: function recipient(address) {
2104
- return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
2105
- recipient: address
2106
- }));
2107
- }
2108
- /**
2109
- * Sets the asset hub address. This is used for transfers that go through the Asset Hub.
2110
- *
2111
- * @param address - The address to be used.
2112
- * @returns An instance of EvmBuilder
2113
- */
2114
- }, {
2115
- key: "ahAddress",
2116
- value: function ahAddress(address) {
2117
- return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
2118
- ahAddress: address
2119
- }));
2120
- }
2121
- /**
2122
- * Specifies the signer for the Ethereum transaction.
2123
- *
2124
- * @param signer - The Ethereum signer to authorize the transfer.
2125
- * @returns An instance of EvmBuilder
2126
- */
2127
- }, {
2128
- key: "signer",
2129
- value: function signer(_signer) {
2130
- return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
2131
- signer: _signer
2132
- }));
2133
- }
2134
- /**
2135
- * Builds and executes the transfer from Ethereum to Polkadot.
2136
- *
2137
- * @throws Error if any required parameters are missing.
2138
- */
2139
- }, {
2140
- key: "build",
2141
- value: (function () {
2142
- var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2143
- var _this$_options, from, to, recipient, api;
2144
- return _regenerator().w(function (_context) {
2145
- while (1) switch (_context.n) {
2146
- case 0:
2147
- _this$_options = this._options, from = _this$_options.from, to = _this$_options.to, recipient = _this$_options.recipient, api = _this$_options.api;
2148
- validateAddress(api, recipient, to);
2149
- if (!(from === 'Moonbeam' && to === 'Ethereum')) {
2150
- _context.n = 1;
2151
- break;
2152
- }
2153
- return _context.a(2, transferMoonbeamToEth(from, this._options));
2154
- case 1:
2155
- return _context.a(2, transferMoonbeamEvm(this._options));
2156
- }
2157
- }, _callee, this);
2158
- }));
2159
- function build() {
2160
- return _build.apply(this, arguments);
2161
- }
2162
- return build;
2163
- }())
2164
- }]);
2165
- }();
2166
- /**
2167
- * Creates a new EvmBuilder instance for constructing Ethereum to Polkadot transfers.
2168
- *
2169
- * @param provider - The Ethereum provider to use for the transfer.
2170
- * @returns An instance of EvmBuilder class
2171
- * @deprecated EvmBuilder is deprecated. Please use the Builder class instead.
2172
- */
2173
- var EvmBuilder$1 = function EvmBuilder(api) {
2174
- return new EvmBuilderCore({
2175
- api: api
2176
- });
2177
- };
2178
-
2179
2039
  /**
2180
2040
  * Creates a new Builder instance.
2181
2041
  *
@@ -2186,11 +2046,6 @@ var Builder = function Builder(options) {
2186
2046
  var papiApi = new PapiApi(options);
2187
2047
  return Builder$1(papiApi);
2188
2048
  };
2189
- /** @deprecated EvmBuilder is deprecated. Please use the Builder class instead. */
2190
- var EvmBuilder = function EvmBuilder(api) {
2191
- var papiApi = new PapiApi(api);
2192
- return EvmBuilder$1(papiApi);
2193
- };
2194
2049
 
2195
2050
  var hydrateCustomChain = /*#__PURE__*/function () {
2196
2051
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(name, input) {
@@ -2303,4 +2158,4 @@ var transfer = /*#__PURE__*/Object.freeze({
2303
2158
  handleSwapExecuteTransfer: handleSwapExecuteTransfer
2304
2159
  });
2305
2160
 
2306
- export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, hydrateCustomChain, _transform as transform, transfer as xcmPallet };
2161
+ export { Builder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, hydrateCustomChain, _transform as transform, transfer as xcmPallet };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "13.10.1",
3
+ "version": "14.0.0",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,10 +27,11 @@
27
27
  "@polkadot-labs/hdkd": "^0.0.28",
28
28
  "@polkadot-labs/hdkd-helpers": "^0.0.30",
29
29
  "viem": "^2.53.1",
30
- "@paraspell/sdk-core": "13.10.1"
30
+ "@paraspell/sdk-core": "14.0.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "polkadot-api": "2.1.7"
33
+ "polkadot-api": ">= 2 < 3",
34
+ "@paraspell/descriptors": "14.0.0"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@acala-network/chopsticks": "^1.5.0",