@paraspell/sdk 10.11.10 → 11.0.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.cjs CHANGED
@@ -780,7 +780,7 @@ var releasePolkadotClient = function releasePolkadotClient(ws) {
780
780
  clientPool["delete"](key);
781
781
  }
782
782
  };
783
- var unsupportedNodes = ['ComposableFinance', 'Interlay', 'CrustShadow', 'Kintsugi', 'RobonomicsKusama', 'Pendulum', 'Subsocial'];
783
+ var unsupportedChains = ['ComposableFinance', 'Interlay', 'CrustShadow', 'Kintsugi', 'RobonomicsKusama', 'Pendulum', 'Subsocial'];
784
784
  var isHex = function isHex(str) {
785
785
  return typeof str === 'string' && /^0x[0-9a-fA-F]+$/.test(str);
786
786
  };
@@ -819,14 +819,14 @@ var PapiApi = /*#__PURE__*/function () {
819
819
  }
820
820
  return _context3.a(2);
821
821
  case 1:
822
- if (!unsupportedNodes.includes(chain)) {
822
+ if (!unsupportedChains.includes(chain)) {
823
823
  _context3.n = 2;
824
824
  break;
825
825
  }
826
- throw new sdkCore.NodeNotSupportedError("The node ".concat(chain, " is not yet supported by the Polkadot API."));
826
+ throw new sdkCore.ChainNotSupportedError("The chain ".concat(chain, " is not yet supported by the Polkadot API."));
827
827
  case 2:
828
828
  this._ttlMs = clientTtlMs;
829
- this._node = chain;
829
+ this._chain = chain;
830
830
  apiConfig = this.getApiConfigForChain(chain); // For development mode, api for each used chain must be provided
831
831
  if (!(sdkCore.isConfig(this._config) && this._config.development && !apiConfig)) {
832
832
  _context3.n = 3;
@@ -869,7 +869,7 @@ var PapiApi = /*#__PURE__*/function () {
869
869
  _context4.n = 1;
870
870
  break;
871
871
  }
872
- return _context4.a(2, sdkCore.createApiInstanceForNode(this, chain));
872
+ return _context4.a(2, sdkCore.createChainClient(this, chain));
873
873
  case 1:
874
874
  if (!(typeof apiConfig === 'string' || apiConfig instanceof Array)) {
875
875
  _context4.n = 2;
@@ -1107,14 +1107,14 @@ var PapiApi = /*#__PURE__*/function () {
1107
1107
  }, {
1108
1108
  key: "getBalanceForeignAssetsPallet",
1109
1109
  value: function () {
1110
- var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(address, multiLocation) {
1111
- var transformedMultiLocation, res;
1110
+ var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(address, location) {
1111
+ var transformedLocation, res;
1112
1112
  return _regenerator().w(function (_context10) {
1113
1113
  while (1) switch (_context10.n) {
1114
1114
  case 0:
1115
- transformedMultiLocation = _transform(multiLocation);
1115
+ transformedLocation = _transform(location);
1116
1116
  _context10.n = 1;
1117
- return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(transformedMultiLocation, address);
1117
+ return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(transformedLocation, address);
1118
1118
  case 1:
1119
1119
  res = _context10.v;
1120
1120
  return _context10.a(2, BigInt(res === undefined ? 0 : res.balance));
@@ -1155,7 +1155,7 @@ var PapiApi = /*#__PURE__*/function () {
1155
1155
  return _regenerator().w(function (_context12) {
1156
1156
  while (1) switch (_context12.n) {
1157
1157
  case 0:
1158
- currencySelection = sdkCore.getNode('BifrostPolkadot').getCurrencySelection(asset);
1158
+ currencySelection = sdkCore.getChain('BifrostPolkadot').getCurrencySelection(asset);
1159
1159
  transformedParameters = _transform(currencySelection);
1160
1160
  _context12.n = 1;
1161
1161
  return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
@@ -1199,16 +1199,16 @@ var PapiApi = /*#__PURE__*/function () {
1199
1199
  }, {
1200
1200
  key: "getBalanceForeignXTokens",
1201
1201
  value: function () {
1202
- var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(node, address, asset) {
1202
+ var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(chain, address, asset) {
1203
1203
  var pallet, _response, response, entry;
1204
1204
  return _regenerator().w(function (_context14) {
1205
1205
  while (1) switch (_context14.n) {
1206
1206
  case 0:
1207
1207
  pallet = 'Tokens';
1208
- if (node === 'Centrifuge' || node === 'Altair') {
1208
+ if (chain === 'Centrifuge' || chain === 'Altair') {
1209
1209
  pallet = 'OrmlTokens';
1210
1210
  }
1211
- if (!(node === 'Hydration')) {
1211
+ if (!(chain === 'Hydration')) {
1212
1212
  _context14.n = 2;
1213
1213
  break;
1214
1214
  }
@@ -1289,42 +1289,42 @@ var PapiApi = /*#__PURE__*/function () {
1289
1289
  return new PapiApi(sdkCore.isConfig(this._config) ? this._config : undefined);
1290
1290
  }
1291
1291
  }, {
1292
- key: "createApiForNode",
1292
+ key: "createApiForChain",
1293
1293
  value: function () {
1294
- var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(node) {
1294
+ var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(chain) {
1295
1295
  var api;
1296
1296
  return _regenerator().w(function (_context17) {
1297
1297
  while (1) switch (_context17.n) {
1298
1298
  case 0:
1299
1299
  api = new PapiApi();
1300
1300
  _context17.n = 1;
1301
- return api.init(node);
1301
+ return api.init(chain);
1302
1302
  case 1:
1303
1303
  return _context17.a(2, api);
1304
1304
  }
1305
1305
  }, _callee17);
1306
1306
  }));
1307
- function createApiForNode(_x32) {
1308
- return _createApiForNode.apply(this, arguments);
1307
+ function createApiForChain(_x32) {
1308
+ return _createApiForChain.apply(this, arguments);
1309
1309
  }
1310
- return createApiForNode;
1310
+ return createApiForChain;
1311
1311
  }()
1312
1312
  }, {
1313
1313
  key: "getDryRunCall",
1314
1314
  value: function () {
1315
1315
  var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref6) {
1316
1316
  var _this = this;
1317
- var tx, address, node, feeAsset, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasMultiLocation, xcmFee, fee;
1317
+ var tx, address, chain, feeAsset, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasLocation, xcmFee, fee;
1318
1318
  return _regenerator().w(function (_context19) {
1319
1319
  while (1) switch (_context19.n) {
1320
1320
  case 0:
1321
- tx = _ref6.tx, address = _ref6.address, node = _ref6.node, feeAsset = _ref6.feeAsset;
1322
- supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
1321
+ tx = _ref6.tx, address = _ref6.address, chain = _ref6.chain, feeAsset = _ref6.feeAsset;
1322
+ supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
1323
1323
  if (supportsDryRunApi) {
1324
1324
  _context19.n = 1;
1325
1325
  break;
1326
1326
  }
1327
- throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
1327
+ throw new sdkCore.ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
1328
1328
  case 1:
1329
1329
  DEFAULT_XCM_VERSION = 3;
1330
1330
  basePayload = {
@@ -1418,16 +1418,16 @@ var PapiApi = /*#__PURE__*/function () {
1418
1418
  return this.calculateTransactionFee(tx, address);
1419
1419
  case 6:
1420
1420
  executionFee = _context19.v;
1421
- nativeAsset = sdkCore.findAsset(node, {
1422
- symbol: sdkCore.Native(sdkCore.getNativeAssetSymbol(node))
1421
+ nativeAsset = sdkCore.findAssetInfo(chain, {
1422
+ symbol: sdkCore.Native(sdkCore.getNativeAssetSymbol(chain))
1423
1423
  }, null);
1424
- hasMultiLocation = feeAsset ? Boolean(feeAsset.multiLocation) : Boolean(nativeAsset === null || nativeAsset === void 0 ? void 0 : nativeAsset.multiLocation);
1425
- if (!(sdkCore.hasXcmPaymentApiSupport(node) && result.value.local_xcm && hasMultiLocation && nativeAsset && node !== 'AssetHubPolkadot' && node !== 'Kusama')) {
1424
+ hasLocation = feeAsset ? Boolean(feeAsset.location) : Boolean(nativeAsset === null || nativeAsset === void 0 ? void 0 : nativeAsset.location);
1425
+ if (!(sdkCore.hasXcmPaymentApiSupport(chain) && result.value.local_xcm && hasLocation && nativeAsset && chain !== 'AssetHubPolkadot' && chain !== 'Kusama')) {
1426
1426
  _context19.n = 8;
1427
1427
  break;
1428
1428
  }
1429
1429
  _context19.n = 7;
1430
- return this.getXcmPaymentApiFee(node, result.value.local_xcm, feeAsset !== null && feeAsset !== void 0 ? feeAsset : nativeAsset);
1430
+ return this.getXcmPaymentApiFee(chain, result.value.local_xcm, feeAsset !== null && feeAsset !== void 0 ? feeAsset : nativeAsset);
1431
1431
  case 7:
1432
1432
  xcmFee = _context19.v;
1433
1433
  if (!(typeof xcmFee === 'bigint')) {
@@ -1442,7 +1442,7 @@ var PapiApi = /*#__PURE__*/function () {
1442
1442
  destParaId: destParaId
1443
1443
  }));
1444
1444
  case 8:
1445
- fee = sdkCore.computeFeeFromDryRun(result, node, executionFee, !!feeAsset);
1445
+ fee = sdkCore.computeFeeFromDryRun(result, chain, executionFee, !!feeAsset);
1446
1446
  return _context19.a(2, Promise.resolve({
1447
1447
  success: true,
1448
1448
  fee: fee,
@@ -1486,7 +1486,7 @@ var PapiApi = /*#__PURE__*/function () {
1486
1486
  }, {
1487
1487
  key: "getXcmPaymentApiFee",
1488
1488
  value: function () {
1489
- var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(node, xcm, asset) {
1489
+ var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(chain, xcm, asset) {
1490
1490
  var transformXcm,
1491
1491
  weight,
1492
1492
  localizedLocation,
@@ -1502,7 +1502,7 @@ var PapiApi = /*#__PURE__*/function () {
1502
1502
  case 1:
1503
1503
  weight = _context21.v;
1504
1504
  sdkCore.assertHasLocation(asset);
1505
- localizedLocation = node === 'AssetHubPolkadot' || node === 'AssetHubKusama' || sdkCore.isRelayChain(node) ? sdkCore.localizeLocation(node, asset.multiLocation) : asset.multiLocation;
1505
+ localizedLocation = chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama' || sdkCore.isRelayChain(chain) ? sdkCore.localizeLocation(chain, asset.location) : asset.location;
1506
1506
  transformedLocation = _transform(localizedLocation);
1507
1507
  _context21.n = 2;
1508
1508
  return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight.value, {
@@ -1525,17 +1525,17 @@ var PapiApi = /*#__PURE__*/function () {
1525
1525
  value: function () {
1526
1526
  var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(_ref9) {
1527
1527
  var _ref0, _processAssetsDeposit, _ref1, _ref10, _ref11, _ref12, _ref13;
1528
- var originLocation, xcm, node, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, fee, processedFee;
1528
+ var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, fee, processedFee;
1529
1529
  return _regenerator().w(function (_context22) {
1530
1530
  while (1) switch (_context22.n) {
1531
1531
  case 0:
1532
- originLocation = _ref9.originLocation, xcm = _ref9.xcm, node = _ref9.node, origin = _ref9.origin, asset = _ref9.asset, feeAsset = _ref9.feeAsset, originFee = _ref9.originFee, amount = _ref9.amount;
1533
- supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
1532
+ originLocation = _ref9.originLocation, xcm = _ref9.xcm, chain = _ref9.chain, origin = _ref9.origin, asset = _ref9.asset, feeAsset = _ref9.feeAsset, originFee = _ref9.originFee, amount = _ref9.amount;
1533
+ supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
1534
1534
  if (supportsDryRunApi) {
1535
1535
  _context22.n = 1;
1536
1536
  break;
1537
1537
  }
1538
- throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
1538
+ throw new sdkCore.ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
1539
1539
  case 1:
1540
1540
  transformedOriginLocation = _transform(originLocation);
1541
1541
  _context22.n = 2;
@@ -1560,12 +1560,12 @@ var PapiApi = /*#__PURE__*/function () {
1560
1560
  } : undefined;
1561
1561
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1562
1562
  destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
1563
- if (!(sdkCore.hasXcmPaymentApiSupport(node) && asset && node !== 'AssetHubPolkadot' && node !== 'Polkadot')) {
1563
+ if (!(sdkCore.hasXcmPaymentApiSupport(chain) && asset && chain !== 'AssetHubPolkadot' && chain !== 'Polkadot')) {
1564
1564
  _context22.n = 5;
1565
1565
  break;
1566
1566
  }
1567
1567
  _context22.n = 4;
1568
- return this.getXcmPaymentApiFee(node, xcm, asset);
1568
+ return this.getXcmPaymentApiFee(chain, xcm, asset);
1569
1569
  case 4:
1570
1570
  _fee = _context22.v;
1571
1571
  if (!(typeof _fee === 'bigint')) {
@@ -1589,7 +1589,7 @@ var PapiApi = /*#__PURE__*/function () {
1589
1589
  }) : undefined) !== null && _ref0 !== void 0 ? _ref0 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1590
1590
  return event.type === 'Tokens' && event.value.type === 'Deposited';
1591
1591
  }) : undefined;
1592
- processedAssetsAmount = node === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? processAssetsDepositedEvents(emitted, amount, 'Assets', 'Deposited', true) : (_processAssetsDeposit = processAssetsDepositedEvents(emitted, amount, 'Balances', 'Minted', false)) !== null && _processAssetsDeposit !== void 0 ? _processAssetsDeposit : processAssetsDepositedEvents(emitted, amount, 'Balances', 'Issued', false);
1592
+ processedAssetsAmount = chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? processAssetsDepositedEvents(emitted, amount, 'Assets', 'Deposited', true) : (_processAssetsDeposit = processAssetsDepositedEvents(emitted, amount, 'Balances', 'Minted', false)) !== null && _processAssetsDeposit !== void 0 ? _processAssetsDeposit : processAssetsDepositedEvents(emitted, amount, 'Balances', 'Issued', false);
1593
1593
  feeEvent = (_ref1 = (_ref10 = (_ref11 = (_ref12 = (_ref13 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent :
1594
1594
  //
1595
1595
  processedAssetsAmount !== undefined ? {
@@ -1602,11 +1602,11 @@ var PapiApi = /*#__PURE__*/function () {
1602
1602
  }
1603
1603
  } : undefined) !== null && _ref13 !== void 0 ? _ref13 :
1604
1604
  //
1605
- node === 'Mythos' ? reversedEvents.find(function (event) {
1605
+ chain === 'Mythos' ? reversedEvents.find(function (event) {
1606
1606
  return event.type === 'Balances' && event.value.type === 'Issued';
1607
1607
  }) : undefined) !== null && _ref12 !== void 0 ? _ref12 :
1608
1608
  //
1609
- origin === 'Mythos' || node === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
1609
+ origin === 'Mythos' || chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
1610
1610
  return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
1611
1611
  }) : undefined) !== null && _ref11 !== void 0 ? _ref11 :
1612
1612
  // Prefer to Minted event
@@ -1632,7 +1632,7 @@ var PapiApi = /*#__PURE__*/function () {
1632
1632
  if (feeAssetFeeEvent) {
1633
1633
  fee = amount - originFee - feeEvent.value.value.amount;
1634
1634
  }
1635
- processedFee = (sdkCore.isRelayChain(node) || node.includes('AssetHub')) && (asset === null || asset === void 0 ? void 0 : asset.symbol) === 'DOT' ? sdkCore.padFeeBy(fee, 30) : fee;
1635
+ processedFee = (sdkCore.isRelayChain(chain) || chain.includes('AssetHub')) && (asset === null || asset === void 0 ? void 0 : asset.symbol) === 'DOT' ? sdkCore.padFeeBy(fee, 30) : fee;
1636
1636
  return _context22.a(2, Promise.resolve({
1637
1637
  success: true,
1638
1638
  fee: processedFee,
@@ -1686,7 +1686,7 @@ var PapiApi = /*#__PURE__*/function () {
1686
1686
  var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1687
1687
  if (!this.initialized) return Promise.resolve();
1688
1688
  if (!force && !this.disconnectAllowed) return Promise.resolve();
1689
- var api = sdkCore.isConfig(this._config) ? (_this$_config$apiOver2 = this._config.apiOverrides) === null || _this$_config$apiOver2 === void 0 ? void 0 : _this$_config$apiOver2[this._node] : this._config;
1689
+ var api = sdkCore.isConfig(this._config) ? (_this$_config$apiOver2 = this._config.apiOverrides) === null || _this$_config$apiOver2 === void 0 ? void 0 : _this$_config$apiOver2[this._chain] : this._config;
1690
1690
  // Own client provided, destroy only if force true
1691
1691
  if (force && _typeof(api) === 'object') {
1692
1692
  this.api.destroy();
@@ -1696,7 +1696,7 @@ var PapiApi = /*#__PURE__*/function () {
1696
1696
  if (force) {
1697
1697
  this.api.destroy();
1698
1698
  } else {
1699
- var key = api === undefined ? sdkCore.getNodeProviders(this._node) : api;
1699
+ var key = api === undefined ? sdkCore.getChainProviders(this._chain) : api;
1700
1700
  releasePolkadotClient(key);
1701
1701
  }
1702
1702
  }
@@ -1705,9 +1705,9 @@ var PapiApi = /*#__PURE__*/function () {
1705
1705
  }]);
1706
1706
  }();
1707
1707
 
1708
- var createApiInstanceForNode = function createApiInstanceForNode(node) {
1708
+ var createChainClient = function createChainClient(chain) {
1709
1709
  var papiApi = new PapiApi();
1710
- return sdkCore.createApiInstanceForNode(papiApi, node);
1710
+ return sdkCore.createChainClient(papiApi, chain);
1711
1711
  };
1712
1712
  var createPapiApiCall = function createPapiApiCall(apiCall) {
1713
1713
  return /*#__PURE__*/function () {
@@ -1731,19 +1731,19 @@ var createPapiApiCall = function createPapiApiCall(apiCall) {
1731
1731
  };
1732
1732
 
1733
1733
  /**
1734
- * Retrieves the native balance for a given account on a specified node.
1734
+ * Retrieves the native balance for a given account on a specified chain.
1735
1735
  *
1736
1736
  * @returns The native balance as a bigint.
1737
1737
  */
1738
1738
  var getBalanceNative = createPapiApiCall(sdkCore.getBalanceNative);
1739
1739
  /**
1740
- * Retrieves the balance of a foreign asset for a given account on a specified node.
1740
+ * Retrieves the balance of a foreign asset for a given account on a specified chain.
1741
1741
  *
1742
1742
  * @returns The balance of the foreign asset as a bigint, or null if not found.
1743
1743
  */
1744
1744
  var getBalanceForeign = createPapiApiCall(sdkCore.getBalanceForeign);
1745
1745
  /**
1746
- * Retrieves the asset balance for a given account on a specified node.
1746
+ * Retrieves the asset balance for a given account on a specified chain.
1747
1747
  *
1748
1748
  * @returns The asset balance as a bigint.
1749
1749
  */
@@ -1757,7 +1757,7 @@ var claimAssets = createPapiApiCall(sdkCore.claimAssets);
1757
1757
  /**
1758
1758
  * @deprecated This function is deprecated and will be removed in a future version.
1759
1759
  * Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
1760
- * where `builder` is an instance of `Builder()`.
1760
+ * where `builder` is an instance of `Builder()`. Will be removed in v12
1761
1761
  * For more details, please refer to the documentation:
1762
1762
  * {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
1763
1763
  */
@@ -1770,7 +1770,7 @@ var assets = /*#__PURE__*/Object.freeze({
1770
1770
  Native: sdkCore.Native,
1771
1771
  Override: sdkCore.Override,
1772
1772
  claimAssets: claimAssets,
1773
- findAsset: sdkCore.findAsset,
1773
+ findAssetInfo: sdkCore.findAssetInfo,
1774
1774
  getAllAssetsSymbols: sdkCore.getAllAssetsSymbols,
1775
1775
  getAssetBalance: getAssetBalance,
1776
1776
  getAssetDecimals: sdkCore.getAssetDecimals,
@@ -1786,14 +1786,14 @@ var assets = /*#__PURE__*/Object.freeze({
1786
1786
  getOtherAssets: sdkCore.getOtherAssets,
1787
1787
  getRelayChainSymbol: sdkCore.getRelayChainSymbol,
1788
1788
  getSupportedAssets: sdkCore.getSupportedAssets,
1789
- getTNode: sdkCore.getTNode,
1789
+ getTChain: sdkCore.getTChain,
1790
1790
  hasSupportForAsset: sdkCore.hasSupportForAsset,
1791
- isNodeEvm: sdkCore.isNodeEvm
1791
+ isChainEvm: sdkCore.isChainEvm
1792
1792
  });
1793
1793
 
1794
- var convertSs58 = function convertSs58(address, node) {
1794
+ var convertSs58 = function convertSs58(address, chain) {
1795
1795
  var papiApi = new PapiApi();
1796
- return sdkCore.convertSs58(papiApi, address, node);
1796
+ return sdkCore.convertSs58(papiApi, address, chain);
1797
1797
  };
1798
1798
 
1799
1799
  /**
@@ -1806,22 +1806,22 @@ var EvmBuilderCore = /*#__PURE__*/function () {
1806
1806
  }
1807
1807
  return _createClass(EvmBuilderCore, [{
1808
1808
  key: "from",
1809
- value: function from(node) {
1809
+ value: function from(chain) {
1810
1810
  return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
1811
- from: node
1811
+ from: chain
1812
1812
  }));
1813
1813
  }
1814
1814
  /**
1815
- * Specifies the destination node on Polkadot.
1815
+ * Specifies the destination chain on Polkadot.
1816
1816
  *
1817
- * @param node - The Polkadot node to which the transfer will be made.
1817
+ * @param chain - The Polkadot chain to which the transfer will be made.
1818
1818
  * @returns An instance of EvmBuilder
1819
1819
  */
1820
1820
  }, {
1821
1821
  key: "to",
1822
- value: function to(node) {
1822
+ value: function to(chain) {
1823
1823
  return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
1824
- to: node
1824
+ to: chain
1825
1825
  }));
1826
1826
  }
1827
1827
  /**
@@ -1930,8 +1930,8 @@ var Builder = function Builder(api) {
1930
1930
  var papiApi = new PapiApi(api);
1931
1931
  return sdkCore.Builder(papiApi);
1932
1932
  };
1933
- var EvmBuilder = function EvmBuilder() {
1934
- var papiApi = new PapiApi();
1933
+ var EvmBuilder = function EvmBuilder(api) {
1934
+ var papiApi = new PapiApi(api);
1935
1935
  return EvmBuilder$1(papiApi);
1936
1936
  };
1937
1937
 
@@ -2015,7 +2015,7 @@ exports.assets = assets;
2015
2015
  exports.checkAndConvertToNumberOrBigInt = checkAndConvertToNumberOrBigInt;
2016
2016
  exports.claimAssets = claimAssets;
2017
2017
  exports.convertSs58 = convertSs58;
2018
- exports.createApiInstanceForNode = createApiInstanceForNode;
2018
+ exports.createChainClient = createChainClient;
2019
2019
  exports.dryRun = dryRun;
2020
2020
  exports.dryRunOrigin = dryRunOrigin;
2021
2021
  exports.getAssetBalance = getAssetBalance;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _paraspell_sdk_core from '@paraspell/sdk-core';
2
- import { TApiOrUrl, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, TNodeDotKsmWithRelayChains, TEvmBuilderOptions, TNodeWithRelayChains, TCurrencyInputWithAmount, GeneralBuilder as GeneralBuilder$1, TSendBaseOptions, TGetXcmFeeBaseOptions } from '@paraspell/sdk-core';
2
+ import { TApiOrUrl, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TEvmBuilderOptions, TChain, TCurrencyInputWithAmount, GeneralBuilder as GeneralBuilder$1, TSendBaseOptions, TGetXcmFeeBaseOptions } from '@paraspell/sdk-core';
3
3
  export * from '@paraspell/sdk-core';
4
- import { TEvmNodeFrom, TBuilderOptions } from '@paraspell/sdk-core/src';
4
+ import { TEvmChainFrom, TBuilderOptions } from '@paraspell/sdk-core/src';
5
5
  import * as polkadot_api from 'polkadot-api';
6
6
  import { PolkadotClient, UnsafeTransaction } from 'polkadot-api';
7
7
  import { WalletClient } from 'viem';
@@ -9,10 +9,10 @@ import { WalletClient } from 'viem';
9
9
  type TPapiApi = PolkadotClient;
10
10
  type TPapiApiOrUrl = TApiOrUrl<PolkadotClient>;
11
11
  type TPapiTransaction = UnsafeTransaction<any, string, string, any>;
12
- type TEvmNodeFromPapi = Extract<TEvmNodeFrom, 'Moonbeam' | 'Moonriver' | 'Darwinia'>;
12
+ type TEvmChainFromPapi = Extract<TEvmChainFrom, 'Moonbeam' | 'Moonriver' | 'Darwinia'>;
13
13
 
14
14
  /**
15
- * Retrieves the native balance for a given account on a specified node.
15
+ * Retrieves the native balance for a given account on a specified chain.
16
16
  *
17
17
  * @returns The native balance as a bigint.
18
18
  */
@@ -20,7 +20,7 @@ declare const getBalanceNative: (options: _paraspell_sdk_core.TGetBalanceNativeO
20
20
  api?: TPapiApiOrUrl;
21
21
  }) => Promise<bigint>;
22
22
  /**
23
- * Retrieves the balance of a foreign asset for a given account on a specified node.
23
+ * Retrieves the balance of a foreign asset for a given account on a specified chain.
24
24
  *
25
25
  * @returns The balance of the foreign asset as a bigint, or null if not found.
26
26
  */
@@ -28,7 +28,7 @@ declare const getBalanceForeign: (options: _paraspell_sdk_core.TGetBalanceForeig
28
28
  api?: TPapiApiOrUrl;
29
29
  }) => Promise<bigint>;
30
30
  /**
31
- * Retrieves the asset balance for a given account on a specified node.
31
+ * Retrieves the asset balance for a given account on a specified chain.
32
32
  *
33
33
  * @returns The asset balance as a bigint.
34
34
  */
@@ -46,7 +46,7 @@ declare const claimAssets: (options: _paraspell_sdk_core.TAssetClaimOptionsBase
46
46
  /**
47
47
  * @deprecated This function is deprecated and will be removed in a future version.
48
48
  * Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
49
- * where `builder` is an instance of `Builder()`.
49
+ * where `builder` is an instance of `Builder()`. Will be removed in v12
50
50
  * For more details, please refer to the documentation:
51
51
  * {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
52
52
  */
@@ -59,7 +59,7 @@ declare const assets_ForeignAbstract: typeof ForeignAbstract;
59
59
  declare const assets_Native: typeof Native;
60
60
  declare const assets_Override: typeof Override;
61
61
  declare const assets_claimAssets: typeof claimAssets;
62
- declare const assets_findAsset: typeof findAsset;
62
+ declare const assets_findAssetInfo: typeof findAssetInfo;
63
63
  declare const assets_getAllAssetsSymbols: typeof getAllAssetsSymbols;
64
64
  declare const assets_getAssetBalance: typeof getAssetBalance;
65
65
  declare const assets_getAssetDecimals: typeof getAssetDecimals;
@@ -75,9 +75,9 @@ declare const assets_getOriginFeeDetails: typeof getOriginFeeDetails;
75
75
  declare const assets_getOtherAssets: typeof getOtherAssets;
76
76
  declare const assets_getRelayChainSymbol: typeof getRelayChainSymbol;
77
77
  declare const assets_getSupportedAssets: typeof getSupportedAssets;
78
- declare const assets_getTNode: typeof getTNode;
78
+ declare const assets_getTChain: typeof getTChain;
79
79
  declare const assets_hasSupportForAsset: typeof hasSupportForAsset;
80
- declare const assets_isNodeEvm: typeof isNodeEvm;
80
+ declare const assets_isChainEvm: typeof isChainEvm;
81
81
  declare namespace assets {
82
82
  export {
83
83
  assets_Foreign as Foreign,
@@ -85,7 +85,7 @@ declare namespace assets {
85
85
  assets_Native as Native,
86
86
  assets_Override as Override,
87
87
  assets_claimAssets as claimAssets,
88
- assets_findAsset as findAsset,
88
+ assets_findAssetInfo as findAssetInfo,
89
89
  assets_getAllAssetsSymbols as getAllAssetsSymbols,
90
90
  assets_getAssetBalance as getAssetBalance,
91
91
  assets_getAssetDecimals as getAssetDecimals,
@@ -101,13 +101,13 @@ declare namespace assets {
101
101
  assets_getOtherAssets as getOtherAssets,
102
102
  assets_getRelayChainSymbol as getRelayChainSymbol,
103
103
  assets_getSupportedAssets as getSupportedAssets,
104
- assets_getTNode as getTNode,
104
+ assets_getTChain as getTChain,
105
105
  assets_hasSupportForAsset as hasSupportForAsset,
106
- assets_isNodeEvm as isNodeEvm,
106
+ assets_isChainEvm as isChainEvm,
107
107
  };
108
108
  }
109
109
 
110
- declare const convertSs58: (address: string, node: TNodeDotKsmWithRelayChains) => string;
110
+ declare const convertSs58: (address: string, chain: TSubstrateChain) => string;
111
111
 
112
112
  /**
113
113
  * Builder class for constructing transfers from Ethereum to Polkadot.
@@ -115,17 +115,17 @@ declare const convertSs58: (address: string, node: TNodeDotKsmWithRelayChains) =
115
115
  declare class EvmBuilderCore<TApi, TRes, T extends Partial<TEvmBuilderOptions<TApi, TRes>> = object> {
116
116
  protected readonly _options: T;
117
117
  constructor(options: T);
118
- from(node: TEvmNodeFromPapi): EvmBuilderCore<TApi, TRes, T & {
119
- from: TEvmNodeFromPapi;
118
+ from(chain: TEvmChainFromPapi): EvmBuilderCore<TApi, TRes, T & {
119
+ from: TEvmChainFromPapi;
120
120
  }>;
121
121
  /**
122
- * Specifies the destination node on Polkadot.
122
+ * Specifies the destination chain on Polkadot.
123
123
  *
124
- * @param node - The Polkadot node to which the transfer will be made.
124
+ * @param chain - The Polkadot chain to which the transfer will be made.
125
125
  * @returns An instance of EvmBuilder
126
126
  */
127
- to(node: TNodeWithRelayChains): EvmBuilderCore<TApi, TRes, T & {
128
- to: TNodeWithRelayChains;
127
+ to(chain: TChain): EvmBuilderCore<TApi, TRes, T & {
128
+ to: TChain;
129
129
  }>;
130
130
  /**
131
131
  * Specifies the currency to transfer.
@@ -179,7 +179,7 @@ declare class EvmBuilderCore<TApi, TRes, T extends Partial<TEvmBuilderOptions<TA
179
179
  */
180
180
  declare const Builder: (api?: TBuilderOptions<TPapiApiOrUrl>) => GeneralBuilder$1<PolkadotClient, TPapiTransaction, object>;
181
181
  type GeneralBuilder<T extends Partial<TSendBaseOptions> = object> = GeneralBuilder$1<PolkadotClient, TPapiTransaction, T>;
182
- declare const EvmBuilder: () => EvmBuilderCore<unknown, unknown, {
182
+ declare const EvmBuilder: (api?: TBuilderOptions<TPapiApiOrUrl>) => EvmBuilderCore<unknown, unknown, {
183
183
  api: _paraspell_sdk_core.IPolkadotApi<PolkadotClient, TPapiTransaction>;
184
184
  }>;
185
185
 
@@ -196,7 +196,7 @@ declare const dryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<TPapiTran
196
196
  }) => Promise<_paraspell_sdk_core.TDryRunResult>;
197
197
  declare const dryRunOrigin: (options: _paraspell_sdk_core.TDryRunCallBaseOptions<TPapiTransaction> & {
198
198
  api?: TPapiApiOrUrl;
199
- }) => Promise<_paraspell_sdk_core.TDryRunNodeResult>;
199
+ }) => Promise<_paraspell_sdk_core.TDryRunChainResult>;
200
200
  declare const getParaEthTransferFees: (ahApi?: TPapiApiOrUrl) => Promise<[bigint, bigint]>;
201
201
  /**
202
202
  * Gets the Ethereum bridge status.
@@ -234,10 +234,10 @@ declare namespace transfer {
234
234
  };
235
235
  }
236
236
 
237
- declare const createApiInstanceForNode: (node: TNodeDotKsmWithRelayChains) => Promise<polkadot_api.PolkadotClient>;
237
+ declare const createChainClient: (chain: TSubstrateChain) => Promise<polkadot_api.PolkadotClient>;
238
238
 
239
239
  declare const checkAndConvertToNumberOrBigInt: (input: string) => number | bigint;
240
240
  declare const transform: (obj: any) => any;
241
241
 
242
- export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, claimAssets, convertSs58, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getOriginFeeDetails, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, send, transform, transfer as xcmPallet };
243
- export type { GeneralBuilder, TEvmNodeFromPapi, TPapiApi, TPapiApiOrUrl, TPapiTransaction };
242
+ export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, claimAssets, convertSs58, createChainClient, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getOriginFeeDetails, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, send, transform, transfer as xcmPallet };
243
+ export type { GeneralBuilder, TEvmChainFromPapi, TPapiApi, TPapiApiOrUrl, TPapiTransaction };