getQuoteAll

Installation

npm install @quickscope/sdk

Usage

Initialization

First, initialize the Quickscope class with your location ("frankfurt" or "nyc") and your API key:

import Quickscope from '@quickscope/sdk';
// OR
const Quickscope = require('@quickscope/sdk');

const quickscope = new Quickscope("frankfurt", "your-api-key");

Method: getQuoteAll

Description

The getQuoteAll method retrieves quotes from all available liquidity providers and pools for a given token pair and amount. It enables comparison across routes, helping developers implement custom routing logic or show users all available pricing options.


Parameters

{
  from: string;
  to: string;
  amount: number;
  slippage: number;
}
  • from: (string) – The mint address of the token being swapped from.
  • to: (string) – The mint address of the token being swapped to.
  • amount: (number) – The input amount in base units (e.g., lamports).
  • slippage: (number) – Acceptable slippage in basis points (e.g., 50 = 0.5%).

Returns

Promise<quoteResponseMap>: A promise that resolves to an object containing an array of quote options and optional error fields.

quoteResponseMap Type

export type quoteResponseMap = {
  quotes: quotesResponseMap[];
  error?: string;
  error_code?: string | number;
}

quotesResponseMap Type

export type quotesResponseMap = {
  uuid: string;
  poolId: string;
  poolType: string;
  provider: string;
  program: string;
  amountIn: number;
  amountOut: number;
  fromMint: string;
  toMint: string;
  priceImpact: number;
}

Example

async function fetchAllQuotes() {
    try {
        const result = await quickscope.v1.quote.getQuoteAll({
            from: 'So11111111111111111111111111111111111111112', // SOL
            to: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',   // USDC
            amount: 1000000, // 0.001 SOL in lamports
            slippage: 50     // 0.5% slippage
        });

        console.log('Quotes:', result.quotes);

        // Example output:
        // [
        //   {
        //     uuid: "a1c3f88e-f0b1-4e44-a98e-3fbf79b45b62",
        //     poolId: "orca_mainnet_SOL_USDC",
        //     poolType: "Whirlpool",
        //     provider: "orca",
        //     program: "Whirlpool",
        //     amountIn: 1000000,
        //     amountOut: 998000,
        //     fromMint: "So11111111111111111111111111111111111111112",
        //     toMint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        //     priceImpact: 0.21
        //   }
        // ]
    } catch (error) {
        console.error('Error fetching quotes:', error);
    }
}

fetchAllQuotes();

Error Handling

The method throws an error if:

  • One or both token mints are invalid
  • The input parameters are malformed
  • No quotes are available
  • The backend returns an error

Use a try/catch block to gracefully handle and debug any issues.