@paraspell/assets 12.0.5 → 12.0.6
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 +1 -1
- package/dist/index.mjs +33 -10
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -215,7 +215,7 @@ declare const normalizeSymbol: (symbol?: string) => string;
|
|
|
215
215
|
|
|
216
216
|
declare const findAssetInfo: (chain: TChain, currency: TCurrencyInput, destination: TChain | null) => TAssetInfo | null;
|
|
217
217
|
|
|
218
|
-
declare const findAssetInfoById: (assets: TAssetInfo[], assetId: TCurrency) => TAssetInfo
|
|
218
|
+
declare const findAssetInfoById: (assets: TAssetInfo[], assetId: TCurrency) => TAssetInfo;
|
|
219
219
|
|
|
220
220
|
declare const findAssetInfoByLoc: (foreignAssets: TAssetInfo[], location: string | TLocation) => TAssetInfo | undefined;
|
|
221
221
|
|
package/dist/index.mjs
CHANGED
|
@@ -2949,6 +2949,7 @@ var Hydration = {
|
|
|
2949
2949
|
isNative: true,
|
|
2950
2950
|
decimals: 12,
|
|
2951
2951
|
existentialDeposit: "1000000000000",
|
|
2952
|
+
assetId: "0",
|
|
2952
2953
|
location: {
|
|
2953
2954
|
parents: 1,
|
|
2954
2955
|
interior: {
|
|
@@ -20436,6 +20437,14 @@ var isSymbolMatch = function isSymbolMatch(symbolA, symbolB) {
|
|
|
20436
20437
|
return normalizeSymbol(symbolA) === normalizeSymbol(symbolB);
|
|
20437
20438
|
};
|
|
20438
20439
|
|
|
20440
|
+
function _arrayLikeToArray(r, a) {
|
|
20441
|
+
(null == a || a > r.length) && (a = r.length);
|
|
20442
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
20443
|
+
return n;
|
|
20444
|
+
}
|
|
20445
|
+
function _arrayWithoutHoles(r) {
|
|
20446
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
20447
|
+
}
|
|
20439
20448
|
function _assertThisInitialized(e) {
|
|
20440
20449
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
20441
20450
|
return e;
|
|
@@ -20490,6 +20499,12 @@ function _isNativeReflectConstruct() {
|
|
|
20490
20499
|
return !!t;
|
|
20491
20500
|
})();
|
|
20492
20501
|
}
|
|
20502
|
+
function _iterableToArray(r) {
|
|
20503
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
20504
|
+
}
|
|
20505
|
+
function _nonIterableSpread() {
|
|
20506
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
20507
|
+
}
|
|
20493
20508
|
function _objectWithoutProperties(e, t) {
|
|
20494
20509
|
if (null == e) return {};
|
|
20495
20510
|
var o,
|
|
@@ -20520,6 +20535,9 @@ function _setPrototypeOf(t, e) {
|
|
|
20520
20535
|
return t.__proto__ = e, t;
|
|
20521
20536
|
}, _setPrototypeOf(t, e);
|
|
20522
20537
|
}
|
|
20538
|
+
function _toConsumableArray(r) {
|
|
20539
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
20540
|
+
}
|
|
20523
20541
|
function _typeof(o) {
|
|
20524
20542
|
"@babel/helpers - typeof";
|
|
20525
20543
|
|
|
@@ -20529,6 +20547,13 @@ function _typeof(o) {
|
|
|
20529
20547
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
20530
20548
|
}, _typeof(o);
|
|
20531
20549
|
}
|
|
20550
|
+
function _unsupportedIterableToArray(r, a) {
|
|
20551
|
+
if (r) {
|
|
20552
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
20553
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
20554
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
20555
|
+
}
|
|
20556
|
+
}
|
|
20532
20557
|
function _wrapNativeSuper(t) {
|
|
20533
20558
|
var r = "function" == typeof Map ? new Map() : void 0;
|
|
20534
20559
|
return _wrapNativeSuper = function (t) {
|
|
@@ -20625,17 +20650,14 @@ var InvalidCurrencyError = /*#__PURE__*/function (_Error) {
|
|
|
20625
20650
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
20626
20651
|
|
|
20627
20652
|
var findAssetInfoById = function findAssetInfoById(assets, assetId) {
|
|
20628
|
-
var
|
|
20629
|
-
|
|
20630
|
-
return
|
|
20653
|
+
var id = assetId.toString();
|
|
20654
|
+
var matches = assets.filter(function (a) {
|
|
20655
|
+
return a.assetId === id;
|
|
20631
20656
|
});
|
|
20632
|
-
if (
|
|
20633
|
-
throw new DuplicateAssetIdError(
|
|
20657
|
+
if (matches.length > 1) {
|
|
20658
|
+
throw new DuplicateAssetIdError(id);
|
|
20634
20659
|
}
|
|
20635
|
-
return
|
|
20636
|
-
var currentAssetId = _ref2.assetId;
|
|
20637
|
-
return currentAssetId === assetId.toString();
|
|
20638
|
-
});
|
|
20660
|
+
return matches[0];
|
|
20639
20661
|
};
|
|
20640
20662
|
|
|
20641
20663
|
var sanitizeLocation = function sanitizeLocation(location) {
|
|
@@ -20902,6 +20924,7 @@ var findAssetInfo = function findAssetInfo(chain, currency, destination) {
|
|
|
20902
20924
|
}
|
|
20903
20925
|
var otherAssets = getOtherAssets(chain);
|
|
20904
20926
|
var nativeAssets = getNativeAssets(chain);
|
|
20927
|
+
var assets = [].concat(_toConsumableArray(nativeAssets), _toConsumableArray(otherAssets));
|
|
20905
20928
|
var asset;
|
|
20906
20929
|
if ('symbol' in currency) {
|
|
20907
20930
|
asset = findAssetInfoBySymbol(destination, otherAssets, nativeAssets, currency.symbol);
|
|
@@ -20909,7 +20932,7 @@ var findAssetInfo = function findAssetInfo(chain, currency, destination) {
|
|
|
20909
20932
|
var _findAssetInfoByLoc;
|
|
20910
20933
|
asset = (_findAssetInfoByLoc = findAssetInfoByLoc(otherAssets, currency.location)) !== null && _findAssetInfoByLoc !== void 0 ? _findAssetInfoByLoc : findAssetInfoByLoc(nativeAssets, currency.location);
|
|
20911
20934
|
} else if ('id' in currency) {
|
|
20912
|
-
asset = findAssetInfoById(
|
|
20935
|
+
asset = findAssetInfoById(assets, currency.id);
|
|
20913
20936
|
}
|
|
20914
20937
|
return asset !== null && asset !== void 0 ? asset : null;
|
|
20915
20938
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/assets",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.6",
|
|
4
4
|
"description": "Assets for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@paraspell/sdk-common": "12.0.
|
|
26
|
+
"@paraspell/sdk-common": "12.0.6"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|