@robertprp/intents-sdk
Version:
Shogun Network Intent-based cross-chain swaps SDK
61 lines • 2.05 kB
TypeScript
import { ChainID, type SupportedChain } from '../chains.js';
/**
* Response structure from DefiLlama API for token prices
*/
export interface DefiLlamaTokensResponse {
coins: Record<string, DefiLlamaCoinData>;
}
/**
* Individual token data from DefiLlama API
*/
export interface DefiLlamaCoinData {
/** Number of decimal places for the token */
decimals: number;
/** Token symbol (e.g., "ETH", "USDC") */
symbol: string;
/** Current price in USD */
price: number;
/** Unix timestamp of the price data */
timestamp: number;
/** Confidence level of the price data (0-1) */
confidence: number;
}
/**
* Maps chain IDs to their corresponding chain types
* Used to determine which SDK implementation to use for a given chain
*/
export declare const chainIdToDefiLlamaChainMap: {
readonly 42161: "arbitrum";
readonly 8453: "base";
readonly 10: "optimism";
readonly 999: "hyperliquid";
readonly 7565164: "solana";
readonly 101: "sui";
};
/**
* Creates DefiLlama coin key from chain ID and token address
* Format: "chainName:tokenAddress"
*/
export declare const createDefiLlamaCoinKey: (chainId: ChainID, tokenAddress: string) => string;
/**
* Retrieves token data from DefiLlama response by chain and address
*/
export declare const getCoinFromResponse: (response: DefiLlamaTokensResponse, chainId: ChainID, tokenAddress: string) => DefiLlamaCoinData;
/**
* Fetch tokens data for array of coins
*
* @param tokens Array of [ChainID, Token Address] tuples
* @returns Promise resolving to DefiLlama tokens response
*/
export declare function getTokensData(tokens: Array<[ChainID, string]>): Promise<DefiLlamaTokensResponse>;
export declare function calculateAmounts({ srcChainId, tokenIn, amountIn, destChainId, tokenOut, }: {
srcChainId: SupportedChain;
tokenIn: string;
amountIn: bigint;
destChainId: SupportedChain;
tokenOut: string;
}): Promise<{
amountOut: bigint;
minStablecoinsAmount: bigint;
}>;
//# sourceMappingURL=defillama.d.ts.map