@paraspell/swap 12.8.6 → 12.8.7

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +20 -23
  2. package/dist/index.mjs +3171 -4251
  3. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -8,8 +8,8 @@ type TRouterBuilderOptions = Omit<TBuilderConfig<TUrl>, 'xcmFormatCheck'>;
8
8
 
9
9
  type TSwapOptions = {
10
10
  papiApi: TPapiApi;
11
- assetFrom: TRouterAsset;
12
- assetTo: TRouterAsset;
11
+ assetFrom: TAssetInfo;
12
+ assetTo: TAssetInfo;
13
13
  amount: bigint;
14
14
  slippagePct: string;
15
15
  senderAddress: string;
@@ -20,8 +20,8 @@ type TSwapOptions = {
20
20
  type TGetAmountOutOptions = {
21
21
  papiApi: TPapiApi;
22
22
  origin?: TOriginInfo;
23
- assetFrom: TRouterAsset;
24
- assetTo: TRouterAsset;
23
+ assetFrom: TAssetInfo;
24
+ assetTo: TAssetInfo;
25
25
  amount: bigint;
26
26
  slippagePct?: string;
27
27
  };
@@ -145,8 +145,8 @@ type TExchangeInfo = {
145
145
  apiPapi: TPapiApi;
146
146
  baseChain: TParachain;
147
147
  exchangeChain: TExchangeChain;
148
- assetFrom: TRouterAsset;
149
- assetTo: TRouterAsset;
148
+ assetFrom: TAssetInfo;
149
+ assetTo: TAssetInfo;
150
150
  feeAssetInfo?: TAssetInfo;
151
151
  };
152
152
  type TDestinationInfo = {
@@ -161,21 +161,18 @@ type TAdditionalTransferOptions = {
161
161
  feeCalcAddress: string;
162
162
  builderOptions?: TRouterBuilderOptions;
163
163
  };
164
- type TRouterAsset = {
165
- symbol: string;
166
- decimals: number;
167
- assetId?: string;
168
- location: TLocation;
169
- alias?: string;
170
- };
171
- type TPairKey = string | object;
172
- type TPairs = TPairKey[][];
173
- type TDexConfig = {
174
- assets: TRouterAsset[];
164
+ type TPairs = TLocation[][];
165
+ type TDexConfigBase = {
175
166
  isOmni: boolean;
176
167
  pairs: TPairs;
177
168
  };
178
- type TAssetsRecord = Record<TExchangeChain, TDexConfig>;
169
+ type TDexConfig = {
170
+ assets: TAssetInfo[];
171
+ } & TDexConfigBase;
172
+ type TDexConfigStored = {
173
+ assets: TLocation[];
174
+ } & TDexConfigBase;
175
+ type TAssetsRecord = Record<TExchangeChain, TDexConfigStored>;
179
176
  /** @deprecated Will be removed in v13 */
180
177
  type TTransactionType = 'TRANSFER' | 'SWAP' | 'SWAP_AND_TRANSFER';
181
178
  type TBaseTransaction = {
@@ -243,9 +240,9 @@ type TRouterXcmFeeDetail = TXcmFeeDetail;
243
240
  type TRouterXcmFeeResult = TGetXcmFeeResult;
244
241
 
245
242
  declare const getExchangeConfig: (exchange: TExchangeChain) => TDexConfig;
246
- declare const getExchangeAssets: (exchange: TExchangeChain) => TRouterAsset[];
243
+ declare const getExchangeAssets: (exchange: TExchangeChain) => TAssetInfo[];
247
244
 
248
- declare const getExchangePairs: (exchange: TExchangeInput) => [TRouterAsset, TRouterAsset][];
245
+ declare const getExchangePairs: (exchange: TExchangeInput) => [TAssetInfo, TAssetInfo][];
249
246
 
250
247
  /**
251
248
  * Retrieves the list of assets supported for transfer from the origin chain to the exchange chain.
@@ -264,7 +261,7 @@ declare const getSupportedAssetsFrom: (from: TChain | undefined, exchange: TExch
264
261
  * @param to - The destination chain.
265
262
  * @returns An array of supported assets.
266
263
  */
267
- declare const getSupportedAssetsTo: (exchange: TExchangeInput, to: TChain | undefined) => TRouterAsset[];
264
+ declare const getSupportedAssetsTo: (exchange: TExchangeInput, to: TChain | undefined) => TAssetInfo[];
268
265
 
269
266
  /**
270
267
  * Retrieves the list of assets that can be used to pay for fees on the origin chain.
@@ -475,7 +472,7 @@ declare abstract class ExchangeChain {
475
472
  abstract swapCurrency(api: ApiPromise, options: TSwapOptions, toDestTransactionFee: bigint): Promise<TSingleSwapResult>;
476
473
  handleMultiSwap(api: ApiPromise, options: TSwapOptions, toDestTransactionFee: bigint): Promise<TMultiSwapResult>;
477
474
  abstract getAmountOut(api: ApiPromise, options: TGetAmountOutOptions): Promise<bigint>;
478
- abstract getDexConfig(api: ApiPromise): Promise<TDexConfig>;
475
+ abstract getDexConfig(api: ApiPromise): Promise<TDexConfigStored>;
479
476
  createApiInstance(builderOptions?: TBuilderOptions<TPjsApiOrUrl>): Promise<ApiPromise>;
480
477
  createApiInstancePapi(builderOptions?: TBuilderOptions<TPapiApiOrUrl>): Promise<TPapiApi>;
481
478
  }
@@ -516,4 +513,4 @@ declare const buildTransactions: (dex: ExchangeChain, options: TTransformedOptio
516
513
  declare const transfer: (initialOptions: TTransferOptions, builderOptions?: TRouterBuilderOptions) => Promise<void>;
517
514
 
518
515
  export { DEST_FEE_BUFFER_PCT, FALLBACK_FEE_CALC_ADDRESS, FALLBACK_FEE_CALC_EVM_ADDRESS, FEE_BUFFER_PCT, RouterBuilder, RouterBuilderCore, buildApiTransactions, buildTransactions, createExchangeInstance, getExchangeAssets, getExchangeConfig, getExchangePairs, getSupportedAssetsFrom, getSupportedAssetsTo, getSupportedFeeAssets, transfer };
519
- export type { TAdditionalTransferOptions, TAssetsRecord, TBuildFromExchangeTxOptions, TBuildToExchangeTxOptions, TBuildTransactionsOptions, TCommonRouterOptions, TDestinationInfo, TDexConfig, TExchangeInfo, TExecuteRouterPlanOptions, TExtrinsic, TGetAmountOutOptions, TGetBestAmountOutOptions, TGetBestAmountOutResult, TMultiSwapResult, TOriginInfo, TPairKey, TPairs, TPreparedExtrinsics, TRouterAsset, TRouterBuilderOptions, TRouterDryRunChainResult, TRouterDryRunHopInfo, TRouterDryRunResult, TRouterEvent, TRouterEventType, TRouterPlan, TRouterXcmFeeDetail, TRouterXcmFeeHopInfo, TRouterXcmFeeResult, TSingleSwapResult, TStatusChangeCallback, TSwapAndTransferTransaction, TSwapOptions, TSwapTransaction, TTransaction, TTransactionType, TTransferOptions, TTransformedOptions };
516
+ export type { TAdditionalTransferOptions, TAssetsRecord, TBuildFromExchangeTxOptions, TBuildToExchangeTxOptions, TBuildTransactionsOptions, TCommonRouterOptions, TDestinationInfo, TDexConfig, TDexConfigBase, TDexConfigStored, TExchangeInfo, TExecuteRouterPlanOptions, TExtrinsic, TGetAmountOutOptions, TGetBestAmountOutOptions, TGetBestAmountOutResult, TMultiSwapResult, TOriginInfo, TPairs, TPreparedExtrinsics, TRouterBuilderOptions, TRouterDryRunChainResult, TRouterDryRunHopInfo, TRouterDryRunResult, TRouterEvent, TRouterEventType, TRouterPlan, TRouterXcmFeeDetail, TRouterXcmFeeHopInfo, TRouterXcmFeeResult, TSingleSwapResult, TStatusChangeCallback, TSwapAndTransferTransaction, TSwapOptions, TSwapTransaction, TTransaction, TTransactionType, TTransferOptions, TTransformedOptions };