Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 21 additions & 2 deletions docs/rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,30 @@

The Whirlpools SDKs are Orca's primary set of SDKs designed to provide enhanced, modular interaction 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. This offering is divided into three main components:

### 1. High-Level SDK, compatible with Solana SDK versions `^1.18.0` but `<2.0.0`
### 1. High-Level SDK
#### Compatibility
- Compatible with Solana SDK versions `^1.18.0` but `<3.0.0`. By default, the Rust compiler 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust compiler -> cargo

```bash
cargo update solana-program:<current-version> --precise <required-version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is kinda tricky cause you potentially also need to patch solana-sdk, solana-client, solana-account-decoder, spl-token, spl-memo, spl-token-2022, and spl-associated-token-account

```

#### 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.

### 2. Core SDK
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.

### 3. Low-Level SDK, compatible with Solana SDK versions `^1.16.0` but `<2.0.0`
### 3. Low-Level SDK
#### Compatibility
- Compatible with `anchor v0.29.0`. If you enable the `anchor` feature of `orcah_whirlpools_client` in `cargo.toml` while using a different version of anchor in your project, you may need to apply a lockfile patch to resolve dependency conflicts:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Believe it is 0.26 to 0.29

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*orcah

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lockfile patch is to switch to a lower version of anchor

```bash
cargo update anchor:<current-version> --precise <required-version>
```
- Compatible with `solana-program` versions `^1.18.0` but `<3.0.0`. By default, the Rust compiler 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:
```bash
cargo update solana-program:<current-version> --precise <required-version>
```
- 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`.

#### Description
The Low-Level SDK is autogenerated from the Whirlpool Program's Interface Description Language (IDL). 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.
23 changes: 19 additions & 4 deletions docs/whirlpool/docs/01-Welcome.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ What follows is a brief overview of our SDK suite, distinguishing between the Wh
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:

#### 1. High-Level SDK
- **TypeScript**: [@orca-so/whirlpools](https://www.npmjs.com/package/@orca-so/whirlpools) (Compatible with Solana Web3.js SDK version `^2.0`)
- **Rust**: [orca_whirlpools](https://crates.io/crates/orca_whirlpools) (Compatible with Solana SDK versions `^1.18.0` but `<2.0.0`)
- **TypeScript**: [@orca-so/whirlpools](https://www.npmjs.com/package/@orca-so/whirlpools)
- Compatible with Solana Web3.js SDK version `^2.0`
- **Rust**: [orca_whirlpools](https://crates.io/crates/orca_whirlpools)
- Compatible with Solana SDK versions `^1.18.0` but `<3.0.0`. By default, the Rust compiler 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:
```bash
cargo update solana-program:<current-version> --precise <required-version>
```
- **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.

#### 2. Core SDK
Expand All @@ -38,8 +43,18 @@ The Whirlpools SDKs are our primary set of SDKs designed to provide enhanced, mo
- **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.

#### 3. Low-Level SDK
- **TypeScript**: [@orca-so/whirlpools-client](https://www.npmjs.com/package/@orca-so/whirlpools-client) (Compatible with Solana Web3.js SDK version `^2.0`)
- **Rust**: [orca_whirlpools_client](https://crates.io/crates/orca_whirlpools_client) (Compatible with Solana SDK versions `^1.16.0` but `<2.0.0`)
- **TypeScript**: [@orca-so/whirlpools-client](https://www.npmjs.com/package/@orca-so/whirlpools-client)
- Compatible with Solana Web3.js SDK version `^2.0`
- **Rust**: [orca_whirlpools_client](https://crates.io/crates/orca_whirlpools_client)
- Compatible with `anchor v0.29.0`. If you enable the `anchor` feature of `orcah_whirlpools_client` in `cargo.toml` while using a different version of anchor in your project, you may need to apply a lockfile patch to resolve dependency conflicts:
```bash
cargo update anchor:<current-version> --precise <required-version>
```
- Compatible with `solana-program` versions `^1.18.0` but `<3.0.0`. By default, the Rust compiler 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:
```bash
cargo update solana-program:<current-version> --precise <required-version>
```
- 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`.
- **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.

### Legacy SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ This document covers the essential setup required to start building on Orca’s
Add the necessary dependencies to your project:

```bash
cargo add orca_whirlpools [email protected] [email protected] tokio serde_json
cargo add orca_whirlpools solana-sdk solana-client tokio serde_json
```

**Note**: If you're using the Rust SDK in an already existing project which does not use the latest version of Solana SDK, you may need to apply a patchfile lock to prevent dependency conflicts. To do this, run the following command:
```bash
cargo update solana-sdk:<current-version> --precise <required-version>
```
</TabItem>
</Tabs>
Expand Down
13 changes: 11 additions & 2 deletions docs/whirlpool/docs/03-Whirlpools SDKs/03-Whirlpools Client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@ This SDK provides developers with low-level functionalities for interacting with
```
</TabItem>
<TabItem value="rust" label="Rust">
**NOTE**: This SDK requires Solana SDK v1. You can use this crate for cross-program-invocation (CPI)
but you will have to disable the default features.
### Compatibility
- Compatible with `anchor v0.29.0`. If you enable the `anchor` feature of `orcah_whirlpools_client` in `cargo.toml` while using a different version of anchor in your project, you may need to apply a lockfile patch to resolve dependency conflicts:
```bash
cargo update anchor:<current-version> --precise <required-version>
```
- Compatible with `solana-program` versions `^1.18.0` but `<3.0.0`. By default, the Rust compiler 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:
```bash
cargo update solana-program:<current-version> --precise <required-version>
```
- 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`.
### Installation
```bash
cargo add orca_whirlpools_client
```
Expand Down
11 changes: 10 additions & 1 deletion rust-sdk/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
## Overview
This package provides developers with low-level functionalities for interacting with the Whirlpool Program on Solana. It serves as a foundational tool that allows developers to manage and integrate detailed operations into their Rust projects, particularly those related to Orca's Whirlpool Program. This package offers granular control for advanced use cases.

> NOTE: To ensure compatibility, use version 1.18 of the `solana-sdk` crate, which matches the version used to build the Whirlpool program.
## Compatibiltiy
- Compatible with `anchor v0.29.0`. If you enable the `anchor` feature of `orcah_whirlpools_client` in `cargo.toml` while using a different version of anchor in your project, you may need to apply a lockfile patch to resolve dependency conflicts:
```bash
cargo update anchor:<current-version> --precise <required-version>
```
- Compatible with Solana SDK versions `^1.18.0` but `<3.0.0`. By default, the Rust compiler 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:
```bash
cargo update solana-program:<current-version> --precise <required-version>
```
- 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`.

## Key Features
- **Codama Client**: The package includes a set of generated client code based on the Whirlpool Program IDL. This ensures all the necessary program information is easily accessible in a structured format. It handles all decoding and encoding of instructions and account data, making it much easier to interact with the program.
Expand Down
Loading