Skip to content

Commit

Permalink
Add Overview of Orca Whirlpools SDK Suite (#471)
Browse files Browse the repository at this point in the history
* Add overview of Orca SDK suite

* Resolve comments. Add README for Rust and TS. Add images.

* Fix rustdoc README.md image?

* Fix typos. Resolve comment.

---------

Co-authored-by: calintje <csimon@orca.so>
Co-authored-by: Wilhelm Thieme <wjthieme@gmail.com>
  • Loading branch information
3 people authored Nov 7, 2024
1 parent a4a0c50 commit d9bf7e1
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 17 deletions.
15 changes: 14 additions & 1 deletion docs/rust/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
Rust
# Orca Whirlpools SDKs

![Overview of Orca Whirlpools SDK suite](/../whirlpools/img/01-Welcome/orca-sdks-overview-rustdocs.png)

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 (in development, requires Solana SDK v1.18)
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 (requires Solana SDK \<v2)
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.
15 changes: 14 additions & 1 deletion docs/ts/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
Typescript
# Orca Whirlpools SDKs

![Overview of Orca Whirlpools SDK suite](../whirlpool/static/img/01-Welcome/orca-sdks-overview-typedocs.png)

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 (Requires Solana Web3.js ≥v2.0)
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 (Requires Solana Web3.js SDK ≥v2.0)
The Low-Level SDK is autogenerated from our 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.
42 changes: 27 additions & 15 deletions docs/whirlpool/docs/01-Welcome.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import DocCard from '@theme/DocCard';

# Welcome

Whirlpools is an open-sourced concentrated liquidity automated market maker (CLAMM) program built for the Solana ecosystem.
On both the Solana and Eclipse networks, the Whirlpool Program runs as an open-sourced concentrated liquidity automated market maker (CLAMM). The program enables advanced DeFi operations such as creating liquidity pools and swapping.

<DocCard item={{
type: 'link',
Expand All @@ -15,29 +15,41 @@ Whirlpools is an open-sourced concentrated liquidity automated market maker (CLA
description: 'https://github.com/orca-so/whirlpools'
}} />

## Introduction to Solana.
## Overview of Orca Whirlpools SDK suite

On Solana, all data is stored in accounts, which operate like a key-value store. Each account has an address (the key) and holds specific data (the value). Some accounts store only data, like token accounts for holding tokens. Other accounts store programs that define the logic for interacting with the network. For example, the Token Program manages token accounts and facilitates transfers, so each time you send a token, you're actually sending a transaction to the Token Program, which then updates the balances involved.
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.

Similarly, the Whirlpools Program is a program that enables more advanced features like concentrated liquidity pools and swapping. It creates specific data accounts on your behalf, such as Whirlpool and Position accounts, which are essential for managing liquidity. While the Whirlpools Program "owns" these accounts, meaning it controls the logic governing them, you still have authority over specific aspects, like managing liquidity in a position through a corresponding Position NFT.
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.

With the Whirlpools SDK, you can interact with these accounts, perform swaps, and manage positions with ease. And since Solana network transaction costs are low, you can execute these operations efficiently.
### Whirlpools SDKs

## Whirlpools SDK
![Overview of Orca Whirlpools SDK suite](../static/img/01-Welcome/orca-sdks-overview.png)

The Whirlpools SDK is an open-source library that allows developers to interact with the Whirlpools Program and is intended to be used in conjunction with the Solana SDK. Simply put, you use the Whirlpools SDK to create instructions, and the Solana SDK to send them to the network.
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:

Some of the main features are:
- Create instructions to set up a new pool, open positions, add or remove liquidity, and swap tokens.
- Get quotes for swaps.
- Query the state of pools to retrieve information about asset prices, liquidity, and fees.
#### 1. High-Level SDK
- **TypeScript**: [@orca-so/whirlpools](https://www.npmjs.com/package/@orca-so/whirlpools) (Requires Solana Web3.js SDK ≥v2.0)
- **Rust**: orca_whirlpools (in development, requires Solana SDK v1.18)
- **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.

## How to use this documentation
#### 2. Core SDK
- **TypeScript**: [@orca-so/whirlpools-core](https://www.npmjs.com/package/@orca-so/whirlpools-core)
- **Rust**: [orca_whirlpools_core](https://crates.io/crates/orca_whirlpools_core)
- **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) (Requires Solana Web3.js SDK ≥v2.0)
- **Rust**: [orca_whirlpools_client](https://crates.io/crates/orca_whirlpools_client) (Requires Solana SDK \<v2)
- **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.

In the next section you will find information about the Whirlpools Program and its architecture.
### Legacy SDK
- **TypeScript**: [@orca-so/whirlpools-sdk](https://www.npmjs.com/package/@orca-so/whirlpools-sdk) (Requires Solana Web3.js SDK \<v2.0)
- **Description**: Despite being called "Legacy", this SDK remains a reliable choice for integrating with projects that use Solana Web3.js versions older than v2.0. It offers foundational tools for interacting with Orca's Whirlpool Program and includes utilities from @orca-so/common-sdk.

## How to use this documentation

In the following sections you will find information about the Whirlpools SDK and how to use it to interact with the program.
In the next section you will find information about the Whirlpool Program and its architecture.

We also provide start-to-end tutorials for specific use cases combining the Whirlpools SDK with the Solana SDK.
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.

If you have any questions or need help, feel free to reach out to us on the [Discord](https://discord.orca.so).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d9bf7e1

Please sign in to comment.