@paraspell/assets 12.0.6 → 12.1.1

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
@@ -192,6 +192,8 @@ declare const isAssetEqual: (asset1: TAssetInfo, asset2: TAssetInfo) => boolean;
192
192
 
193
193
  declare const isAssetXcEqual: (asset1: TAssetInfo, asset2: TAssetInfo) => boolean;
194
194
 
195
+ declare const isStableCoinAsset: (asset: TAssetInfo, assetId?: number) => boolean;
196
+
195
197
  declare const isSymbolMatch: (symbolA: string, symbolB: string) => boolean;
196
198
 
197
199
  /**
@@ -279,5 +281,5 @@ declare const extractAssetLocation: <T = bigint>(asset: TAsset<T>) => TLocation;
279
281
 
280
282
  declare const getAssetLocation: (chain: TChain, currency: TCurrencyInput) => TLocation | null;
281
283
 
282
- export { DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, Override, assertEdDefined, compareLocations, extractAssetLocation, findAssetInfo, findAssetInfoById, findAssetInfoByLoc, findAssetInfoBySymbol, findAssetInfoOnDest, findAssetInfoOrThrow, findAssetOnDestOrThrow, findBestMatches, findNativeAssetInfo, findNativeAssetInfoOrThrow, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetLocation, getAssets, getAssetsObject, getEdFromAssetOrThrow, getExistentialDeposit, getExistentialDepositOrThrow, getFeeAssets, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getSupportedDestinations, hasDryRunSupport, hasSupportForAsset, hasXcmPaymentApiSupport, isAssetEqual, isAssetXcEqual, isChainEvm, isOverrideLocationSpecifier, isSymbolMatch, isSymbolSpecifier, isTAsset, normalizeLocation, normalizeSymbol };
284
+ export { DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, Override, assertEdDefined, compareLocations, extractAssetLocation, findAssetInfo, findAssetInfoById, findAssetInfoByLoc, findAssetInfoBySymbol, findAssetInfoOnDest, findAssetInfoOrThrow, findAssetOnDestOrThrow, findBestMatches, findNativeAssetInfo, findNativeAssetInfoOrThrow, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetLocation, getAssets, getAssetsObject, getEdFromAssetOrThrow, getExistentialDeposit, getExistentialDepositOrThrow, getFeeAssets, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getSupportedDestinations, hasDryRunSupport, hasSupportForAsset, hasXcmPaymentApiSupport, isAssetEqual, isAssetXcEqual, isChainEvm, isOverrideLocationSpecifier, isStableCoinAsset, isSymbolMatch, isSymbolSpecifier, isTAsset, normalizeLocation, normalizeSymbol };
283
285
  export type { TAmount, TAsset, TAssetInfo, TAssetInfoWithId, TAssetJsonMap, TAssetV3, TAssetV4, TAssetWithFee, TAssetWithLocation, TChainAssetsInfo, TCurrency, TCurrencyCore, TCurrencyInput, TCurrencyInputWithAmount, TCurrencySymbol, TCurrencySymbolValue, TLocationValue, TLocationValueWithOverride, TOverrideLocationSpecifier, TSymbolSpecifier, WithAmount, WithComplexAmount };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { Version, deepEqual, getJunctionValue, replaceBigInt, isSubstrateBridge, CHAINS } from '@paraspell/sdk-common';
1
+ import { Version, deepEqual, getJunctionValue, hasJunction, replaceBigInt, isSubstrateBridge, CHAINS } from '@paraspell/sdk-common';
2
2
 
3
3
  var Polkadot = {
4
4
  relaychainSymbol: "DOT",
@@ -6923,6 +6923,28 @@ var AssetHubPolkadot = {
6923
6923
  },
6924
6924
  isFeeAsset: true
6925
6925
  },
6926
+ {
6927
+ assetId: "22222005",
6928
+ symbol: "love",
6929
+ decimals: 12,
6930
+ location: {
6931
+ parents: 1,
6932
+ interior: {
6933
+ X3: [
6934
+ {
6935
+ Parachain: 1000
6936
+ },
6937
+ {
6938
+ PalletInstance: 50
6939
+ },
6940
+ {
6941
+ GeneralIndex: 22222005
6942
+ }
6943
+ ]
6944
+ }
6945
+ },
6946
+ existentialDeposit: "1000000000000"
6947
+ },
6926
6948
  {
6927
6949
  assetId: "50000074",
6928
6950
  symbol: "VDOT",
@@ -11548,44 +11570,6 @@ var Jamton = {
11548
11570
  }
11549
11571
  ]
11550
11572
  };
11551
- var RobonomicsKusama = {
11552
- relaychainSymbol: "KSM",
11553
- nativeAssetSymbol: "XRT",
11554
- isEVM: false,
11555
- ss58Prefix: 32,
11556
- supportsDryRunApi: false,
11557
- supportsXcmPaymentApi: false,
11558
- assets: [
11559
- {
11560
- symbol: "XRT",
11561
- isNative: true,
11562
- decimals: 9,
11563
- existentialDeposit: "1000",
11564
- location: {
11565
- parents: 1,
11566
- interior: {
11567
- X1: [
11568
- {
11569
- Parachain: 2048
11570
- }
11571
- ]
11572
- }
11573
- }
11574
- },
11575
- {
11576
- assetId: "4294967295",
11577
- symbol: "KSM",
11578
- decimals: 12,
11579
- existentialDeposit: "100"
11580
- },
11581
- {
11582
- assetId: "4294967291",
11583
- symbol: "CSM",
11584
- decimals: 12,
11585
- existentialDeposit: "1000000000000"
11586
- }
11587
- ]
11588
- };
11589
11573
  var RobonomicsPolkadot = {
11590
11574
  relaychainSymbol: "DOT",
11591
11575
  nativeAssetSymbol: "XRT",
@@ -12529,6 +12513,28 @@ var AssetHubKusama = {
12529
12513
  },
12530
12514
  existentialDeposit: "1000000"
12531
12515
  },
12516
+ {
12517
+ assetId: "214",
12518
+ symbol: "LOVE",
12519
+ decimals: 20,
12520
+ location: {
12521
+ parents: 1,
12522
+ interior: {
12523
+ X3: [
12524
+ {
12525
+ Parachain: 1000
12526
+ },
12527
+ {
12528
+ PalletInstance: 50
12529
+ },
12530
+ {
12531
+ GeneralIndex: 214
12532
+ }
12533
+ ]
12534
+ }
12535
+ },
12536
+ existentialDeposit: "10000000000000000"
12537
+ },
12532
12538
  {
12533
12539
  symbol: "sUSDe",
12534
12540
  decimals: 18,
@@ -16359,6 +16365,29 @@ var AssetHubWestend = {
16359
16365
  existentialDeposit: "100000000",
16360
16366
  alias: "WETH1"
16361
16367
  },
16368
+ {
16369
+ assetId: "381",
16370
+ symbol: "ALC",
16371
+ decimals: 12,
16372
+ location: {
16373
+ parents: 1,
16374
+ interior: {
16375
+ X3: [
16376
+ {
16377
+ Parachain: 1000
16378
+ },
16379
+ {
16380
+ PalletInstance: 50
16381
+ },
16382
+ {
16383
+ GeneralIndex: 381
16384
+ }
16385
+ ]
16386
+ }
16387
+ },
16388
+ existentialDeposit: "1000000000000000",
16389
+ isFeeAsset: true
16390
+ },
16362
16391
  {
16363
16392
  assetId: "66",
16364
16393
  symbol: "USDT",
@@ -17525,6 +17554,28 @@ var AssetHubPaseo = {
17525
17554
  isFeeAsset: true,
17526
17555
  alias: "USDC1"
17527
17556
  },
17557
+ {
17558
+ assetId: "50000064",
17559
+ symbol: "LKK",
17560
+ decimals: 10,
17561
+ location: {
17562
+ parents: 1,
17563
+ interior: {
17564
+ X3: [
17565
+ {
17566
+ Parachain: 1000
17567
+ },
17568
+ {
17569
+ PalletInstance: 50
17570
+ },
17571
+ {
17572
+ GeneralIndex: 50000064
17573
+ }
17574
+ ]
17575
+ }
17576
+ },
17577
+ existentialDeposit: "1"
17578
+ },
17528
17579
  {
17529
17580
  symbol: "ETH",
17530
17581
  decimals: 18,
@@ -17740,6 +17791,28 @@ var PAssetHub = {
17740
17791
  },
17741
17792
  isFeeAsset: true
17742
17793
  },
17794
+ {
17795
+ assetId: "10",
17796
+ symbol: "lkk",
17797
+ decimals: 1,
17798
+ location: {
17799
+ parents: 1,
17800
+ interior: {
17801
+ X3: [
17802
+ {
17803
+ Parachain: 1000
17804
+ },
17805
+ {
17806
+ PalletInstance: 50
17807
+ },
17808
+ {
17809
+ GeneralIndex: 10
17810
+ }
17811
+ ]
17812
+ }
17813
+ },
17814
+ existentialDeposit: "10"
17815
+ },
17743
17816
  {
17744
17817
  assetId: "1984",
17745
17818
  symbol: "USDt",
@@ -20377,7 +20450,6 @@ var assetsMapJson = {
20377
20450
  Moonriver: Moonriver,
20378
20451
  Quartz: Quartz,
20379
20452
  Jamton: Jamton,
20380
- RobonomicsKusama: RobonomicsKusama,
20381
20453
  RobonomicsPolkadot: RobonomicsPolkadot,
20382
20454
  PeopleKusama: PeopleKusama,
20383
20455
  PeoplePolkadot: PeoplePolkadot,
@@ -20962,6 +21034,20 @@ var Override = function Override(location) {
20962
21034
  };
20963
21035
  };
20964
21036
 
21037
+ var STABLECOIN_IDS = [1984, 1337];
21038
+
21039
+ var hasStablecoinIndex = function hasStablecoinIndex(location, assetId) {
21040
+ return assetId !== undefined ? hasJunction(location, 'GeneralIndex', assetId) : STABLECOIN_IDS.some(function (id) {
21041
+ return hasJunction(location, 'GeneralIndex', id);
21042
+ });
21043
+ };
21044
+ var isStablecoinLocation = function isStablecoinLocation(location, assetId) {
21045
+ return !!location && hasJunction(location, 'PalletInstance', 50) && hasStablecoinIndex(location, assetId);
21046
+ };
21047
+ var isStableCoinAsset = function isStableCoinAsset(asset, assetId) {
21048
+ return isStablecoinLocation(asset.location, assetId);
21049
+ };
21050
+
20965
21051
  var findAssetInfoOrThrow = function findAssetInfoOrThrow(chain, currency, destination) {
20966
21052
  var asset = findAssetInfo(chain, currency, destination);
20967
21053
  if (!asset) {
@@ -20970,6 +21056,19 @@ var findAssetInfoOrThrow = function findAssetInfoOrThrow(chain, currency, destin
20970
21056
  return asset;
20971
21057
  };
20972
21058
 
21059
+ var findStablecoinAssets = function findStablecoinAssets(chain) {
21060
+ var assets = getOtherAssets(chain);
21061
+ return STABLECOIN_IDS.map(function (id) {
21062
+ var matches = assets.filter(function (asset) {
21063
+ return isStableCoinAsset(asset, id);
21064
+ });
21065
+ var consensusMatch = matches.find(function (asset) {
21066
+ return asset.location && hasJunction(asset.location, 'GlobalConsensus');
21067
+ });
21068
+ return consensusMatch !== null && consensusMatch !== void 0 ? consensusMatch : matches[0];
21069
+ });
21070
+ };
21071
+
20973
21072
  var findAssetInfoOnDest = function findAssetInfoOnDest(origin, destination, currency, originAsset) {
20974
21073
  var isBridge = isSubstrateBridge(origin, destination);
20975
21074
  var resolvedOriginAsset = originAsset !== null && originAsset !== void 0 ? originAsset : findAssetInfoOrThrow(origin, currency, destination);
@@ -20979,6 +21078,14 @@ var findAssetInfoOnDest = function findAssetInfoOnDest(origin, destination, curr
20979
21078
  symbol: Native(resolvedOriginAsset.symbol)
20980
21079
  }, null);
20981
21080
  if (nativeMatch) return nativeMatch;
21081
+ var isStablecoin = isStableCoinAsset(resolvedOriginAsset);
21082
+ if (isStablecoin) {
21083
+ var stablecoins = findStablecoinAssets(destination);
21084
+ var match = stablecoins.find(function (asset) {
21085
+ return asset.symbol === resolvedOriginAsset.symbol;
21086
+ });
21087
+ if (match) return match;
21088
+ }
20982
21089
  // Then try foreign
20983
21090
  var foreignMatch = findAssetInfo(destination, {
20984
21091
  symbol: Foreign(resolvedOriginAsset.symbol)
@@ -21246,9 +21353,11 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
21246
21353
  var destinationAssets = getAssets(destination);
21247
21354
  var isSubBridge = isSubstrateBridge(origin, destination);
21248
21355
  if (isSubBridge) {
21249
- return originAssets.filter(function (asset) {
21250
- return asset.symbol === 'KSM' || asset.symbol === 'DOT';
21356
+ var systemAssets = originAssets.filter(function (asset) {
21357
+ return ['DOT', 'KSM'].includes(asset.symbol);
21251
21358
  });
21359
+ var stablecoinAssets = findStablecoinAssets(origin);
21360
+ return [].concat(_toConsumableArray(systemAssets), _toConsumableArray(stablecoinAssets));
21252
21361
  }
21253
21362
  var supportedAssets = originAssets.filter(function (asset) {
21254
21363
  return destinationAssets.some(function (a) {
@@ -21293,4 +21402,4 @@ var isAssetEqual = function isAssetEqual(asset1, asset2) {
21293
21402
  return isSymbolMatch(asset1.symbol, asset2.symbol);
21294
21403
  };
21295
21404
 
21296
- export { DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, Override, assertEdDefined, compareLocations, extractAssetLocation, findAssetInfo, findAssetInfoById, findAssetInfoByLoc, findAssetInfoBySymbol, findAssetInfoOnDest, findAssetInfoOrThrow, findAssetOnDestOrThrow, findBestMatches, findNativeAssetInfo, findNativeAssetInfoOrThrow, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetLocation, getAssets, getAssetsObject, getEdFromAssetOrThrow, getExistentialDeposit, getExistentialDepositOrThrow, getFeeAssets, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getSupportedDestinations, hasDryRunSupport, hasSupportForAsset, hasXcmPaymentApiSupport, isAssetEqual, isAssetXcEqual, isChainEvm, isOverrideLocationSpecifier, isSymbolMatch, isSymbolSpecifier, isTAsset, normalizeLocation, normalizeSymbol };
21405
+ export { DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, Override, assertEdDefined, compareLocations, extractAssetLocation, findAssetInfo, findAssetInfoById, findAssetInfoByLoc, findAssetInfoBySymbol, findAssetInfoOnDest, findAssetInfoOrThrow, findAssetOnDestOrThrow, findBestMatches, findNativeAssetInfo, findNativeAssetInfoOrThrow, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetLocation, getAssets, getAssetsObject, getEdFromAssetOrThrow, getExistentialDeposit, getExistentialDepositOrThrow, getFeeAssets, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getSupportedDestinations, hasDryRunSupport, hasSupportForAsset, hasXcmPaymentApiSupport, isAssetEqual, isAssetXcEqual, isChainEvm, isOverrideLocationSpecifier, isStableCoinAsset, isSymbolMatch, isSymbolSpecifier, isTAsset, normalizeLocation, normalizeSymbol };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/assets",
3
- "version": "12.0.6",
3
+ "version": "12.1.1",
4
4
  "description": "Assets for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,24 +23,24 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@paraspell/sdk-common": "12.0.6"
26
+ "@paraspell/sdk-common": "12.1.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@babel/plugin-syntax-import-attributes": "^7.27.1",
30
30
  "@babel/preset-env": "^7.28.5",
31
31
  "@codecov/rollup-plugin": "^1.9.1",
32
- "@polkadot/api": "^16.5.3",
33
- "@polkadot/types": "^16.5.3",
32
+ "@polkadot/api": "^16.5.4",
33
+ "@polkadot/types": "^16.5.4",
34
34
  "@rollup/plugin-babel": "^6.1.0",
35
35
  "@rollup/plugin-json": "^6.1.0",
36
36
  "@rollup/plugin-typescript": "^12.3.0",
37
- "@snowbridge/registry": "^0.2.17",
38
- "@vitest/coverage-v8": "^4.0.14",
37
+ "@snowbridge/registry": "^0.2.20",
38
+ "@vitest/coverage-v8": "^4.0.16",
39
39
  "dotenv": "^17.2.3",
40
- "rollup": "^4.53.3",
40
+ "rollup": "^4.54.0",
41
41
  "rollup-plugin-dts": "^6.3.0",
42
42
  "ts-node": "^10.9.2",
43
- "viem": "^2.40.3"
43
+ "viem": "2.40.3"
44
44
  },
45
45
  "scripts": {
46
46
  "compile": "tsc --noEmit",