@paraspell/assets 11.14.8 → 12.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/dist/index.d.ts CHANGED
@@ -16,29 +16,19 @@ interface TAssetV4<T = bigint> {
16
16
  };
17
17
  }
18
18
 
19
- type AtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
20
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
21
- }[Keys];
22
- type TBaseAssetInfo = {
23
- symbol: string;
19
+ type TAssetInfo = {
24
20
  decimals: number;
25
- manuallyAdded?: boolean;
26
- alias?: string;
21
+ symbol: string;
22
+ isNative?: boolean;
23
+ assetId?: string;
24
+ location?: TLocation;
27
25
  existentialDeposit?: string;
28
26
  isFeeAsset?: boolean;
27
+ alias?: string;
29
28
  };
30
- type TNativeAssetInfo = TBaseAssetInfo & {
31
- isNative: true;
32
- location?: TLocation;
33
- };
34
- type TForeignAssetInfo = TBaseAssetInfo & AtLeastOne<{
35
- assetId?: string;
36
- location?: TLocation;
37
- }>;
38
- type TForeignAssetWithId = TForeignAssetInfo & {
29
+ type TAssetInfoWithId = TAssetInfo & {
39
30
  assetId: string;
40
31
  };
41
- type TAssetInfo = TNativeAssetInfo | TForeignAssetInfo;
42
32
  type TAssetWithLocation = TAssetInfo & {
43
33
  location: TLocation;
44
34
  };
@@ -49,8 +39,7 @@ type TChainAssetsInfo = {
49
39
  ss58Prefix: number;
50
40
  supportsDryRunApi: boolean;
51
41
  supportsXcmPaymentApi: boolean;
52
- nativeAssets: TNativeAssetInfo[];
53
- otherAssets: TForeignAssetInfo[];
42
+ assets: TAssetInfo[];
54
43
  };
55
44
  type TAssetJsonMap = Record<TChain, TChainAssetsInfo>;
56
45
 
@@ -135,14 +124,14 @@ declare const getRelayChainSymbol: (chain: TChain) => string;
135
124
  * @param chain - The chain for which to get native assets.
136
125
  * @returns An array of native asset details.
137
126
  */
138
- declare const getNativeAssets: (chain: TChain) => TNativeAssetInfo[];
127
+ declare const getNativeAssets: (chain: TChain) => TAssetInfo[];
139
128
  /**
140
129
  * Retrieves the list of other (non-native) assets for a specified chain.
141
130
  *
142
131
  * @param chain - The chain for which to get other assets.
143
132
  * @returns An array of other asset details.
144
133
  */
145
- declare const getOtherAssets: (chain: TChain) => TForeignAssetInfo[];
134
+ declare const getOtherAssets: (chain: TChain) => TAssetInfo[];
146
135
  /**
147
136
  * Retrieves the complete list of assets for a specified chain, including relay chain asset, native, and other assets.
148
137
  *
@@ -226,18 +215,18 @@ declare const normalizeSymbol: (symbol?: string) => string;
226
215
 
227
216
  declare const findAssetInfo: (chain: TChain, currency: TCurrencyInput, destination: TChain | null) => TAssetInfo | null;
228
217
 
229
- declare const findAssetInfoById: (assets: TForeignAssetInfo[], assetId: TCurrency) => TForeignAssetInfo | undefined;
218
+ declare const findAssetInfoById: (assets: TAssetInfo[], assetId: TCurrency) => TAssetInfo | undefined;
230
219
 
231
- declare const findAssetInfoByLoc: (foreignAssets: TForeignAssetInfo[], location: string | TLocation) => TForeignAssetInfo | undefined;
220
+ declare const findAssetInfoByLoc: (foreignAssets: TAssetInfo[], location: string | TLocation) => TAssetInfo | undefined;
232
221
 
233
- declare const findAssetInfoBySymbol: (destination: TChain | null, otherAssets: TForeignAssetInfo[], nativeAssets: TNativeAssetInfo[], symbol: TCurrencySymbolValue) => TAssetInfo | undefined;
222
+ declare const findAssetInfoBySymbol: (destination: TChain | null, otherAssets: TAssetInfo[], nativeAssets: TAssetInfo[], symbol: TCurrencySymbolValue) => TAssetInfo | undefined;
234
223
 
235
224
  declare const findAssetInfoOnDest: (origin: TChain, destination: TChain, currency: TCurrencyInput, originAsset?: TAssetInfo | null) => TAssetInfo | null;
236
225
  declare const findAssetOnDestOrThrow: (origin: TChain, destination: TChain, currency: TCurrencyInput) => TAssetInfo;
237
226
 
238
227
  declare const findAssetInfoOrThrow: (chain: TChain, currency: TCurrencyInput, destination: TChain | null) => TAssetInfo;
239
228
 
240
- declare const findBestMatches: <T extends TBaseAssetInfo>(assets: T[], value: string, property?: "symbol" | "alias") => T[];
229
+ declare const findBestMatches: (assets: TAssetInfo[], value: string, property?: "symbol" | "alias") => TAssetInfo[];
241
230
 
242
231
  declare const findNativeAssetInfo: (chain: TChain) => TAssetInfo | null;
243
232
  declare const findNativeAssetInfoOrThrow: (chain: TChain) => TAssetInfo;
@@ -278,19 +267,17 @@ declare class InvalidCurrencyError extends Error {
278
267
  constructor(message: string);
279
268
  }
280
269
 
281
- declare const isForeignAsset: (asset: TAssetInfo) => asset is TForeignAssetInfo;
282
-
283
270
  declare const isOverrideLocationSpecifier: (locationSpecifier: TLocationValueWithOverride) => locationSpecifier is TOverrideLocationSpecifier;
284
271
 
285
272
  declare const isSymbolSpecifier: (currencySymbolValue: TCurrencySymbolValue) => currencySymbolValue is TSymbolSpecifier;
286
273
 
287
274
  declare const isTAsset: <T = bigint>(value: unknown) => value is TAsset<T>;
288
275
 
289
- declare const compareLocations: (input: string, asset: TForeignAssetInfo) => boolean;
276
+ declare const compareLocations: (input: string, asset: TAssetInfo) => boolean;
290
277
 
291
278
  declare const extractAssetLocation: <T = bigint>(asset: TAsset<T>) => TLocation;
292
279
 
293
280
  declare const getAssetLocation: (chain: TChain, currency: TCurrencyInput) => TLocation | null;
294
281
 
295
- 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, isForeignAsset, isOverrideLocationSpecifier, isSymbolMatch, isSymbolSpecifier, isTAsset, normalizeLocation, normalizeSymbol };
296
- export type { TAmount, TAsset, TAssetInfo, TAssetJsonMap, TAssetV3, TAssetV4, TAssetWithFee, TAssetWithLocation, TBaseAssetInfo, TChainAssetsInfo, TCurrency, TCurrencyCore, TCurrencyInput, TCurrencyInputWithAmount, TCurrencySymbol, TCurrencySymbolValue, TForeignAssetInfo, TForeignAssetWithId, TLocationValue, TLocationValueWithOverride, TNativeAssetInfo, TOverrideLocationSpecifier, TSymbolSpecifier, WithAmount, WithComplexAmount };
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 };
283
+ export type { TAmount, TAsset, TAssetInfo, TAssetInfoWithId, TAssetJsonMap, TAssetV3, TAssetV4, TAssetWithFee, TAssetWithLocation, TChainAssetsInfo, TCurrency, TCurrencyCore, TCurrencyInput, TCurrencyInputWithAmount, TCurrencySymbol, TCurrencySymbolValue, TLocationValue, TLocationValueWithOverride, TOverrideLocationSpecifier, TSymbolSpecifier, WithAmount, WithComplexAmount };