@paraspell/sdk-pjs 10.0.0 → 10.0.2

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
@@ -258,6 +258,7 @@ const result = await Builder(API /*optional*/)
258
258
  .from(NODE)
259
259
  .to(NODE_2)
260
260
  .currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {multilocation: AssetMultilocationString, amount: amount | AssetMultilocationJson, amount: amount} | {multilocation: Override('Custom Multilocation'), amount: amount} | {multiasset: {currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or multilocation: multilocation*/, amount: amount}})
261
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
261
262
  .address(ADDRESS)
262
263
  .senderAddress(SENDER_ADDRESS)
263
264
  .dryRun()
@@ -278,6 +279,7 @@ const info = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
278
279
  .from(ORIGIN_CHAIN)
279
280
  .to(DESTINATION_CHAIN)
280
281
  .currency(CURRENCY)
282
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
281
283
  .address(RECIPIENT_ADDRESS)
282
284
  .senderAddress(SENDER_ADDRESS)
283
285
  .getTransferInfo()
@@ -289,6 +291,7 @@ const transferable = await Builder(/*node api/ws_url_string/ws_url_array - optio
289
291
  .from(ORIGIN_CHAIN)
290
292
  .to(DESTINATION_CHAIN)
291
293
  .currency(CURRENCY)
294
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
292
295
  .address(RECIPIENT_ADDRESS)
293
296
  .senderAddress(SENDER_ADDRESS)
294
297
  .getTransferableAmount()
@@ -300,6 +303,7 @@ const ed = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
300
303
  .from(ORIGIN_CHAIN)
301
304
  .to(DESTINATION_CHAIN)
302
305
  .currency(CURRENCY)
306
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
303
307
  .address(RECIPIENT_ADDRESS)
304
308
  .senderAddress(SENDER_ADDRESS)
305
309
  .verifyEdOnDestination()
@@ -313,6 +317,7 @@ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
313
317
  .from(ORIGIN_CHAIN)
314
318
  .to(DESTINATION_CHAIN)
315
319
  .currency(CURRENCY)
320
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
316
321
  .address(RECIPIENT_ADDRESS)
317
322
  .senderAddress(SENDER_ADDRESS)
318
323
  .getXcmFee(/*{disableFallback: true / false}*/) //Fallback is optional. When fallback is disabled, you only get notified of DryRun error, but no Payment info query fallback is performed. Payment info is still performed if Origin or Destination chain do not support DryRun out of the box.
@@ -337,6 +342,7 @@ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
337
342
  .from(ORIGIN_CHAIN)
338
343
  .to(DESTINATION_CHAIN)
339
344
  .currency(CURRENCY)
345
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
340
346
  .address(RECIPIENT_ADDRESS)
341
347
  .senderAddress(SENDER_ADDRESS)
342
348
  .getOriginXcmFee(/*{disableFallback: true / false}*/) //Fallback is optional. When fallback is disabled, you only get notified of DryRun error, but no Payment info query fallback is performed. Payment info is still performed if Origin do not support DryRun out of the box.
package/dist/index.cjs CHANGED
@@ -874,7 +874,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
874
874
  _context12.next = 3;
875
875
  break;
876
876
  }
877
- throw new Error("RPC method ".concat(module, ".").concat(method, " not available"));
877
+ throw new sdkCore.InvalidParameterError("RPC method ".concat(module, ".").concat(method, " not available"));
878
878
  case 3:
879
879
  _context12.next = 5;
880
880
  return rpcModule[method](key);
@@ -1272,7 +1272,7 @@ var approveToken = /*#__PURE__*/function () {
1272
1272
  _context.next = 4;
1273
1273
  break;
1274
1274
  }
1275
- throw new Error("Token ".concat(symbol, " not supported"));
1275
+ throw new sdkCore.InvalidParameterError("Token ".concat(symbol, " not supported"));
1276
1276
  case 4:
1277
1277
  weth9 = contractTypes.WETH9__factory.connect(contract.address, signer);
1278
1278
  _context.next = 7;
@@ -1312,7 +1312,7 @@ var depositToken = /*#__PURE__*/function () {
1312
1312
  _context.next = 4;
1313
1313
  break;
1314
1314
  }
1315
- throw new Error("Token ".concat(symbol, " not supported"));
1315
+ throw new sdkCore.InvalidParameterError("Token ".concat(symbol, " not supported"));
1316
1316
  case 4:
1317
1317
  weth9 = contractTypes.WETH9__factory.connect(contract.address, signer);
1318
1318
  _context.next = 7;
@@ -1383,25 +1383,25 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1383
1383
  _context.next = 3;
1384
1384
  break;
1385
1385
  }
1386
- throw new Error('Multiassets syntax is not supported for Evm transfers');
1386
+ throw new sdkCore.InvalidParameterError('Multiassets syntax is not supported for Evm transfers');
1387
1387
  case 3:
1388
1388
  if (!('multilocation' in currency && sdkCore.isOverrideMultiLocationSpecifier(currency.multilocation))) {
1389
1389
  _context.next = 5;
1390
1390
  break;
1391
1391
  }
1392
- throw new Error('Override multilocation is not supported for Evm transfers');
1392
+ throw new sdkCore.InvalidParameterError('Override multilocation is not supported for Evm transfers');
1393
1393
  case 5:
1394
1394
  if (provider) {
1395
1395
  _context.next = 7;
1396
1396
  break;
1397
1397
  }
1398
- throw new Error('provider parameter is required for Snowbridge transfers.');
1398
+ throw new sdkCore.InvalidParameterError('provider parameter is required for Snowbridge transfers.');
1399
1399
  case 7:
1400
1400
  if (sdkCore.isEthersSigner(signer)) {
1401
1401
  _context.next = 9;
1402
1402
  break;
1403
1403
  }
1404
- throw new Error('Snowbridge does not support Viem provider yet.');
1404
+ throw new sdkCore.InvalidParameterError('Snowbridge does not support Viem provider yet.');
1405
1405
  case 9:
1406
1406
  ethAsset = sdkCore.findAsset('Ethereum', currency, to);
1407
1407
  if (!(ethAsset === null)) {
@@ -1525,7 +1525,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1525
1525
  _context.next = 76;
1526
1526
  break;
1527
1527
  }
1528
- throw Error("Validation failed with following errors: \n\n ".concat(validation.logs.filter(function (l) {
1528
+ throw new sdkCore.InvalidParameterError("Validation failed with following errors: \n\n ".concat(validation.logs.filter(function (l) {
1529
1529
  return l.kind == api$1.toPolkadotV2.ValidationKind.Error;
1530
1530
  }).map(function (l) {
1531
1531
  return l.message;
@@ -1544,7 +1544,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1544
1544
  _context.next = 85;
1545
1545
  break;
1546
1546
  }
1547
- throw Error("Transaction ".concat(response.hash, " not included."));
1547
+ throw new sdkCore.InvalidParameterError("Transaction ".concat(response.hash, " not included."));
1548
1548
  case 85:
1549
1549
  _context.next = 87;
1550
1550
  return api$1.toPolkadotV2.getMessageReceipt(receipt);
@@ -1554,7 +1554,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1554
1554
  _context.next = 90;
1555
1555
  break;
1556
1556
  }
1557
- throw Error("Transaction ".concat(receipt.hash, " did not emit a message."));
1557
+ throw new sdkCore.InvalidParameterError("Transaction ".concat(receipt.hash, " did not emit a message."));
1558
1558
  case 90:
1559
1559
  return _context.abrupt("return", {
1560
1560
  response: response,
@@ -1585,7 +1585,7 @@ var getTokenBalance = /*#__PURE__*/function () {
1585
1585
  _context.next = 4;
1586
1586
  break;
1587
1587
  }
1588
- throw new Error("Token ".concat(symbol, " not supported"));
1588
+ throw new sdkCore.InvalidParameterError("Token ".concat(symbol, " not supported"));
1589
1589
  case 4:
1590
1590
  weth9 = contractTypes.WETH9__factory.connect(contract.address, signer);
1591
1591
  _context.next = 7;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, getNode, isForeignAsset, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, NodeNotSupportedError, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, convertSs58 as convertSs58$1, getParaId, ETH_CHAIN_ID, InvalidCurrencyError, isEthersSigner, isOverrideMultiLocationSpecifier, validateAddress, transferMoonbeamToEth, transferMoonbeamEvm, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, getBridgeStatus as getBridgeStatus$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
1
+ import { BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, getNode, isForeignAsset, InvalidParameterError, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, NodeNotSupportedError, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, convertSs58 as convertSs58$1, getParaId, ETH_CHAIN_ID, InvalidCurrencyError, isEthersSigner, isOverrideMultiLocationSpecifier, validateAddress, transferMoonbeamToEth, transferMoonbeamEvm, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, getBridgeStatus as getBridgeStatus$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
2
2
  export * from '@paraspell/sdk-core';
3
3
  import { WsProvider, ApiPromise } from '@polkadot/api';
4
4
  import { u32 } from '@polkadot/types';
@@ -873,7 +873,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
873
873
  _context12.next = 3;
874
874
  break;
875
875
  }
876
- throw new Error("RPC method ".concat(module, ".").concat(method, " not available"));
876
+ throw new InvalidParameterError("RPC method ".concat(module, ".").concat(method, " not available"));
877
877
  case 3:
878
878
  _context12.next = 5;
879
879
  return rpcModule[method](key);
@@ -1271,7 +1271,7 @@ var approveToken = /*#__PURE__*/function () {
1271
1271
  _context.next = 4;
1272
1272
  break;
1273
1273
  }
1274
- throw new Error("Token ".concat(symbol, " not supported"));
1274
+ throw new InvalidParameterError("Token ".concat(symbol, " not supported"));
1275
1275
  case 4:
1276
1276
  weth9 = WETH9__factory.connect(contract.address, signer);
1277
1277
  _context.next = 7;
@@ -1311,7 +1311,7 @@ var depositToken = /*#__PURE__*/function () {
1311
1311
  _context.next = 4;
1312
1312
  break;
1313
1313
  }
1314
- throw new Error("Token ".concat(symbol, " not supported"));
1314
+ throw new InvalidParameterError("Token ".concat(symbol, " not supported"));
1315
1315
  case 4:
1316
1316
  weth9 = WETH9__factory.connect(contract.address, signer);
1317
1317
  _context.next = 7;
@@ -1382,25 +1382,25 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1382
1382
  _context.next = 3;
1383
1383
  break;
1384
1384
  }
1385
- throw new Error('Multiassets syntax is not supported for Evm transfers');
1385
+ throw new InvalidParameterError('Multiassets syntax is not supported for Evm transfers');
1386
1386
  case 3:
1387
1387
  if (!('multilocation' in currency && isOverrideMultiLocationSpecifier(currency.multilocation))) {
1388
1388
  _context.next = 5;
1389
1389
  break;
1390
1390
  }
1391
- throw new Error('Override multilocation is not supported for Evm transfers');
1391
+ throw new InvalidParameterError('Override multilocation is not supported for Evm transfers');
1392
1392
  case 5:
1393
1393
  if (provider) {
1394
1394
  _context.next = 7;
1395
1395
  break;
1396
1396
  }
1397
- throw new Error('provider parameter is required for Snowbridge transfers.');
1397
+ throw new InvalidParameterError('provider parameter is required for Snowbridge transfers.');
1398
1398
  case 7:
1399
1399
  if (isEthersSigner(signer)) {
1400
1400
  _context.next = 9;
1401
1401
  break;
1402
1402
  }
1403
- throw new Error('Snowbridge does not support Viem provider yet.');
1403
+ throw new InvalidParameterError('Snowbridge does not support Viem provider yet.');
1404
1404
  case 9:
1405
1405
  ethAsset = findAsset('Ethereum', currency, to);
1406
1406
  if (!(ethAsset === null)) {
@@ -1524,7 +1524,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1524
1524
  _context.next = 76;
1525
1525
  break;
1526
1526
  }
1527
- throw Error("Validation failed with following errors: \n\n ".concat(validation.logs.filter(function (l) {
1527
+ throw new InvalidParameterError("Validation failed with following errors: \n\n ".concat(validation.logs.filter(function (l) {
1528
1528
  return l.kind == toPolkadotV2.ValidationKind.Error;
1529
1529
  }).map(function (l) {
1530
1530
  return l.message;
@@ -1543,7 +1543,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1543
1543
  _context.next = 85;
1544
1544
  break;
1545
1545
  }
1546
- throw Error("Transaction ".concat(response.hash, " not included."));
1546
+ throw new InvalidParameterError("Transaction ".concat(response.hash, " not included."));
1547
1547
  case 85:
1548
1548
  _context.next = 87;
1549
1549
  return toPolkadotV2.getMessageReceipt(receipt);
@@ -1553,7 +1553,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1553
1553
  _context.next = 90;
1554
1554
  break;
1555
1555
  }
1556
- throw Error("Transaction ".concat(receipt.hash, " did not emit a message."));
1556
+ throw new InvalidParameterError("Transaction ".concat(receipt.hash, " did not emit a message."));
1557
1557
  case 90:
1558
1558
  return _context.abrupt("return", {
1559
1559
  response: response,
@@ -1584,7 +1584,7 @@ var getTokenBalance = /*#__PURE__*/function () {
1584
1584
  _context.next = 4;
1585
1585
  break;
1586
1586
  }
1587
- throw new Error("Token ".concat(symbol, " not supported"));
1587
+ throw new InvalidParameterError("Token ".concat(symbol, " not supported"));
1588
1588
  case 4:
1589
1589
  weth9 = WETH9__factory.connect(contract.address, signer);
1590
1590
  _context.next = 7;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-pjs",
3
- "version": "10.0.0",
3
+ "version": "10.0.2",
4
4
  "description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  "@snowbridge/contract-types": "0.1.50",
28
28
  "ethers": "^6.13.7",
29
29
  "viem": "^2.28.1",
30
- "@paraspell/sdk-core": "10.0.0"
30
+ "@paraspell/sdk-core": "10.0.2"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@polkadot/api": ">= 15.0 < 16",