@paraspell/sdk-core 11.14.10 → 11.14.12

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.cjs CHANGED
@@ -6800,8 +6800,8 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
6800
6800
  feeType: originFeeType
6801
6801
  }), {}, {
6802
6802
  sufficient: sufficientOriginFee,
6803
- currency: originAsset.symbol,
6804
- asset: originAsset
6803
+ currency: originFeeType === 'paymentInfo' ? assets.getNativeAssetSymbol(origin) : originAsset.symbol,
6804
+ asset: originFeeType === 'paymentInfo' ? assets.findNativeAssetInfoOrThrow(origin) : originAsset
6805
6805
  }, originDryRunError && {
6806
6806
  dryRunError: originDryRunError
6807
6807
  }), originDryRunSubError && {
@@ -8372,25 +8372,6 @@ var createCustomXcm = function createCustomXcm(context, assetCount, isForFeeCalc
8372
8372
  return [depositInstruction];
8373
8373
  };
8374
8374
 
8375
- var createRefundInstruction = function createRefundInstruction(api, senderAddress, version, assetCount) {
8376
- return {
8377
- SetAppendix: [{
8378
- DepositAsset: {
8379
- assets: {
8380
- Wild: {
8381
- AllCounted: assetCount
8382
- }
8383
- },
8384
- beneficiary: createBeneficiaryLocation({
8385
- api: api,
8386
- address: senderAddress,
8387
- version: version
8388
- })
8389
- }
8390
- }]
8391
- };
8392
- };
8393
-
8394
8375
  var buildAssets = function buildAssets(chain, asset, feeAmount, isDotAsset, version) {
8395
8376
  var assets = [];
8396
8377
  var shouldLocalizeAndSort = sdkCommon.isRelayChain(chain) || chain.startsWith('AssetHub');
@@ -8412,15 +8393,10 @@ var constructTypeAndThenCall = function constructTypeAndThenCall(context) {
8412
8393
  var fees = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
8413
8394
  var origin = context.origin,
8414
8395
  assetInfo = context.assetInfo,
8415
- isSubBridge = context.isSubBridge,
8416
8396
  isRelayAsset = context.isRelayAsset,
8417
- _context$options = context.options,
8418
- senderAddress = _context$options.senderAddress,
8419
- version = _context$options.version;
8397
+ version = context.options.version;
8420
8398
  var assetCount = isRelayAsset ? 1 : 2;
8421
- var refundInstruction = senderAddress ? createRefundInstruction(origin.api, senderAddress, version, assetCount) : null;
8422
8399
  var finalCustomXcm = [];
8423
- if (refundInstruction && !isSubBridge) finalCustomXcm.push(refundInstruction);
8424
8400
  var resolvedFees = fees !== null && fees !== void 0 ? fees : {
8425
8401
  hopFees: 0n,
8426
8402
  destFee: 0n
@@ -9339,7 +9315,7 @@ var Parachain = /*#__PURE__*/function () {
9339
9315
  instance = getPalletInstance(pallet);
9340
9316
  _context5.p = 4;
9341
9317
  _context5.n = 5;
9342
- return instance.getBalance(api, address, asset, customCurrencyId);
9318
+ return instance.getBalance(api, address, asset, customCurrencyId, this.chain);
9343
9319
  case 5:
9344
9320
  return _context5.a(2, _context5.v);
9345
9321
  case 6:
@@ -11726,6 +11702,11 @@ var EnergyWebX = /*#__PURE__*/function (_Parachain) {
11726
11702
  value: function transferRelayToPara() {
11727
11703
  throw new ChainNotSupportedError();
11728
11704
  }
11705
+ }, {
11706
+ key: "getBalanceForeign",
11707
+ value: function getBalanceForeign(api, address, asset) {
11708
+ return getPalletInstance('Assets').getBalance(api, address, asset, this.chain);
11709
+ }
11729
11710
  }]);
11730
11711
  }(Parachain);
11731
11712
 
@@ -13576,21 +13557,22 @@ var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
13576
13557
  }, {
13577
13558
  key: "getBalance",
13578
13559
  value: function () {
13579
- var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, address, asset) {
13560
+ var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, address, asset, chain) {
13580
13561
  var _this = this,
13581
13562
  _balance$balance,
13582
13563
  _balance2;
13583
- var fetchBalance, balance, _t;
13564
+ var isEnergyWebX, fetchBalance, balance, _t;
13584
13565
  return _regenerator().w(function (_context) {
13585
13566
  while (1) switch (_context.p = _context.n) {
13586
13567
  case 0:
13587
13568
  assertHasId(asset);
13569
+ isEnergyWebX = chain === 'EnergyWebX';
13588
13570
  fetchBalance = function fetchBalance() {
13589
13571
  var useBigInt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
13590
13572
  return api.queryState({
13591
13573
  module: _this.palletName,
13592
13574
  method: 'Account',
13593
- params: [useBigInt ? BigInt(asset.assetId) : Number(asset.assetId), address]
13575
+ params: [isEnergyWebX ? asset.location : useBigInt ? BigInt(asset.assetId) : Number(asset.assetId), address]
13594
13576
  });
13595
13577
  }; // Try with number ID first, if it fails, try with bigint ID
13596
13578
  _context.p = 1;
@@ -13620,7 +13602,7 @@ var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
13620
13602
  }
13621
13603
  }, _callee, null, [[1, 3]]);
13622
13604
  }));
13623
- function getBalance(_x, _x2, _x3) {
13605
+ function getBalance(_x, _x2, _x3, _x4) {
13624
13606
  return _getBalance.apply(this, arguments);
13625
13607
  }
13626
13608
  return getBalance;
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
  /**
@@ -1878,6 +1878,7 @@ declare class EnergyWebX<TApi, TRes> extends Parachain<TApi, TRes> implements IP
1878
1878
  constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
1879
1879
  transferPolkadotXCM<TApi, TRes>(input: TPolkadotXCMTransferOptions<TApi, TRes>): Promise<TRes>;
1880
1880
  transferRelayToPara(): Promise<TSerializedExtrinsics>;
1881
+ getBalanceForeign<TApi, TRes>(api: IPolkadotApi<TApi, TRes>, address: string, asset: TAssetInfo): Promise<bigint>;
1881
1882
  }
1882
1883
 
1883
1884
  declare class EnergyWebXPaseo<TApi, TRes> extends EnergyWebX<TApi, TRes> {
package/dist/index.mjs CHANGED
@@ -6801,8 +6801,8 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
6801
6801
  feeType: originFeeType
6802
6802
  }), {}, {
6803
6803
  sufficient: sufficientOriginFee,
6804
- currency: originAsset.symbol,
6805
- asset: originAsset
6804
+ currency: originFeeType === 'paymentInfo' ? getNativeAssetSymbol(origin) : originAsset.symbol,
6805
+ asset: originFeeType === 'paymentInfo' ? findNativeAssetInfoOrThrow(origin) : originAsset
6806
6806
  }, originDryRunError && {
6807
6807
  dryRunError: originDryRunError
6808
6808
  }), originDryRunSubError && {
@@ -8373,25 +8373,6 @@ var createCustomXcm = function createCustomXcm(context, assetCount, isForFeeCalc
8373
8373
  return [depositInstruction];
8374
8374
  };
8375
8375
 
8376
- var createRefundInstruction = function createRefundInstruction(api, senderAddress, version, assetCount) {
8377
- return {
8378
- SetAppendix: [{
8379
- DepositAsset: {
8380
- assets: {
8381
- Wild: {
8382
- AllCounted: assetCount
8383
- }
8384
- },
8385
- beneficiary: createBeneficiaryLocation({
8386
- api: api,
8387
- address: senderAddress,
8388
- version: version
8389
- })
8390
- }
8391
- }]
8392
- };
8393
- };
8394
-
8395
8376
  var buildAssets = function buildAssets(chain, asset, feeAmount, isDotAsset, version) {
8396
8377
  var assets = [];
8397
8378
  var shouldLocalizeAndSort = isRelayChain(chain) || chain.startsWith('AssetHub');
@@ -8413,15 +8394,10 @@ var constructTypeAndThenCall = function constructTypeAndThenCall(context) {
8413
8394
  var fees = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
8414
8395
  var origin = context.origin,
8415
8396
  assetInfo = context.assetInfo,
8416
- isSubBridge = context.isSubBridge,
8417
8397
  isRelayAsset = context.isRelayAsset,
8418
- _context$options = context.options,
8419
- senderAddress = _context$options.senderAddress,
8420
- version = _context$options.version;
8398
+ version = context.options.version;
8421
8399
  var assetCount = isRelayAsset ? 1 : 2;
8422
- var refundInstruction = senderAddress ? createRefundInstruction(origin.api, senderAddress, version, assetCount) : null;
8423
8400
  var finalCustomXcm = [];
8424
- if (refundInstruction && !isSubBridge) finalCustomXcm.push(refundInstruction);
8425
8401
  var resolvedFees = fees !== null && fees !== void 0 ? fees : {
8426
8402
  hopFees: 0n,
8427
8403
  destFee: 0n
@@ -9340,7 +9316,7 @@ var Parachain = /*#__PURE__*/function () {
9340
9316
  instance = getPalletInstance(pallet);
9341
9317
  _context5.p = 4;
9342
9318
  _context5.n = 5;
9343
- return instance.getBalance(api, address, asset, customCurrencyId);
9319
+ return instance.getBalance(api, address, asset, customCurrencyId, this.chain);
9344
9320
  case 5:
9345
9321
  return _context5.a(2, _context5.v);
9346
9322
  case 6:
@@ -11727,6 +11703,11 @@ var EnergyWebX = /*#__PURE__*/function (_Parachain) {
11727
11703
  value: function transferRelayToPara() {
11728
11704
  throw new ChainNotSupportedError();
11729
11705
  }
11706
+ }, {
11707
+ key: "getBalanceForeign",
11708
+ value: function getBalanceForeign(api, address, asset) {
11709
+ return getPalletInstance('Assets').getBalance(api, address, asset, this.chain);
11710
+ }
11730
11711
  }]);
11731
11712
  }(Parachain);
11732
11713
 
@@ -13577,21 +13558,22 @@ var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
13577
13558
  }, {
13578
13559
  key: "getBalance",
13579
13560
  value: function () {
13580
- var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, address, asset) {
13561
+ var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, address, asset, chain) {
13581
13562
  var _this = this,
13582
13563
  _balance$balance,
13583
13564
  _balance2;
13584
- var fetchBalance, balance, _t;
13565
+ var isEnergyWebX, fetchBalance, balance, _t;
13585
13566
  return _regenerator().w(function (_context) {
13586
13567
  while (1) switch (_context.p = _context.n) {
13587
13568
  case 0:
13588
13569
  assertHasId(asset);
13570
+ isEnergyWebX = chain === 'EnergyWebX';
13589
13571
  fetchBalance = function fetchBalance() {
13590
13572
  var useBigInt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
13591
13573
  return api.queryState({
13592
13574
  module: _this.palletName,
13593
13575
  method: 'Account',
13594
- params: [useBigInt ? BigInt(asset.assetId) : Number(asset.assetId), address]
13576
+ params: [isEnergyWebX ? asset.location : useBigInt ? BigInt(asset.assetId) : Number(asset.assetId), address]
13595
13577
  });
13596
13578
  }; // Try with number ID first, if it fails, try with bigint ID
13597
13579
  _context.p = 1;
@@ -13621,7 +13603,7 @@ var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
13621
13603
  }
13622
13604
  }, _callee, null, [[1, 3]]);
13623
13605
  }));
13624
- function getBalance(_x, _x2, _x3) {
13606
+ function getBalance(_x, _x2, _x3, _x4) {
13625
13607
  return _getBalance.apply(this, arguments);
13626
13608
  }
13627
13609
  return getBalance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "11.14.10",
3
+ "version": "11.14.12",
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": "^1.8.0",
27
27
  "@scure/base": "^2.0.0",
28
28
  "viem": "^2.40.3",
29
- "@paraspell/assets": "11.14.10",
30
- "@paraspell/pallets": "11.14.10",
31
- "@paraspell/sdk-common": "11.14.10"
29
+ "@paraspell/assets": "11.14.12",
30
+ "@paraspell/pallets": "11.14.12",
31
+ "@paraspell/sdk-common": "11.14.12"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/plugin-syntax-import-attributes": "^7.27.1",