
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@orca-so/sdk
Advanced tools
The Orca SDK contains a set of simple to use APIs to allow developers to integrate with the Orca exchange platform.
Learn more Orca here.
Supported Orca Pools
Aquafarm Support
Features Coming Soon
Use your environment's package manager to install @orca-so/sdk and other related packages into your project.
yarn add @orca-so/sdk @solana/web3.js decimal.js
npm install @orca-so/sdk @solana/web3.js decimal.js
import { Connection, Keypair } from "@solana/web3.js";
import { getOrca, OrcaPoolConfig, OrcaU64 } from "@orca-so/sdk";
try {
const connection = new Connection(url, "singleGossip");
const orca = getOrca(connection);
const owner: Keypair = getKeyPair();
// Get an instance of the ETH-USDC orca pool
let pool = orca.getPool(OrcaPoolConfig.ETH_USDC);
// Get the number of ETH-USDC LP tokens in your wallet
let ethUsdcLPBalance = await pool.getLPBalance(owner.publicKey);
// Get the total supply of ETH-USDC LP tokens
let ethUsdcLPSupply = await pool.getLPSupply();
// Get a quote of exchanging 1.1 ETH to USDC with a slippage tolerance of 0.1%
// From the quote, you can get the current rate, fees, expected output amount and minimum output amount
let ethToken = pool.getTokenA();
let tradeValue = new Decimal(1.1);
let quote = await pool.getQuote(ethToken, tradeValue, new Decimal(0.1));
// Perform a swap for 1USDC to the quoted minimum amount of ETH
// If the user does not have the Associated Token Address(ATA) to receive the output token, the ATA
// instructions will be appended in the transaction.
const txId = await pool.swap(owner, usdcToken, tradeValue, quote.getMinOutputAmount()).execute();
} catch (err) {
// Handle errors
}
Decimals & OrcaU64
The SDK relies on the use of Decimal for number inputs and Decimal/OrcaU64 for token-value inputs. If a Decimal instance is provided for a token-value input, it will be automatically transformed to the token's scale.
Stability of the Public Util Functions
We hope you find the tools we used to build our API useful in the public/utils folder. Due to our on-going development of the Orca platform, we cannot guarrantee the stability of the util APIs. The trading APIs can only be upgraded on major version updates.
Integration Questions
Have problems integrating with the SDK? Pop by over to our Discord #integrations channel and chat with one of our engineers.
Issues / Bugs
If you found a bug, open up an issue on github with the prefix [ISSUE]. To help us be more effective in resolving the problem, be specific in the steps it took to reproduce the problem (ex. when did the issue occur, code samples, debug logs etc).
Feedback
Got ideas on how to improve the system? Open up an issue on github with the prefix [FEEDBACK] and let's brainstorm more about it together!
FAQs
Typescript SDK for the Orca protocol.
The npm package @orca-so/sdk receives a total of 1,832 weekly downloads. As such, @orca-so/sdk popularity was classified as popular.
We found that @orca-so/sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.