@rhea-finance/cross-chain-aggregation-dex 0.1.8 → 0.2.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.mts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +179 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +177 -88
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -433,6 +433,41 @@ declare const logger: {
|
|
|
433
433
|
error: (...args: any[]) => void;
|
|
434
434
|
};
|
|
435
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Unified error messages for the SDK
|
|
438
|
+
* All error messages should be defined here for consistency
|
|
439
|
+
*/
|
|
440
|
+
declare const ErrorMessages: {
|
|
441
|
+
readonly MISSING_PARAMS: "Required parameters missing";
|
|
442
|
+
readonly MISSING_TOKEN_ADDRESS: "Token address required";
|
|
443
|
+
readonly INVALID_TOKEN_ADDRESS: "Invalid token address";
|
|
444
|
+
readonly MISSING_USER_ADDRESS: "User address required";
|
|
445
|
+
readonly INVALID_USER_ADDRESS: "Invalid user address";
|
|
446
|
+
readonly QUOTE_FAILED: "Failed to get quote";
|
|
447
|
+
readonly QUOTE_INVALID: "Invalid quote";
|
|
448
|
+
readonly QUOTE_NO_ROUTE: "No route found";
|
|
449
|
+
readonly QUOTE_EXPIRED: "Quote expired, please refresh";
|
|
450
|
+
readonly EXECUTE_FAILED: "Transaction failed";
|
|
451
|
+
readonly EXECUTE_INVALID_QUOTE: "Invalid quote, please refresh";
|
|
452
|
+
readonly EXECUTE_INSUFFICIENT_BALANCE: "Insufficient balance";
|
|
453
|
+
readonly EXECUTE_INSUFFICIENT_LIQUIDITY: "Insufficient liquidity";
|
|
454
|
+
readonly EXECUTE_SLIPPAGE_TOO_HIGH: "Price changed, please refresh";
|
|
455
|
+
readonly NETWORK_ERROR: "Network error, please try again";
|
|
456
|
+
readonly API_ERROR: "Service temporarily unavailable";
|
|
457
|
+
readonly GAS_ESTIMATE_FAILED: "Unable to estimate transaction fee";
|
|
458
|
+
readonly GAS_PRICE_FAILED: "Failed to get transaction fee";
|
|
459
|
+
readonly TRANSACTION_REVERTED: "Transaction would fail, please refresh";
|
|
460
|
+
};
|
|
461
|
+
/**
|
|
462
|
+
* Get user-friendly error message
|
|
463
|
+
* Prioritizes API error messages, falls back to standardized messages
|
|
464
|
+
*/
|
|
465
|
+
declare function getErrorMessage(error: string | undefined | null, fallback?: string): string;
|
|
466
|
+
/**
|
|
467
|
+
* Normalize common error patterns
|
|
468
|
+
*/
|
|
469
|
+
declare function normalizeError(error: string | undefined | null): string;
|
|
470
|
+
|
|
436
471
|
/** Set the SDK-wide bluechip token config used for NearIntents compatibility and intermediate routing. */
|
|
437
472
|
declare function setBluechipTokensConfig(config: BluechipTokensConfig): void;
|
|
438
473
|
/** Get the bluechip token config; returns an empty object if unset. */
|
|
@@ -664,4 +699,4 @@ interface QuoteSameChainSwapResult {
|
|
|
664
699
|
*/
|
|
665
700
|
declare function quoteSameChainSwap(params: QuoteSameChainSwapParams, dexRouters: DexRouter[]): Promise<QuoteSameChainSwapResult>;
|
|
666
701
|
|
|
667
|
-
export { AggregateDexRouter, type AggregateDexRouterConfig, type BaseExecuteParams, type BaseQuoteParams, type BitgetAdapter, type BitgetQuoteResponse, BitgetRouter, type BitgetRouterConfig, type BitgetSwapResponse, type BluechipTokenConfig, type BluechipTokensConfig, type CompleteQuoteConfig, type CompleteQuoteParams, type CompleteQuoteResult, type ConfigAdapter, type DexRouter, type EvmChainAdapter, 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, findBestEvmBluechipToken, formatGasString, formatGasToTgas, getBluechipTokensConfig, isEvmIntentsSupportedToken, isNearIntentsSupportedToken, logger, normalizeDestinationAsset, normalizeEvmAddress, normalizeTokenId, quoteSameChainSwap, requiresRecipient, requiresRecipientInExecute, selectBestQuote, setBluechipTokensConfig };
|
|
702
|
+
export { AggregateDexRouter, type AggregateDexRouterConfig, type BaseExecuteParams, type BaseQuoteParams, type BitgetAdapter, type BitgetQuoteResponse, BitgetRouter, type BitgetRouterConfig, type BitgetSwapResponse, type BluechipTokenConfig, type BluechipTokensConfig, type CompleteQuoteConfig, type CompleteQuoteParams, type CompleteQuoteResult, type ConfigAdapter, type DexRouter, ErrorMessages, type EvmChainAdapter, 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, findBestEvmBluechipToken, formatGasString, formatGasToTgas, getBluechipTokensConfig, getErrorMessage, isEvmIntentsSupportedToken, isNearIntentsSupportedToken, logger, normalizeDestinationAsset, normalizeError, normalizeEvmAddress, normalizeTokenId, quoteSameChainSwap, requiresRecipient, requiresRecipientInExecute, selectBestQuote, setBluechipTokensConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -433,6 +433,41 @@ declare const logger: {
|
|
|
433
433
|
error: (...args: any[]) => void;
|
|
434
434
|
};
|
|
435
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Unified error messages for the SDK
|
|
438
|
+
* All error messages should be defined here for consistency
|
|
439
|
+
*/
|
|
440
|
+
declare const ErrorMessages: {
|
|
441
|
+
readonly MISSING_PARAMS: "Required parameters missing";
|
|
442
|
+
readonly MISSING_TOKEN_ADDRESS: "Token address required";
|
|
443
|
+
readonly INVALID_TOKEN_ADDRESS: "Invalid token address";
|
|
444
|
+
readonly MISSING_USER_ADDRESS: "User address required";
|
|
445
|
+
readonly INVALID_USER_ADDRESS: "Invalid user address";
|
|
446
|
+
readonly QUOTE_FAILED: "Failed to get quote";
|
|
447
|
+
readonly QUOTE_INVALID: "Invalid quote";
|
|
448
|
+
readonly QUOTE_NO_ROUTE: "No route found";
|
|
449
|
+
readonly QUOTE_EXPIRED: "Quote expired, please refresh";
|
|
450
|
+
readonly EXECUTE_FAILED: "Transaction failed";
|
|
451
|
+
readonly EXECUTE_INVALID_QUOTE: "Invalid quote, please refresh";
|
|
452
|
+
readonly EXECUTE_INSUFFICIENT_BALANCE: "Insufficient balance";
|
|
453
|
+
readonly EXECUTE_INSUFFICIENT_LIQUIDITY: "Insufficient liquidity";
|
|
454
|
+
readonly EXECUTE_SLIPPAGE_TOO_HIGH: "Price changed, please refresh";
|
|
455
|
+
readonly NETWORK_ERROR: "Network error, please try again";
|
|
456
|
+
readonly API_ERROR: "Service temporarily unavailable";
|
|
457
|
+
readonly GAS_ESTIMATE_FAILED: "Unable to estimate transaction fee";
|
|
458
|
+
readonly GAS_PRICE_FAILED: "Failed to get transaction fee";
|
|
459
|
+
readonly TRANSACTION_REVERTED: "Transaction would fail, please refresh";
|
|
460
|
+
};
|
|
461
|
+
/**
|
|
462
|
+
* Get user-friendly error message
|
|
463
|
+
* Prioritizes API error messages, falls back to standardized messages
|
|
464
|
+
*/
|
|
465
|
+
declare function getErrorMessage(error: string | undefined | null, fallback?: string): string;
|
|
466
|
+
/**
|
|
467
|
+
* Normalize common error patterns
|
|
468
|
+
*/
|
|
469
|
+
declare function normalizeError(error: string | undefined | null): string;
|
|
470
|
+
|
|
436
471
|
/** Set the SDK-wide bluechip token config used for NearIntents compatibility and intermediate routing. */
|
|
437
472
|
declare function setBluechipTokensConfig(config: BluechipTokensConfig): void;
|
|
438
473
|
/** Get the bluechip token config; returns an empty object if unset. */
|
|
@@ -664,4 +699,4 @@ interface QuoteSameChainSwapResult {
|
|
|
664
699
|
*/
|
|
665
700
|
declare function quoteSameChainSwap(params: QuoteSameChainSwapParams, dexRouters: DexRouter[]): Promise<QuoteSameChainSwapResult>;
|
|
666
701
|
|
|
667
|
-
export { AggregateDexRouter, type AggregateDexRouterConfig, type BaseExecuteParams, type BaseQuoteParams, type BitgetAdapter, type BitgetQuoteResponse, BitgetRouter, type BitgetRouterConfig, type BitgetSwapResponse, type BluechipTokenConfig, type BluechipTokensConfig, type CompleteQuoteConfig, type CompleteQuoteParams, type CompleteQuoteResult, type ConfigAdapter, type DexRouter, type EvmChainAdapter, 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, findBestEvmBluechipToken, formatGasString, formatGasToTgas, getBluechipTokensConfig, isEvmIntentsSupportedToken, isNearIntentsSupportedToken, logger, normalizeDestinationAsset, normalizeEvmAddress, normalizeTokenId, quoteSameChainSwap, requiresRecipient, requiresRecipientInExecute, selectBestQuote, setBluechipTokensConfig };
|
|
702
|
+
export { AggregateDexRouter, type AggregateDexRouterConfig, type BaseExecuteParams, type BaseQuoteParams, type BitgetAdapter, type BitgetQuoteResponse, BitgetRouter, type BitgetRouterConfig, type BitgetSwapResponse, type BluechipTokenConfig, type BluechipTokensConfig, type CompleteQuoteConfig, type CompleteQuoteParams, type CompleteQuoteResult, type ConfigAdapter, type DexRouter, ErrorMessages, type EvmChainAdapter, 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, findBestEvmBluechipToken, formatGasString, formatGasToTgas, getBluechipTokensConfig, getErrorMessage, isEvmIntentsSupportedToken, isNearIntentsSupportedToken, logger, normalizeDestinationAsset, normalizeError, normalizeEvmAddress, normalizeTokenId, quoteSameChainSwap, requiresRecipient, requiresRecipientInExecute, selectBestQuote, setBluechipTokensConfig };
|