@paraspell/sdk 6.2.3 → 6.2.4

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
@@ -589,6 +589,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
589
589
  };
590
590
 
591
591
  var Polkadot$1 = {
592
+ paraId: 0,
592
593
  relayChainAssetSymbol: "DOT",
593
594
  nativeAssetSymbol: "DOT",
594
595
  nativeAssets: [
@@ -601,6 +602,7 @@ var Polkadot$1 = {
601
602
  ]
602
603
  };
603
604
  var Kusama$1 = {
605
+ paraId: 0,
604
606
  relayChainAssetSymbol: "KSM",
605
607
  nativeAssetSymbol: "KSM",
606
608
  nativeAssets: [
@@ -7664,7 +7666,6 @@ var Phala$3 = {
7664
7666
  ]
7665
7667
  };
7666
7668
  var Ethereum$1 = {
7667
- paraId: 1,
7668
7669
  relayChainAssetSymbol: "DOT",
7669
7670
  nativeAssetSymbol: "ETH",
7670
7671
  nativeAssets: [
@@ -8240,11 +8241,14 @@ var createBridgePolkadotXcmDest = function createBridgePolkadotXcmDest(version,
8240
8241
  return _defineProperty({}, version, isMultiLocationDestination ? destination : multiLocation);
8241
8242
  };
8242
8243
  var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(multiLocation) {
8244
+ var _a;
8243
8245
  var parachainId = findParachainJunction(multiLocation);
8244
8246
  if (parachainId === null) {
8245
8247
  throw new Error('Parachain ID not found in destination multi location.');
8246
8248
  }
8247
- var node = getTNode(parachainId);
8249
+ var node = (_a = NODE_NAMES.find(function (nodeName) {
8250
+ return getParaId(nodeName) === parachainId;
8251
+ })) !== null && _a !== void 0 ? _a : null;
8248
8252
  if (node === null) {
8249
8253
  throw new Error('Node with specified paraId not found in destination multi location.');
8250
8254
  }
@@ -11082,10 +11086,13 @@ var getParaId = function getParaId(node) {
11082
11086
  * @param paraId - The parachain ID.
11083
11087
  * @returns The node name if found; otherwise, null.
11084
11088
  */
11085
- var getTNode = function getTNode(paraId) {
11089
+ var getTNode = function getTNode(paraId, ecosystem) {
11086
11090
  var _a;
11087
- return (_a = NODE_NAMES.find(function (node) {
11088
- return getParaId(node) === paraId;
11091
+ if (paraId === 0) {
11092
+ return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
11093
+ }
11094
+ return (_a = NODE_NAMES_DOT_KSM.find(function (nodeName) {
11095
+ return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
11089
11096
  })) !== null && _a !== void 0 ? _a : null;
11090
11097
  };
11091
11098
 
@@ -11518,6 +11525,60 @@ var getBalanceForeign = function getBalanceForeign(address, node, symbolOrId, ap
11518
11525
  }));
11519
11526
  };
11520
11527
 
11528
+ var getAssetBalance = function getAssetBalance(account, node, currency) {
11529
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11530
+ var _a, api, isNativeSymbol;
11531
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11532
+ while (1) switch (_context.prev = _context.next) {
11533
+ case 0:
11534
+ _context.next = 2;
11535
+ return createApiInstanceForNode(node);
11536
+ case 2:
11537
+ api = _context.sent;
11538
+ isNativeSymbol = 'symbol' in currency && getNativeAssetSymbol(node) === currency.symbol;
11539
+ if (!isNativeSymbol) {
11540
+ _context.next = 10;
11541
+ break;
11542
+ }
11543
+ _context.next = 7;
11544
+ return getBalanceNative(account, node, api);
11545
+ case 7:
11546
+ _context.t0 = _context.sent;
11547
+ _context.next = 22;
11548
+ break;
11549
+ case 10:
11550
+ _context.next = 12;
11551
+ return getBalanceForeign(account, node, currency, api);
11552
+ case 12:
11553
+ _context.t2 = _a = _context.sent;
11554
+ _context.t1 = _context.t2 !== null;
11555
+ if (!_context.t1) {
11556
+ _context.next = 16;
11557
+ break;
11558
+ }
11559
+ _context.t1 = _a !== void 0;
11560
+ case 16:
11561
+ if (!_context.t1) {
11562
+ _context.next = 20;
11563
+ break;
11564
+ }
11565
+ _context.t3 = _a;
11566
+ _context.next = 21;
11567
+ break;
11568
+ case 20:
11569
+ _context.t3 = BigInt(0);
11570
+ case 21:
11571
+ _context.t0 = _context.t3;
11572
+ case 22:
11573
+ return _context.abrupt("return", _context.t0);
11574
+ case 23:
11575
+ case "end":
11576
+ return _context.stop();
11577
+ }
11578
+ }, _callee);
11579
+ }));
11580
+ };
11581
+
11521
11582
  var palletsMap = edsMapJson;
11522
11583
  var getExistentialDeposit = function getExistentialDeposit(node) {
11523
11584
  return BigInt(palletsMap[node]);
@@ -12729,16 +12790,12 @@ var getOriginFeeDetails = function getOriginFeeDetails(origin_1, destination_1,
12729
12790
  xcmFee = _context2.sent;
12730
12791
  xcmFeeBigInt = BigInt(xcmFee.toString());
12731
12792
  xcmFeeWithMargin = xcmFeeBigInt + xcmFeeBigInt / BigInt(feeMarginPercentage);
12732
- console.log('nativeBalance', nativeBalance);
12733
- console.log('minTransferableAmount', minTransferableAmount);
12734
- console.log('xcmFeeBigInt', xcmFeeBigInt);
12735
- console.log('xcmFeeWithMargin', xcmFeeWithMargin);
12736
12793
  sufficientForXCM = nativeBalance - minTransferableAmount - xcmFeeWithMargin > 0;
12737
12794
  return _context2.abrupt("return", {
12738
12795
  sufficientForXCM: sufficientForXCM,
12739
12796
  xcmFee: xcmFeeBigInt
12740
12797
  });
12741
- case 26:
12798
+ case 22:
12742
12799
  case "end":
12743
12800
  return _context2.stop();
12744
12801
  }
@@ -12747,60 +12804,6 @@ var getOriginFeeDetails = function getOriginFeeDetails(origin_1, destination_1,
12747
12804
  });
12748
12805
  };
12749
12806
 
12750
- var getAssetBalance = function getAssetBalance(account, node, currency) {
12751
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
12752
- var _a, api, isNativeSymbol;
12753
- return _regeneratorRuntime().wrap(function _callee$(_context) {
12754
- while (1) switch (_context.prev = _context.next) {
12755
- case 0:
12756
- _context.next = 2;
12757
- return createApiInstanceForNode(node);
12758
- case 2:
12759
- api = _context.sent;
12760
- isNativeSymbol = 'symbol' in currency && getNativeAssetSymbol(node) === currency.symbol;
12761
- if (!isNativeSymbol) {
12762
- _context.next = 10;
12763
- break;
12764
- }
12765
- _context.next = 7;
12766
- return getBalanceNative(account, node, api);
12767
- case 7:
12768
- _context.t0 = _context.sent;
12769
- _context.next = 22;
12770
- break;
12771
- case 10:
12772
- _context.next = 12;
12773
- return getBalanceForeign(account, node, currency, api);
12774
- case 12:
12775
- _context.t2 = _a = _context.sent;
12776
- _context.t1 = _context.t2 !== null;
12777
- if (!_context.t1) {
12778
- _context.next = 16;
12779
- break;
12780
- }
12781
- _context.t1 = _a !== void 0;
12782
- case 16:
12783
- if (!_context.t1) {
12784
- _context.next = 20;
12785
- break;
12786
- }
12787
- _context.t3 = _a;
12788
- _context.next = 21;
12789
- break;
12790
- case 20:
12791
- _context.t3 = BigInt(0);
12792
- case 21:
12793
- _context.t0 = _context.t3;
12794
- case 22:
12795
- return _context.abrupt("return", _context.t0);
12796
- case 23:
12797
- case "end":
12798
- return _context.stop();
12799
- }
12800
- }, _callee);
12801
- }));
12802
- };
12803
-
12804
12807
  /**
12805
12808
  * Retrieves detailed transfer information for a cross-chain transfer.
12806
12809
  *
@@ -12944,6 +12947,7 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
12944
12947
  var index$1 = /*#__PURE__*/Object.freeze({
12945
12948
  __proto__: null,
12946
12949
  getAllAssetsSymbols: getAllAssetsSymbols,
12950
+ getAssetBalance: getAssetBalance,
12947
12951
  getAssetDecimals: getAssetDecimals,
12948
12952
  getAssetId: getAssetId,
12949
12953
  getAssets: getAssets,
@@ -13050,10 +13054,8 @@ var getAllNodeProviders = function getAllNodeProviders(node) {
13050
13054
 
13051
13055
  var getFees = function getFees(scenario) {
13052
13056
  if (scenario === 'ParaToRelay') {
13053
- console.log('Asigning fees for transfer to Relay chain');
13054
13057
  return 4600000000;
13055
13058
  } else if (scenario === 'ParaToPara') {
13056
- console.log('Asigning fees for transfer to another Parachain chain');
13057
13059
  return 399600000000;
13058
13060
  }
13059
13061
  throw new Error("Fees for scenario ".concat(scenario, " are not defined."));
@@ -13821,6 +13823,7 @@ exports.createApiInstanceForNode = createApiInstanceForNode;
13821
13823
  exports.determineRelayChain = determineRelayChain;
13822
13824
  exports.getAllAssetsSymbols = getAllAssetsSymbols;
13823
13825
  exports.getAllNodeProviders = getAllNodeProviders;
13826
+ exports.getAssetBalance = getAssetBalance;
13824
13827
  exports.getAssetDecimals = getAssetDecimals;
13825
13828
  exports.getAssetId = getAssetId;
13826
13829
  exports.getAssets = getAssets;
package/dist/index.d.ts CHANGED
@@ -1082,14 +1082,14 @@ declare const getAssetDecimals: (node: TNodeWithRelayChains, symbol: string) =>
1082
1082
  * @param node - The node for which to get the paraId.
1083
1083
  * @returns The parachain ID of the node.
1084
1084
  */
1085
- declare const getParaId: (node: TNode) => number;
1085
+ declare const getParaId: (node: TNodeWithRelayChains) => number;
1086
1086
  /**
1087
1087
  * Retrieves the node name corresponding to a specified parachain ID.
1088
1088
  *
1089
1089
  * @param paraId - The parachain ID.
1090
1090
  * @returns The node name if found; otherwise, null.
1091
1091
  */
1092
- declare const getTNode: (paraId: number) => TNode | null;
1092
+ declare const getTNode: (paraId: number, ecosystem: TRelayChainType) => TNodeDotKsmWithRelayChains | null;
1093
1093
 
1094
1094
  /**
1095
1095
  * Retrieves the existential deposit value for a given node.
@@ -1099,6 +1099,8 @@ declare const getTNode: (paraId: number) => TNode | null;
1099
1099
  */
1100
1100
  declare const getExistentialDeposit: (node: TNodeDotKsmWithRelayChains) => string | null;
1101
1101
 
1102
+ declare const getAssetBalance: (account: string, node: TNodeDotKsmWithRelayChains, currency: TCurrencyCore) => Promise<bigint>;
1103
+
1102
1104
  /**
1103
1105
  * Retrieves the native balance for a given account on a specified node.
1104
1106
  *
@@ -1146,6 +1148,7 @@ declare const getTransferInfo: (origin: TNodeDotKsmWithRelayChains, destination:
1146
1148
  declare const getSupportedAssets: (origin: TNodeWithRelayChains, destination: TNodeWithRelayChains) => TAsset[];
1147
1149
 
1148
1150
  declare const index_getAllAssetsSymbols: typeof getAllAssetsSymbols;
1151
+ declare const index_getAssetBalance: typeof getAssetBalance;
1149
1152
  declare const index_getAssetDecimals: typeof getAssetDecimals;
1150
1153
  declare const index_getAssetId: typeof getAssetId;
1151
1154
  declare const index_getAssets: typeof getAssets;
@@ -1164,7 +1167,7 @@ declare const index_getTNode: typeof getTNode;
1164
1167
  declare const index_getTransferInfo: typeof getTransferInfo;
1165
1168
  declare const index_hasSupportForAsset: typeof hasSupportForAsset;
1166
1169
  declare namespace index {
1167
- export { index_getAllAssetsSymbols as getAllAssetsSymbols, index_getAssetDecimals as getAssetDecimals, index_getAssetId as getAssetId, index_getAssets as getAssets, index_getAssetsObject as getAssetsObject, index_getBalanceForeign as getBalanceForeign, index_getBalanceNative as getBalanceNative, index_getExistentialDeposit as getExistentialDeposit, index_getNativeAssetSymbol as getNativeAssetSymbol, index_getNativeAssets as getNativeAssets, index_getOriginFeeDetails as getOriginFeeDetails, index_getOtherAssets as getOtherAssets, index_getParaId as getParaId, index_getRelayChainSymbol as getRelayChainSymbol, index_getSupportedAssets as getSupportedAssets, index_getTNode as getTNode, index_getTransferInfo as getTransferInfo, index_hasSupportForAsset as hasSupportForAsset };
1170
+ export { index_getAllAssetsSymbols as getAllAssetsSymbols, index_getAssetBalance as getAssetBalance, index_getAssetDecimals as getAssetDecimals, index_getAssetId as getAssetId, index_getAssets as getAssets, index_getAssetsObject as getAssetsObject, index_getBalanceForeign as getBalanceForeign, index_getBalanceNative as getBalanceNative, index_getExistentialDeposit as getExistentialDeposit, index_getNativeAssetSymbol as getNativeAssetSymbol, index_getNativeAssets as getNativeAssets, index_getOriginFeeDetails as getOriginFeeDetails, index_getOtherAssets as getOtherAssets, index_getParaId as getParaId, index_getRelayChainSymbol as getRelayChainSymbol, index_getSupportedAssets as getSupportedAssets, index_getTNode as getTNode, index_getTransferInfo as getTransferInfo, index_hasSupportForAsset as hasSupportForAsset };
1168
1171
  }
1169
1172
 
1170
1173
  /**
@@ -1517,4 +1520,4 @@ declare class DuplicateAssetIdError extends Error {
1517
1520
  constructor(id: string);
1518
1521
  }
1519
1522
 
1520
- export { BatchMode, Builder, type CheckKeepAliveOptions, DuplicateAssetError, DuplicateAssetIdError, EvmBuilder, type Extrinsic, GeneralBuilder, type HexString$1 as HexString, type IPolkadotXCMTransfer, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidCurrencyError, type JunctionParachain, type JunctionType, type Junctions, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, type PolkadotXCMTransferInput, type PolkadotXcmModule, type PolkadotXcmSection, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TApiType, type TAsset, type TAssetDetails, type TAssetJsonMap, type TBatchOptions, type TBifrostToken, type TCurrency, type TCurrencyCore, type TCurrencyInput, type TCurrencySelection, type TCurrencySelectionHeader, type TCurrencySelectionHeaderArr, type TCurrencySelectionV4, type TCurrencySymbol, type TDestWeight, type TDestination, type TEdJsonMap, type TEvmBuilderOptions, type TForeignAsset, type TForeignAssetId, type TForeignOrNativeAsset, type TForeignOrTokenAsset, type TJunction, type TMantaAsset, type TMultiAsset, type TMultiAssetV3, type TMultiAssetV4, type TMultiLocation, type TMultiLocationHeader, type TNativeAssetDetails, type TNativeTokenAsset, type TNode, type TNodeAssets, type TNodeDotKsmWithRelayChains, type TNodePolkadotKusama, type TNodeWithRelayChains, type TNodleAsset, type TOptionalEvmBuilderOptions, type TOriginFeeDetails, type TOtherReserveAsset, type TPallet, type TPalletJsonMap, type TPalletMap, type TRelayChainSymbol, type TRelayChainType, type TRelayToParaCommonOptions, type TRelayToParaInternalOptions, type TRelayToParaOptions, type TResType, type TReserveAsset, type TScenario, type TSelfReserveAsset, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSendOptionsCommon, type TSerializeEthTransferOptions, type TSerializedApiCall, type TSerializedEthTransfer, type TTransferInfo, type TTransferReturn, type TVersionClaimAssets, type TXTokensCurrencySelection, type TXcmAsset, type TZeitgeistAsset, type UseKeepAliveFinalBuilder, Version, type XTokensModule, type XTokensSection, type XTokensTransferInput, type XTransferModule, type XTransferSection, type XTransferTransferInput, index as assets, buildEthTransferOptions, createApiInstanceForNode, determineRelayChain, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOriginFeeDetails, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, isRelayChain, send, sendSerializedApiCall, transferRelayToPara, transferRelayToParaCommon, transferRelayToParaSerializedApiCall, index$1 as xcmPallet };
1523
+ export { BatchMode, Builder, type CheckKeepAliveOptions, DuplicateAssetError, DuplicateAssetIdError, EvmBuilder, type Extrinsic, GeneralBuilder, type HexString$1 as HexString, type IPolkadotXCMTransfer, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidCurrencyError, type JunctionParachain, type JunctionType, type Junctions, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, type PolkadotXCMTransferInput, type PolkadotXcmModule, type PolkadotXcmSection, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TApiType, type TAsset, type TAssetDetails, type TAssetJsonMap, type TBatchOptions, type TBifrostToken, type TCurrency, type TCurrencyCore, type TCurrencyInput, type TCurrencySelection, type TCurrencySelectionHeader, type TCurrencySelectionHeaderArr, type TCurrencySelectionV4, type TCurrencySymbol, type TDestWeight, type TDestination, type TEdJsonMap, type TEvmBuilderOptions, type TForeignAsset, type TForeignAssetId, type TForeignOrNativeAsset, type TForeignOrTokenAsset, type TJunction, type TMantaAsset, type TMultiAsset, type TMultiAssetV3, type TMultiAssetV4, type TMultiLocation, type TMultiLocationHeader, type TNativeAssetDetails, type TNativeTokenAsset, type TNode, type TNodeAssets, type TNodeDotKsmWithRelayChains, type TNodePolkadotKusama, type TNodeWithRelayChains, type TNodleAsset, type TOptionalEvmBuilderOptions, type TOriginFeeDetails, type TOtherReserveAsset, type TPallet, type TPalletJsonMap, type TPalletMap, type TRelayChainSymbol, type TRelayChainType, type TRelayToParaCommonOptions, type TRelayToParaInternalOptions, type TRelayToParaOptions, type TResType, type TReserveAsset, type TScenario, type TSelfReserveAsset, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSendOptionsCommon, type TSerializeEthTransferOptions, type TSerializedApiCall, type TSerializedEthTransfer, type TTransferInfo, type TTransferReturn, type TVersionClaimAssets, type TXTokensCurrencySelection, type TXcmAsset, type TZeitgeistAsset, type UseKeepAliveFinalBuilder, Version, type XTokensModule, type XTokensSection, type XTokensTransferInput, type XTransferModule, type XTransferSection, type XTransferTransferInput, index as assets, buildEthTransferOptions, createApiInstanceForNode, determineRelayChain, getAllAssetsSymbols, getAllNodeProviders, getAssetBalance, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOriginFeeDetails, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, isRelayChain, send, sendSerializedApiCall, transferRelayToPara, transferRelayToParaCommon, transferRelayToParaSerializedApiCall, index$1 as xcmPallet };
package/dist/index.mjs CHANGED
@@ -587,6 +587,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
587
587
  };
588
588
 
589
589
  var Polkadot$1 = {
590
+ paraId: 0,
590
591
  relayChainAssetSymbol: "DOT",
591
592
  nativeAssetSymbol: "DOT",
592
593
  nativeAssets: [
@@ -599,6 +600,7 @@ var Polkadot$1 = {
599
600
  ]
600
601
  };
601
602
  var Kusama$1 = {
603
+ paraId: 0,
602
604
  relayChainAssetSymbol: "KSM",
603
605
  nativeAssetSymbol: "KSM",
604
606
  nativeAssets: [
@@ -7662,7 +7664,6 @@ var Phala$3 = {
7662
7664
  ]
7663
7665
  };
7664
7666
  var Ethereum$1 = {
7665
- paraId: 1,
7666
7667
  relayChainAssetSymbol: "DOT",
7667
7668
  nativeAssetSymbol: "ETH",
7668
7669
  nativeAssets: [
@@ -8238,11 +8239,14 @@ var createBridgePolkadotXcmDest = function createBridgePolkadotXcmDest(version,
8238
8239
  return _defineProperty({}, version, isMultiLocationDestination ? destination : multiLocation);
8239
8240
  };
8240
8241
  var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(multiLocation) {
8242
+ var _a;
8241
8243
  var parachainId = findParachainJunction(multiLocation);
8242
8244
  if (parachainId === null) {
8243
8245
  throw new Error('Parachain ID not found in destination multi location.');
8244
8246
  }
8245
- var node = getTNode(parachainId);
8247
+ var node = (_a = NODE_NAMES.find(function (nodeName) {
8248
+ return getParaId(nodeName) === parachainId;
8249
+ })) !== null && _a !== void 0 ? _a : null;
8246
8250
  if (node === null) {
8247
8251
  throw new Error('Node with specified paraId not found in destination multi location.');
8248
8252
  }
@@ -11080,10 +11084,13 @@ var getParaId = function getParaId(node) {
11080
11084
  * @param paraId - The parachain ID.
11081
11085
  * @returns The node name if found; otherwise, null.
11082
11086
  */
11083
- var getTNode = function getTNode(paraId) {
11087
+ var getTNode = function getTNode(paraId, ecosystem) {
11084
11088
  var _a;
11085
- return (_a = NODE_NAMES.find(function (node) {
11086
- return getParaId(node) === paraId;
11089
+ if (paraId === 0) {
11090
+ return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
11091
+ }
11092
+ return (_a = NODE_NAMES_DOT_KSM.find(function (nodeName) {
11093
+ return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
11087
11094
  })) !== null && _a !== void 0 ? _a : null;
11088
11095
  };
11089
11096
 
@@ -11516,6 +11523,60 @@ var getBalanceForeign = function getBalanceForeign(address, node, symbolOrId, ap
11516
11523
  }));
11517
11524
  };
11518
11525
 
11526
+ var getAssetBalance = function getAssetBalance(account, node, currency) {
11527
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11528
+ var _a, api, isNativeSymbol;
11529
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11530
+ while (1) switch (_context.prev = _context.next) {
11531
+ case 0:
11532
+ _context.next = 2;
11533
+ return createApiInstanceForNode(node);
11534
+ case 2:
11535
+ api = _context.sent;
11536
+ isNativeSymbol = 'symbol' in currency && getNativeAssetSymbol(node) === currency.symbol;
11537
+ if (!isNativeSymbol) {
11538
+ _context.next = 10;
11539
+ break;
11540
+ }
11541
+ _context.next = 7;
11542
+ return getBalanceNative(account, node, api);
11543
+ case 7:
11544
+ _context.t0 = _context.sent;
11545
+ _context.next = 22;
11546
+ break;
11547
+ case 10:
11548
+ _context.next = 12;
11549
+ return getBalanceForeign(account, node, currency, api);
11550
+ case 12:
11551
+ _context.t2 = _a = _context.sent;
11552
+ _context.t1 = _context.t2 !== null;
11553
+ if (!_context.t1) {
11554
+ _context.next = 16;
11555
+ break;
11556
+ }
11557
+ _context.t1 = _a !== void 0;
11558
+ case 16:
11559
+ if (!_context.t1) {
11560
+ _context.next = 20;
11561
+ break;
11562
+ }
11563
+ _context.t3 = _a;
11564
+ _context.next = 21;
11565
+ break;
11566
+ case 20:
11567
+ _context.t3 = BigInt(0);
11568
+ case 21:
11569
+ _context.t0 = _context.t3;
11570
+ case 22:
11571
+ return _context.abrupt("return", _context.t0);
11572
+ case 23:
11573
+ case "end":
11574
+ return _context.stop();
11575
+ }
11576
+ }, _callee);
11577
+ }));
11578
+ };
11579
+
11519
11580
  var palletsMap = edsMapJson;
11520
11581
  var getExistentialDeposit = function getExistentialDeposit(node) {
11521
11582
  return BigInt(palletsMap[node]);
@@ -12727,16 +12788,12 @@ var getOriginFeeDetails = function getOriginFeeDetails(origin_1, destination_1,
12727
12788
  xcmFee = _context2.sent;
12728
12789
  xcmFeeBigInt = BigInt(xcmFee.toString());
12729
12790
  xcmFeeWithMargin = xcmFeeBigInt + xcmFeeBigInt / BigInt(feeMarginPercentage);
12730
- console.log('nativeBalance', nativeBalance);
12731
- console.log('minTransferableAmount', minTransferableAmount);
12732
- console.log('xcmFeeBigInt', xcmFeeBigInt);
12733
- console.log('xcmFeeWithMargin', xcmFeeWithMargin);
12734
12791
  sufficientForXCM = nativeBalance - minTransferableAmount - xcmFeeWithMargin > 0;
12735
12792
  return _context2.abrupt("return", {
12736
12793
  sufficientForXCM: sufficientForXCM,
12737
12794
  xcmFee: xcmFeeBigInt
12738
12795
  });
12739
- case 26:
12796
+ case 22:
12740
12797
  case "end":
12741
12798
  return _context2.stop();
12742
12799
  }
@@ -12745,60 +12802,6 @@ var getOriginFeeDetails = function getOriginFeeDetails(origin_1, destination_1,
12745
12802
  });
12746
12803
  };
12747
12804
 
12748
- var getAssetBalance = function getAssetBalance(account, node, currency) {
12749
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
12750
- var _a, api, isNativeSymbol;
12751
- return _regeneratorRuntime().wrap(function _callee$(_context) {
12752
- while (1) switch (_context.prev = _context.next) {
12753
- case 0:
12754
- _context.next = 2;
12755
- return createApiInstanceForNode(node);
12756
- case 2:
12757
- api = _context.sent;
12758
- isNativeSymbol = 'symbol' in currency && getNativeAssetSymbol(node) === currency.symbol;
12759
- if (!isNativeSymbol) {
12760
- _context.next = 10;
12761
- break;
12762
- }
12763
- _context.next = 7;
12764
- return getBalanceNative(account, node, api);
12765
- case 7:
12766
- _context.t0 = _context.sent;
12767
- _context.next = 22;
12768
- break;
12769
- case 10:
12770
- _context.next = 12;
12771
- return getBalanceForeign(account, node, currency, api);
12772
- case 12:
12773
- _context.t2 = _a = _context.sent;
12774
- _context.t1 = _context.t2 !== null;
12775
- if (!_context.t1) {
12776
- _context.next = 16;
12777
- break;
12778
- }
12779
- _context.t1 = _a !== void 0;
12780
- case 16:
12781
- if (!_context.t1) {
12782
- _context.next = 20;
12783
- break;
12784
- }
12785
- _context.t3 = _a;
12786
- _context.next = 21;
12787
- break;
12788
- case 20:
12789
- _context.t3 = BigInt(0);
12790
- case 21:
12791
- _context.t0 = _context.t3;
12792
- case 22:
12793
- return _context.abrupt("return", _context.t0);
12794
- case 23:
12795
- case "end":
12796
- return _context.stop();
12797
- }
12798
- }, _callee);
12799
- }));
12800
- };
12801
-
12802
12805
  /**
12803
12806
  * Retrieves detailed transfer information for a cross-chain transfer.
12804
12807
  *
@@ -12942,6 +12945,7 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
12942
12945
  var index$1 = /*#__PURE__*/Object.freeze({
12943
12946
  __proto__: null,
12944
12947
  getAllAssetsSymbols: getAllAssetsSymbols,
12948
+ getAssetBalance: getAssetBalance,
12945
12949
  getAssetDecimals: getAssetDecimals,
12946
12950
  getAssetId: getAssetId,
12947
12951
  getAssets: getAssets,
@@ -13048,10 +13052,8 @@ var getAllNodeProviders = function getAllNodeProviders(node) {
13048
13052
 
13049
13053
  var getFees = function getFees(scenario) {
13050
13054
  if (scenario === 'ParaToRelay') {
13051
- console.log('Asigning fees for transfer to Relay chain');
13052
13055
  return 4600000000;
13053
13056
  } else if (scenario === 'ParaToPara') {
13054
- console.log('Asigning fees for transfer to another Parachain chain');
13055
13057
  return 399600000000;
13056
13058
  }
13057
13059
  throw new Error("Fees for scenario ".concat(scenario, " are not defined."));
@@ -13798,4 +13800,4 @@ var index = /*#__PURE__*/Object.freeze({
13798
13800
  transferRelayToParaSerializedApiCall: transferRelayToParaSerializedApiCall
13799
13801
  });
13800
13802
 
13801
- export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, EvmBuilder, GeneralBuilder, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, index$1 as assets, buildEthTransferOptions, createApiInstanceForNode, determineRelayChain, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit$1 as getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOriginFeeDetails, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, isRelayChain, send, sendSerializedApiCall, transferRelayToPara, transferRelayToParaCommon, transferRelayToParaSerializedApiCall, index as xcmPallet };
13803
+ export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, EvmBuilder, GeneralBuilder, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, index$1 as assets, buildEthTransferOptions, createApiInstanceForNode, determineRelayChain, getAllAssetsSymbols, getAllNodeProviders, getAssetBalance, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit$1 as getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOriginFeeDetails, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, isRelayChain, send, sendSerializedApiCall, transferRelayToPara, transferRelayToParaCommon, transferRelayToParaSerializedApiCall, index as xcmPallet };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "6.2.3",
3
+ "version": "6.2.4",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": "@paraspell/sdk",
6
6
  "license": "MIT",