@paraspell/sdk-pjs 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
|
@@ -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.*/
|
|
@@ -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-pjs";
|
|
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
|
@@ -1652,10 +1652,22 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1652
1652
|
*/
|
|
1653
1653
|
}, {
|
|
1654
1654
|
key: "address",
|
|
1655
|
-
value: function address(_address
|
|
1655
|
+
value: function address(_address) {
|
|
1656
1656
|
return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1657
|
-
address: _address
|
|
1658
|
-
|
|
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
|
|
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
|
|
1654
|
+
value: function address(_address) {
|
|
1655
1655
|
return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1656
|
-
address: _address
|
|
1657
|
-
|
|
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.15.
|
|
3
|
+
"version": "8.15.2",
|
|
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.15.
|
|
30
|
+
"@paraspell/sdk-core": "8.15.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@polkadot/api": ">= 15.0 < 16",
|