Get quotes from a simple sdk call.
The getQuotes
method will return a list of quotes based on our routing engine, these quotes will be based on the user’s preference for speed vs price.
If getQuote
this method will return a single quote based on the default preference of “price”.
Quotes are only valid for a short period of time, and will expire.
Get Quotes
import { SuaveSDK } from 'suave-sdk';
const sdk = new SuaveSDK({
apiKey: 'your-api-key'
});
let quote = await sdk.getQuotes({
tokenA: string;
tokenB: string;
tokenAAmount: number;
chainA: string;
chainB: string;
},'speed').then(quotes => {
console.log('Quotes:', quotes);
return quotes[0];
});
// Returns back a quote object
interface Quote {
tokenA: string;
tokenB: string;
chainA: string;
chainB: string;
totalFees: [{
token:<string>,
amount:<number>
}
]
expirationTime: Date;
}