import { Connection } from "@solana/web3.js";
// Get the current Unix timestamp from the onchain clock
const clock = await connection.getClock();
const unixNow = Number(clock.unixTimestamp);
const quote = orderbook.getQuote({
// Input amount in lamports
inAmount: 1_000_000_000,
// The direction of the trade
direction: QuoteDirection.SY_TO_PT,
// Current Unix timestamp from the onchain clock
unixNow: unixNow,
// The SY exchange rate (e.g., 1.000009210084)
syExchangeRate: 1.000009210084,
});
console.log("Expected output:", quote.outAmount);
console.log("Maker fees:", quote.makerFees);
console.log("Taker fees:", quote.takerFees);