@paraspell/sdk-core 12.0.2 → 12.0.4

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/dist/index.d.ts CHANGED
@@ -292,7 +292,7 @@ declare abstract class BaseAssetsPallet {
292
292
  protected palletName: TAssetsPallet;
293
293
  constructor(palletName: TAssetsPallet);
294
294
  abstract mint<TApi, TRes>(address: string, assetInfo: WithAmount<TAssetInfo>, balance: bigint, chain: TSubstrateChain, api: IPolkadotApi<TApi, TRes>): Promise<TSetBalanceRes>;
295
- abstract getBalance<TApi, TRes>(api: IPolkadotApi<TApi, TRes>, address: string, asset: TAssetInfo, customCurrencyId?: unknown): Promise<bigint>;
295
+ abstract getBalance<TApi, TRes>(api: IPolkadotApi<TApi, TRes>, address: string, asset: TAssetInfo, customCurrencyId?: unknown, chain?: TSubstrateChain): Promise<bigint>;
296
296
  }
297
297
 
298
298
  /**
@@ -1794,6 +1794,7 @@ declare class EnergyWebX<TApi, TRes> extends Parachain<TApi, TRes> implements IP
1794
1794
  constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
1795
1795
  transferPolkadotXCM<TApi, TRes>(input: TPolkadotXCMTransferOptions<TApi, TRes>): Promise<TRes>;
1796
1796
  transferRelayToPara(): Promise<TSerializedExtrinsics>;
1797
+ getBalanceForeign<TApi, TRes>(api: IPolkadotApi<TApi, TRes>, address: string, asset: TAssetInfo): Promise<bigint>;
1797
1798
  }
1798
1799
 
1799
1800
  declare class EnergyWebXPaseo<TApi, TRes> extends EnergyWebX<TApi, TRes> {
package/dist/index.mjs CHANGED
@@ -6765,7 +6765,7 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
6765
6765
  feeType: originFeeType
6766
6766
  }), {}, {
6767
6767
  sufficient: sufficientOriginFee,
6768
- asset: originAsset
6768
+ asset: originFeeType === 'paymentInfo' ? findNativeAssetInfoOrThrow(origin) : originAsset
6769
6769
  }, originDryRunError && {
6770
6770
  dryRunError: originDryRunError
6771
6771
  }), originDryRunSubError && {
@@ -8255,25 +8255,6 @@ var createCustomXcm = function createCustomXcm(context, assetCount, isForFeeCalc
8255
8255
  return [depositInstruction];
8256
8256
  };
8257
8257
 
8258
- var createRefundInstruction = function createRefundInstruction(api, senderAddress, version, assetCount) {
8259
- return {
8260
- SetAppendix: [{
8261
- DepositAsset: {
8262
- assets: {
8263
- Wild: {
8264
- AllCounted: assetCount
8265
- }
8266
- },
8267
- beneficiary: createBeneficiaryLocation({
8268
- api: api,
8269
- address: senderAddress,
8270
- version: version
8271
- })
8272
- }
8273
- }]
8274
- };
8275
- };
8276
-
8277
8258
  var buildAssets = function buildAssets(chain, asset, feeAmount, isDotAsset, version) {
8278
8259
  var assets = [];
8279
8260
  var shouldLocalizeAndSort = isRelayChain(chain) || chain.startsWith('AssetHub');
@@ -8295,15 +8276,10 @@ var constructTypeAndThenCall = function constructTypeAndThenCall(context) {
8295
8276
  var fees = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
8296
8277
  var origin = context.origin,
8297
8278
  assetInfo = context.assetInfo,
8298
- isSubBridge = context.isSubBridge,
8299
8279
  isRelayAsset = context.isRelayAsset,
8300
- _context$options = context.options,
8301
- senderAddress = _context$options.senderAddress,
8302
- version = _context$options.version;
8280
+ version = context.options.version;
8303
8281
  var assetCount = isRelayAsset ? 1 : 2;
8304
- var refundInstruction = senderAddress ? createRefundInstruction(origin.api, senderAddress, version, assetCount) : null;
8305
8282
  var finalCustomXcm = [];
8306
- if (refundInstruction && !isSubBridge) finalCustomXcm.push(refundInstruction);
8307
8283
  var resolvedFees = fees !== null && fees !== void 0 ? fees : {
8308
8284
  hopFees: 0n,
8309
8285
  destFee: 0n
@@ -9222,7 +9198,7 @@ var Parachain = /*#__PURE__*/function () {
9222
9198
  instance = getPalletInstance(pallet);
9223
9199
  _context5.p = 4;
9224
9200
  _context5.n = 5;
9225
- return instance.getBalance(api, address, asset, customCurrencyId);
9201
+ return instance.getBalance(api, address, asset, customCurrencyId, this.chain);
9226
9202
  case 5:
9227
9203
  return _context5.a(2, _context5.v);
9228
9204
  case 6:
@@ -11645,6 +11621,11 @@ var EnergyWebX = /*#__PURE__*/function (_Parachain) {
11645
11621
  scenario: 'RelayToPara'
11646
11622
  });
11647
11623
  }
11624
+ }, {
11625
+ key: "getBalanceForeign",
11626
+ value: function getBalanceForeign(api, address, asset) {
11627
+ return getPalletInstance('Assets').getBalance(api, address, asset, this.chain);
11628
+ }
11648
11629
  }]);
11649
11630
  }(Parachain);
11650
11631
 
@@ -13534,21 +13515,22 @@ var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
13534
13515
  }, {
13535
13516
  key: "getBalance",
13536
13517
  value: function () {
13537
- var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, address, asset) {
13518
+ var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, address, asset, chain) {
13538
13519
  var _this = this,
13539
13520
  _balance$balance,
13540
13521
  _balance2;
13541
- var fetchBalance, balance, _t;
13522
+ var isEnergyWebX, fetchBalance, balance, _t;
13542
13523
  return _regenerator().w(function (_context) {
13543
13524
  while (1) switch (_context.p = _context.n) {
13544
13525
  case 0:
13545
13526
  assertHasId(asset);
13527
+ isEnergyWebX = chain === 'EnergyWebX';
13546
13528
  fetchBalance = function fetchBalance() {
13547
13529
  var useBigInt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
13548
13530
  return api.queryState({
13549
13531
  module: _this.palletName,
13550
13532
  method: 'Account',
13551
- params: [useBigInt ? BigInt(asset.assetId) : Number(asset.assetId), address]
13533
+ params: [isEnergyWebX ? asset.location : useBigInt ? BigInt(asset.assetId) : Number(asset.assetId), address]
13552
13534
  });
13553
13535
  }; // Try with number ID first, if it fails, try with bigint ID
13554
13536
  _context.p = 1;
@@ -13578,7 +13560,7 @@ var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
13578
13560
  }
13579
13561
  }, _callee, null, [[1, 3]]);
13580
13562
  }));
13581
- function getBalance(_x, _x2, _x3) {
13563
+ function getBalance(_x, _x2, _x3, _x4) {
13582
13564
  return _getBalance.apply(this, arguments);
13583
13565
  }
13584
13566
  return getBalance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "12.0.2",
3
+ "version": "12.0.4",
4
4
  "description": "SDK core for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,9 +26,9 @@
26
26
  "@noble/hashes": "^2.0.1",
27
27
  "@scure/base": "^2.0.0",
28
28
  "viem": "^2.40.3",
29
- "@paraspell/assets": "12.0.2",
30
- "@paraspell/sdk-common": "12.0.2",
31
- "@paraspell/pallets": "12.0.2"
29
+ "@paraspell/assets": "12.0.4",
30
+ "@paraspell/sdk-common": "12.0.4",
31
+ "@paraspell/pallets": "12.0.4"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/plugin-syntax-import-attributes": "^7.27.1",