@paraspell/assets 14.2.2 → 14.3.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.d.ts CHANGED
@@ -189,6 +189,9 @@ declare const isAdditionalSubstrateBridgeAsset: (asset: TAssetInfo) => boolean;
189
189
 
190
190
  declare const isAssetEqual: (asset1: TAssetInfo, asset2: TAssetInfo) => boolean;
191
191
 
192
+ declare const isDestinationReachableImpl: <TCustomChain extends string = never>(origin: TChain | TCustomChain, destination: TChain | TCustomChain, ctx?: TCustomCtx) => boolean;
193
+ declare const isDestinationReachable: (origin: TChain, destination: TChain) => boolean;
194
+
192
195
  declare const isStableCoinAsset: (asset: TAssetInfo, assetId?: number) => boolean;
193
196
 
194
197
  declare const isSymbolMatch: (symbolA: string, symbolB: string) => boolean;
@@ -296,5 +299,5 @@ declare const extractAssetLocation: <T = bigint>(asset: TAsset<T>) => TLocation;
296
299
 
297
300
  declare const getAssetLocation: (chain: TChain, currency: TCurrencyInput) => TLocation | null;
298
301
 
299
- export { CustomAssetConflictError, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, STABLECOIN_IDS, assertEdDefined, canonicalizeLocation, compareLocations, extractAssetLocation, findAssetInfo, findAssetInfoById, findAssetInfoByLoc, findAssetInfoBySymbol, findAssetInfoImpl, findAssetInfoOnDest, findAssetInfoOnDestImpl, findAssetInfoOrThrow, findAssetInfoOrThrowImpl, findAssetOnDestOrThrow, findAssetOnDestOrThrowImpl, findBestMatches, findNativeAssetInfo, findNativeAssetInfoImpl, findNativeAssetInfoOrThrow, findNativeAssetInfoOrThrowImpl, getAllAssetsSymbols, getAssetLocation, getAssets, getAssetsImpl, getAssetsObject, getAssetsObjectImpl, getEdFromAssetOrThrow, getExistentialDeposit, getExistentialDepositImpl, getExistentialDepositOrThrow, getExistentialDepositOrThrowImpl, getFeeAssets, getNativeAssetSymbol, getNativeAssetSymbolImpl, getNativeAssets, getNativeAssetsImpl, getOtherAssets, getOtherAssetsImpl, getRelayChainSymbol, getRelayChainSymbolImpl, getSupportedAssets, getSupportedAssetsImpl, getSupportedDestinations, hasDryRunSupport, hasDryRunSupportImpl, hasXcmPaymentApiSupport, hasXcmPaymentApiSupportImpl, isAdditionalSubstrateBridgeAsset, isAssetEqual, isBridgedSystemAsset, isChainEvm, isChainEvmImpl, isCustomAsset, isStableCoinAsset, isSymbolMatch, isSymbolSpecifier, isSystemAsset, isTAsset, normalizeCustomAssets, normalizeLocation, normalizeSymbol };
302
+ export { CustomAssetConflictError, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, STABLECOIN_IDS, assertEdDefined, canonicalizeLocation, compareLocations, extractAssetLocation, findAssetInfo, findAssetInfoById, findAssetInfoByLoc, findAssetInfoBySymbol, findAssetInfoImpl, findAssetInfoOnDest, findAssetInfoOnDestImpl, findAssetInfoOrThrow, findAssetInfoOrThrowImpl, findAssetOnDestOrThrow, findAssetOnDestOrThrowImpl, findBestMatches, findNativeAssetInfo, findNativeAssetInfoImpl, findNativeAssetInfoOrThrow, findNativeAssetInfoOrThrowImpl, getAllAssetsSymbols, getAssetLocation, getAssets, getAssetsImpl, getAssetsObject, getAssetsObjectImpl, getEdFromAssetOrThrow, getExistentialDeposit, getExistentialDepositImpl, getExistentialDepositOrThrow, getExistentialDepositOrThrowImpl, getFeeAssets, getNativeAssetSymbol, getNativeAssetSymbolImpl, getNativeAssets, getNativeAssetsImpl, getOtherAssets, getOtherAssetsImpl, getRelayChainSymbol, getRelayChainSymbolImpl, getSupportedAssets, getSupportedAssetsImpl, getSupportedDestinations, hasDryRunSupport, hasDryRunSupportImpl, hasXcmPaymentApiSupport, hasXcmPaymentApiSupportImpl, isAdditionalSubstrateBridgeAsset, isAssetEqual, isBridgedSystemAsset, isChainEvm, isChainEvmImpl, isCustomAsset, isDestinationReachable, isDestinationReachableImpl, isStableCoinAsset, isSymbolMatch, isSymbolSpecifier, isSystemAsset, isTAsset, normalizeCustomAssets, normalizeLocation, normalizeSymbol };
300
303
  export type { TAmount, TAsset, TAssetInfo, TAssetInfoWithId, TAssetJsonMap, TAssetV3, TAssetV4, TAssetWithFee, TChainAssetsInfo, TCurrency, TCurrencyCore, TCurrencyInput, TCurrencyInputWithAmount, TCurrencySymbol, TCurrencySymbolValue, TCustomAssetInfo, TCustomAssetsMap, TCustomAssetsMapNormalized, TCustomCtx, TLocationValue, TSingleCurrencyInput, TSingleCurrencyInputWithAmount, TSymbolSpecifier, WithAmount, WithComplexAmount, WithOptionalAmount };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { ParaSpellError, Version, deepEqual, isChain, isExternalChain, getJunctionValue, hasJunction, Parents, RELAYCHAINS, replaceBigInt, isCustomChain, isSubstrateBridge, isSnowbridge, ETHEREUM_BRIDGE_ORIGINS, SUBSTRATE_CHAINS, CHAINS } from '@paraspell/sdk-common';
1
+ import { ParaSpellError, Version, deepEqual, isChain, isExternalChain, getJunctionValue, hasJunction, Parents, RELAYCHAINS, replaceBigInt, isCustomChain, isSubstrateBridge, isSnowbridge, isEthereumBridgeOrigin, SUBSTRATE_CHAINS, CHAINS } from '@paraspell/sdk-common';
2
2
 
3
3
  function _arrayLikeToArray(r, a) {
4
4
  (null == a || a > r.length) && (a = r.length);
@@ -7932,35 +7932,6 @@ var BifrostKusama = {
7932
7932
  }
7933
7933
  ]
7934
7934
  };
7935
- var Crab = {
7936
- relaychainSymbol: "KSM",
7937
- nativeAssetSymbol: "CRAB",
7938
- isEVM: true,
7939
- ss58Prefix: 42,
7940
- supportsDryRunApi: true,
7941
- supportsXcmPaymentApi: true,
7942
- assets: [
7943
- {
7944
- symbol: "CRAB",
7945
- isNative: true,
7946
- decimals: 18,
7947
- existentialDeposit: "0",
7948
- location: {
7949
- parents: 1,
7950
- interior: {
7951
- X2: [
7952
- {
7953
- Parachain: 2105
7954
- },
7955
- {
7956
- PalletInstance: 5
7957
- }
7958
- ]
7959
- }
7960
- }
7961
- }
7962
- ]
7963
- };
7964
7935
  var CrustShadow = {
7965
7936
  relaychainSymbol: "KSM",
7966
7937
  nativeAssetSymbol: "CSM",
@@ -16038,96 +16009,6 @@ var HydrationPaseo = {
16038
16009
  }
16039
16010
  ]
16040
16011
  };
16041
- var NeuroWebPaseo = {
16042
- relaychainSymbol: "PAS",
16043
- nativeAssetSymbol: "NEURO",
16044
- isEVM: false,
16045
- ss58Prefix: 101,
16046
- supportsDryRunApi: true,
16047
- supportsXcmPaymentApi: true,
16048
- assets: [
16049
- {
16050
- symbol: "NEURO",
16051
- isNative: true,
16052
- decimals: 12,
16053
- existentialDeposit: "100000000000",
16054
- location: {
16055
- parents: 1,
16056
- interior: {
16057
- X1: [
16058
- {
16059
- Parachain: 2043
16060
- }
16061
- ]
16062
- }
16063
- }
16064
- },
16065
- {
16066
- symbol: "TRAC",
16067
- decimals: 18,
16068
- location: {
16069
- parents: 2,
16070
- interior: {
16071
- X2: [
16072
- {
16073
- GlobalConsensus: {
16074
- Ethereum: {
16075
- chainId: 11155111
16076
- }
16077
- }
16078
- },
16079
- {
16080
- AccountKey20: {
16081
- network: null,
16082
- key: "0xef32abea56beff54f61da319a7311098d6fbcea9"
16083
- }
16084
- }
16085
- ]
16086
- }
16087
- },
16088
- existentialDeposit: "1000000000000000",
16089
- alias: "TRAC1"
16090
- },
16091
- {
16092
- symbol: "TRAC",
16093
- decimals: 18,
16094
- location: {
16095
- parents: 2,
16096
- interior: {
16097
- X2: [
16098
- {
16099
- GlobalConsensus: {
16100
- Ethereum: {
16101
- chainId: 1
16102
- }
16103
- }
16104
- },
16105
- {
16106
- AccountKey20: {
16107
- network: null,
16108
- key: "0xaa7a9ca87d3694b5755f213b5d04094b8d0f0a6f"
16109
- }
16110
- }
16111
- ]
16112
- }
16113
- },
16114
- existentialDeposit: "1",
16115
- alias: "TRAC2"
16116
- },
16117
- {
16118
- symbol: "PAS",
16119
- decimals: 10,
16120
- location: {
16121
- parents: 1,
16122
- interior: {
16123
- Here: null
16124
- }
16125
- },
16126
- existentialDeposit: "10000000",
16127
- isFeeAsset: true
16128
- }
16129
- ]
16130
- };
16131
16012
  var Curio = {
16132
16013
  relaychainSymbol: "KSM",
16133
16014
  nativeAssetSymbol: "CGT",
@@ -16287,7 +16168,6 @@ var assetsMapJson = {
16287
16168
  AssetHubPolkadot: AssetHubPolkadot,
16288
16169
  Basilisk: Basilisk,
16289
16170
  BifrostKusama: BifrostKusama,
16290
- Crab: Crab,
16291
16171
  CrustShadow: CrustShadow,
16292
16172
  Encointer: Encointer,
16293
16173
  Karura: Karura,
@@ -16319,7 +16199,6 @@ var assetsMapJson = {
16319
16199
  HeimaPaseo: HeimaPaseo,
16320
16200
  EnergyWebXPaseo: EnergyWebXPaseo,
16321
16201
  HydrationPaseo: HydrationPaseo,
16322
- NeuroWebPaseo: NeuroWebPaseo,
16323
16202
  Curio: Curio
16324
16203
  };
16325
16204
 
@@ -17063,12 +16942,24 @@ var isAssetEqual = function isAssetEqual(asset1, asset2) {
17063
16942
  return deepEqual(loc1, loc2);
17064
16943
  };
17065
16944
 
16945
+ var isDestinationReachableImpl = function isDestinationReachableImpl(origin, destination, ctx) {
16946
+ if (isExternalChain(origin)) {
16947
+ return !isExternalChain(destination) && isEthereumBridgeOrigin(destination, origin);
16948
+ }
16949
+ if (isExternalChain(destination)) {
16950
+ return isEthereumBridgeOrigin(origin, destination);
16951
+ }
16952
+ if (isSubstrateBridge(origin, destination)) return true;
16953
+ return getRelayChainSymbolImpl(origin, ctx) === getRelayChainSymbolImpl(destination, ctx);
16954
+ };
16955
+ var isDestinationReachable = function isDestinationReachable(origin, destination) {
16956
+ return isDestinationReachableImpl(origin, destination);
16957
+ };
16958
+
17066
16959
  var getSupportedAssetsImpl = function getSupportedAssetsImpl(origin, destination, ctx) {
17067
16960
  var isSubBridge = isSubstrateBridge(origin, destination);
17068
16961
  var isSb = isSnowbridge(origin, destination);
17069
- if (isSb && !ETHEREUM_BRIDGE_ORIGINS.some(function (chain) {
17070
- return chain === origin;
17071
- })) return [];
16962
+ if (!isDestinationReachableImpl(origin, destination, ctx)) return [];
17072
16963
  var originAssets = getAssetsImpl(origin, ctx);
17073
16964
  var destinationAssets = getAssetsImpl(destination, ctx);
17074
16965
  var supportedAssets = originAssets.filter(function (asset) {
@@ -17113,15 +17004,6 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
17113
17004
  return getSupportedAssetsImpl(origin, destination);
17114
17005
  };
17115
17006
 
17116
- var isDestinationReachable = function isDestinationReachable(origin, destination) {
17117
- if (isExternalChain(origin) || isExternalChain(destination)) {
17118
- var substrateSide = isExternalChain(origin) ? destination : origin;
17119
- if (isExternalChain(substrateSide)) return false;
17120
- return ETHEREUM_BRIDGE_ORIGINS.includes(substrateSide);
17121
- }
17122
- if (isSubstrateBridge(origin, destination)) return true;
17123
- return getRelayChainSymbol(origin) === getRelayChainSymbol(destination);
17124
- };
17125
17007
  var isUnsupportedAssetHubNative = function isUnsupportedAssetHubNative(origin, destination, originAsset, nativeAssets) {
17126
17008
  if (isExternalChain(origin) || isExternalChain(destination)) return false;
17127
17009
  var originIsAssetHub = origin.startsWith('AssetHub');
@@ -17186,4 +17068,4 @@ var isSymbolMatch = function isSymbolMatch(symbolA, symbolB) {
17186
17068
  return normalizeSymbol(symbolA) === normalizeSymbol(symbolB);
17187
17069
  };
17188
17070
 
17189
- export { CustomAssetConflictError, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, STABLECOIN_IDS, assertEdDefined, canonicalizeLocation, compareLocations, extractAssetLocation, findAssetInfo, findAssetInfoById, findAssetInfoByLoc, findAssetInfoBySymbol, findAssetInfoImpl, findAssetInfoOnDest, findAssetInfoOnDestImpl, findAssetInfoOrThrow, findAssetInfoOrThrowImpl, findAssetOnDestOrThrow, findAssetOnDestOrThrowImpl, findBestMatches, findNativeAssetInfo, findNativeAssetInfoImpl, findNativeAssetInfoOrThrow, findNativeAssetInfoOrThrowImpl, getAllAssetsSymbols, getAssetLocation, getAssets, getAssetsImpl, getAssetsObject, getAssetsObjectImpl, getEdFromAssetOrThrow, getExistentialDeposit, getExistentialDepositImpl, getExistentialDepositOrThrow, getExistentialDepositOrThrowImpl, getFeeAssets, getNativeAssetSymbol, getNativeAssetSymbolImpl, getNativeAssets, getNativeAssetsImpl, getOtherAssets, getOtherAssetsImpl, getRelayChainSymbol, getRelayChainSymbolImpl, getSupportedAssets, getSupportedAssetsImpl, getSupportedDestinations, hasDryRunSupport, hasDryRunSupportImpl, hasXcmPaymentApiSupport, hasXcmPaymentApiSupportImpl, isAdditionalSubstrateBridgeAsset, isAssetEqual, isBridgedSystemAsset, isChainEvm, isChainEvmImpl, isCustomAsset, isStableCoinAsset, isSymbolMatch, isSymbolSpecifier, isSystemAsset, isTAsset, normalizeCustomAssets, normalizeLocation, normalizeSymbol };
17071
+ export { CustomAssetConflictError, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, STABLECOIN_IDS, assertEdDefined, canonicalizeLocation, compareLocations, extractAssetLocation, findAssetInfo, findAssetInfoById, findAssetInfoByLoc, findAssetInfoBySymbol, findAssetInfoImpl, findAssetInfoOnDest, findAssetInfoOnDestImpl, findAssetInfoOrThrow, findAssetInfoOrThrowImpl, findAssetOnDestOrThrow, findAssetOnDestOrThrowImpl, findBestMatches, findNativeAssetInfo, findNativeAssetInfoImpl, findNativeAssetInfoOrThrow, findNativeAssetInfoOrThrowImpl, getAllAssetsSymbols, getAssetLocation, getAssets, getAssetsImpl, getAssetsObject, getAssetsObjectImpl, getEdFromAssetOrThrow, getExistentialDeposit, getExistentialDepositImpl, getExistentialDepositOrThrow, getExistentialDepositOrThrowImpl, getFeeAssets, getNativeAssetSymbol, getNativeAssetSymbolImpl, getNativeAssets, getNativeAssetsImpl, getOtherAssets, getOtherAssetsImpl, getRelayChainSymbol, getRelayChainSymbolImpl, getSupportedAssets, getSupportedAssetsImpl, getSupportedDestinations, hasDryRunSupport, hasDryRunSupportImpl, hasXcmPaymentApiSupport, hasXcmPaymentApiSupportImpl, isAdditionalSubstrateBridgeAsset, isAssetEqual, isBridgedSystemAsset, isChainEvm, isChainEvmImpl, isCustomAsset, isDestinationReachable, isDestinationReachableImpl, isStableCoinAsset, isSymbolMatch, isSymbolSpecifier, isSystemAsset, isTAsset, normalizeCustomAssets, normalizeLocation, normalizeSymbol };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/assets",
3
- "version": "14.2.2",
3
+ "version": "14.3.0",
4
4
  "description": "Assets for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,24 +22,24 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@paraspell/sdk-common": "14.2.2"
25
+ "@paraspell/sdk-common": "14.3.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@babel/plugin-syntax-import-attributes": "^7.29.7",
29
29
  "@babel/preset-env": "^7.29.7",
30
30
  "@codecov/rollup-plugin": "^2.0.1",
31
- "@polkadot-api/metadata-builders": "^0.14.3",
32
- "@polkadot-api/substrate-bindings": "^0.20.3",
31
+ "@polkadot-api/metadata-builders": "^0.15.0",
32
+ "@polkadot-api/substrate-bindings": "^0.21.0",
33
33
  "@rollup/plugin-babel": "^7.1.0",
34
34
  "@rollup/plugin-json": "^6.1.0",
35
35
  "@rollup/plugin-typescript": "^12.3.0",
36
- "@snowbridge/registry": "^1.1.12",
37
- "@vitest/coverage-v8": "^4.1.10",
36
+ "@snowbridge/registry": "^1.1.13",
37
+ "@vitest/coverage-v8": "^4.1.11",
38
38
  "dotenv": "^17.4.2",
39
- "polkadot-api": "^2.2.1",
40
- "rollup": "^4.62.3",
41
- "rollup-plugin-dts": "^6.4.1",
42
- "tsx": "^4.23.1"
39
+ "polkadot-api": "^3.0.0",
40
+ "rollup": "^4.62.5",
41
+ "rollup-plugin-dts": "^6.5.1",
42
+ "tsx": "^4.23.12"
43
43
  },
44
44
  "scripts": {
45
45
  "compile": "tsc --noEmit",