@paraspell/sdk 12.9.6 → 13.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _paraspell_sdk_core from '@paraspell/sdk-core';
2
- import { TApiOrUrl, TEvmChainFrom, TSwapEvent as TSwapEvent$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TEvmBuilderOptions, TChain, TCurrencyInputWithAmount, TBuilderOptions, GeneralBuilder as GeneralBuilder$1, TSendBaseOptions, TGetXcmFeeBaseOptions, TCreateBaseSwapXcmOptions } from '@paraspell/sdk-core';
2
+ import { TApiOrUrl, TEvmChainFrom, TSwapEvent as TSwapEvent$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TEvmBuilderOptions, TChain, TCurrencyInputWithAmount, TBuilderOptions, GeneralBuilder as GeneralBuilder$1, TTransferBaseOptions, 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, UnsafeTransaction, PolkadotSigner } from 'polkadot-api';
@@ -22,20 +22,11 @@ declare const getBalance: (options: _paraspell_sdk_core.TGetBalanceCommonOptions
22
22
  } & {
23
23
  api?: TPapiApiOrUrl;
24
24
  }) => Promise<bigint>;
25
- /**
26
- * Claims assets from a parachain.
27
- *
28
- * @returns An extrinsic representing the claim transaction.
29
- */
30
- declare const claimAssets: (options: _paraspell_sdk_core.TAssetClaimOptionsBase & {
31
- api?: TPapiApiOrUrl;
32
- }) => Promise<TPapiTransaction>;
33
25
 
34
26
  declare const assets_Foreign: typeof Foreign;
35
27
  declare const assets_ForeignAbstract: typeof ForeignAbstract;
36
28
  declare const assets_Native: typeof Native;
37
29
  declare const assets_Override: typeof Override;
38
- declare const assets_claimAssets: typeof claimAssets;
39
30
  declare const assets_findAssetInfo: typeof findAssetInfo;
40
31
  declare const assets_getAllAssetsSymbols: typeof getAllAssetsSymbols;
41
32
  declare const assets_getAssetDecimals: typeof getAssetDecimals;
@@ -58,7 +49,6 @@ declare namespace assets {
58
49
  assets_ForeignAbstract as ForeignAbstract,
59
50
  assets_Native as Native,
60
51
  assets_Override as Override,
61
- assets_claimAssets as claimAssets,
62
52
  assets_findAssetInfo as findAssetInfo,
63
53
  assets_getAllAssetsSymbols as getAllAssetsSymbols,
64
54
  assets_getAssetDecimals as getAssetDecimals,
@@ -113,8 +103,8 @@ declare class EvmBuilderCore<TApi, TRes, TSigner, T extends Partial<TEvmBuilderO
113
103
  * @param address - The Polkadot address to receive the transfer.
114
104
  * @returns An instance of EvmBuilder
115
105
  */
116
- address(address: string): EvmBuilderCore<TApi, TRes, TSigner, T & {
117
- address: string;
106
+ recipient(address: string): EvmBuilderCore<TApi, TRes, TSigner, T & {
107
+ recipient: string;
118
108
  }>;
119
109
  /**
120
110
  * Sets the asset hub address. This is used for transfers that go through the Asset Hub.
@@ -149,7 +139,7 @@ declare class EvmBuilderCore<TApi, TRes, TSigner, T extends Partial<TEvmBuilderO
149
139
  * @returns A new Builder instance.
150
140
  */
151
141
  declare const Builder: (api?: TBuilderOptions<TPapiApiOrUrl>) => GeneralBuilder$1<PolkadotClient, TPapiTransaction, PolkadotSigner, object>;
152
- type GeneralBuilder<T extends Partial<TSendBaseOptions<TPapiApi, TPapiTransaction, TPapiSigner>> = object> = GeneralBuilder$1<PolkadotClient, TPapiTransaction, PolkadotSigner, T>;
142
+ type GeneralBuilder<T extends Partial<TTransferBaseOptions<TPapiApi, TPapiTransaction, TPapiSigner>> = object> = GeneralBuilder$1<PolkadotClient, TPapiTransaction, PolkadotSigner, T>;
153
143
  declare const EvmBuilder: (api?: TBuilderOptions<TPapiApiOrUrl>) => EvmBuilderCore<unknown, unknown, unknown, {
154
144
  api: _paraspell_sdk_core.IPolkadotApi<PolkadotClient, TPapiTransaction, PolkadotSigner>;
155
145
  }>;
@@ -198,5 +188,5 @@ declare const createChainClient: (chain: TSubstrateChain, api?: TBuilderOptions<
198
188
  declare const checkAndConvertToNumberOrBigInt: (input: string) => number | bigint;
199
189
  declare const transform: (obj: any) => any;
200
190
 
201
- export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, claimAssets, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, transform, transfer as xcmPallet };
191
+ export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, transform, transfer as xcmPallet };
202
192
  export type { GeneralBuilder, TEvmChainFromPapi, TPapiApi, TPapiApiOrUrl, 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, findNativeAssetInfoOrThrow, getChainProviders, DEFAULT_TTL_MS, resolveChainApi, isExternalChain, Parents, findAssetInfoOrThrow, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, isAssetXcEqual, addXcmVersionHeader, RELAY_LOCATION, getRelayChainOf, isRelayChain, padValueBy, isAssetEqual, createChainClient as createChainClient$1, getBalance as getBalance$1, claimAssets as claimAssets$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, 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, findNativeAssetInfoOrThrow, getChainProviders, DEFAULT_TTL_MS, resolveChainApi, isExternalChain, Parents, findAssetInfoOrThrow, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, isAssetXcEqual, addXcmVersionHeader, RELAY_LOCATION, getRelayChainOf, isRelayChain, padValueBy, isAssetEqual, SubmitTransactionError, 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, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, 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';
@@ -1044,13 +1044,13 @@ var PapiApi = /*#__PURE__*/function () {
1044
1044
  return _regenerator().w(function (_context9) {
1045
1045
  while (1) switch (_context9.n) {
1046
1046
  case 0:
1047
- api = new PapiApi();
1047
+ api = new PapiApi(isConfig(this._config) ? this._config : undefined);
1048
1048
  _context9.n = 1;
1049
1049
  return api.init(chain);
1050
1050
  case 1:
1051
1051
  return _context9.a(2, api);
1052
1052
  }
1053
- }, _callee9);
1053
+ }, _callee9, this);
1054
1054
  }));
1055
1055
  function createApiForChain(_x15) {
1056
1056
  return _createApiForChain.apply(this, arguments);
@@ -1099,7 +1099,7 @@ var PapiApi = /*#__PURE__*/function () {
1099
1099
  isCustomAsset: true,
1100
1100
  asset: findAssetInfoOrThrow(chain, {
1101
1101
  id: assetId
1102
- }, null)
1102
+ })
1103
1103
  });
1104
1104
  }
1105
1105
  }, _callee0, this);
@@ -1785,6 +1785,39 @@ var PapiApi = /*#__PURE__*/function () {
1785
1785
  }
1786
1786
  return signAndSubmit;
1787
1787
  }()
1788
+ }, {
1789
+ key: "signAndSubmitFinalized",
1790
+ value: function () {
1791
+ var _signAndSubmitFinalized = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(tx, sender) {
1792
+ var signer;
1793
+ return _regenerator().w(function (_context19) {
1794
+ while (1) switch (_context19.n) {
1795
+ case 0:
1796
+ signer = isSenderSigner(sender) ? sender : createDevSigner(sender);
1797
+ return _context19.a(2, new Promise(function (resolve, reject) {
1798
+ tx.signSubmitAndWatch(signer).subscribe({
1799
+ next: function next(event) {
1800
+ if (event.type === 'finalized' || event.type === 'txBestBlocksState' && event.found) {
1801
+ if (!event.ok) {
1802
+ reject(new SubmitTransactionError(JSON.stringify(event.dispatchError.value)));
1803
+ } else {
1804
+ resolve(event.txHash);
1805
+ }
1806
+ }
1807
+ },
1808
+ error: function error(_error) {
1809
+ reject(_error instanceof Error ? _error : new SubmitTransactionError(String(_error)));
1810
+ }
1811
+ });
1812
+ }));
1813
+ }
1814
+ }, _callee19);
1815
+ }));
1816
+ function signAndSubmitFinalized(_x37, _x38) {
1817
+ return _signAndSubmitFinalized.apply(this, arguments);
1818
+ }
1819
+ return signAndSubmitFinalized;
1820
+ }()
1788
1821
  }]);
1789
1822
  }();
1790
1823
 
@@ -1825,12 +1858,6 @@ var findFailingEvent = function findFailingEvent(result) {
1825
1858
  * @returns The asset balance as a bigint.
1826
1859
  */
1827
1860
  var getBalance = createPapiApiCall(getBalance$1);
1828
- /**
1829
- * Claims assets from a parachain.
1830
- *
1831
- * @returns An extrinsic representing the claim transaction.
1832
- */
1833
- var claimAssets = createPapiApiCall(claimAssets$1);
1834
1861
 
1835
1862
  var assets = /*#__PURE__*/Object.freeze({
1836
1863
  __proto__: null,
@@ -1838,7 +1865,6 @@ var assets = /*#__PURE__*/Object.freeze({
1838
1865
  ForeignAbstract: ForeignAbstract,
1839
1866
  Native: Native,
1840
1867
  Override: Override,
1841
- claimAssets: claimAssets,
1842
1868
  findAssetInfo: findAssetInfo,
1843
1869
  getAllAssetsSymbols: getAllAssetsSymbols,
1844
1870
  getAssetDecimals: getAssetDecimals,
@@ -1910,10 +1936,10 @@ var EvmBuilderCore = /*#__PURE__*/function () {
1910
1936
  * @returns An instance of EvmBuilder
1911
1937
  */
1912
1938
  }, {
1913
- key: "address",
1914
- value: function address(_address) {
1939
+ key: "recipient",
1940
+ value: function recipient(address) {
1915
1941
  return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
1916
- address: _address
1942
+ recipient: address
1917
1943
  }));
1918
1944
  }
1919
1945
  /**
@@ -1951,12 +1977,12 @@ var EvmBuilderCore = /*#__PURE__*/function () {
1951
1977
  key: "build",
1952
1978
  value: (function () {
1953
1979
  var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
1954
- var _this$_options, from, to, address, api;
1980
+ var _this$_options, from, to, recipient, api;
1955
1981
  return _regenerator().w(function (_context) {
1956
1982
  while (1) switch (_context.n) {
1957
1983
  case 0:
1958
- _this$_options = this._options, from = _this$_options.from, to = _this$_options.to, address = _this$_options.address, api = _this$_options.api;
1959
- validateAddress(api, address, to);
1984
+ _this$_options = this._options, from = _this$_options.from, to = _this$_options.to, recipient = _this$_options.recipient, api = _this$_options.api;
1985
+ validateAddress(api, recipient, to);
1960
1986
  if (!(from === 'Moonbeam' && to === 'Ethereum')) {
1961
1987
  _context.n = 1;
1962
1988
  break;
@@ -2075,4 +2101,4 @@ var transfer = /*#__PURE__*/Object.freeze({
2075
2101
  handleSwapExecuteTransfer: handleSwapExecuteTransfer
2076
2102
  });
2077
2103
 
2078
- export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, claimAssets, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, _transform as transform, transfer as xcmPallet };
2104
+ export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, _transform as transform, transfer as xcmPallet };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "12.9.6",
3
+ "version": "13.0.0-rc.1",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "@polkadot-labs/hdkd": "^0.0.27",
29
29
  "@polkadot-labs/hdkd-helpers": "^0.0.28",
30
30
  "viem": "2.47.1",
31
- "@paraspell/sdk-core": "12.9.6"
31
+ "@paraspell/sdk-core": "13.0.0-rc.1"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "polkadot-api": ">= 1.23.3 < 2"
@@ -63,6 +63,7 @@
63
63
  "test:watch": "vitest",
64
64
  "runAll": "pnpm compile && pnpm format:write && pnpm lint && pnpm test",
65
65
  "test:e2e": "vitest run --config ./vitest.config.e2e.ts --sequence.concurrent",
66
- "test:e2e:chopsticks": "vitest run --config ./vitest.config.chopsticks.e2e.ts"
66
+ "test:e2e:chopsticks": "vitest run --config ./vitest.config.chopsticks.e2e.ts",
67
+ "test:e2e:swap": "vitest run --config ./vitest.config.swap.e2e.ts --sequence.concurrent"
67
68
  }
68
69
  }