@paraspell/sdk 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 +18 -24
- package/dist/index.cjs +15 -3
- package/dist/index.d.ts +10 -1
- package/dist/index.mjs +15 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -93,6 +93,7 @@ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
|
93
93
|
.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}})
|
|
94
94
|
.address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/)
|
|
95
95
|
/*.senderAddress(address) - OPTIONAL - used when origin is AssetHub and feeAsset parameter is provided
|
|
96
|
+
.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)
|
|
96
97
|
.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
|
|
97
98
|
.xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
|
|
98
99
|
.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'
|
|
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
|
-
|
|
323
|
+
getAssetsObject(node: TNode)
|
|
318
324
|
|
|
319
325
|
// Retrieve foreign assetId for a particular node and asset symbol
|
|
320
|
-
|
|
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
|
-
|
|
329
|
+
getRelayChainSymbol(node: TNode)
|
|
324
330
|
|
|
325
331
|
// Retrieve string array of native assets symbols for particular node
|
|
326
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
341
|
+
hasSupportForAsset(node: TNode, symbol: string)
|
|
336
342
|
|
|
337
343
|
// Get decimals for specific asset
|
|
338
|
-
|
|
344
|
+
getAssetDecimals(node: TNode, symbol: string)
|
|
339
345
|
|
|
340
346
|
// Get specific node id
|
|
341
|
-
|
|
347
|
+
getParaId(node: TNode)
|
|
342
348
|
|
|
343
349
|
// Get specific TNode from nodeID
|
|
344
|
-
|
|
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
|
-
|
|
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 {
|
|
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";
|
|
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
|
@@ -1783,10 +1783,22 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1783
1783
|
*/
|
|
1784
1784
|
}, {
|
|
1785
1785
|
key: "address",
|
|
1786
|
-
value: function address(_address
|
|
1786
|
+
value: function address(_address) {
|
|
1787
1787
|
return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1788
|
-
address: _address
|
|
1789
|
-
|
|
1788
|
+
address: _address
|
|
1789
|
+
}));
|
|
1790
|
+
}
|
|
1791
|
+
/**
|
|
1792
|
+
* Sets the asset hub address. This is used for transfers that go through the Asset Hub.
|
|
1793
|
+
*
|
|
1794
|
+
* @param address - The address to be used.
|
|
1795
|
+
* @returns An instance of EvmBuilder
|
|
1796
|
+
*/
|
|
1797
|
+
}, {
|
|
1798
|
+
key: "ahAddress",
|
|
1799
|
+
value: function ahAddress(address) {
|
|
1800
|
+
return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1801
|
+
ahAddress: address
|
|
1790
1802
|
}));
|
|
1791
1803
|
}
|
|
1792
1804
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -164,9 +164,18 @@ declare class EvmBuilderCore<TApi, TRes, T extends Partial<TEvmBuilderOptions<TA
|
|
|
164
164
|
* @param address - The Polkadot address to receive the transfer.
|
|
165
165
|
* @returns An instance of EvmBuilder
|
|
166
166
|
*/
|
|
167
|
-
address(address: string
|
|
167
|
+
address(address: string): EvmBuilderCore<TApi, TRes, T & {
|
|
168
168
|
address: string;
|
|
169
169
|
}>;
|
|
170
|
+
/**
|
|
171
|
+
* Sets the asset hub address. This is used for transfers that go through the Asset Hub.
|
|
172
|
+
*
|
|
173
|
+
* @param address - The address to be used.
|
|
174
|
+
* @returns An instance of EvmBuilder
|
|
175
|
+
*/
|
|
176
|
+
ahAddress(address: string | undefined): EvmBuilderCore<unknown, unknown, T & {
|
|
177
|
+
ahAddress: string | undefined;
|
|
178
|
+
}>;
|
|
170
179
|
/**
|
|
171
180
|
* Specifies the signer for the Ethereum transaction.
|
|
172
181
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1782,10 +1782,22 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1782
1782
|
*/
|
|
1783
1783
|
}, {
|
|
1784
1784
|
key: "address",
|
|
1785
|
-
value: function address(_address
|
|
1785
|
+
value: function address(_address) {
|
|
1786
1786
|
return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1787
|
-
address: _address
|
|
1788
|
-
|
|
1787
|
+
address: _address
|
|
1788
|
+
}));
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* Sets the asset hub address. This is used for transfers that go through the Asset Hub.
|
|
1792
|
+
*
|
|
1793
|
+
* @param address - The address to be used.
|
|
1794
|
+
* @returns An instance of EvmBuilder
|
|
1795
|
+
*/
|
|
1796
|
+
}, {
|
|
1797
|
+
key: "ahAddress",
|
|
1798
|
+
value: function ahAddress(address) {
|
|
1799
|
+
return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1800
|
+
ahAddress: address
|
|
1789
1801
|
}));
|
|
1790
1802
|
}
|
|
1791
1803
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.15.1",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"ethers": "^6.13.7",
|
|
28
28
|
"quick-lru": "^7.0.1",
|
|
29
29
|
"viem": "^2.28.1",
|
|
30
|
-
"@paraspell/sdk-core": "8.
|
|
30
|
+
"@paraspell/sdk-core": "8.15.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"polkadot-api": ">= 1.10.2 < 2"
|