@paraspell/sdk 8.12.0 → 8.13.0

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
@@ -91,8 +91,9 @@ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
91
91
  .from(NODE)
92
92
  .to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
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
- .address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/, /*senderAddress - OPTIONAL - used when origin is AssetHub and feeAsset parameter is provided*/)
95
- /*.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
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
+ /*.senderAddress(address) - OPTIONAL - used when origin is AssetHub and feeAsset parameter is provided
96
+ .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
96
97
  .xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
97
98
  .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.*/
98
99
 
@@ -216,10 +217,8 @@ const result = await Builder(API /*optional*/)
216
217
  .to(NODE_2)
217
218
  .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}})
218
219
  .address(ADDRESS)
219
- .dryRun(SENDER_ADDRESS)
220
-
221
- //Function pattern
222
- await getDryRun({api /*optional*/, node, address /*sender address*/, tx /* Extrinsic object */})
220
+ .senderAddress(SENDER_ADDRESS)
221
+ .dryRun()
223
222
 
224
223
  //Check Parachain for DryRun support - returns true/false
225
224
  import { hasDryRunSupport } from "@paraspell/sdk-pjs";
@@ -242,7 +241,8 @@ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
242
241
  .from(ORIGIN_CHAIN)
243
242
  .to(DESTINATION_CHAIN)
244
243
  .currency(CURRENCY)
245
- .address(RECIPIENT_ADDRESS, SENDER_ADDRESS) // Both sender and recipient addresses are required!
244
+ .address(RECIPIENT_ADDRESS)
245
+ .senderAddress(SENDER_ADDRESS)
246
246
  .getXcmFee({disableFallback: true / false}) //When fallback is disabled, you only get notified of DryRun error, but no Payment info query fallback is performed. Payment info is still performed if Origin or Destination chain do not support DryRun out of the box.
247
247
  ```
248
248
 
@@ -258,7 +258,8 @@ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
258
258
  .from(ORIGIN_CHAIN)
259
259
  .to(DESTINATION_CHAIN)
260
260
  .currency(CURRENCY)
261
- .address(RECIPIENT_ADDRESS, SENDER_ADDRESS) // Both sender and recipient addresses are required!
261
+ .address(RECIPIENT_ADDRESS)
262
+ .senderAddress(SENDER_ADDRESS)
262
263
  .getXcmFeeEstimate()
263
264
  ```
264
265
 
package/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  var sdkCore = require('@paraspell/sdk-core');
4
4
  var blake2b = require('@noble/hashes/blake2b');
5
5
  var utils = require('@noble/hashes/utils');
6
+ var ethers = require('ethers');
6
7
  var polkadotApi = require('polkadot-api');
7
8
  var polkadotSdkCompat = require('polkadot-api/polkadot-sdk-compat');
8
9
 
@@ -1128,7 +1129,7 @@ var PapiApi = /*#__PURE__*/function () {
1128
1129
  case 0:
1129
1130
  toSS58 = polkadotApi.AccountId().dec;
1130
1131
  _context13.next = 3;
1131
- return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) ? toSS58(key) : key]);
1132
+ return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) && !ethers.ethers.isAddress(key) ? toSS58(key) : key]);
1132
1133
  case 3:
1133
1134
  value = _context13.sent;
1134
1135
  return _context13.abrupt("return", isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
@@ -1611,7 +1612,8 @@ var EvmBuilder = function EvmBuilder() {
1611
1612
  * @returns An extrinsic to be signed and sent.
1612
1613
  */
1613
1614
  var send = createPapiApiCall(sdkCore.send);
1614
- var getDryRun = createPapiApiCall(sdkCore.getDryRun);
1615
+ var dryRun = createPapiApiCall(sdkCore.dryRun);
1616
+ var dryRunOrigin = createPapiApiCall(sdkCore.dryRunOrigin);
1615
1617
  var getParaEthTransferFees = /*#__PURE__*/function () {
1616
1618
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ahApi) {
1617
1619
  var papiApi;
@@ -1659,8 +1661,9 @@ var getBridgeStatus = /*#__PURE__*/function () {
1659
1661
 
1660
1662
  var transfer = /*#__PURE__*/Object.freeze({
1661
1663
  __proto__: null,
1664
+ dryRun: dryRun,
1665
+ dryRunOrigin: dryRunOrigin,
1662
1666
  getBridgeStatus: getBridgeStatus,
1663
- getDryRun: getDryRun,
1664
1667
  getParaEthTransferFees: getParaEthTransferFees,
1665
1668
  send: send
1666
1669
  });
@@ -1670,11 +1673,12 @@ exports.EvmBuilder = EvmBuilder;
1670
1673
  exports.assets = assets;
1671
1674
  exports.claimAssets = claimAssets;
1672
1675
  exports.createApiInstanceForNode = createApiInstanceForNode;
1676
+ exports.dryRun = dryRun;
1677
+ exports.dryRunOrigin = dryRunOrigin;
1673
1678
  exports.getAssetBalance = getAssetBalance;
1674
1679
  exports.getBalanceForeign = getBalanceForeign;
1675
1680
  exports.getBalanceNative = getBalanceNative;
1676
1681
  exports.getBridgeStatus = getBridgeStatus;
1677
- exports.getDryRun = getDryRun;
1678
1682
  exports.getMaxForeignTransferableAmount = getMaxForeignTransferableAmount;
1679
1683
  exports.getMaxNativeTransferableAmount = getMaxNativeTransferableAmount;
1680
1684
  exports.getOriginFeeDetails = getOriginFeeDetails;
package/dist/index.d.ts CHANGED
@@ -204,23 +204,28 @@ declare const EvmBuilder: () => EvmBuilderCore<unknown, unknown, {
204
204
  declare const send: (options: _paraspell_sdk_core.TSendBaseOptions & {
205
205
  api?: TPapiApiOrUrl;
206
206
  }) => Promise<TPapiTransaction>;
207
- declare const getDryRun: (options: _paraspell_sdk_core.TDryRunCallBaseOptions<TPapiTransaction> & {
207
+ declare const dryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<TPapiTransaction> & {
208
208
  api?: TPapiApiOrUrl;
209
209
  }) => Promise<_paraspell_sdk_core.TDryRunResult>;
210
+ declare const dryRunOrigin: (options: _paraspell_sdk_core.TDryRunCallBaseOptions<TPapiTransaction> & {
211
+ api?: TPapiApiOrUrl;
212
+ }) => Promise<_paraspell_sdk_core.TDryRunNodeResult>;
210
213
  declare const getParaEthTransferFees: (ahApi?: TPapiApiOrUrl) => Promise<[bigint, bigint]>;
211
214
  /**
212
215
  * Gets the Ethereum bridge status.
213
216
  */
214
217
  declare const getBridgeStatus: (ahApi?: TPapiApiOrUrl) => Promise<_paraspell_sdk_core.TBridgeStatus>;
215
218
 
219
+ declare const transfer_dryRun: typeof dryRun;
220
+ declare const transfer_dryRunOrigin: typeof dryRunOrigin;
216
221
  declare const transfer_getBridgeStatus: typeof getBridgeStatus;
217
- declare const transfer_getDryRun: typeof getDryRun;
218
222
  declare const transfer_getParaEthTransferFees: typeof getParaEthTransferFees;
219
223
  declare const transfer_send: typeof send;
220
224
  declare namespace transfer {
221
225
  export {
226
+ transfer_dryRun as dryRun,
227
+ transfer_dryRunOrigin as dryRunOrigin,
222
228
  transfer_getBridgeStatus as getBridgeStatus,
223
- transfer_getDryRun as getDryRun,
224
229
  transfer_getParaEthTransferFees as getParaEthTransferFees,
225
230
  transfer_send as send,
226
231
  };
@@ -228,5 +233,5 @@ declare namespace transfer {
228
233
 
229
234
  declare const createApiInstanceForNode: (node: TNodeDotKsmWithRelayChains) => Promise<polkadot_api.PolkadotClient>;
230
235
 
231
- export { Builder, EvmBuilder, assets, claimAssets, createApiInstanceForNode, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getDryRun, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTransferInfo, getTransferableAmount, send, verifyEdOnDestination, transfer as xcmPallet };
236
+ export { Builder, EvmBuilder, assets, claimAssets, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTransferInfo, getTransferableAmount, send, verifyEdOnDestination, transfer as xcmPallet };
232
237
  export type { GeneralBuilder, TEvmNodeFromPapi, TPapiApi, TPapiApiOrUrl, TPapiTransaction };
package/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
- import { BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, NodeNotSupportedError, Parents, Version, getNode, isForeignAsset, computeFeeFromDryRun, getAssetsObject, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getTransferInfo as getTransferInfo$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, getMaxNativeTransferableAmount as getMaxNativeTransferableAmount$1, getMaxForeignTransferableAmount as getMaxForeignTransferableAmount$1, getTransferableAmount as getTransferableAmount$1, verifyEdOnDestination as verifyEdOnDestination$1, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, send as send$1, getDryRun as getDryRun$1 } from '@paraspell/sdk-core';
1
+ import { BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, NodeNotSupportedError, Parents, Version, getNode, isForeignAsset, computeFeeFromDryRun, getAssetsObject, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getTransferInfo as getTransferInfo$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, getMaxNativeTransferableAmount as getMaxNativeTransferableAmount$1, getMaxForeignTransferableAmount as getMaxForeignTransferableAmount$1, getTransferableAmount as getTransferableAmount$1, verifyEdOnDestination as verifyEdOnDestination$1, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
2
2
  export * from '@paraspell/sdk-core';
3
3
  import { blake2b } from '@noble/hashes/blake2b';
4
4
  import { bytesToHex } from '@noble/hashes/utils';
5
+ import { ethers } from 'ethers';
5
6
  import { FixedSizeBinary, Binary, createClient, AccountId } from 'polkadot-api';
6
7
  import { withPolkadotSdkCompat } from 'polkadot-api/polkadot-sdk-compat';
7
8
 
@@ -1127,7 +1128,7 @@ var PapiApi = /*#__PURE__*/function () {
1127
1128
  case 0:
1128
1129
  toSS58 = AccountId().dec;
1129
1130
  _context13.next = 3;
1130
- return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) ? toSS58(key) : key]);
1131
+ return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) && !ethers.isAddress(key) ? toSS58(key) : key]);
1131
1132
  case 3:
1132
1133
  value = _context13.sent;
1133
1134
  return _context13.abrupt("return", isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
@@ -1610,7 +1611,8 @@ var EvmBuilder = function EvmBuilder() {
1610
1611
  * @returns An extrinsic to be signed and sent.
1611
1612
  */
1612
1613
  var send = createPapiApiCall(send$1);
1613
- var getDryRun = createPapiApiCall(getDryRun$1);
1614
+ var dryRun = createPapiApiCall(dryRun$1);
1615
+ var dryRunOrigin = createPapiApiCall(dryRunOrigin$1);
1614
1616
  var getParaEthTransferFees = /*#__PURE__*/function () {
1615
1617
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ahApi) {
1616
1618
  var papiApi;
@@ -1658,10 +1660,11 @@ var getBridgeStatus = /*#__PURE__*/function () {
1658
1660
 
1659
1661
  var transfer = /*#__PURE__*/Object.freeze({
1660
1662
  __proto__: null,
1663
+ dryRun: dryRun,
1664
+ dryRunOrigin: dryRunOrigin,
1661
1665
  getBridgeStatus: getBridgeStatus,
1662
- getDryRun: getDryRun,
1663
1666
  getParaEthTransferFees: getParaEthTransferFees,
1664
1667
  send: send
1665
1668
  });
1666
1669
 
1667
- export { Builder, EvmBuilder, assets, claimAssets, createApiInstanceForNode, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getDryRun, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTransferInfo, getTransferableAmount, send, verifyEdOnDestination, transfer as xcmPallet };
1670
+ export { Builder, EvmBuilder, assets, claimAssets, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTransferInfo, getTransferableAmount, send, verifyEdOnDestination, transfer as xcmPallet };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "8.12.0",
3
+ "version": "8.13.0",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "ethers": "^6.13.7",
27
27
  "viem": "^2.28.1",
28
28
  "@noble/hashes": "^1.8.0",
29
- "@paraspell/sdk-core": "8.12.0"
29
+ "@paraspell/sdk-core": "8.13.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "polkadot-api": ">= 1.10.0 < 2"