delegate-framework
Version:
A TypeScript framework for building robust, production-ready blockchain workflows with comprehensive error handling, logging, and testing. Maintained by delegate.fun
48 lines • 1.88 kB
TypeScript
import { PublicKey, VersionedTransaction } from "@solana/web3.js";
import { QuoteResponse } from "@jup-ag/api";
import { JupiterConfig, Logger, SwapParams } from "../types";
export declare class JupiterClient {
private static readonly DEFAULT_TIMEOUT;
private static readonly DEFAULT_RETRIES;
private static readonly DEFAULT_QUOTE_API_URL;
private readonly config;
private readonly logger?;
private requestId;
constructor(config: JupiterConfig);
/**
* Get a quote for swapping tokens
* @param fromMint - The input token mint
* @param toMint - The output token mint
* @param amount - The amount to swap (in smallest unit)
* @param slippageBps - Slippage tolerance in basis points (default: 100 = 1%)
* @returns Quote response from Jupiter
*/
getQuote(fromMint: PublicKey, toMint: PublicKey, amount: number | string, slippageBps?: number): Promise<QuoteResponse>;
/**
* Get a swap transaction from Jupiter
* @param quoteResponse - The quote response from getQuote
* @param swapParams - Additional swap parameters
* @returns Versioned transaction ready for signing
*/
getSwapTransaction(quoteResponse: QuoteResponse, swapParams: SwapParams): Promise<VersionedTransaction>;
/**
* Make a request with retry logic and error handling
* @param operation - The operation to perform
* @param operationName - Name of the operation for logging
* @returns Result of the operation
*/
private makeRequest;
/**
* Utility method for delays
* @param ms - Milliseconds to delay
*/
private delay;
/**
* Get the current configuration
* @returns Current client configuration
*/
getConfig(): Readonly<Omit<Required<JupiterConfig>, 'logger'> & {
logger?: Logger;
}>;
}
//# sourceMappingURL=jupiter.d.ts.map