@paraspell/sdk-pjs 8.14.0 → 8.15.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/README.md CHANGED
@@ -89,6 +89,7 @@ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
89
89
  .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}})
90
90
  .address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/)
91
91
  /*.senderAddress(address) - OPTIONAL - used when origin is AssetHub and feeAsset parameter is provided
92
+ .ahAddress(ahAddress) - OPTIONAL - used when origin is EVM node and XCM goes through AssetHub (Multihop transfer where we are unable to convert Key20 to ID32 address eg. origin: Moonbeam & destination: Ethereum (Multihop goes from Moonbeam > AssetHub > BridgeHub > Ethereum)
92
93
  .feeAsset({symbol: 'symbol'} || {id: 'id'} || {multilocation: 'multilocation'}) // Optional parameter used when multiasset is provided or when origin is AssetHub - so user can pay in fees different than DOT
93
94
  .xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
94
95
  .customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some node but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
@@ -313,38 +314,43 @@ await builder.disconnect()
313
314
  ### Asset queries:
314
315
 
315
316
  ```ts
317
+ import { getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTNode, getAssetMultiLocation, NODE_NAMES } from '@paraspell/sdk-pjs'
318
+
319
+ // Retrieve Fee asset queries (Assets accepted as XCM Fee on specific node)
320
+ getFeeAssets(node: TNode)
321
+
316
322
  // Retrieve assets object from assets.json for particular node including information about native and foreign assets
317
- paraspell.assets.getAssetsObject(node: TNode)
323
+ getAssetsObject(node: TNode)
318
324
 
319
325
  // Retrieve foreign assetId for a particular node and asset symbol
320
- paraspell.assets.getAssetId(node: TNode, symbol: string)
326
+ getAssetId(node: TNode, symbol: string)
321
327
 
322
328
  // Retrieve the symbol of the relay chain for a particular node. Either "DOT" or "KSM"
323
- paraspell.assets.getRelayChainSymbol(node: TNode)
329
+ getRelayChainSymbol(node: TNode)
324
330
 
325
331
  // Retrieve string array of native assets symbols for particular node
326
- paraspell.assets.getNativeAssets(node: TNode)
332
+ getNativeAssets(node: TNode)
327
333
 
328
334
  // Retrieve object array of foreign assets for a particular node. Each object has a symbol and assetId property
329
- paraspell.assets.getOtherAssets(node: TNode)
335
+ getOtherAssets(node: TNode)
330
336
 
331
337
  // Retrieve string array of all assets symbols. (native and foreign assets are merged into a single array)
332
- paraspell.assets.getAllAssetsSymbols(node: TNode)
338
+ getAllAssetsSymbols(node: TNode)
333
339
 
334
340
  // Check if a node supports a particular asset. (Both native and foreign assets are searched). Returns boolean
335
- paraspell.assets.hasSupportForAsset(node: TNode, symbol: string)
341
+ hasSupportForAsset(node: TNode, symbol: string)
336
342
 
337
343
  // Get decimals for specific asset
338
- paraspell.assets.getAssetDecimals(node: TNode, symbol: string)
344
+ getAssetDecimals(node: TNode, symbol: string)
339
345
 
340
346
  // Get specific node id
341
- paraspell.assets.getParaId(node: TNode)
347
+ getParaId(node: TNode)
342
348
 
343
349
  // Get specific TNode from nodeID
344
- paraspell.assets.getTNode(nodeID: number, ecosystem: 'polkadot' || 'kusama' || 'ethereum') //When Ethereum ecosystem is selected please fill nodeID as 1 to select Ethereum.
350
+ getTNode(nodeID: number, ecosystem: 'polkadot' || 'kusama' || 'ethereum') //When Ethereum ecosystem is selected please fill nodeID as 1 to select Ethereum.
345
351
 
346
352
  // Import all compatible nodes as constant
347
- paraspell.NODE_NAMES
353
+ NODE_NAMES
348
354
 
349
355
  // Get multilocation for asset id or symbol on specific chain
350
356
  getAssetMultiLocation(chainFrom, { symbol: symbol } | { id: assetId })
@@ -378,13 +384,7 @@ const ed = getExistentialDeposit(node, currency?)
378
384
 
379
385
  ### XCM Transfer info
380
386
  ```ts
381
- import { getTransferInfo, getBalanceForeign, getBalanceNative, getOriginFeeDetails, getMaxNativeTransferableAmount, getMaxForeignTransferableAmount, getTransferableAmount } from "@paraspell/sdk-pjs";
382
-
383
- //Get balance of foreign currency
384
- await getBalanceForeign({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, api /* api/ws_url_string optional */})
385
-
386
- //Get balance of native currency
387
- await getBalanceNative({address, node, api /* api/ws_url_string optional */})
387
+ import { getAssetBalance, getTransferInfo, getOriginFeeDetails, getTransferableAmount, getParaEthTransferFees, verifyEdOnDestination } from "@paraspell/sdk-pjs";
388
388
 
389
389
  //Get fee information regarding XCM call
390
390
  await getOriginFeeDetails({from, to, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, amount, originAddress, destinationAddress, ahAddress /* optional parameter when destination is Ethereum and origin is Parachain other than AssetHub*/, api /* api/ws_url_string optional */, feeMargin /* 10% by default */})
@@ -392,12 +392,6 @@ await getOriginFeeDetails({from, to, currency /*- {id: currencyID} | {symbol: cu
392
392
  //Retrieves the asset balance for a given account on a specified node. (You do not need to specify if it is native or foreign).
393
393
  await getAssetBalance({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, api /* api/ws_url_string optional */});
394
394
 
395
- //Retrieves maximal transferable balance of chain's native asset (Balance-AssetED) (If a node has more native assets, the asset selection has to be provided. Otherwise the parameter is optional).
396
- await getMaxNativeTransferableAmount({address, node, currency /*- {symbol: currencySymbol} */})
397
-
398
- //Retrives maximal transferable balance of chain's foreign asset (Balance-AssetED)
399
- await getMaxForeignTransferableAmount({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/});
400
-
401
395
  //Combines the getMaxNative and getMaxForeign transferable amount functions into one, so you don't have to specify whether you want a native or foreign asset.
402
396
  await getTransferableAmount({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/});
403
397
 
package/dist/index.cjs CHANGED
@@ -1652,10 +1652,22 @@ var EvmBuilderCore = /*#__PURE__*/function () {
1652
1652
  */
1653
1653
  }, {
1654
1654
  key: "address",
1655
- value: function address(_address, ahAddress) {
1655
+ value: function address(_address) {
1656
1656
  return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
1657
- address: _address,
1658
- ahAddress: ahAddress
1657
+ address: _address
1658
+ }));
1659
+ }
1660
+ /**
1661
+ * Sets the asset hub address. This is used for transfers that go through the Asset Hub.
1662
+ *
1663
+ * @param address - The address to be used.
1664
+ * @returns An instance of EvmBuilder
1665
+ */
1666
+ }, {
1667
+ key: "ahAddress",
1668
+ value: function ahAddress(address) {
1669
+ return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
1670
+ ahAddress: address
1659
1671
  }));
1660
1672
  }
1661
1673
  /**
package/dist/index.d.ts CHANGED
@@ -166,9 +166,18 @@ declare class EvmBuilderCore<TApi, TRes, T extends Partial<TEvmBuilderOptions<TA
166
166
  * @param address - The Polkadot address to receive the transfer.
167
167
  * @returns An instance of EvmBuilder
168
168
  */
169
- address(address: string, ahAddress?: string): EvmBuilderCore<TApi, TRes, T & {
169
+ address(address: string): EvmBuilderCore<TApi, TRes, T & {
170
170
  address: string;
171
171
  }>;
172
+ /**
173
+ * Sets the asset hub address. This is used for transfers that go through the Asset Hub.
174
+ *
175
+ * @param address - The address to be used.
176
+ * @returns An instance of EvmBuilder
177
+ */
178
+ ahAddress(address: string | undefined): EvmBuilderCore<unknown, unknown, T & {
179
+ ahAddress: string | undefined;
180
+ }>;
172
181
  /**
173
182
  * Specifies the signer for the Ethereum transaction.
174
183
  *
package/dist/index.mjs CHANGED
@@ -1651,10 +1651,22 @@ var EvmBuilderCore = /*#__PURE__*/function () {
1651
1651
  */
1652
1652
  }, {
1653
1653
  key: "address",
1654
- value: function address(_address, ahAddress) {
1654
+ value: function address(_address) {
1655
1655
  return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
1656
- address: _address,
1657
- ahAddress: ahAddress
1656
+ address: _address
1657
+ }));
1658
+ }
1659
+ /**
1660
+ * Sets the asset hub address. This is used for transfers that go through the Asset Hub.
1661
+ *
1662
+ * @param address - The address to be used.
1663
+ * @returns An instance of EvmBuilder
1664
+ */
1665
+ }, {
1666
+ key: "ahAddress",
1667
+ value: function ahAddress(address) {
1668
+ return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
1669
+ ahAddress: address
1658
1670
  }));
1659
1671
  }
1660
1672
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-pjs",
3
- "version": "8.14.0",
3
+ "version": "8.15.1",
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": "8.14.0"
30
+ "@paraspell/sdk-core": "8.15.1"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@polkadot/api": ">= 15.0 < 16",