@paraspell/sdk 7.2.6 → 7.2.8

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
@@ -16116,7 +16116,8 @@ var getNativeAssets = function getNativeAssets(node) {
16116
16116
  * @returns An array of other asset details.
16117
16117
  */
16118
16118
  var getOtherAssets = function getOtherAssets(node) {
16119
- return getAssetsObject(node).otherAssets;
16119
+ var otherAssets = getAssetsObject(node).otherAssets;
16120
+ return node === 'AssetHubPolkadot' ? [].concat(_toConsumableArray(otherAssets), _toConsumableArray(getAssetsObject('Ethereum').otherAssets)) : otherAssets;
16120
16121
  };
16121
16122
  /**
16122
16123
  * Retrieves the complete list of assets for a specified node, including relay chain asset, native, and other assets.
@@ -16144,13 +16145,15 @@ var getAllAssetsSymbols = function getAllAssetsSymbols(node) {
16144
16145
  var symbol = _ref.symbol;
16145
16146
  return symbol;
16146
16147
  });
16147
- var otherAssetsSymbols = otherAssets.filter(function (asset) {
16148
- return asset.symbol !== undefined;
16149
- }).map(function (_ref2) {
16148
+ var otherAssetsSymbols = otherAssets.map(function (_ref2) {
16150
16149
  var symbol = _ref2.symbol;
16151
16150
  return symbol;
16152
16151
  });
16153
- return [].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols));
16152
+ var ethAssetsSymbols = node === 'AssetHubPolkadot' ? getAssetsObject('Ethereum').otherAssets.map(function (_ref3) {
16153
+ var symbol = _ref3.symbol;
16154
+ return symbol;
16155
+ }) : [];
16156
+ return [].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols), _toConsumableArray(ethAssetsSymbols));
16154
16157
  };
16155
16158
  /**
16156
16159
  * Retrieves the symbol of the native asset for a specified node.
@@ -16816,7 +16819,7 @@ var getBalanceForeignXTokens = function getBalanceForeignXTokens(api, node, addr
16816
16819
  }
16817
16820
  return _context.abrupt("return", api.getBalanceForeignBifrost(address, asset));
16818
16821
  case 6:
16819
- return _context.abrupt("return", api.getBalanceForeignXTokens(address, asset));
16822
+ return _context.abrupt("return", api.getBalanceForeignXTokens(node, address, asset));
16820
16823
  case 7:
16821
16824
  case "end":
16822
16825
  return _context.stop();
@@ -19354,15 +19357,19 @@ var PolkadotJsApi = /*#__PURE__*/function () {
19354
19357
  }
19355
19358
  }, {
19356
19359
  key: "getBalanceForeignXTokens",
19357
- value: function getBalanceForeignXTokens(address, asset) {
19360
+ value: function getBalanceForeignXTokens(node, address, asset) {
19358
19361
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
19359
- var response, entry, accountData;
19362
+ var pallet, response, entry, accountData;
19360
19363
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
19361
19364
  while (1) switch (_context11.prev = _context11.next) {
19362
19365
  case 0:
19363
- _context11.next = 2;
19364
- return this.api.query.tokens.accounts.entries(address);
19365
- case 2:
19366
+ pallet = 'tokens';
19367
+ if (node === 'Centrifuge' || node === 'Altair') {
19368
+ pallet = 'ormlTokens';
19369
+ }
19370
+ _context11.next = 4;
19371
+ return this.api.query[pallet].accounts.entries(address);
19372
+ case 4:
19366
19373
  response = _context11.sent;
19367
19374
  entry = response.find(function (_ref2) {
19368
19375
  var _ref3 = _slicedToArray(_ref2, 2),
@@ -19376,7 +19383,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
19376
19383
  });
19377
19384
  accountData = entry ? entry[1] : null;
19378
19385
  return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) : BigInt(0));
19379
- case 6:
19386
+ case 8:
19380
19387
  case "end":
19381
19388
  return _context11.stop();
19382
19389
  }
package/dist/index.d.ts CHANGED
@@ -1042,7 +1042,7 @@ interface IPolkadotApi<TApi, TRes> {
1042
1042
  getMythosForeignBalance(address: string): Promise<bigint>;
1043
1043
  getAssetHubForeignBalance(address: string, multiLocation: TMultiLocation): Promise<bigint>;
1044
1044
  getForeignAssetsByIdBalance(address: string, assetId: string): Promise<bigint>;
1045
- getBalanceForeignXTokens(address: string, asset: TAsset): Promise<bigint>;
1045
+ getBalanceForeignXTokens(node: TNodePolkadotKusama, address: string, asset: TAsset): Promise<bigint>;
1046
1046
  getBalanceForeignBifrost(address: string, asset: TAsset): Promise<bigint>;
1047
1047
  getBalanceForeignAssetsAccount(address: string, assetId: bigint | number): Promise<bigint>;
1048
1048
  getFromStorage(key: string): Promise<string>;
package/dist/index.mjs CHANGED
@@ -16114,7 +16114,8 @@ var getNativeAssets = function getNativeAssets(node) {
16114
16114
  * @returns An array of other asset details.
16115
16115
  */
16116
16116
  var getOtherAssets = function getOtherAssets(node) {
16117
- return getAssetsObject(node).otherAssets;
16117
+ var otherAssets = getAssetsObject(node).otherAssets;
16118
+ return node === 'AssetHubPolkadot' ? [].concat(_toConsumableArray(otherAssets), _toConsumableArray(getAssetsObject('Ethereum').otherAssets)) : otherAssets;
16118
16119
  };
16119
16120
  /**
16120
16121
  * Retrieves the complete list of assets for a specified node, including relay chain asset, native, and other assets.
@@ -16142,13 +16143,15 @@ var getAllAssetsSymbols = function getAllAssetsSymbols(node) {
16142
16143
  var symbol = _ref.symbol;
16143
16144
  return symbol;
16144
16145
  });
16145
- var otherAssetsSymbols = otherAssets.filter(function (asset) {
16146
- return asset.symbol !== undefined;
16147
- }).map(function (_ref2) {
16146
+ var otherAssetsSymbols = otherAssets.map(function (_ref2) {
16148
16147
  var symbol = _ref2.symbol;
16149
16148
  return symbol;
16150
16149
  });
16151
- return [].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols));
16150
+ var ethAssetsSymbols = node === 'AssetHubPolkadot' ? getAssetsObject('Ethereum').otherAssets.map(function (_ref3) {
16151
+ var symbol = _ref3.symbol;
16152
+ return symbol;
16153
+ }) : [];
16154
+ return [].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols), _toConsumableArray(ethAssetsSymbols));
16152
16155
  };
16153
16156
  /**
16154
16157
  * Retrieves the symbol of the native asset for a specified node.
@@ -16814,7 +16817,7 @@ var getBalanceForeignXTokens = function getBalanceForeignXTokens(api, node, addr
16814
16817
  }
16815
16818
  return _context.abrupt("return", api.getBalanceForeignBifrost(address, asset));
16816
16819
  case 6:
16817
- return _context.abrupt("return", api.getBalanceForeignXTokens(address, asset));
16820
+ return _context.abrupt("return", api.getBalanceForeignXTokens(node, address, asset));
16818
16821
  case 7:
16819
16822
  case "end":
16820
16823
  return _context.stop();
@@ -19352,15 +19355,19 @@ var PolkadotJsApi = /*#__PURE__*/function () {
19352
19355
  }
19353
19356
  }, {
19354
19357
  key: "getBalanceForeignXTokens",
19355
- value: function getBalanceForeignXTokens(address, asset) {
19358
+ value: function getBalanceForeignXTokens(node, address, asset) {
19356
19359
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
19357
- var response, entry, accountData;
19360
+ var pallet, response, entry, accountData;
19358
19361
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
19359
19362
  while (1) switch (_context11.prev = _context11.next) {
19360
19363
  case 0:
19361
- _context11.next = 2;
19362
- return this.api.query.tokens.accounts.entries(address);
19363
- case 2:
19364
+ pallet = 'tokens';
19365
+ if (node === 'Centrifuge' || node === 'Altair') {
19366
+ pallet = 'ormlTokens';
19367
+ }
19368
+ _context11.next = 4;
19369
+ return this.api.query[pallet].accounts.entries(address);
19370
+ case 4:
19364
19371
  response = _context11.sent;
19365
19372
  entry = response.find(function (_ref2) {
19366
19373
  var _ref3 = _slicedToArray(_ref2, 2),
@@ -19374,7 +19381,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
19374
19381
  });
19375
19382
  accountData = entry ? entry[1] : null;
19376
19383
  return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) : BigInt(0));
19377
- case 6:
19384
+ case 8:
19378
19385
  case "end":
19379
19386
  return _context11.stop();
19380
19387
  }
@@ -16116,7 +16116,8 @@ var getNativeAssets = function getNativeAssets(node) {
16116
16116
  * @returns An array of other asset details.
16117
16117
  */
16118
16118
  var getOtherAssets = function getOtherAssets(node) {
16119
- return getAssetsObject(node).otherAssets;
16119
+ var otherAssets = getAssetsObject(node).otherAssets;
16120
+ return node === 'AssetHubPolkadot' ? [].concat(_toConsumableArray(otherAssets), _toConsumableArray(getAssetsObject('Ethereum').otherAssets)) : otherAssets;
16120
16121
  };
16121
16122
  /**
16122
16123
  * Retrieves the complete list of assets for a specified node, including relay chain asset, native, and other assets.
@@ -16144,13 +16145,15 @@ var getAllAssetsSymbols = function getAllAssetsSymbols(node) {
16144
16145
  var symbol = _ref.symbol;
16145
16146
  return symbol;
16146
16147
  });
16147
- var otherAssetsSymbols = otherAssets.filter(function (asset) {
16148
- return asset.symbol !== undefined;
16149
- }).map(function (_ref2) {
16148
+ var otherAssetsSymbols = otherAssets.map(function (_ref2) {
16150
16149
  var symbol = _ref2.symbol;
16151
16150
  return symbol;
16152
16151
  });
16153
- return [].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols));
16152
+ var ethAssetsSymbols = node === 'AssetHubPolkadot' ? getAssetsObject('Ethereum').otherAssets.map(function (_ref3) {
16153
+ var symbol = _ref3.symbol;
16154
+ return symbol;
16155
+ }) : [];
16156
+ return [].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols), _toConsumableArray(ethAssetsSymbols));
16154
16157
  };
16155
16158
  /**
16156
16159
  * Retrieves the symbol of the native asset for a specified node.
@@ -16816,7 +16819,7 @@ var getBalanceForeignXTokens = function getBalanceForeignXTokens(api, node, addr
16816
16819
  }
16817
16820
  return _context.abrupt("return", api.getBalanceForeignBifrost(address, asset));
16818
16821
  case 6:
16819
- return _context.abrupt("return", api.getBalanceForeignXTokens(address, asset));
16822
+ return _context.abrupt("return", api.getBalanceForeignXTokens(node, address, asset));
16820
16823
  case 7:
16821
16824
  case "end":
16822
16825
  return _context.stop();
@@ -19549,15 +19552,19 @@ var PapiApi = /*#__PURE__*/function () {
19549
19552
  }
19550
19553
  }, {
19551
19554
  key: "getBalanceForeignXTokens",
19552
- value: function getBalanceForeignXTokens(address, asset) {
19555
+ value: function getBalanceForeignXTokens(node, address, asset) {
19553
19556
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
19554
- var response, entry;
19557
+ var pallet, response, entry;
19555
19558
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
19556
19559
  while (1) switch (_context11.prev = _context11.next) {
19557
19560
  case 0:
19558
- _context11.next = 2;
19559
- return this.api.getUnsafeApi().query.Tokens.Accounts.getEntries(address);
19560
- case 2:
19561
+ pallet = 'Tokens';
19562
+ if (node === 'Centrifuge' || node === 'Altair') {
19563
+ pallet = 'OrmlTokens';
19564
+ }
19565
+ _context11.next = 4;
19566
+ return this.api.getUnsafeApi().query[pallet].Accounts.getEntries(address);
19567
+ case 4:
19561
19568
  response = _context11.sent;
19562
19569
  entry = response.find(function (_ref2) {
19563
19570
  var keyArgs = _ref2.keyArgs;
@@ -19568,7 +19575,7 @@ var PapiApi = /*#__PURE__*/function () {
19568
19575
  return assetItem.toString().toLowerCase() === ((_a = asset.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || isForeignAsset(asset) && assetItem.toString().toLowerCase() === ((_b = asset.assetId) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && assetItem.value.toString().toLowerCase() === ((_c = asset.symbol) === null || _c === void 0 ? void 0 : _c.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && isForeignAsset(asset) && assetItem.value.toString().toLowerCase() === ((_d = asset.assetId) === null || _d === void 0 ? void 0 : _d.toLowerCase());
19569
19576
  });
19570
19577
  return _context11.abrupt("return", (entry === null || entry === void 0 ? void 0 : entry.value) ? BigInt(entry.value.free.toString()) : BigInt(0));
19571
- case 5:
19578
+ case 7:
19572
19579
  case "end":
19573
19580
  return _context11.stop();
19574
19581
  }
@@ -22,7 +22,7 @@ interface IPolkadotApi<TApi, TRes> {
22
22
  getMythosForeignBalance(address: string): Promise<bigint>;
23
23
  getAssetHubForeignBalance(address: string, multiLocation: TMultiLocation): Promise<bigint>;
24
24
  getForeignAssetsByIdBalance(address: string, assetId: string): Promise<bigint>;
25
- getBalanceForeignXTokens(address: string, asset: TAsset): Promise<bigint>;
25
+ getBalanceForeignXTokens(node: TNodePolkadotKusama, address: string, asset: TAsset): Promise<bigint>;
26
26
  getBalanceForeignBifrost(address: string, asset: TAsset): Promise<bigint>;
27
27
  getBalanceForeignAssetsAccount(address: string, assetId: bigint | number): Promise<bigint>;
28
28
  getFromStorage(key: string): Promise<string>;
@@ -16114,7 +16114,8 @@ var getNativeAssets = function getNativeAssets(node) {
16114
16114
  * @returns An array of other asset details.
16115
16115
  */
16116
16116
  var getOtherAssets = function getOtherAssets(node) {
16117
- return getAssetsObject(node).otherAssets;
16117
+ var otherAssets = getAssetsObject(node).otherAssets;
16118
+ return node === 'AssetHubPolkadot' ? [].concat(_toConsumableArray(otherAssets), _toConsumableArray(getAssetsObject('Ethereum').otherAssets)) : otherAssets;
16118
16119
  };
16119
16120
  /**
16120
16121
  * Retrieves the complete list of assets for a specified node, including relay chain asset, native, and other assets.
@@ -16142,13 +16143,15 @@ var getAllAssetsSymbols = function getAllAssetsSymbols(node) {
16142
16143
  var symbol = _ref.symbol;
16143
16144
  return symbol;
16144
16145
  });
16145
- var otherAssetsSymbols = otherAssets.filter(function (asset) {
16146
- return asset.symbol !== undefined;
16147
- }).map(function (_ref2) {
16146
+ var otherAssetsSymbols = otherAssets.map(function (_ref2) {
16148
16147
  var symbol = _ref2.symbol;
16149
16148
  return symbol;
16150
16149
  });
16151
- return [].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols));
16150
+ var ethAssetsSymbols = node === 'AssetHubPolkadot' ? getAssetsObject('Ethereum').otherAssets.map(function (_ref3) {
16151
+ var symbol = _ref3.symbol;
16152
+ return symbol;
16153
+ }) : [];
16154
+ return [].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols), _toConsumableArray(ethAssetsSymbols));
16152
16155
  };
16153
16156
  /**
16154
16157
  * Retrieves the symbol of the native asset for a specified node.
@@ -16814,7 +16817,7 @@ var getBalanceForeignXTokens = function getBalanceForeignXTokens(api, node, addr
16814
16817
  }
16815
16818
  return _context.abrupt("return", api.getBalanceForeignBifrost(address, asset));
16816
16819
  case 6:
16817
- return _context.abrupt("return", api.getBalanceForeignXTokens(address, asset));
16820
+ return _context.abrupt("return", api.getBalanceForeignXTokens(node, address, asset));
16818
16821
  case 7:
16819
16822
  case "end":
16820
16823
  return _context.stop();
@@ -19547,15 +19550,19 @@ var PapiApi = /*#__PURE__*/function () {
19547
19550
  }
19548
19551
  }, {
19549
19552
  key: "getBalanceForeignXTokens",
19550
- value: function getBalanceForeignXTokens(address, asset) {
19553
+ value: function getBalanceForeignXTokens(node, address, asset) {
19551
19554
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
19552
- var response, entry;
19555
+ var pallet, response, entry;
19553
19556
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
19554
19557
  while (1) switch (_context11.prev = _context11.next) {
19555
19558
  case 0:
19556
- _context11.next = 2;
19557
- return this.api.getUnsafeApi().query.Tokens.Accounts.getEntries(address);
19558
- case 2:
19559
+ pallet = 'Tokens';
19560
+ if (node === 'Centrifuge' || node === 'Altair') {
19561
+ pallet = 'OrmlTokens';
19562
+ }
19563
+ _context11.next = 4;
19564
+ return this.api.getUnsafeApi().query[pallet].Accounts.getEntries(address);
19565
+ case 4:
19559
19566
  response = _context11.sent;
19560
19567
  entry = response.find(function (_ref2) {
19561
19568
  var keyArgs = _ref2.keyArgs;
@@ -19566,7 +19573,7 @@ var PapiApi = /*#__PURE__*/function () {
19566
19573
  return assetItem.toString().toLowerCase() === ((_a = asset.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || isForeignAsset(asset) && assetItem.toString().toLowerCase() === ((_b = asset.assetId) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && assetItem.value.toString().toLowerCase() === ((_c = asset.symbol) === null || _c === void 0 ? void 0 : _c.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && isForeignAsset(asset) && assetItem.value.toString().toLowerCase() === ((_d = asset.assetId) === null || _d === void 0 ? void 0 : _d.toLowerCase());
19567
19574
  });
19568
19575
  return _context11.abrupt("return", (entry === null || entry === void 0 ? void 0 : entry.value) ? BigInt(entry.value.free.toString()) : BigInt(0));
19569
- case 5:
19576
+ case 7:
19570
19577
  case "end":
19571
19578
  return _context11.stop();
19572
19579
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "7.2.6",
3
+ "version": "7.2.8",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": "@paraspell/sdk",
6
6
  "license": "MIT",