Created
November 4, 2021 11:07
-
-
Save rawfalafel/093e2f63e87c363425c1792ce65727e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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