1) What to do:
Write small TypeScript/Solana project to work via API with
pools in Orca
[login to view URL]
2) Which language to develop in the code:
TypeScript
3) Development environment versions:
Ubuntu 24.04.1
Anchor 0.29.0
avm 0.29.0
Solana 1.18.25
Cargo 1.82.0
Rust 1.82.0
npm 10.9.0
as per these instructions here
[login to view URL]
Which SDK to use
Orca Whirpools SDK v0.13.0
as per these instructions here:
[login to view URL]:installation
Sample TypeScript code of Wrilpools SDK usage:
[login to view URL]
Dev docs here
[login to view URL]
Full list of dev resources for Orca here
[login to view URL]
4) Solana network - devnet + mainnet
5) Which tockens - SOL, USDC
6) List of arguments of each functions - is not known exactly
at this point, maybe more arguments, add accordingly
7) We are only working with pair SOL/USDC in Orca pools.
To see real Orca pools - register on site
[login to view URL] with TrustWallet wallet,
not sure, how and where to see dev orca pools,
and which dev tockens to use then - you'll need to advise
8) Write new following working & tested functions, written in TypeScript
8а)
find_my_orca_pools(my_wallet) - find all Orca pools, where
are money from my wallet, need to return array of Pool_IDs
8b)
find_current_SOL_price(Pool_ID) - return as human-readable decimal SOL/USDC current price from the Pool by Pool_ID (Solana network) -
like 165.102030
8c)
find_current_SOL_balance_in_pool(Pool_ID, price_low, price_high)
return my current balance from Pool_ID with price range from
price_low to price_high - in SOL
- like 2.5559 SOL, return 0 otherwise
8d)
find_current_USDC_balance_in_pool(Pool_ID)
return my current total balance in Pool_ID in USDC
as USDC - like 100.66 USDC
8e)
withdraw_liquidity_SOL(Pool_ID, tocken, amountX, walletX, price_low, price_high) -
withdraw token (SOL) in amountX from my Pool_ID
with price range from price_low to price_high
to my SOL walletX
may have additional parameters, like slippage, quantity of tries
to withdraw, etc
8f)
withdraw_liquidity_USDC(Pool_ID, tocken, amountX, walletX, price_low, price_high) - withdraw token (USDC) in amountX from my Pool_ID
with price range from price_low to price_high
to my USDC walletX , address
similar to 4e), but in USDC
It is possible, that functions withdraw_liquidity_SOL()
and withdraw_liquidity_USDC() may not be possible to work
at all, then combined function to withdraw 2 tokens (SOL and USDC)
at once will be required as :
withdraw_liquidity(Pool_ID, SOL, USDC, amount_SOL, amount_USDC, walletX, price_low, price_high)
8g)
add_liquidity_USDC(Pool_ID, tocken, amountX, walletX, price_low, price_high) -
deposit token (USDC) in amountX to my Pool_ID from my USDC walletX
with price range (within the Pool) from price_low to price_high,
assuming that this position in the pool for price range price_low to price_high already exists
8h)
add_liquidity_SOL(Pool_ID, tocken, amountX, walletX, price_low, price_high) -
deposit token (SOL) in amountX to my Pool_ID from my SOL walletX
with price range (within the Pool) from priceLow to priceHigh,
assuming that this position in the pool for price range price_low to price_high already exists
It is possible, that functions add_liquidity_SOL()
and add_liquidity_USDC() may not be possible to work
at all, then combined function to deposit 2 tokens (SOL and USDC)
at once will be required as:
add_liquidity(Pool_ID, SOL, USDC, amount_SOL, amount_USDC, walletX, price_low, price_high)
8i)
open_position_SOL(Pool_ID, tocken, amountX, walletX, price_low, price_high, max_fees) -
deposit token (SOL) in amountX to my Pool_ID from my SOL walletX
with price range (within the Pool) from priceLow to priceHigh,
assuming that no such mine position in the pool for price range price_low to price_high exists. max_fees - is the max allowed amount of fees,
if calculated entry fees are greater - don't deposit