Skip to content

Commit 22c9d4a

Browse files
authored
Documentation Reorganization: Unified SDK Documentation (#892)
* Set up and first bulk * Save state * Finish restructuring. Add actions to examples. Add tx-sender to docs. * Nits * Add changeset. Remove package-lock.json. * Update actions * Update lock files * Add tx-sender example * Add tx-sender example * Add Rust tx-sender to Rust code examples * Fix test
1 parent f66e6ae commit 22c9d4a

File tree

58 files changed

+4659
-3634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4659
-3634
lines changed

.changeset/crazy-grapes-bathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@orca-so/whirlpools-docs": patch
3+
---
4+
5+
Documentation Reorganization: Unified SDK Documentation

docs/rust/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/whirlpool/docs/01-Welcome.mdx

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
sidebar_position: 1
33
slug: /
4+
hide_table_of_contents: true
45
---
56
import DocCard from '@theme/DocCard';
67

@@ -15,57 +16,3 @@ On both the Solana and Eclipse networks, the Whirlpool Program runs as an open-s
1516
description: 'https://github.com/orca-so/whirlpools'
1617
}} />
1718

18-
## Overview of Orca Whirlpools SDK suite
19-
20-
![Overview of Orca Whirlpools SDK suite](../static/img/01-Welcome/orca-sdks-overview.png)
21-
22-
Orca provides a range of SDKs that cater to different levels of development needs for interacting with the Whirlpool Program on Solana and Eclipse. Whether you are managing liquidity, building applications that require pool infrastructure, or building automation tools that interact with the program, our SDKs cover a spectrum of functionality from low-level granular control to high-level abstractions.
23-
24-
What follows is a brief overview of our SDK suite, distinguishing between the Whirlpools SDKs and the Legacy SDK, and explaining their intended purposes and relationships.
25-
26-
### Whirlpools SDKs
27-
28-
The Whirlpools SDKs are our primary set of SDKs designed to provide enhanced, modular interaction with the Whirlpool Program. This offering is divided into three main components:
29-
30-
#### 1. High-Level SDK
31-
- **TypeScript**: [@orca-so/whirlpools](https://www.npmjs.com/package/@orca-so/whirlpools)
32-
- Compatible with Solana Kit
33-
- **Rust**: [orca_whirlpools](https://crates.io/crates/orca_whirlpools)
34-
- Compatible with Solana SDK versions `^1.18.0` but `<3.0.0`. By default, Cargo will install the latest version of Solana SDK `^v2`. This can cause dependcy issues when using older versions. To solve this you can apply a lockfile patch with the following command:
35-
```bash
36-
cargo update solana-program:<current-version> --precise <required-version>
37-
```
38-
You might also have to apply lockfile patches for `solana-program`, `solana-client`, `solana-account-decoder`, `spl-token`, `spl-memo`, `spl-token-2022`, `spl-associated-token-account`.
39-
- **Description**: The High-Level SDK is our top recommendation for anyone who wants to integrate with the Whirlpool Program. It builds upon the Low-Level and Core SDKs to provide an easy-to-use interface for interacting with the Whirlpool Program. This SDK abstracts many of the underlying complexities, such as tick array management, and makes managing pools and positions, and executing swaps much simpler. It is suitable for developers who need efficient, high-level functionalities and want to minimize manual configuration and management.
40-
41-
#### 2. Core SDK
42-
- **TypeScript**: [@orca-so/whirlpools-core](https://www.npmjs.com/package/@orca-so/whirlpools-core)
43-
- **Rust**: [orca_whirlpools_core](https://crates.io/crates/orca_whirlpools_core)
44-
- **Description**: The Core SDK provides essential utilities for math operations and quotes, required for working with liquidity pools. This library focuses on calculations such as determining position status, price conversions, and computing quotes on adjusting liquidity and swaps. It is written in Rust but has been compiled to WebAssembly (Wasm) for easy integration into TypeScript projects.
45-
46-
#### 3. Low-Level SDK
47-
- **TypeScript**: [@orca-so/whirlpools-client](https://www.npmjs.com/package/@orca-so/whirlpools-client)
48-
- Compatible with Solana Kit
49-
- **Rust**: [orca_whirlpools_client](https://crates.io/crates/orca_whirlpools_client)
50-
- Compatible with `anchor` versions `^0.26` but `<0.30`. If you enable the `anchor` feature of `orca_whirlpools_client` in `cargo.toml` while using a version of anchor that's `^0.30` in your project, you may need to apply a lockfile patch to switch to a lower version:
51-
```bash
52-
cargo update anchor:<current-version> --precise 0.29
53-
```
54-
- Compatible with `solana-program` versions `^1.18.0` but `<3.0.0`. By default, Cargo will install the latest version of Solana SDK `^v2`. This can cause dependcy issues when using older versions. To solve this you can apply a lockfile patch with the following command:
55-
```bash
56-
cargo update solana-program:<current-version> --precise <required-version>
57-
```
58-
- NOTE: if you are dealing with compatibility issues for both `anchor` and `solana-program`, the order of the patches matters. First patch `anchor`, then patch `solana-program`.
59-
- **Description**: The Low-Level SDK is autogenerated from the Whirlpool Program's Interface Description Language (IDL) using Codama. This SDK provides direct program interactions and is designed for developers who need complete, low-level control over Whirlpool operations. It covers direct access to Solana accounts, instructions, and transactions.
60-
61-
### Legacy SDK
62-
- **TypeScript**: [@orca-so/whirlpools-sdk](https://www.npmjs.com/package/@orca-so/whirlpools-sdk) (Compatible with Solana Web3.js)
63-
- **Description**: Despite being called "Legacy", this SDK remains a reliable choice for integrating with projects that use Solana Web3.js. It offers foundational tools for interacting with Orca's Whirlpool Program and includes utilities from @orca-so/common-sdk.
64-
65-
## How to use this documentation
66-
67-
In the next section you will find information about the Whirlpool Program and its architecture.
68-
69-
In the following sections you will find documentation on the Whirlpools SDKs and the Legacy SDK and how to use it to interact with the program.
70-
71-
If you have any questions or need help, feel free to reach out to us on the [Discord](https://discord.orca.so).
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Account Architecture
22

33
## Overview
4+
45
![Account Architecture](../../static/img/02-Architecture%20Overview/architecture-overview.png)
56

67
## WhirlpoolsConfig
7-
The owner of a Config account has the authority to define the many authorities over the pools that it owns (ex. default fees, collect protocol fees etc) . Whirlpools visible on the ORCA UI are all derived and controlled by a WhirlpoolsConfig account owned by the ORCA foundation. To learn more about managing pools, start [here](../03-Whirlpools%20SDKs/01-Whirlpools/03-Whirlpool%20Management/01-Create%20Pool.mdx).
8+
9+
The owner of a Config account has the authority to define the many authorities over the pools that it owns (ex. default fees, collect protocol fees etc) . Whirlpools visible on the ORCA UI are all derived and controlled by a WhirlpoolsConfig account owned by the ORCA foundation. To learn more about managing pools, start [here](../03-SDKs/03-Whirlpool%20Management/01-Create%20Pool.mdx).
810

911
Users and other protocols are free to deploy their own WhirlpoolsConfig account on our Whirlpool program to spawn their own set of liquidity pools.
1012

@@ -13,35 +15,42 @@ Users and other protocols are free to deploy their own WhirlpoolsConfig account
1315
WhirlpoolsConfig account may have WhirlpoolsConfigExtension account. WhirlpoolsConfigExtension account holds some additional authorities to manage TokenExtensions, especially TokenBadge accounts.
1416

1517
## FeeTier
18+
1619
FeeTier is an account that defines the fee rate, defined per WhirlpoolsConfig and tick spacing.
1720

1821
## Whirlpool
22+
1923
![Whirlpool Overview](../../static/img/02-Architecture%20Overview/whirlpool-overview.png)
2024
A Whirlpool is a concentrated liquidity pool between a token pair (A & B).
2125

22-
Each Whirlpool account hosts the necessary information to deal with the accounting of the pool. It also hosts the PDAs to the vaults. Only the Whirlpool program has authority to withdraw from the vault. No one, not even the program owner or WhirlpoolsConfig owner, has the authority to withdraw.
26+
Each Whirlpool account hosts the necessary information to deal with the accounting of the pool. It also hosts the token accounts of the vaults. Only the Whirlpool program has authority to withdraw from the vault. No one, not even the program owner or WhirlpoolsConfig owner, has the authority to withdraw.
2327

24-
A Whirlpool account is hashed by the Config, Token pair mints and tick spacing, so there can be many pools for the same trading pair but with a different tick-spacing.
28+
A Whirlpool account is hashed by the Config, Token pair mints and tick spacing, so there can be many pools for the same trading pair but with a different tick-spacing.
2529

2630
Users are able to perform position management and fee/reward collection operations against the Whirlpool.
2731

2832
## TickArray
33+
2934
To learn about TickArry, read [Understanding Tick Arrays](./03-Understanding%20Tick%20Arrays.md)
3035

3136
## Position
37+
3238
Positions represents a set of liquidity distributed on a price range within a single Whirlpool. To learn more, read [Tokenized Positions](./04-Tokenized%20Positions.md)
3339

3440
## PositionBundle
41+
3542
By creating a PositionBundle, up to 256 positions can be managed by a single NFT. Also, by closing a position, a new position can be created on the same PositionBundle account, so there is no rent overhead when rebalancing.
3643

3744
If you manage many positions and open and close them frequently, there is no reason not to use PositionBundle.
3845

3946
## TokenBadge
47+
4048
This account was introduced to support TokenExtensions.
4149

4250
While TokenExtensions provides useful extensions, there are extensions that pose a risk to the pool and pool users.
4351

4452
Therefore, tokens with some extensions can only be used for pool initialization if TokenBadge authority has issued a TokenBadge for that token.
4553

4654
## How are Whirlpool Accounts stored
47-
Whirlpool program accounts are all [Program Derived Addresses](https://solana.com/docs/core/pda) (PDA) derivable from another Whirlpool account up the hierarchy.
55+
56+
Whirlpool program accounts are all [Program Derived Addresses](https://solana.com/docs/core/pda) (PDA) derivable from another Whirlpool account up the hierarchy.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
sidebar_label: Overview
3+
hide_table_of_contents: true
4+
---
5+
import Tabs from "@theme/Tabs";
6+
import TabItem from "@theme/TabItem";
7+
8+
# Overview of Orca's SDKs
9+
10+
![Overview of Orca Whirlpools SDK suite](../../static/img/01-Welcome/orca-sdks-overview.png)
11+
12+
Orca provides a range of SDKs that cater to different levels of development needs for interacting with the Whirlpool Program on Solana and Eclipse. Whether you are managing liquidity, building applications that require pool infrastructure, or building automation tools that interact with the program, our SDKs cover a spectrum of functionality from low-level granular control to high-level abstractions.
13+
14+
What follows is an overview of our SDK suite, distinguishing between the various layers of the SDKs, and explaining their intended purposes and relationships.
15+
16+
## 1. High-Level SDKs
17+
18+
The High-Level SDKs are our top recommendation for anyone who wants to integrate with the Whirlpool Program. These SDKs abstract many of the underlying complexities, such as tick array management, and makes managing pools and positions, and executing swaps much simpler. It is suitable for developers who need efficient, high-level functionalities and want to minimize manual configuration and management.
19+
20+
- **Rust**: [orca_whirlpools](https://crates.io/crates/orca_whirlpools)
21+
- Compatible with Solana SDK versions `^1.18.0` but `<3.0.0`. By default, Cargo will install the latest version of Solana SDK `^v2`. This can cause dependcy issues when using older versions. To solve this you can apply a lockfile patch with the following command:
22+
```bash
23+
cargo update solana-program:<current-version> --precise <required-version>
24+
```
25+
You might also have to apply lockfile patches for `solana-program`, `solana-client`, `solana-account-decoder`, `spl-token`, `spl-memo`, `spl-token-2022`, `spl-associated-token-account`.
26+
- **TypeScript Kit**: [@orca-so/whirlpools](https://www.npmjs.com/package/@orca-so/whirlpools)
27+
- Compatible with Solana Kit
28+
- **Typescript Legacy**: [@orca-so/whirlpools-sdk](https://www.npmjs.com/package/@orca-so/whirlpools-sdk)
29+
- Compatible with Solana Web3.js. Despite being called "Legacy", this class-based SDK remains a reliable choice for integrating with projects that use Solana Web3.js. It offers foundational tools for interacting with Orca's Whirlpool Program and includes utilities from @orca-so/common-sdk.
30+
31+
## 2. Core SDKs
32+
33+
The Core SDKs provide essential utilities for **math operations** and **quotes**, required for working with liquidity pools. These libraries focus on calculations such as determining position status, price conversions, and computing quotes on adjusting liquidity and swaps. It is written in Rust but has been compiled to WebAssembly (Wasm) for easy integration into TypeScript projects.
34+
35+
- **Rust**: [orca_whirlpools_core](https://crates.io/crates/orca_whirlpools_core)
36+
- **TypeScript Kit**: [@orca-so/whirlpools-core](https://www.npmjs.com/package/@orca-so/whirlpools-core)
37+
- **TypeScript Legacy**: [@orca-so/whirlpools-sdk](https://www.npmjs.com/package/@orca-so/whirlpools-sdk)
38+
- The Legacy SDK has has separate utility classes for certain math operations such as `PoolUtil`, `TickUtil`, `TickArrayUtil`, and `SwapUtils`. For quotes, there are separate functions exported, such as `decreaseLiquidityQuoteByLiquidity`, `increaseLiquidityQuoteByInputToken`, `swapQuoteByInputToken`, `collectFeesQuote`, `collectRewardsQuote`, and more. Check out the reference docs in the navbor for more details.
39+
40+
## 3. Low-Level SDKs
41+
42+
This SDK provides direct program interactions and is designed for developers who need complete, low-level control over Whirlpool operations. It covers direct access to Solana accounts, instructions, and transactions.
43+
44+
- **Rust**: [orca_whirlpools_client](https://crates.io/crates/orca_whirlpools_client)
45+
- Compatible with `anchor` versions `^0.26` but `<0.30`. If you enable the `anchor` feature of `orca_whirlpools_client` in `cargo.toml` while using a version of anchor that's `^0.30` in your project, you may need to apply a lockfile patch to switch to a lower version:
46+
```bash
47+
cargo update anchor:<current-version> --precise 0.29
48+
```
49+
- Compatible with `solana-program` versions `^1.18.0` but `<3.0.0`. By default, Cargo will install the latest version of Solana SDK `^v2`. This can cause dependcy issues when using older versions. To solve this you can apply a lockfile patch with the following command:
50+
```bash
51+
cargo update solana-program:<current-version> --precise <required-version>
52+
```
53+
- NOTE: if you are dealing with compatibility issues for both `anchor` and `solana-program`, the order of the patches matters. First patch `anchor`, then patch `solana-program`.
54+
- **TypeScript Kit**: [@orca-so/whirlpools-client](https://www.npmjs.com/package/@orca-so/whirlpools-client)
55+
- Compatible with Solana Kit
56+
- **Typescript Legacy**: [@orca-so/whirlpools-sdk](https://www.npmjs.com/package/@orca-so/whirlpools-sdk)
57+
- The Legacy SDK offers the `WhirlpoolIx` class which enables you to interface directly with the instructions of the Whirlpool Program.

0 commit comments

Comments
 (0)