@paraspell/sdk 11.9.3 → 11.11.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
@@ -358,6 +358,18 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
358
358
  .getMinTransferableAmount()
359
359
  ```
360
360
 
361
+ #### Receivable amount
362
+ ```ts
363
+ const receivable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
364
+ .from(ORIGIN_CHAIN)
365
+ .to(DESTINATION_CHAIN)
366
+ .currency(CURRENCY)
367
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
368
+ .address(RECIPIENT_ADDRESS)
369
+ .senderAddress(SENDER_ADDRESS)
370
+ .getReceivableAmount()
371
+ ```
372
+
361
373
  #### Verify ED on destination
362
374
  ```ts
363
375
  const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
package/dist/index.cjs CHANGED
@@ -838,6 +838,7 @@ var PapiApi = /*#__PURE__*/function () {
838
838
  key: "resolveApi",
839
839
  value: function () {
840
840
  var _resolveApi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(apiConfig, chain) {
841
+ var wsUrl;
841
842
  return _regenerator().w(function (_context2) {
842
843
  while (1) switch (_context2.n) {
843
844
  case 0:
@@ -845,7 +846,8 @@ var PapiApi = /*#__PURE__*/function () {
845
846
  _context2.n = 1;
846
847
  break;
847
848
  }
848
- return _context2.a(2, sdkCore.createChainClient(this, chain));
849
+ wsUrl = sdkCore.getChainProviders(chain);
850
+ return _context2.a(2, this.createApiInstance(wsUrl, chain));
849
851
  case 1:
850
852
  if (!(typeof apiConfig === 'string' || apiConfig instanceof Array)) {
851
853
  _context2.n = 2;
@@ -1881,8 +1883,8 @@ var PapiApi = /*#__PURE__*/function () {
1881
1883
  }]);
1882
1884
  }();
1883
1885
 
1884
- var createChainClient = function createChainClient(chain) {
1885
- var papiApi = new PapiApi();
1886
+ var createChainClient = function createChainClient(chain, api) {
1887
+ var papiApi = new PapiApi(api);
1886
1888
  return sdkCore.createChainClient(papiApi, chain);
1887
1889
  };
1888
1890
  var createPapiApiCall = function createPapiApiCall(apiCall) {
@@ -2163,21 +2165,28 @@ var getBridgeStatus = /*#__PURE__*/function () {
2163
2165
  }();
2164
2166
  var getOriginXcmFee = createPapiApiCall(sdkCore.getOriginXcmFee);
2165
2167
  var getXcmFee = /*#__PURE__*/function () {
2166
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
2168
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options, builderOptions) {
2169
+ var api;
2167
2170
  return _regenerator().w(function (_context3) {
2168
2171
  while (1) switch (_context3.n) {
2169
2172
  case 0:
2173
+ api = new PapiApi(builderOptions);
2170
2174
  return _context3.a(2, sdkCore.getXcmFee(_objectSpread2(_objectSpread2({}, options), {}, {
2171
- api: new PapiApi()
2175
+ api: api
2172
2176
  })));
2173
2177
  }
2174
2178
  }, _callee3);
2175
2179
  }));
2176
- return function getXcmFee(_x3) {
2180
+ return function getXcmFee(_x3, _x4) {
2177
2181
  return _ref3.apply(this, arguments);
2178
2182
  };
2179
2183
  }();
2180
- var handleSwapExecuteTransfer = createPapiApiCall(sdkCore.handleSwapExecuteTransfer);
2184
+ var handleSwapExecuteTransfer = function handleSwapExecuteTransfer(options, builderOptions) {
2185
+ var api = new PapiApi(builderOptions);
2186
+ return sdkCore.handleSwapExecuteTransfer(_objectSpread2(_objectSpread2({}, options), {}, {
2187
+ api: api
2188
+ }));
2189
+ };
2181
2190
 
2182
2191
  var transfer = /*#__PURE__*/Object.freeze({
2183
2192
  __proto__: null,
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, 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 } from '@paraspell/sdk-core';
2
+ import { TApiOrUrl, TEvmChainFrom, 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';
3
3
  export * from '@paraspell/sdk-core';
4
4
  import * as polkadot_api from 'polkadot-api';
5
5
  import { PolkadotClient, UnsafeTransaction } from 'polkadot-api';
@@ -211,10 +211,8 @@ declare const getOriginXcmFee: (options: _paraspell_sdk_core.TGetOriginXcmFeeBas
211
211
  forwardedXcms?: unknown;
212
212
  destParaId?: number;
213
213
  }>;
214
- declare const getXcmFee: <TDisableFallback extends boolean>(options: TGetXcmFeeBaseOptions<TPapiTransaction, TDisableFallback>) => Promise<_paraspell_sdk_core.TGetXcmFeeResult<TDisableFallback>>;
215
- declare const handleSwapExecuteTransfer: (options: _paraspell_sdk_core.TCreateBaseSwapXcmOptions & {
216
- api?: TPapiApiOrUrl;
217
- }) => Promise<TPapiTransaction>;
214
+ declare const getXcmFee: <TDisableFallback extends boolean>(options: TGetXcmFeeBaseOptions<TPapiTransaction, TDisableFallback>, builderOptions?: TBuilderOptions<TPapiApiOrUrl>) => Promise<_paraspell_sdk_core.TGetXcmFeeResult<TDisableFallback>>;
215
+ declare const handleSwapExecuteTransfer: (options: TCreateBaseSwapXcmOptions, builderOptions?: TBuilderOptions<TPapiApiOrUrl>) => Promise<TPapiTransaction>;
218
216
 
219
217
  declare const transfer_dryRun: typeof dryRun;
220
218
  declare const transfer_dryRunOrigin: typeof dryRunOrigin;
@@ -237,7 +235,7 @@ declare namespace transfer {
237
235
  };
238
236
  }
239
237
 
240
- declare const createChainClient: (chain: TSubstrateChain) => Promise<polkadot_api.PolkadotClient>;
238
+ declare const createChainClient: (chain: TSubstrateChain, api?: TBuilderOptions<TPapiApiOrUrl>) => Promise<polkadot_api.PolkadotClient>;
241
239
 
242
240
  declare const checkAndConvertToNumberOrBigInt: (input: string) => number | bigint;
243
241
  declare const transform: (obj: any) => any;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { InvalidParameterError, isConfig, BatchMode, getChainProviders, MissingChainApiError, createChainClient as createChainClient$1, Parents, Version, assertHasId, assertHasLocation, getChain, isForeignAsset, computeFeeFromDryRun, findNativeAssetInfoOrThrow, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, ChainNotSupportedError, wrapTxBypass, localizeLocation, isAssetXcEqual, padFeeBy, isRelayChain, isAssetEqual, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, getXcmFee as getXcmFee$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1 } from '@paraspell/sdk-core';
1
+ import { InvalidParameterError, isConfig, BatchMode, getChainProviders, MissingChainApiError, Parents, Version, assertHasId, assertHasLocation, getChain, isForeignAsset, computeFeeFromDryRun, findNativeAssetInfoOrThrow, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, ChainNotSupportedError, wrapTxBypass, localizeLocation, isAssetXcEqual, padFeeBy, isRelayChain, isAssetEqual, createChainClient as createChainClient$1, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, getXcmFee as getXcmFee$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1 } from '@paraspell/sdk-core';
2
2
  export * from '@paraspell/sdk-core';
3
3
  import { blake2b } from '@noble/hashes/blake2';
4
4
  import { bytesToHex } from '@noble/hashes/utils';
@@ -837,6 +837,7 @@ var PapiApi = /*#__PURE__*/function () {
837
837
  key: "resolveApi",
838
838
  value: function () {
839
839
  var _resolveApi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(apiConfig, chain) {
840
+ var wsUrl;
840
841
  return _regenerator().w(function (_context2) {
841
842
  while (1) switch (_context2.n) {
842
843
  case 0:
@@ -844,7 +845,8 @@ var PapiApi = /*#__PURE__*/function () {
844
845
  _context2.n = 1;
845
846
  break;
846
847
  }
847
- return _context2.a(2, createChainClient$1(this, chain));
848
+ wsUrl = getChainProviders(chain);
849
+ return _context2.a(2, this.createApiInstance(wsUrl, chain));
848
850
  case 1:
849
851
  if (!(typeof apiConfig === 'string' || apiConfig instanceof Array)) {
850
852
  _context2.n = 2;
@@ -1880,8 +1882,8 @@ var PapiApi = /*#__PURE__*/function () {
1880
1882
  }]);
1881
1883
  }();
1882
1884
 
1883
- var createChainClient = function createChainClient(chain) {
1884
- var papiApi = new PapiApi();
1885
+ var createChainClient = function createChainClient(chain, api) {
1886
+ var papiApi = new PapiApi(api);
1885
1887
  return createChainClient$1(papiApi, chain);
1886
1888
  };
1887
1889
  var createPapiApiCall = function createPapiApiCall(apiCall) {
@@ -2162,21 +2164,28 @@ var getBridgeStatus = /*#__PURE__*/function () {
2162
2164
  }();
2163
2165
  var getOriginXcmFee = createPapiApiCall(getOriginXcmFee$1);
2164
2166
  var getXcmFee = /*#__PURE__*/function () {
2165
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
2167
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options, builderOptions) {
2168
+ var api;
2166
2169
  return _regenerator().w(function (_context3) {
2167
2170
  while (1) switch (_context3.n) {
2168
2171
  case 0:
2172
+ api = new PapiApi(builderOptions);
2169
2173
  return _context3.a(2, getXcmFee$1(_objectSpread2(_objectSpread2({}, options), {}, {
2170
- api: new PapiApi()
2174
+ api: api
2171
2175
  })));
2172
2176
  }
2173
2177
  }, _callee3);
2174
2178
  }));
2175
- return function getXcmFee(_x3) {
2179
+ return function getXcmFee(_x3, _x4) {
2176
2180
  return _ref3.apply(this, arguments);
2177
2181
  };
2178
2182
  }();
2179
- var handleSwapExecuteTransfer = createPapiApiCall(handleSwapExecuteTransfer$1);
2183
+ var handleSwapExecuteTransfer = function handleSwapExecuteTransfer(options, builderOptions) {
2184
+ var api = new PapiApi(builderOptions);
2185
+ return handleSwapExecuteTransfer$1(_objectSpread2(_objectSpread2({}, options), {}, {
2186
+ api: api
2187
+ }));
2188
+ };
2180
2189
 
2181
2190
  var transfer = /*#__PURE__*/Object.freeze({
2182
2191
  __proto__: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "11.9.3",
3
+ "version": "11.11.0",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "@noble/hashes": "^1.8.0",
27
27
  "@polkadot-api/legacy-provider": "^0.3.3",
28
28
  "viem": "^2.37.9",
29
- "@paraspell/sdk-core": "11.9.3"
29
+ "@paraspell/sdk-core": "11.11.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "polkadot-api": ">= 1.20.0 < 2"