@paraspell/assets 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/dist/index.cjs CHANGED
@@ -5467,6 +5467,104 @@ var Moonbeam = {
5467
5467
  }
5468
5468
  },
5469
5469
  existentialDeposit: "1"
5470
+ },
5471
+ {
5472
+ symbol: "DAI",
5473
+ existentialDeposit: "1",
5474
+ decimals: 18,
5475
+ assetId: "209858003230988836317829383377338889687",
5476
+ multiLocation: {
5477
+ parents: 2,
5478
+ interior: {
5479
+ X2: [
5480
+ {
5481
+ GlobalConsensus: {
5482
+ Ethereum: {
5483
+ chainId: 1
5484
+ }
5485
+ }
5486
+ },
5487
+ {
5488
+ AccountKey20: {
5489
+ network: null,
5490
+ key: "0x6b175474e89094c44da98b954eedeac495271d0f"
5491
+ }
5492
+ }
5493
+ ]
5494
+ }
5495
+ }
5496
+ },
5497
+ {
5498
+ symbol: "USDC",
5499
+ existentialDeposit: "1",
5500
+ decimals: 6,
5501
+ assetId: "29822050060168568866953499393406221037",
5502
+ multiLocation: {
5503
+ parents: 2,
5504
+ interior: {
5505
+ X2: [
5506
+ {
5507
+ GlobalConsensus: {
5508
+ Ethereum: {
5509
+ chainId: 1
5510
+ }
5511
+ }
5512
+ },
5513
+ {
5514
+ AccountKey20: {
5515
+ network: null,
5516
+ key: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
5517
+ }
5518
+ }
5519
+ ]
5520
+ }
5521
+ }
5522
+ },
5523
+ {
5524
+ symbol: "ETH",
5525
+ existentialDeposit: "15000000000000",
5526
+ decimals: 18,
5527
+ assetId: "233896737710358964064857020859081821253",
5528
+ multiLocation: {
5529
+ parents: 2,
5530
+ interior: {
5531
+ X1: [
5532
+ {
5533
+ GlobalConsensus: {
5534
+ Ethereum: {
5535
+ chainId: 1
5536
+ }
5537
+ }
5538
+ }
5539
+ ]
5540
+ }
5541
+ }
5542
+ },
5543
+ {
5544
+ symbol: "USDT",
5545
+ existentialDeposit: "1",
5546
+ decimals: 6,
5547
+ assetId: "164507627753062513353393042023152019483",
5548
+ multiLocation: {
5549
+ parents: 2,
5550
+ interior: {
5551
+ X2: [
5552
+ {
5553
+ GlobalConsensus: {
5554
+ Ethereum: {
5555
+ chainId: 1
5556
+ }
5557
+ }
5558
+ },
5559
+ {
5560
+ AccountKey20: {
5561
+ network: null,
5562
+ key: "0xdac17f958d2ee523a2206206994597c13d831ec7"
5563
+ }
5564
+ }
5565
+ ]
5566
+ }
5567
+ }
5470
5568
  }
5471
5569
  ]
5472
5570
  };
@@ -10887,14 +10985,34 @@ var compareMultiLocations = function compareMultiLocations(input, asset) {
10887
10985
  );
10888
10986
  };
10889
10987
 
10988
+ /**
10989
+ * Converts a multi-location to XCM V4 format. X1 junction of type object is converted to an array.
10990
+ *
10991
+ * @param multiLocation - The multi-location to normalize.
10992
+ * @returns
10993
+ */
10994
+ var normalizeMultiLocation = function normalizeMultiLocation(multiLocation) {
10995
+ if (multiLocation.interior === 'Here' || multiLocation.interior.X1 === undefined || Array.isArray(multiLocation.interior.X1)) {
10996
+ return multiLocation;
10997
+ }
10998
+ return {
10999
+ parents: multiLocation.parents,
11000
+ interior: {
11001
+ X1: [multiLocation.interior.X1]
11002
+ }
11003
+ };
11004
+ };
11005
+
10890
11006
  var findAssetByMultiLocation = function findAssetByMultiLocation(foreignAssets, multiLocation) {
10891
11007
  if (typeof multiLocation === 'string') {
10892
11008
  return foreignAssets.find(function (asset) {
10893
11009
  return compareMultiLocations(multiLocation, asset);
10894
11010
  });
10895
11011
  } else {
11012
+ var normalizedMultiLocation = normalizeMultiLocation(multiLocation);
10896
11013
  return foreignAssets.find(function (asset) {
10897
- return sdkCommon.deepEqual(asset.multiLocation, multiLocation);
11014
+ var normalizedAssetML = asset.multiLocation && normalizeMultiLocation(asset.multiLocation);
11015
+ return sdkCommon.deepEqual(normalizedMultiLocation, normalizedAssetML);
10898
11016
  });
10899
11017
  }
10900
11018
  };
@@ -11358,6 +11476,9 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
11358
11476
  var otherAssets = getOtherAssets(origin);
11359
11477
  var ethereumCompatibleAssets = filterEthCompatibleAssets(otherAssets);
11360
11478
  var ethereumAssets = getOtherAssets('Ethereum');
11479
+ if (origin === 'Moonbeam') {
11480
+ return ethereumCompatibleAssets;
11481
+ }
11361
11482
  return [].concat(_toConsumableArray(ethereumCompatibleAssets), _toConsumableArray(ethereumAssets));
11362
11483
  }
11363
11484
  if (origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot') {
package/dist/index.mjs CHANGED
@@ -5465,6 +5465,104 @@ var Moonbeam = {
5465
5465
  }
5466
5466
  },
5467
5467
  existentialDeposit: "1"
5468
+ },
5469
+ {
5470
+ symbol: "DAI",
5471
+ existentialDeposit: "1",
5472
+ decimals: 18,
5473
+ assetId: "209858003230988836317829383377338889687",
5474
+ multiLocation: {
5475
+ parents: 2,
5476
+ interior: {
5477
+ X2: [
5478
+ {
5479
+ GlobalConsensus: {
5480
+ Ethereum: {
5481
+ chainId: 1
5482
+ }
5483
+ }
5484
+ },
5485
+ {
5486
+ AccountKey20: {
5487
+ network: null,
5488
+ key: "0x6b175474e89094c44da98b954eedeac495271d0f"
5489
+ }
5490
+ }
5491
+ ]
5492
+ }
5493
+ }
5494
+ },
5495
+ {
5496
+ symbol: "USDC",
5497
+ existentialDeposit: "1",
5498
+ decimals: 6,
5499
+ assetId: "29822050060168568866953499393406221037",
5500
+ multiLocation: {
5501
+ parents: 2,
5502
+ interior: {
5503
+ X2: [
5504
+ {
5505
+ GlobalConsensus: {
5506
+ Ethereum: {
5507
+ chainId: 1
5508
+ }
5509
+ }
5510
+ },
5511
+ {
5512
+ AccountKey20: {
5513
+ network: null,
5514
+ key: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
5515
+ }
5516
+ }
5517
+ ]
5518
+ }
5519
+ }
5520
+ },
5521
+ {
5522
+ symbol: "ETH",
5523
+ existentialDeposit: "15000000000000",
5524
+ decimals: 18,
5525
+ assetId: "233896737710358964064857020859081821253",
5526
+ multiLocation: {
5527
+ parents: 2,
5528
+ interior: {
5529
+ X1: [
5530
+ {
5531
+ GlobalConsensus: {
5532
+ Ethereum: {
5533
+ chainId: 1
5534
+ }
5535
+ }
5536
+ }
5537
+ ]
5538
+ }
5539
+ }
5540
+ },
5541
+ {
5542
+ symbol: "USDT",
5543
+ existentialDeposit: "1",
5544
+ decimals: 6,
5545
+ assetId: "164507627753062513353393042023152019483",
5546
+ multiLocation: {
5547
+ parents: 2,
5548
+ interior: {
5549
+ X2: [
5550
+ {
5551
+ GlobalConsensus: {
5552
+ Ethereum: {
5553
+ chainId: 1
5554
+ }
5555
+ }
5556
+ },
5557
+ {
5558
+ AccountKey20: {
5559
+ network: null,
5560
+ key: "0xdac17f958d2ee523a2206206994597c13d831ec7"
5561
+ }
5562
+ }
5563
+ ]
5564
+ }
5565
+ }
5468
5566
  }
5469
5567
  ]
5470
5568
  };
@@ -10885,14 +10983,34 @@ var compareMultiLocations = function compareMultiLocations(input, asset) {
10885
10983
  );
10886
10984
  };
10887
10985
 
10986
+ /**
10987
+ * Converts a multi-location to XCM V4 format. X1 junction of type object is converted to an array.
10988
+ *
10989
+ * @param multiLocation - The multi-location to normalize.
10990
+ * @returns
10991
+ */
10992
+ var normalizeMultiLocation = function normalizeMultiLocation(multiLocation) {
10993
+ if (multiLocation.interior === 'Here' || multiLocation.interior.X1 === undefined || Array.isArray(multiLocation.interior.X1)) {
10994
+ return multiLocation;
10995
+ }
10996
+ return {
10997
+ parents: multiLocation.parents,
10998
+ interior: {
10999
+ X1: [multiLocation.interior.X1]
11000
+ }
11001
+ };
11002
+ };
11003
+
10888
11004
  var findAssetByMultiLocation = function findAssetByMultiLocation(foreignAssets, multiLocation) {
10889
11005
  if (typeof multiLocation === 'string') {
10890
11006
  return foreignAssets.find(function (asset) {
10891
11007
  return compareMultiLocations(multiLocation, asset);
10892
11008
  });
10893
11009
  } else {
11010
+ var normalizedMultiLocation = normalizeMultiLocation(multiLocation);
10894
11011
  return foreignAssets.find(function (asset) {
10895
- return deepEqual(asset.multiLocation, multiLocation);
11012
+ var normalizedAssetML = asset.multiLocation && normalizeMultiLocation(asset.multiLocation);
11013
+ return deepEqual(normalizedMultiLocation, normalizedAssetML);
10896
11014
  });
10897
11015
  }
10898
11016
  };
@@ -11356,6 +11474,9 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
11356
11474
  var otherAssets = getOtherAssets(origin);
11357
11475
  var ethereumCompatibleAssets = filterEthCompatibleAssets(otherAssets);
11358
11476
  var ethereumAssets = getOtherAssets('Ethereum');
11477
+ if (origin === 'Moonbeam') {
11478
+ return ethereumCompatibleAssets;
11479
+ }
11359
11480
  return [].concat(_toConsumableArray(ethereumCompatibleAssets), _toConsumableArray(ethereumAssets));
11360
11481
  }
11361
11482
  if (origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/assets",
3
- "version": "8.12.0",
3
+ "version": "8.13.0",
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": "8.12.0"
26
+ "@paraspell/sdk-common": "8.13.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@babel/plugin-syntax-import-attributes": "^7.27.1",