Skip to content

Instantly share code, notes, and snippets.

@rawfalafel
Created November 4, 2021 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rawfalafel/093e2f63e87c363425c1792ce65727e4 to your computer and use it in GitHub Desktop.
Save rawfalafel/093e2f63e87c363425c1792ce65727e4 to your computer and use it in GitHub Desktop.
import Decimal from "decimal.js";
import { Connection, Keypair } from "@solana/web3.js";
import { getOrca, OrcaFarmConfig, OrcaPoolConfig } from "@orca-so/sdk";
const connection = new Connection("https://api.mainnet-beta.solana.com", "singleGossip");
const orca = getOrca(connection);
const pool = orca.getPool(OrcaPoolConfig.SOL_mSOL);
const solToken = pool.getTokenA();
const amount = new Decimal(0.1);
const quote = await pool.getQuote(solToken, amount);
// Compare expectedOutput against conversion rate from mSOL to SOL when unstaking
const expectedOutput = quote.getExpectedOutputAmount();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment