@paraspell/sdk 8.15.0 → 8.15.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 +2 -13
- 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.*/
|
|
@@ -383,13 +384,7 @@ const ed = getExistentialDeposit(node, currency?)
|
|
|
383
384
|
|
|
384
385
|
### XCM Transfer info
|
|
385
386
|
```ts
|
|
386
|
-
import {
|
|
387
|
-
|
|
388
|
-
//Get balance of foreign currency
|
|
389
|
-
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 */})
|
|
390
|
-
|
|
391
|
-
//Get balance of native currency
|
|
392
|
-
await getBalanceNative({address, node, api /* api/ws_url_string optional */})
|
|
387
|
+
import { getAssetBalance, getTransferInfo, getOriginFeeDetails, getTransferableAmount, getParaEthTransferFees, verifyEdOnDestination } from "@paraspell/sdk";
|
|
393
388
|
|
|
394
389
|
//Get fee information regarding XCM call
|
|
395
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 */})
|
|
@@ -397,12 +392,6 @@ await getOriginFeeDetails({from, to, currency /*- {id: currencyID} | {symbol: cu
|
|
|
397
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).
|
|
398
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 */});
|
|
399
394
|
|
|
400
|
-
//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).
|
|
401
|
-
await getMaxNativeTransferableAmount({address, node, currency /*- {symbol: currencySymbol} */})
|
|
402
|
-
|
|
403
|
-
//Retrives maximal transferable balance of chain's foreign asset (Balance-AssetED)
|
|
404
|
-
await getMaxForeignTransferableAmount({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/});
|
|
405
|
-
|
|
406
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.
|
|
407
396
|
await getTransferableAmount({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/});
|
|
408
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.15.
|
|
3
|
+
"version": "8.15.2",
|
|
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.15.
|
|
30
|
+
"@paraspell/sdk-core": "8.15.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"polkadot-api": ">= 1.10.2 < 2"
|