@paraspell/swap 12.8.5

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ParaSpell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ <br /><br />
2
+
3
+ <div align="center">
4
+ <h1 align="center">@paraspell/swap</h1>
5
+ <h4 align="center"> An extension to @paraspell/sdk for cross-chain asset swaps via XCM. </h4>
6
+ <p align="center">
7
+ <a href="https://npmjs.com/package/@paraspell/swap">
8
+ <img alt="version" src="https://img.shields.io/npm/v/@paraspell/swap?style=flat-square" />
9
+ </a>
10
+ <a href="https://npmjs.com/package/@paraspell/swap">
11
+ <img alt="downloads" src="https://img.shields.io/npm/dm/@paraspell/swap?style=flat-square" />
12
+ </a>
13
+ <a href="https://github.com/paraspell/xcm-sdk/actions">
14
+ <img alt="build" src="https://github.com/paraspell/xcm-tools/actions/workflows/ci.yml/badge.svg" />
15
+ </a>
16
+ </p>
17
+ <p>How to swap <a href = "https://paraspell.github.io/docs/sdk/xcmPallet.html#swap" \>[here]</p>
18
+ <p>XCM SDK starter template project <a href = "https://github.com/paraspell/xcm-sdk-template" \>[here]</p>
19
+ </div>
20
+
21
+ <br /><br />
22
+ <br /><br />
23
+
24
+ # Installation
25
+
26
+ Please reffer to [SDK documentation](https://paraspell.github.io/docs/sdk/getting-started.html#install-swap-extension)
27
+
28
+ ## 💻 Testing
29
+
30
+ - Run compilation using `pnpm compile`
31
+
32
+ - Run linting test using `pnpm lint`
33
+
34
+ - Run unit tests using `pnpm test`
35
+
36
+ > [!NOTE]
37
+ > Swaps can be tested in [Playground](https://playground.paraspell.xyz/https://playground.paraspell.xyz/xcm-sdk/xcm-transfer).
38
+
39
+ ## Contribute to XCM Tools and earn rewards 💰
40
+
41
+ We run an open Bug Bounty Program that rewards contributors for reporting and fixing bugs in the project. More information on bug bounty can be found in the [official documentation](https://paraspell.github.io/docs/contribution.html).
42
+
43
+ ## Get Support 🚑
44
+
45
+ - Contact form on our [landing page](https://paraspell.xyz/#contact-us).
46
+ - Message us on our [X](https://x.com/paraspell).
47
+ - Support channel on [telegram](https://t.me/paraspell).
48
+
49
+ ## License
50
+
51
+ Made with 💛 by [ParaSpell✨](https://paraspell.xyz/)
52
+
53
+ Published under [MIT License](https://github.com/paraspell/xcm-tools/blob/main/packages/swap/LICENSE).
54
+
55
+ ## Supported by
56
+
57
+ <p align="center">
58
+ <picture>
59
+ <source media="(prefers-color-scheme: dark)" srcset="https://github.com/paraspell/presskit/blob/main/logos_supporters/polkadot_kusama_transparent.png">
60
+ <source media="(prefers-color-scheme: light)" srcset="https://github.com/paraspell/presskit/blob/main/logos_supporters/polkadot_kusama_w3f_standard.png">
61
+ <img width="750" alt="Shows a black logo in light color mode and a white one in dark color mode." src="https://github.com/paraspell/presskit/blob/main/logos_supporters/polkadot_kusama_w3f_standard.png">
62
+ </picture>
63
+ </p>
@@ -0,0 +1,519 @@
1
+ import { TBuilderConfig, TUrl, TSubstrateChain, TExchangeInput, TChain, TCurrencyInput, TAmount, TPapiApi, TPapiTransaction, TExchangeChain, TAssetInfo, TParachain, TLocation, TDryRunChainResult, THopInfo, TDryRunResult, TXcmFeeDetail, TXcmFeeHopInfo, TGetXcmFeeResult, TGetXcmFeeBuilderOptions, TBuilderOptions, TPapiApiOrUrl } from '@paraspell/sdk';
2
+ export { EXCHANGE_CHAINS, TExchangeChain, TExchangeInput } from '@paraspell/sdk';
3
+ import { TPjsApi, Extrinsic, TParachain as TParachain$1, TPjsApiOrUrl } from '@paraspell/sdk-pjs';
4
+ import { PolkadotSigner } from 'polkadot-api';
5
+ import { ApiPromise } from '@polkadot/api';
6
+
7
+ type TRouterBuilderOptions = Omit<TBuilderConfig<TUrl>, 'xcmFormatCheck'>;
8
+
9
+ type TSwapOptions = {
10
+ papiApi: TPapiApi;
11
+ assetFrom: TRouterAsset;
12
+ assetTo: TRouterAsset;
13
+ amount: bigint;
14
+ slippagePct: string;
15
+ senderAddress: string;
16
+ feeCalcAddress: string;
17
+ origin?: TOriginInfo;
18
+ isForFeeEstimation?: boolean;
19
+ };
20
+ type TGetAmountOutOptions = {
21
+ papiApi: TPapiApi;
22
+ origin?: TOriginInfo;
23
+ assetFrom: TRouterAsset;
24
+ assetTo: TRouterAsset;
25
+ amount: bigint;
26
+ slippagePct?: string;
27
+ };
28
+ type TExtrinsic = Extrinsic | TPapiTransaction;
29
+ type TSingleSwapResult = {
30
+ tx: TExtrinsic;
31
+ amountOut: bigint;
32
+ };
33
+ type TMultiSwapResult = {
34
+ txs: TExtrinsic[];
35
+ amountOut: bigint;
36
+ };
37
+ /** @deprecated Use `TSwapEventType` instead. Will be removed in v13 */
38
+ type TRouterEventType = TTransactionType | 'SELECTING_EXCHANGE' | 'COMPLETED';
39
+ /**
40
+ * @deprecated Use `TSwapEvent` instead. Will be removed in v13
41
+ *
42
+ * The transaction progress information.
43
+ */
44
+ type TRouterEvent = {
45
+ /**
46
+ * Current execution phase type
47
+ */
48
+ type: TRouterEventType;
49
+ /**
50
+ * Full transaction plan for visualization
51
+ */
52
+ routerPlan?: TRouterPlan;
53
+ /**
54
+ * Current transaction's origin chain
55
+ */
56
+ chain?: TSubstrateChain;
57
+ /**
58
+ * Current transaction's destination chain
59
+ */
60
+ destinationChain?: TChain;
61
+ /**
62
+ * 0-based step index of current operation
63
+ */
64
+ currentStep?: number;
65
+ };
66
+ type TStatusChangeCallback = (info: TRouterEvent) => void;
67
+ /**
68
+ * The options for an XCM Router transfer.
69
+ */
70
+ type TTransferOptions = {
71
+ /**
72
+ * The origin chain to transfer from.
73
+ */
74
+ from?: TSubstrateChain;
75
+ /**
76
+ * The exchange chain to use for the transfer.
77
+ */
78
+ exchange?: TExchangeInput;
79
+ /**
80
+ * The destination chain to transfer to.
81
+ */
82
+ to?: TChain;
83
+ /**
84
+ * The origin currency.
85
+ */
86
+ currencyFrom: TCurrencyInput;
87
+ /**
88
+ * The destination currency that the origin currency will be exchanged to.
89
+ */
90
+ currencyTo: TCurrencyInput;
91
+ /**
92
+ * The amount to transfer.
93
+ * @example '1000000000000000'
94
+ */
95
+ amount: TAmount;
96
+ /**
97
+ * The sender address.
98
+ */
99
+ senderAddress: string;
100
+ /**
101
+ * The EVM injector address. Used when dealing with EVM chains.
102
+ */
103
+ evmSenderAddress?: string;
104
+ /**
105
+ * The recipient address.
106
+ */
107
+ recipientAddress?: string;
108
+ /**
109
+ * The slippage percentage.
110
+ */
111
+ slippagePct: string;
112
+ /**
113
+ * The Polkadot signer instance.
114
+ */
115
+ signer: PolkadotSigner;
116
+ /**
117
+ * The Polkadot EVM signer instance.
118
+ */
119
+ evmSigner?: PolkadotSigner;
120
+ /**
121
+ * The asset used to pay XCM fees.
122
+ */
123
+ feeAsset?: TCurrencyInput;
124
+ /**
125
+ * The callback function to call when the transaction status changes.
126
+ */
127
+ onStatusChange?: TStatusChangeCallback;
128
+ };
129
+ type TGetBestAmountOutOptions = Omit<TTransferOptions, 'onStatusChange' | 'signer' | 'evmSigner' | 'recipientAddress' | 'slippagePct' | 'senderAddress' | 'evmSenderAddress'>;
130
+ type TGetBestAmountOutResult = {
131
+ exchange: TExchangeChain;
132
+ amountOut: bigint;
133
+ };
134
+ type TBuildTransactionsOptions = Omit<TTransferOptions, 'onStatusChange' | 'signer' | 'evmSigner'>;
135
+ type TCommonRouterOptions = TTransferOptions | TBuildTransactionsOptions;
136
+ type TTransformedOptions<T> = Omit<T, 'exchange' | 'amount'> & TAdditionalTransferOptions;
137
+ type TOriginInfo = {
138
+ api: TPapiApi;
139
+ chain: TSubstrateChain;
140
+ assetFrom: TAssetInfo;
141
+ feeAssetInfo?: TAssetInfo;
142
+ };
143
+ type TExchangeInfo = {
144
+ api: TPjsApi;
145
+ apiPapi: TPapiApi;
146
+ baseChain: TParachain;
147
+ exchangeChain: TExchangeChain;
148
+ assetFrom: TRouterAsset;
149
+ assetTo: TRouterAsset;
150
+ feeAssetInfo?: TAssetInfo;
151
+ };
152
+ type TDestinationInfo = {
153
+ chain: TChain;
154
+ address: string;
155
+ };
156
+ type TAdditionalTransferOptions = {
157
+ amount: bigint;
158
+ origin?: TOriginInfo;
159
+ exchange: TExchangeInfo;
160
+ destination?: TDestinationInfo;
161
+ feeCalcAddress: string;
162
+ builderOptions?: TRouterBuilderOptions;
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[];
175
+ isOmni: boolean;
176
+ pairs: TPairs;
177
+ };
178
+ type TAssetsRecord = Record<TExchangeChain, TDexConfig>;
179
+ /** @deprecated Will be removed in v13 */
180
+ type TTransactionType = 'TRANSFER' | 'SWAP' | 'SWAP_AND_TRANSFER';
181
+ type TBaseTransaction = {
182
+ api: TPapiApi;
183
+ chain: TSubstrateChain;
184
+ destinationChain?: TChain;
185
+ tx: TPapiTransaction;
186
+ };
187
+ type TSwapTransaction = TBaseTransaction & {
188
+ type: 'SWAP';
189
+ amountOut: bigint;
190
+ };
191
+ type TTransferTransaction = TBaseTransaction & {
192
+ type: 'TRANSFER';
193
+ };
194
+ type TSwapAndTransferTransaction = TBaseTransaction & {
195
+ type: 'SWAP_AND_TRANSFER';
196
+ amountOut: bigint;
197
+ };
198
+ type TTransaction = TSwapTransaction | TSwapAndTransferTransaction | TTransferTransaction;
199
+ type TRouterPlan = TTransaction[];
200
+ type TExecuteRouterPlanOptions = {
201
+ signer: PolkadotSigner;
202
+ senderAddress: string;
203
+ destination?: TChain;
204
+ evmSigner?: PolkadotSigner;
205
+ evmSenderAddress?: string;
206
+ onStatusChange?: TStatusChangeCallback;
207
+ };
208
+ type TPreparedExtrinsics = {
209
+ toExchangeTx?: TPapiTransaction;
210
+ swapTxs: TPapiTransaction[];
211
+ isExecute?: boolean;
212
+ toDestTx?: TPapiTransaction;
213
+ amountOut: bigint;
214
+ };
215
+ type TBuildToExchangeTxOptions = {
216
+ origin: TOriginInfo;
217
+ exchange: TExchangeInfo;
218
+ senderAddress: string;
219
+ evmSenderAddress?: string;
220
+ amount: bigint;
221
+ builderOptions?: TRouterBuilderOptions;
222
+ };
223
+ type TBuildFromExchangeTxOptions = {
224
+ exchange: TExchangeInfo;
225
+ destination: TDestinationInfo;
226
+ amount: bigint;
227
+ senderAddress: string;
228
+ builderOptions?: TRouterBuilderOptions;
229
+ };
230
+
231
+ /** @deprecated - Use TDryRunChainResult instead. Will be removed in v13. */
232
+ type TRouterDryRunChainResult = TDryRunChainResult;
233
+ /** @deprecated - Use THopInfo instead. Will be removed in v13. */
234
+ type TRouterDryRunHopInfo = THopInfo;
235
+ /** @deprecated - Use TDryRunResult instead. Will be removed in v13. */
236
+ type TRouterDryRunResult = TDryRunResult;
237
+
238
+ /** @deprecated - Use TConditionalXcmFeeHopInfo instead. Will be removed in v13. */
239
+ type TRouterXcmFeeHopInfo = TXcmFeeHopInfo;
240
+ /** @deprecated - Use TConditionalXcmFeeDetail instead. Will be removed in v13. */
241
+ type TRouterXcmFeeDetail = TXcmFeeDetail;
242
+ /** @deprecated - Use TGetXcmFeeResult instead. Will be removed in v13. */
243
+ type TRouterXcmFeeResult = TGetXcmFeeResult;
244
+
245
+ declare const getExchangeConfig: (exchange: TExchangeChain) => TDexConfig;
246
+ declare const getExchangeAssets: (exchange: TExchangeChain) => TRouterAsset[];
247
+
248
+ declare const getExchangePairs: (exchange: TExchangeInput) => [TRouterAsset, TRouterAsset][];
249
+
250
+ /**
251
+ * Retrieves the list of assets supported for transfer from the origin chain to the exchange chain.
252
+ *
253
+ * @param from - The origin chain.
254
+ * @param exchange - The exchange chain or 'Auto select'.
255
+ * @returns An array of supported assets.
256
+ */
257
+ declare const getSupportedAssetsFrom: (from: TChain | undefined, exchange: TExchangeInput) => TAssetInfo[];
258
+
259
+ /**
260
+ * Retrieves the list of assets supported for transfer to the destination chain.
261
+ *
262
+ * @param origin - The origin chain.
263
+ * @param exchange - The exchange chain or 'Auto select'.
264
+ * @param to - The destination chain.
265
+ * @returns An array of supported assets.
266
+ */
267
+ declare const getSupportedAssetsTo: (exchange: TExchangeInput, to: TChain | undefined) => TRouterAsset[];
268
+
269
+ /**
270
+ * Retrieves the list of assets that can be used to pay for fees on the origin chain.
271
+ *
272
+ * @param from - The origin chain.
273
+ * @param exchange - The exchange chain or 'Auto select'.
274
+ * @returns An array of fee-eligible assets.
275
+ */
276
+ declare const getSupportedFeeAssets: (from: TChain | undefined, exchange: TExchangeInput) => TAssetInfo[];
277
+
278
+ /**
279
+ * Builder class for constructing and executing cross-chain transfers using the XCM Router.
280
+ *
281
+ * @deprecated Use `@paraspell/sdk` with the "swap" extension installed instead.
282
+ */
283
+ declare class RouterBuilderCore<T extends Partial<TTransferOptions> = object> {
284
+ protected readonly _options: T;
285
+ private readonly _builderOptions?;
286
+ constructor(builderOptions?: TRouterBuilderOptions, options?: T);
287
+ /**
288
+ * Specifies the origin chain of the transfer.
289
+ *
290
+ * @param chain - The origin chain.
291
+ * @returns The current builder instance.
292
+ */
293
+ from(chain: TSubstrateChain | undefined): RouterBuilderCore<T & {
294
+ from: TSubstrateChain | undefined;
295
+ }>;
296
+ /**
297
+ * Specifies the exchange chain to use.
298
+ *
299
+ * @param chain - The exchange chain, or `undefined` to auto-select.
300
+ * @returns The current builder instance.
301
+ */
302
+ exchange(chain: TExchangeInput): RouterBuilderCore<T & {
303
+ exchange: TExchangeInput;
304
+ }>;
305
+ /**
306
+ * Specifies the destination chain of the transfer.
307
+ *
308
+ * @param chain - The destination chain.
309
+ * @returns The current builder instance.
310
+ */
311
+ to(chain: TChain | undefined): RouterBuilderCore<T & {
312
+ to: TChain | undefined;
313
+ }>;
314
+ /**
315
+ * Specifies the currency to send from the origin chain.
316
+ *
317
+ * @param currencyFrom - The currency to send.
318
+ * @returns The current builder instance.
319
+ */
320
+ currencyFrom(currency: TCurrencyInput): RouterBuilderCore<T & {
321
+ currencyFrom: TCurrencyInput;
322
+ }>;
323
+ /**
324
+ * Specifies the currency that the origin currency will be exchanged to and received on the destination chain.
325
+ *
326
+ * @param currencyTo - The currency to receive.
327
+ * @returns The current builder instance.
328
+ */
329
+ currencyTo(currency: TCurrencyInput): RouterBuilderCore<T & {
330
+ currencyTo: TCurrencyInput;
331
+ }>;
332
+ /**
333
+ * Specifies the asset used to pay XCM fees.
334
+ *
335
+ * @param currency - The fee asset currency, or `undefined` to use the default.
336
+ * @returns The current builder instance.
337
+ */
338
+ feeAsset(currency: TCurrencyInput | undefined): RouterBuilderCore<T & {
339
+ feeAsset: TCurrencyInput | undefined;
340
+ }>;
341
+ /**
342
+ * Specifies the amount to transfer.
343
+ *
344
+ * @param amount - The amount to transfer.
345
+ * @returns The current builder instance.
346
+ */
347
+ amount(amount: TAmount): RouterBuilderCore<T & {
348
+ amount: TAmount;
349
+ }>;
350
+ /**
351
+ * Specifies the recipient address on the destination chain.
352
+ *
353
+ * @param recipientAddress - The recipient address.
354
+ * @returns The current builder instance.
355
+ */
356
+ recipientAddress(address: string | undefined): RouterBuilderCore<T & {
357
+ recipientAddress: string | undefined;
358
+ }>;
359
+ /**
360
+ * Specifies the sender address initiating the transfer.
361
+ *
362
+ * @param senderAddress - The sender address.
363
+ * @returns The current builder instance.
364
+ */
365
+ senderAddress(address: string): RouterBuilderCore<T & {
366
+ senderAddress: string;
367
+ }>;
368
+ /**
369
+ * Specifies the Polkadot signer for the transaction.
370
+ *
371
+ * @param signer - The Polkadot signer instance.
372
+ * @returns The current builder instance.
373
+ */
374
+ signer(signer: PolkadotSigner): RouterBuilderCore<T & {
375
+ signer: PolkadotSigner;
376
+ }>;
377
+ /**
378
+ * Specifies the EVM sender address, required if `evmSigner` is provided. Used when dealing with EVM chains.
379
+ *
380
+ * @param evmSenderAddress - The EVM sender address.
381
+ * @returns The current builder instance.
382
+ */
383
+ evmSenderAddress(address: string | undefined): RouterBuilderCore<T & {
384
+ evmSenderAddress: string | undefined;
385
+ }>;
386
+ /**
387
+ * Specifies the EVM signer, required if `evmSenderAddress` is provided.
388
+ *
389
+ * @param evmSigner - The EVM signer.
390
+ * @returns The current builder instance.
391
+ */
392
+ evmSigner(signer: PolkadotSigner | undefined): RouterBuilderCore<T & {
393
+ evmSigner: PolkadotSigner | undefined;
394
+ }>;
395
+ /**
396
+ * Specifies the maximum slippage percentage for swaps.
397
+ *
398
+ * @param slippagePct - The slippage percentage.
399
+ * @returns The current builder instance.
400
+ */
401
+ slippagePct(pct: string): RouterBuilderCore<T & {
402
+ slippagePct: string;
403
+ }>;
404
+ /**
405
+ * Sets a callback to receive status updates during the transfer.
406
+ *
407
+ * @param callback - The status change callback.
408
+ * @returns The current builder instance.
409
+ */
410
+ onStatusChange(callback: TStatusChangeCallback): RouterBuilderCore<T & {
411
+ onStatusChange: TStatusChangeCallback;
412
+ }>;
413
+ /**
414
+ * Returns the XCM fee for origin, exchange, and destination.
415
+ *
416
+ * @returns The XCM fee result.
417
+ */
418
+ getXcmFees<TDisableFallback extends boolean = false>(this: RouterBuilderCore<TBuildTransactionsOptions>, options?: TGetXcmFeeBuilderOptions & {
419
+ disableFallback: TDisableFallback;
420
+ }): Promise<TGetXcmFeeResult<TDisableFallback>>;
421
+ getTransferableAmount(this: RouterBuilderCore<TBuildTransactionsOptions>): Promise<bigint>;
422
+ getMinTransferableAmount(this: RouterBuilderCore<TBuildTransactionsOptions>): Promise<bigint>;
423
+ /**
424
+ * Executes the transfer with the provided parameters.
425
+ *
426
+ * @throws Error if required parameters are missing.
427
+ */
428
+ build(this: RouterBuilderCore<TTransferOptions>): Promise<void>;
429
+ /**
430
+ * Builds the transactions for the transfer with the provided parameters.
431
+ */
432
+ buildTransactions(this: RouterBuilderCore<TBuildTransactionsOptions>): Promise<TRouterPlan>;
433
+ dryRun(this: RouterBuilderCore<TBuildTransactionsOptions>): Promise<TDryRunResult>;
434
+ getBestAmountOut(this: RouterBuilderCore<TGetBestAmountOutOptions>): Promise<TGetBestAmountOutResult>;
435
+ }
436
+ /**
437
+ * Creates a new `RouterBuilder` instance for constructing and executing cross-chain transfers using the XCM Router.
438
+ *
439
+ * @deprecated Use `@paraspell/sdk` with the "swap" extension installed instead.
440
+ *
441
+ * **Example usage:**
442
+ * ```typescript
443
+ * await RouterBuilder(options)
444
+ * .from('Polkadot')
445
+ * .exchange('HydrationDex')
446
+ * .to('Astar')
447
+ * .currencyFrom({ symbol: 'DOT' })
448
+ * .currencyTo({ symbol: 'ASTR' })
449
+ * .amount(1000000n)
450
+ * .slippagePct('1')
451
+ * .senderAddress('sender_address')
452
+ * .recipientAddress('recipient_address')
453
+ * .signer(yourSigner)
454
+ * .onStatusChange((status) => {
455
+ * console.log(status);
456
+ * })
457
+ * .build();
458
+ * ```
459
+ *
460
+ * @returns A new `RouterBuilder`.
461
+ */
462
+ declare const RouterBuilder: (options?: TRouterBuilderOptions) => RouterBuilderCore<object>;
463
+
464
+ declare const FEE_BUFFER_PCT = 10;
465
+ declare const DEST_FEE_BUFFER_PCT = -1;
466
+ declare const FALLBACK_FEE_CALC_ADDRESS = "5EtHZF4E8QagNCz6naobCkCAUT52SbcEqaXiDUu2PjUHxZid";
467
+ declare const FALLBACK_FEE_CALC_EVM_ADDRESS = "0x1501C1413e4178c38567Ada8945A80351F7B8496";
468
+
469
+ declare abstract class ExchangeChain {
470
+ private readonly _chain;
471
+ private readonly _exchangeChain;
472
+ constructor(chain: TParachain$1, exchangeChain: TExchangeChain);
473
+ get chain(): TParachain$1;
474
+ get exchangeChain(): TExchangeChain;
475
+ abstract swapCurrency(api: ApiPromise, options: TSwapOptions, toDestTransactionFee: bigint): Promise<TSingleSwapResult>;
476
+ handleMultiSwap(api: ApiPromise, options: TSwapOptions, toDestTransactionFee: bigint): Promise<TMultiSwapResult>;
477
+ abstract getAmountOut(api: ApiPromise, options: TGetAmountOutOptions): Promise<bigint>;
478
+ abstract getDexConfig(api: ApiPromise): Promise<TDexConfig>;
479
+ createApiInstance(builderOptions?: TBuilderOptions<TPjsApiOrUrl>): Promise<ApiPromise>;
480
+ createApiInstancePapi(builderOptions?: TBuilderOptions<TPapiApiOrUrl>): Promise<TPapiApi>;
481
+ }
482
+
483
+ declare const createExchangeInstance: (chain: TExchangeChain) => ExchangeChain;
484
+
485
+ declare const buildApiTransactions: (initialOptions: TBuildTransactionsOptions, builderOptions?: TRouterBuilderOptions) => Promise<TRouterPlan>;
486
+
487
+ declare const buildTransactions: (dex: ExchangeChain, options: TTransformedOptions<TBuildTransactionsOptions>) => Promise<TRouterPlan>;
488
+
489
+ /**
490
+ * This function allows users to send one type of token and receive a different one on the destination chain
491
+ * in a one operation. It integrates with multiple exchanges like Acala, Basilisk, Bifrost, HydraDX, Interlay,
492
+ * Karura, and Kintsugi, covering over 500 asset pools.
493
+ *
494
+ * **Example Usage:**
495
+ * ```typescript
496
+ * await transfer({
497
+ * from: 'Polkadot',
498
+ * to: 'Astar',
499
+ * currencyFrom: { symbol: 'DOT' },
500
+ * currencyTo: { symbol: 'ASTR' },
501
+ * amount: '1000000',
502
+ * slippagePct: '1',
503
+ * senderAddress: 'your_injector_address',
504
+ * recipientAddress: 'recipient_address',
505
+ * signer: 'your_signer',
506
+ * onStatusChange: (status) => {
507
+ * console.log(status);
508
+ * },
509
+ * });
510
+ * ```
511
+ *
512
+ * @param initialOptions - An object containing transfer details such as origin, destination, currencies, amount, addresses, and signers.
513
+ * @returns A Promise that resolves when the transfer is complete.
514
+ * @throws An error if required parameters are missing or invalid.
515
+ */
516
+ declare const transfer: (initialOptions: TTransferOptions, builderOptions?: TRouterBuilderOptions) => Promise<void>;
517
+
518
+ 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 };