@rhea-finance/cross-chain-aggregation-dex 0.1.2 → 0.1.3
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.mts +40 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +236 -200
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +234 -200
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -332,6 +332,18 @@ declare function formatGasToTgas(gasInYoctoNEAR: string | number): string;
|
|
|
332
332
|
* @returns Formatted gas string in yoctoNEAR
|
|
333
333
|
*/
|
|
334
334
|
declare function formatGasString(gas: string | number | bigint): string;
|
|
335
|
+
/**
|
|
336
|
+
* Select the best quote from multiple quotes based on maximum amountOut
|
|
337
|
+
*/
|
|
338
|
+
declare function selectBestQuote<T extends {
|
|
339
|
+
amountOut: string;
|
|
340
|
+
}, R = any>(quotes: Array<{
|
|
341
|
+
quote: T;
|
|
342
|
+
router: R;
|
|
343
|
+
}>): {
|
|
344
|
+
quote: T;
|
|
345
|
+
router: R;
|
|
346
|
+
};
|
|
335
347
|
|
|
336
348
|
/** NEAR DEX router implementation (FindPath for routing + REF for execution). */
|
|
337
349
|
|
|
@@ -428,10 +440,12 @@ interface CompleteQuoteResult {
|
|
|
428
440
|
tokenIn: TokenInfo;
|
|
429
441
|
tokenOut: TokenInfo;
|
|
430
442
|
executor: DexRouter;
|
|
443
|
+
routeType?: "v1" | "v2";
|
|
431
444
|
};
|
|
432
445
|
finalAmountOut: string;
|
|
433
446
|
totalPriceImpact?: number;
|
|
434
447
|
totalFee?: number;
|
|
448
|
+
routeType?: "v1" | "v2" | "intents";
|
|
435
449
|
}
|
|
436
450
|
interface CompleteQuoteConfig {
|
|
437
451
|
intentsQuotationAdapter: IntentsQuotationAdapter;
|
|
@@ -442,6 +456,8 @@ interface CompleteQuoteConfig {
|
|
|
442
456
|
getWrapNearContractId(): string;
|
|
443
457
|
};
|
|
444
458
|
currentUserAddress?: string;
|
|
459
|
+
/** Optional function to check if token supports Intents (beyond bluechip tokens) */
|
|
460
|
+
isIntentsSupportedToken?: (token: TokenInfo) => boolean;
|
|
445
461
|
}
|
|
446
462
|
/**
|
|
447
463
|
* Build a "complete quote":
|
|
@@ -454,4 +470,27 @@ interface CompleteQuoteConfig {
|
|
|
454
470
|
*/
|
|
455
471
|
declare function completeQuote(params: CompleteQuoteParams, config: CompleteQuoteConfig): Promise<CompleteQuoteResult>;
|
|
456
472
|
|
|
457
|
-
|
|
473
|
+
/**
|
|
474
|
+
* Same-chain swap quote (NEAR -> NEAR)
|
|
475
|
+
* Queries V1 and V2 routers in parallel and selects the best route based on maximum amountOut
|
|
476
|
+
*/
|
|
477
|
+
|
|
478
|
+
interface QuoteSameChainSwapParams {
|
|
479
|
+
tokenIn: TokenInfo;
|
|
480
|
+
tokenOut: TokenInfo;
|
|
481
|
+
amountIn: string;
|
|
482
|
+
slippage: number;
|
|
483
|
+
recipient: string;
|
|
484
|
+
currentUserAddress: string;
|
|
485
|
+
}
|
|
486
|
+
interface QuoteSameChainSwapResult {
|
|
487
|
+
quote: QuoteResult;
|
|
488
|
+
router: DexRouter;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Quote same-chain swap (NEAR -> NEAR) by querying V1 and V2 routers in parallel
|
|
492
|
+
* and selecting the best route based on maximum amountOut
|
|
493
|
+
*/
|
|
494
|
+
declare function quoteSameChainSwap(params: QuoteSameChainSwapParams, dexRouters: DexRouter[]): Promise<QuoteSameChainSwapResult>;
|
|
495
|
+
|
|
496
|
+
export { AggregateDexRouter, type AggregateDexRouterConfig, type BaseExecuteParams, type BaseQuoteParams, type BluechipTokenConfig, type BluechipTokensConfig, type CompleteQuoteConfig, type CompleteQuoteParams, type CompleteQuoteResult, type ConfigAdapter, type DexRouter, type ExecuteParams, type ExecuteResult, type FindPathAdapter, type FindPathResponse, type IntentsQuotationAdapter, type IntentsQuoteResult, type NearChainAdapter, NearSmartRouter, type NearSmartRouterConfig, type PoolInfo, type QuoteParams, type QuoteResult, type QuoteSameChainSwapParams, type QuoteSameChainSwapResult, type RecipientExecuteParams, type RecipientQuoteParams, type Route, type RouterCapabilities, type SimpleQuoteParams, type SupportedChain, type SwapMultiDexPathAdapter, type SwapMultiDexPathResponse, type TokenInfo, completeQuote, convertSlippageToBasisPoints, findBestBluechipToken, formatGasString, formatGasToTgas, getBluechipTokensConfig, isNearIntentsSupportedToken, logger, normalizeDestinationAsset, normalizeTokenId, quoteSameChainSwap, requiresRecipient, requiresRecipientInExecute, selectBestQuote, setBluechipTokensConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -332,6 +332,18 @@ declare function formatGasToTgas(gasInYoctoNEAR: string | number): string;
|
|
|
332
332
|
* @returns Formatted gas string in yoctoNEAR
|
|
333
333
|
*/
|
|
334
334
|
declare function formatGasString(gas: string | number | bigint): string;
|
|
335
|
+
/**
|
|
336
|
+
* Select the best quote from multiple quotes based on maximum amountOut
|
|
337
|
+
*/
|
|
338
|
+
declare function selectBestQuote<T extends {
|
|
339
|
+
amountOut: string;
|
|
340
|
+
}, R = any>(quotes: Array<{
|
|
341
|
+
quote: T;
|
|
342
|
+
router: R;
|
|
343
|
+
}>): {
|
|
344
|
+
quote: T;
|
|
345
|
+
router: R;
|
|
346
|
+
};
|
|
335
347
|
|
|
336
348
|
/** NEAR DEX router implementation (FindPath for routing + REF for execution). */
|
|
337
349
|
|
|
@@ -428,10 +440,12 @@ interface CompleteQuoteResult {
|
|
|
428
440
|
tokenIn: TokenInfo;
|
|
429
441
|
tokenOut: TokenInfo;
|
|
430
442
|
executor: DexRouter;
|
|
443
|
+
routeType?: "v1" | "v2";
|
|
431
444
|
};
|
|
432
445
|
finalAmountOut: string;
|
|
433
446
|
totalPriceImpact?: number;
|
|
434
447
|
totalFee?: number;
|
|
448
|
+
routeType?: "v1" | "v2" | "intents";
|
|
435
449
|
}
|
|
436
450
|
interface CompleteQuoteConfig {
|
|
437
451
|
intentsQuotationAdapter: IntentsQuotationAdapter;
|
|
@@ -442,6 +456,8 @@ interface CompleteQuoteConfig {
|
|
|
442
456
|
getWrapNearContractId(): string;
|
|
443
457
|
};
|
|
444
458
|
currentUserAddress?: string;
|
|
459
|
+
/** Optional function to check if token supports Intents (beyond bluechip tokens) */
|
|
460
|
+
isIntentsSupportedToken?: (token: TokenInfo) => boolean;
|
|
445
461
|
}
|
|
446
462
|
/**
|
|
447
463
|
* Build a "complete quote":
|
|
@@ -454,4 +470,27 @@ interface CompleteQuoteConfig {
|
|
|
454
470
|
*/
|
|
455
471
|
declare function completeQuote(params: CompleteQuoteParams, config: CompleteQuoteConfig): Promise<CompleteQuoteResult>;
|
|
456
472
|
|
|
457
|
-
|
|
473
|
+
/**
|
|
474
|
+
* Same-chain swap quote (NEAR -> NEAR)
|
|
475
|
+
* Queries V1 and V2 routers in parallel and selects the best route based on maximum amountOut
|
|
476
|
+
*/
|
|
477
|
+
|
|
478
|
+
interface QuoteSameChainSwapParams {
|
|
479
|
+
tokenIn: TokenInfo;
|
|
480
|
+
tokenOut: TokenInfo;
|
|
481
|
+
amountIn: string;
|
|
482
|
+
slippage: number;
|
|
483
|
+
recipient: string;
|
|
484
|
+
currentUserAddress: string;
|
|
485
|
+
}
|
|
486
|
+
interface QuoteSameChainSwapResult {
|
|
487
|
+
quote: QuoteResult;
|
|
488
|
+
router: DexRouter;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Quote same-chain swap (NEAR -> NEAR) by querying V1 and V2 routers in parallel
|
|
492
|
+
* and selecting the best route based on maximum amountOut
|
|
493
|
+
*/
|
|
494
|
+
declare function quoteSameChainSwap(params: QuoteSameChainSwapParams, dexRouters: DexRouter[]): Promise<QuoteSameChainSwapResult>;
|
|
495
|
+
|
|
496
|
+
export { AggregateDexRouter, type AggregateDexRouterConfig, type BaseExecuteParams, type BaseQuoteParams, type BluechipTokenConfig, type BluechipTokensConfig, type CompleteQuoteConfig, type CompleteQuoteParams, type CompleteQuoteResult, type ConfigAdapter, type DexRouter, type ExecuteParams, type ExecuteResult, type FindPathAdapter, type FindPathResponse, type IntentsQuotationAdapter, type IntentsQuoteResult, type NearChainAdapter, NearSmartRouter, type NearSmartRouterConfig, type PoolInfo, type QuoteParams, type QuoteResult, type QuoteSameChainSwapParams, type QuoteSameChainSwapResult, type RecipientExecuteParams, type RecipientQuoteParams, type Route, type RouterCapabilities, type SimpleQuoteParams, type SupportedChain, type SwapMultiDexPathAdapter, type SwapMultiDexPathResponse, type TokenInfo, completeQuote, convertSlippageToBasisPoints, findBestBluechipToken, formatGasString, formatGasToTgas, getBluechipTokensConfig, isNearIntentsSupportedToken, logger, normalizeDestinationAsset, normalizeTokenId, quoteSameChainSwap, requiresRecipient, requiresRecipientInExecute, selectBestQuote, setBluechipTokensConfig };
|