@paraspell/assets 13.11.0 → 14.0.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/README.md +1 -22
- package/dist/index.d.ts +6 -47
- package/dist/index.mjs +95 -125
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ npm install | pnpm add | yarn add @paraspell/assets
|
|
|
36
36
|
To use this functionality, you first have to import it in the following way.
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
import { getSupportedDestinations, getSupportedAssets, getFeeAssets, getAssetsObject,
|
|
39
|
+
import { getSupportedDestinations, getSupportedAssets, getFeeAssets, getAssetsObject, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, getParaId, getTChain, getAssetLocation, findAssetInfo, findAssetInfoOrThrow } from '@paraspell/assets'
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
|
|
@@ -47,13 +47,6 @@ This function returns `assets object` from `assets.json` for `particular Paracha
|
|
|
47
47
|
getAssetsObject(TChain)
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
### Query asset ID
|
|
51
|
-
This function returns `assetId` for `particular Parachain` and `asset symbol`. Function uses [TChain](https://paraspell.github.io/docs/xcm-sdk/asset-package.html#import-chains-as-types) types.
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
getAssetId(TChain, ASSET_SYMBOL)
|
|
55
|
-
```
|
|
56
|
-
|
|
57
50
|
### Query Relay chain asset symbol
|
|
58
51
|
This function returns the `symbol` of the Relay chain for a particular Parachain. Either `DOT` or `KSM` or `WND` or `PAS`. Function uses [TChain](https://paraspell.github.io/docs/xcm-sdk/asset-package.html#import-chains-as-types) types.
|
|
59
52
|
|
|
@@ -82,20 +75,6 @@ Function returns string array of all asset symbols for a specific Parachain. (na
|
|
|
82
75
|
getAllAssetsSymbols(TChain)
|
|
83
76
|
```
|
|
84
77
|
|
|
85
|
-
### Query asset support
|
|
86
|
-
The function checks if Parachain supports a particular asset. (Both native and foreign assets are searched). Returns boolean. Function uses [TChain](https://paraspell.github.io/docs/xcm-sdk/asset-package.html#import-chains-as-types) types.
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
hasSupportForAsset(TChain, ASSET_SYMBOL)
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Query asset decimals
|
|
93
|
-
The function returns decimals for a specific asset. Function uses [TChain](https://paraspell.github.io/docs/xcm-sdk/asset-package.html#import-chains-as-types) types.
|
|
94
|
-
|
|
95
|
-
```ts
|
|
96
|
-
getAssetDecimals(TChain, ASSET_SYMBOL)
|
|
97
|
-
```
|
|
98
|
-
|
|
99
78
|
### Query Parachain ID
|
|
100
79
|
The function returns specific Parachain id. Function uses [TChain](https://paraspell.github.io/docs/xcm-sdk/asset-package.html#import-chains-as-types) types.
|
|
101
80
|
|
package/dist/index.d.ts
CHANGED
|
@@ -46,10 +46,6 @@ type TSymbolSpecifier = {
|
|
|
46
46
|
type: 'Native' | 'Foreign' | 'ForeignAbstract';
|
|
47
47
|
value: string;
|
|
48
48
|
};
|
|
49
|
-
type TOverrideLocationSpecifier = {
|
|
50
|
-
type: 'Override';
|
|
51
|
-
value: TLocation;
|
|
52
|
-
};
|
|
53
49
|
type TCurrencySymbolValue = string | TSymbolSpecifier;
|
|
54
50
|
type TCurrencySymbol = {
|
|
55
51
|
symbol: TCurrencySymbolValue;
|
|
@@ -63,19 +59,18 @@ type TAssetWithFee = TAsset & {
|
|
|
63
59
|
isFeeAsset?: boolean;
|
|
64
60
|
};
|
|
65
61
|
type TLocationValue = string | TLocation;
|
|
66
|
-
type TLocationValueWithOverride = TLocationValue | TOverrideLocationSpecifier;
|
|
67
62
|
type TCurrencyInputWithAmount = WithComplexAmount<TCurrencySymbol | {
|
|
68
63
|
id: TCurrency;
|
|
69
64
|
} | {
|
|
70
|
-
location:
|
|
71
|
-
}> |
|
|
65
|
+
location: TLocationValue;
|
|
66
|
+
}> | WithComplexAmount<TCurrencyCore>[];
|
|
72
67
|
type TSingleCurrencyInputWithAmount = Exclude<TCurrencyInputWithAmount, unknown[]>;
|
|
73
68
|
type TSingleCurrencyInput = Exclude<TCurrencyInput, unknown[]>;
|
|
74
69
|
type TCurrencyInput = TCurrencySymbol | {
|
|
75
70
|
id: TCurrency;
|
|
76
71
|
} | {
|
|
77
|
-
location:
|
|
78
|
-
} |
|
|
72
|
+
location: TLocationValue;
|
|
73
|
+
} | WithComplexAmount<TCurrencyCore>[];
|
|
79
74
|
type WithAmount<TBase, T = bigint> = TBase & {
|
|
80
75
|
amount: T;
|
|
81
76
|
};
|
|
@@ -119,16 +114,6 @@ declare const getAssetsObjectImpl: <TCustomChain extends string = never>(chain:
|
|
|
119
114
|
declare const getAssetsObject: (chain: TChain) => TChainAssetsInfo;
|
|
120
115
|
declare const isChainEvmImpl: <TCustomChain extends string = never>(chain: TChain | TCustomChain, ctx?: TCustomCtx) => boolean;
|
|
121
116
|
declare const isChainEvm: <TCustomChain extends string = never>(chain: TChain | TCustomChain) => boolean;
|
|
122
|
-
/**
|
|
123
|
-
* Retrieves the asset ID for a given symbol on a specified chain.
|
|
124
|
-
*
|
|
125
|
-
* @deprecated Use `findAssetInfo` instead. Will be removed in v14.
|
|
126
|
-
*
|
|
127
|
-
* @param chain - The chain to search for the asset.
|
|
128
|
-
* @param symbol - The symbol of the asset.
|
|
129
|
-
* @returns The asset ID if found; otherwise, null.
|
|
130
|
-
*/
|
|
131
|
-
declare const getAssetId: (chain: TChain, symbol: string) => string | null;
|
|
132
117
|
declare const getRelayChainSymbolImpl: <TCustomChain extends string = never>(chain: TChain | TCustomChain, ctx?: TCustomCtx) => string;
|
|
133
118
|
/**
|
|
134
119
|
* Retrieves the relay chain asset symbol for a specified chain.
|
|
@@ -176,26 +161,6 @@ declare const getNativeAssetSymbolImpl: <TCustomChain extends string = never>(ch
|
|
|
176
161
|
* @returns The symbol of the native asset.
|
|
177
162
|
*/
|
|
178
163
|
declare const getNativeAssetSymbol: <TCustomChain extends string = never>(chain: TChain | TCustomChain) => string;
|
|
179
|
-
/**
|
|
180
|
-
* Determines whether a specified chain supports an asset with the given symbol.
|
|
181
|
-
*
|
|
182
|
-
* @deprecated Use `findAssetInfo` instead. Will be removed in v14.
|
|
183
|
-
*
|
|
184
|
-
* @param chain - The chain to check for asset support.
|
|
185
|
-
* @param symbol - The symbol of the asset to check.
|
|
186
|
-
* @returns True if the asset is supported; otherwise, false.
|
|
187
|
-
*/
|
|
188
|
-
declare const hasSupportForAsset: (chain: TChain, symbol: string) => boolean;
|
|
189
|
-
/**
|
|
190
|
-
* Retrieves the number of decimals for an asset with the given symbol on a specified chain.
|
|
191
|
-
*
|
|
192
|
-
* @deprecated Use `findAssetInfo` instead. Will be removed in v14.
|
|
193
|
-
*
|
|
194
|
-
* @param chain - The chain where the asset is located.
|
|
195
|
-
* @param symbol - The symbol of the asset.
|
|
196
|
-
* @returns The number of decimals if the asset is found; otherwise, null.
|
|
197
|
-
*/
|
|
198
|
-
declare const getAssetDecimals: (chain: TChain, symbol: string) => number | null;
|
|
199
164
|
declare const hasDryRunSupportImpl: <TCustomChain extends string = never>(chain: TChain | TCustomChain, ctx?: TCustomCtx) => boolean;
|
|
200
165
|
declare const hasDryRunSupport: (chain: TChain) => boolean;
|
|
201
166
|
declare const hasXcmPaymentApiSupportImpl: <TCustomChain extends string = never>(chain: TChain | TCustomChain, ctx?: TCustomCtx) => boolean;
|
|
@@ -204,10 +169,6 @@ declare const hasXcmPaymentApiSupport: (chain: TChain) => boolean;
|
|
|
204
169
|
declare const Native: (symbol: string) => TSymbolSpecifier;
|
|
205
170
|
declare const Foreign: (symbol: string) => TSymbolSpecifier;
|
|
206
171
|
declare const ForeignAbstract: (symbol: string) => TSymbolSpecifier;
|
|
207
|
-
/**
|
|
208
|
-
* @deprecated Use the `customAssets` Builder option to register the asset instead. Will be removed in v14.
|
|
209
|
-
*/
|
|
210
|
-
declare const Override: (location: TLocation) => TOverrideLocationSpecifier;
|
|
211
172
|
|
|
212
173
|
declare const normalizeCustomAssets: (map: TCustomAssetsMap | undefined) => TCustomAssetsMapNormalized;
|
|
213
174
|
declare const isCustomAsset: (chain: TChain, asset: TAssetInfo, ctx?: Pick<TCustomCtx, "customAssets">) => boolean;
|
|
@@ -321,8 +282,6 @@ declare class InvalidCurrencyError extends Error {
|
|
|
321
282
|
constructor(message: string);
|
|
322
283
|
}
|
|
323
284
|
|
|
324
|
-
declare const isOverrideLocationSpecifier: (locationSpecifier: TLocationValueWithOverride) => locationSpecifier is TOverrideLocationSpecifier;
|
|
325
|
-
|
|
326
285
|
declare const isSymbolSpecifier: (currencySymbolValue: TCurrencySymbolValue) => currencySymbolValue is TSymbolSpecifier;
|
|
327
286
|
|
|
328
287
|
declare const isTAsset: <T = bigint>(value: unknown) => value is TAsset<T>;
|
|
@@ -333,5 +292,5 @@ declare const extractAssetLocation: <T = bigint>(asset: TAsset<T>) => TLocation;
|
|
|
333
292
|
|
|
334
293
|
declare const getAssetLocation: (chain: TChain, currency: TCurrencyInput) => TLocation | null;
|
|
335
294
|
|
|
336
|
-
export { CustomAssetConflictError, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native,
|
|
337
|
-
export type { TAmount, TAsset, TAssetInfo, TAssetInfoWithId, TAssetJsonMap, TAssetV3, TAssetV4, TAssetWithFee, TChainAssetsInfo, TCurrency, TCurrencyCore, TCurrencyInput, TCurrencyInputWithAmount, TCurrencySymbol, TCurrencySymbolValue, TCustomAssetInfo, TCustomAssetsMap, TCustomAssetsMapNormalized, TCustomCtx, TLocationValue,
|
|
295
|
+
export { CustomAssetConflictError, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, 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, isAssetEqual, isBridgedSystemAsset, isChainEvm, isChainEvmImpl, isCustomAsset, isStableCoinAsset, isSymbolMatch, isSymbolSpecifier, isSystemAsset, isTAsset, normalizeCustomAssets, normalizeLocation, normalizeSymbol };
|
|
296
|
+
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
|
@@ -410,7 +410,7 @@ var Paseo = {
|
|
|
410
410
|
relaychainSymbol: "PAS",
|
|
411
411
|
nativeAssetSymbol: "PAS",
|
|
412
412
|
isEVM: false,
|
|
413
|
-
ss58Prefix:
|
|
413
|
+
ss58Prefix: 42,
|
|
414
414
|
supportsDryRunApi: true,
|
|
415
415
|
supportsXcmPaymentApi: true,
|
|
416
416
|
assets: [
|
|
@@ -7564,6 +7564,29 @@ var AssetHubPolkadot = {
|
|
|
7564
7564
|
},
|
|
7565
7565
|
existentialDeposit: "100000000"
|
|
7566
7566
|
},
|
|
7567
|
+
{
|
|
7568
|
+
assetId: "50000534",
|
|
7569
|
+
symbol: "DOT",
|
|
7570
|
+
decimals: 10,
|
|
7571
|
+
location: {
|
|
7572
|
+
parents: 1,
|
|
7573
|
+
interior: {
|
|
7574
|
+
X3: [
|
|
7575
|
+
{
|
|
7576
|
+
Parachain: 1000
|
|
7577
|
+
},
|
|
7578
|
+
{
|
|
7579
|
+
PalletInstance: 50
|
|
7580
|
+
},
|
|
7581
|
+
{
|
|
7582
|
+
GeneralIndex: 50000534
|
|
7583
|
+
}
|
|
7584
|
+
]
|
|
7585
|
+
}
|
|
7586
|
+
},
|
|
7587
|
+
existentialDeposit: "1",
|
|
7588
|
+
alias: "DOT3"
|
|
7589
|
+
},
|
|
7567
7590
|
{
|
|
7568
7591
|
assetId: "50000073",
|
|
7569
7592
|
symbol: "VDOT",
|
|
@@ -12265,7 +12288,8 @@ var AssetHubKusama = {
|
|
|
12265
12288
|
]
|
|
12266
12289
|
}
|
|
12267
12290
|
},
|
|
12268
|
-
existentialDeposit: "10000"
|
|
12291
|
+
existentialDeposit: "10000",
|
|
12292
|
+
alias: "KSM1"
|
|
12269
12293
|
},
|
|
12270
12294
|
{
|
|
12271
12295
|
assetId: "223",
|
|
@@ -12290,6 +12314,29 @@ var AssetHubKusama = {
|
|
|
12290
12314
|
existentialDeposit: "10000",
|
|
12291
12315
|
isFeeAsset: true
|
|
12292
12316
|
},
|
|
12317
|
+
{
|
|
12318
|
+
assetId: "50000011",
|
|
12319
|
+
symbol: "KSM",
|
|
12320
|
+
decimals: 12,
|
|
12321
|
+
location: {
|
|
12322
|
+
parents: 1,
|
|
12323
|
+
interior: {
|
|
12324
|
+
X3: [
|
|
12325
|
+
{
|
|
12326
|
+
Parachain: 1000
|
|
12327
|
+
},
|
|
12328
|
+
{
|
|
12329
|
+
PalletInstance: 50
|
|
12330
|
+
},
|
|
12331
|
+
{
|
|
12332
|
+
GeneralIndex: 50000011
|
|
12333
|
+
}
|
|
12334
|
+
]
|
|
12335
|
+
}
|
|
12336
|
+
},
|
|
12337
|
+
existentialDeposit: "1",
|
|
12338
|
+
alias: "KSM2"
|
|
12339
|
+
},
|
|
12293
12340
|
{
|
|
12294
12341
|
assetId: "2000",
|
|
12295
12342
|
symbol: "USDT",
|
|
@@ -17109,14 +17156,14 @@ var HeimaPaseo = {
|
|
|
17109
17156
|
};
|
|
17110
17157
|
var EnergyWebXPaseo = {
|
|
17111
17158
|
relaychainSymbol: "PAS",
|
|
17112
|
-
nativeAssetSymbol: "
|
|
17159
|
+
nativeAssetSymbol: "VT",
|
|
17113
17160
|
isEVM: false,
|
|
17114
17161
|
ss58Prefix: 42,
|
|
17115
17162
|
supportsDryRunApi: true,
|
|
17116
17163
|
supportsXcmPaymentApi: true,
|
|
17117
17164
|
assets: [
|
|
17118
17165
|
{
|
|
17119
|
-
symbol: "
|
|
17166
|
+
symbol: "VT",
|
|
17120
17167
|
isNative: true,
|
|
17121
17168
|
decimals: 18,
|
|
17122
17169
|
existentialDeposit: "0",
|
|
@@ -19410,34 +19457,23 @@ var isCustomAsset = function isCustomAsset(chain, asset, ctx) {
|
|
|
19410
19457
|
});
|
|
19411
19458
|
};
|
|
19412
19459
|
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
|
|
19417
|
-
|
|
19418
|
-
*/
|
|
19419
|
-
var normalizeSymbol = function normalizeSymbol(symbol) {
|
|
19420
|
-
if (!symbol) return '';
|
|
19421
|
-
var s = symbol.toLowerCase();
|
|
19422
|
-
if (s.startsWith('xc')) s = s.substring(2);
|
|
19423
|
-
if (s.endsWith('.e')) s = s.slice(0, -2);
|
|
19424
|
-
return s;
|
|
19425
|
-
};
|
|
19426
|
-
|
|
19427
|
-
var isSymbolMatch = function isSymbolMatch(symbolA, symbolB) {
|
|
19428
|
-
return normalizeSymbol(symbolA) === normalizeSymbol(symbolB);
|
|
19429
|
-
};
|
|
19430
|
-
|
|
19431
|
-
var isOverrideLocationSpecifier = function isOverrideLocationSpecifier(locationSpecifier) {
|
|
19432
|
-
return _typeof(locationSpecifier) === 'object' && 'type' in locationSpecifier && 'value' in locationSpecifier;
|
|
19460
|
+
var Native = function Native(symbol) {
|
|
19461
|
+
return {
|
|
19462
|
+
type: 'Native',
|
|
19463
|
+
value: symbol
|
|
19464
|
+
};
|
|
19433
19465
|
};
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
|
|
19466
|
+
var Foreign = function Foreign(symbol) {
|
|
19467
|
+
return {
|
|
19468
|
+
type: 'Foreign',
|
|
19469
|
+
value: symbol
|
|
19470
|
+
};
|
|
19437
19471
|
};
|
|
19438
|
-
|
|
19439
|
-
|
|
19440
|
-
|
|
19472
|
+
var ForeignAbstract = function ForeignAbstract(symbol) {
|
|
19473
|
+
return {
|
|
19474
|
+
type: 'ForeignAbstract',
|
|
19475
|
+
value: symbol
|
|
19476
|
+
};
|
|
19441
19477
|
};
|
|
19442
19478
|
|
|
19443
19479
|
var findAssetInfoById = function findAssetInfoById(assets, assetId) {
|
|
@@ -19492,6 +19528,14 @@ var findAssetInfoByLoc = function findAssetInfoByLoc(foreignAssets, location) {
|
|
|
19492
19528
|
});
|
|
19493
19529
|
};
|
|
19494
19530
|
|
|
19531
|
+
var isSymbolSpecifier = function isSymbolSpecifier(currencySymbolValue) {
|
|
19532
|
+
return _typeof(currencySymbolValue) === 'object' && 'type' in currencySymbolValue && 'value' in currencySymbolValue;
|
|
19533
|
+
};
|
|
19534
|
+
|
|
19535
|
+
var isTAsset = function isTAsset(value) {
|
|
19536
|
+
return _typeof(value) === 'object' && value !== null && 'id' in value && 'fun' in value;
|
|
19537
|
+
};
|
|
19538
|
+
|
|
19495
19539
|
var findBestMatches = function findBestMatches(assets, value) {
|
|
19496
19540
|
var property = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'symbol';
|
|
19497
19541
|
// First, exact match
|
|
@@ -19665,14 +19709,14 @@ var findAssetInfoBySymbol = function findAssetInfoBySymbol(otherAssets, nativeAs
|
|
|
19665
19709
|
};
|
|
19666
19710
|
|
|
19667
19711
|
var findAssetInfoImpl = function findAssetInfoImpl(chain, currency, destination, ctx) {
|
|
19668
|
-
if (
|
|
19712
|
+
if (Array.isArray(currency)) {
|
|
19669
19713
|
return null;
|
|
19670
19714
|
}
|
|
19671
19715
|
var otherAssets = getOtherAssetsImpl(chain, ctx);
|
|
19672
19716
|
var nativeAssets = getNativeAssetsImpl(chain, ctx);
|
|
19673
19717
|
var assets = [].concat(_toConsumableArray(nativeAssets), _toConsumableArray(otherAssets));
|
|
19674
19718
|
var asset;
|
|
19675
|
-
if ('location' in currency
|
|
19719
|
+
if ('location' in currency) {
|
|
19676
19720
|
asset = findAssetInfoByLoc(assets, currency.location);
|
|
19677
19721
|
} else if ('symbol' in currency) {
|
|
19678
19722
|
asset = findAssetInfoBySymbol(otherAssets, nativeAssets, currency.symbol, destination !== null && destination !== void 0 ? destination : undefined);
|
|
@@ -19685,34 +19729,6 @@ var findAssetInfo = function findAssetInfo(chain, currency, destination) {
|
|
|
19685
19729
|
return findAssetInfoImpl(chain, currency, destination);
|
|
19686
19730
|
};
|
|
19687
19731
|
|
|
19688
|
-
var Native = function Native(symbol) {
|
|
19689
|
-
return {
|
|
19690
|
-
type: 'Native',
|
|
19691
|
-
value: symbol
|
|
19692
|
-
};
|
|
19693
|
-
};
|
|
19694
|
-
var Foreign = function Foreign(symbol) {
|
|
19695
|
-
return {
|
|
19696
|
-
type: 'Foreign',
|
|
19697
|
-
value: symbol
|
|
19698
|
-
};
|
|
19699
|
-
};
|
|
19700
|
-
var ForeignAbstract = function ForeignAbstract(symbol) {
|
|
19701
|
-
return {
|
|
19702
|
-
type: 'ForeignAbstract',
|
|
19703
|
-
value: symbol
|
|
19704
|
-
};
|
|
19705
|
-
};
|
|
19706
|
-
/**
|
|
19707
|
-
* @deprecated Use the `customAssets` Builder option to register the asset instead. Will be removed in v14.
|
|
19708
|
-
*/
|
|
19709
|
-
var Override = function Override(location) {
|
|
19710
|
-
return {
|
|
19711
|
-
type: 'Override',
|
|
19712
|
-
value: location
|
|
19713
|
-
};
|
|
19714
|
-
};
|
|
19715
|
-
|
|
19716
19732
|
var STABLECOIN_IDS = [1984, 1337];
|
|
19717
19733
|
|
|
19718
19734
|
var hasStablecoinIndex = function hasStablecoinIndex(location, assetId) {
|
|
@@ -19953,21 +19969,6 @@ var isChainEvmImpl = function isChainEvmImpl(chain, ctx) {
|
|
|
19953
19969
|
var isChainEvm = function isChainEvm(chain) {
|
|
19954
19970
|
return isChainEvmImpl(chain);
|
|
19955
19971
|
};
|
|
19956
|
-
/**
|
|
19957
|
-
* Retrieves the asset ID for a given symbol on a specified chain.
|
|
19958
|
-
*
|
|
19959
|
-
* @deprecated Use `findAssetInfo` instead. Will be removed in v14.
|
|
19960
|
-
*
|
|
19961
|
-
* @param chain - The chain to search for the asset.
|
|
19962
|
-
* @param symbol - The symbol of the asset.
|
|
19963
|
-
* @returns The asset ID if found; otherwise, null.
|
|
19964
|
-
*/
|
|
19965
|
-
var getAssetId = function getAssetId(chain, symbol) {
|
|
19966
|
-
var asset = getAssetsObject(chain).assets.find(function (o) {
|
|
19967
|
-
return o.symbol === symbol;
|
|
19968
|
-
});
|
|
19969
|
-
return asset != null && asset.assetId ? asset.assetId : null;
|
|
19970
|
-
};
|
|
19971
19972
|
var getRelayChainSymbolImpl = function getRelayChainSymbolImpl(chain, ctx) {
|
|
19972
19973
|
return getAssetsObjectImpl(chain, ctx).relaychainSymbol;
|
|
19973
19974
|
};
|
|
@@ -20046,55 +20047,6 @@ var getNativeAssetSymbolImpl = function getNativeAssetSymbolImpl(chain, ctx) {
|
|
|
20046
20047
|
var getNativeAssetSymbol = function getNativeAssetSymbol(chain) {
|
|
20047
20048
|
return getNativeAssetSymbolImpl(chain);
|
|
20048
20049
|
};
|
|
20049
|
-
/**
|
|
20050
|
-
* Determines whether a specified chain supports an asset with the given symbol.
|
|
20051
|
-
*
|
|
20052
|
-
* @deprecated Use `findAssetInfo` instead. Will be removed in v14.
|
|
20053
|
-
*
|
|
20054
|
-
* @param chain - The chain to check for asset support.
|
|
20055
|
-
* @param symbol - The symbol of the asset to check.
|
|
20056
|
-
* @returns True if the asset is supported; otherwise, false.
|
|
20057
|
-
*/
|
|
20058
|
-
var hasSupportForAsset = function hasSupportForAsset(chain, symbol) {
|
|
20059
|
-
var lowerSymbol = symbol.toLowerCase();
|
|
20060
|
-
var symbolsToCheck = new Set();
|
|
20061
|
-
symbolsToCheck.add(lowerSymbol);
|
|
20062
|
-
if (lowerSymbol.startsWith('xc')) {
|
|
20063
|
-
symbolsToCheck.add(lowerSymbol.substring(2));
|
|
20064
|
-
} else {
|
|
20065
|
-
symbolsToCheck.add("xc".concat(lowerSymbol));
|
|
20066
|
-
}
|
|
20067
|
-
if (lowerSymbol.endsWith('.e')) {
|
|
20068
|
-
symbolsToCheck.add(lowerSymbol.substring(0, lowerSymbol.length - 2));
|
|
20069
|
-
} else {
|
|
20070
|
-
symbolsToCheck.add("".concat(lowerSymbol, ".e"));
|
|
20071
|
-
}
|
|
20072
|
-
var chainSymbols = getAllAssetsSymbols(chain).map(function (s) {
|
|
20073
|
-
return s.toLowerCase();
|
|
20074
|
-
});
|
|
20075
|
-
return chainSymbols.some(function (chainSymbol) {
|
|
20076
|
-
return symbolsToCheck.has(chainSymbol);
|
|
20077
|
-
});
|
|
20078
|
-
};
|
|
20079
|
-
/**
|
|
20080
|
-
* Retrieves the number of decimals for an asset with the given symbol on a specified chain.
|
|
20081
|
-
*
|
|
20082
|
-
* @deprecated Use `findAssetInfo` instead. Will be removed in v14.
|
|
20083
|
-
*
|
|
20084
|
-
* @param chain - The chain where the asset is located.
|
|
20085
|
-
* @param symbol - The symbol of the asset.
|
|
20086
|
-
* @returns The number of decimals if the asset is found; otherwise, null.
|
|
20087
|
-
*/
|
|
20088
|
-
var getAssetDecimals = function getAssetDecimals(chain, symbol) {
|
|
20089
|
-
var _getAssetsObject2 = getAssetsObject(chain),
|
|
20090
|
-
assets = _getAssetsObject2.assets;
|
|
20091
|
-
var isMainNativeAsset = isSymbolMatch(symbol, getNativeAssetSymbol(chain));
|
|
20092
|
-
if (isMainNativeAsset) return findNativeAssetInfoOrThrowImpl(chain).decimals;
|
|
20093
|
-
var asset = assets.find(function (o) {
|
|
20094
|
-
return o.symbol === symbol;
|
|
20095
|
-
});
|
|
20096
|
-
return (asset === null || asset === void 0 ? void 0 : asset.decimals) !== undefined ? asset.decimals : null;
|
|
20097
|
-
};
|
|
20098
20050
|
var hasDryRunSupportImpl = function hasDryRunSupportImpl(chain, ctx) {
|
|
20099
20051
|
// These chains have DryRun but it's not working
|
|
20100
20052
|
var DISABLED_CHAINS = ['Basilisk', 'Jamton'];
|
|
@@ -20223,4 +20175,22 @@ var getSupportedDestinations = function getSupportedDestinations(origin, currenc
|
|
|
20223
20175
|
});
|
|
20224
20176
|
};
|
|
20225
20177
|
|
|
20226
|
-
|
|
20178
|
+
/**
|
|
20179
|
+
* Normalizes an asset symbol by stripping the 'xc' prefix (if present) and converting it to lowercase.
|
|
20180
|
+
*
|
|
20181
|
+
* @param symbol - The symbol to normalize.
|
|
20182
|
+
* @returns The normalized symbol.
|
|
20183
|
+
*/
|
|
20184
|
+
var normalizeSymbol = function normalizeSymbol(symbol) {
|
|
20185
|
+
if (!symbol) return '';
|
|
20186
|
+
var s = symbol.toLowerCase();
|
|
20187
|
+
if (s.startsWith('xc')) s = s.substring(2);
|
|
20188
|
+
if (s.endsWith('.e')) s = s.slice(0, -2);
|
|
20189
|
+
return s;
|
|
20190
|
+
};
|
|
20191
|
+
|
|
20192
|
+
var isSymbolMatch = function isSymbolMatch(symbolA, symbolB) {
|
|
20193
|
+
return normalizeSymbol(symbolA) === normalizeSymbol(symbolB);
|
|
20194
|
+
};
|
|
20195
|
+
|
|
20196
|
+
export { CustomAssetConflictError, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, 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, isAssetEqual, isBridgedSystemAsset, isChainEvm, isChainEvmImpl, isCustomAsset, 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": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "Assets for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@paraspell/sdk-common": "
|
|
25
|
+
"@paraspell/sdk-common": "14.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-syntax-import-attributes": "^7.29.7",
|