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: getMint
getMint
Description
The getMint
method retrieves metadata for a specific token mint address on Solana. This includes the token’s symbol, name, image URL, type, and decimals. It’s useful for displaying token information in UIs or verifying token details before quoting or swapping.
Parameters
{
address: string;
}
- address: (string) – The token's mint address (e.g.,
So11111111111111111111111111111111111111112
for wrapped SOL).
Returns
Promise<mintResponse>
: A promise that resolves to a mintResponse
object containing token metadata.
mintResponse
Type
mintResponse
Typeexport type mintResponse = {
address: string;
name: string;
symbol: number;
image: string;
type: string;
decimals: number;
}
Example
async function fetchMintInfo() {
try {
const mint = await quickscope.v1.info.getMint({
address: 'So11111111111111111111111111111111111111112'
});
console.log('Mint info:', mint);
// Example output:
// {
// address: "So11111111111111111111111111111111111111112",
// name: "Wrapped SOL",
// symbol: "SOL",
// image: "https://example.com/sol.png",
// type: "wrapped",
// decimals: 9
// }
} catch (error) {
console.error('Error fetching mint info:', error);
}
}
fetchMintInfo();
Error Handling
The method throws an error if the mint address is invalid or cannot be resolved. Common causes include:
- Typos in the mint address
- Nonexistent or unsupported tokens
- Network or API errors
Wrap this call in a try/catch
block to capture and debug any issues.