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: getProviders
getProviders
Description
The getProviders
method retrieves detailed metadata about all supported liquidity providers available through the Quickscope API. This includes platform names, routing program addresses, and internal identifiers used in quoting and swapping.
Returns
Promise<providerResponse>
: A promise that resolves to an object containing information about each provider keyed by its name.
providerResponse
Type
providerResponse
Typeexport type providerResponse = {
[programId: string]: {
platform: string,
program: string,
programId: string,
internal_program: string,
}
}
Example
async function fetchProviders() {
try {
const providers = await quickscope.v1.info.getProviders();
console.log('Providers:', providers);
// Example output:
// {
// whirLbMiicV...: {
// platform: "orca",
// program: "whirlpool",
// programId: "whirLbMiicV...",
// internal_program: "orca_whirlpool"
// },
// 4ry9XvA9dX1...: {
// platform: "raydium",
// program: "v4",
// programId: "4ry9XvA9dX1...",
// internal_program: "raydium_v4"
// }
// }
} catch (error) {
console.error('Error fetching providers:', error);
}
}
fetchProviders();
Error Handling
The method will throw an error if the provider list cannot be fetched due to issues like:
- Invalid API key
- Unsupported location
- Network or server error
Make sure to wrap this method in a try/catch
block to gracefully handle failures and debug error messages.