@cetusprotocol/sui-clmm-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +11100 -0
- package/README.md +108 -0
- package/dist/index.d.mts +2251 -0
- package/dist/index.d.ts +2251 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -0
- package/docs/add_liquidity.md +145 -0
- package/docs/close_position.md +57 -0
- package/docs/collect_fees.md +37 -0
- package/docs/create_clmm_pool.md +228 -0
- package/docs/error_code.md +69 -0
- package/docs/get_clmm_pools.md +92 -0
- package/docs/get_positions.md +70 -0
- package/docs/get_reward.md +53 -0
- package/docs/get_ticks.md +39 -0
- package/docs/migrate_to_version_6.0.md +143 -0
- package/docs/open_position.md +224 -0
- package/docs/partner_swap.md +60 -0
- package/docs/pre_swap.md +136 -0
- package/docs/remove_liquidity.md +124 -0
- package/docs/swap.md +153 -0
- package/docs/utils.md +85 -0
- package/package.json +37 -0
- package/src/config/index.ts +2 -0
- package/src/config/mainnet.ts +41 -0
- package/src/config/testnet.ts +40 -0
- package/src/errors/errors.ts +93 -0
- package/src/errors/index.ts +1 -0
- package/src/index.ts +10 -0
- package/src/math/apr.ts +167 -0
- package/src/math/index.ts +1 -0
- package/src/modules/configModule.ts +540 -0
- package/src/modules/index.ts +5 -0
- package/src/modules/poolModule.ts +1066 -0
- package/src/modules/positionModule.ts +932 -0
- package/src/modules/rewarderModule.ts +430 -0
- package/src/modules/swapModule.ts +389 -0
- package/src/sdk.ts +131 -0
- package/src/types/clmm_type.ts +1002 -0
- package/src/types/clmmpool.ts +366 -0
- package/src/types/config_type.ts +241 -0
- package/src/types/index.ts +8 -0
- package/src/types/sui.ts +124 -0
- package/src/types/token_type.ts +189 -0
- package/src/utils/common.ts +426 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/positionUtils.ts +434 -0
- package/src/utils/swapUtils.ts +499 -0
- package/tests/add_liquidity.test.ts +121 -0
- package/tests/add_liquidity_fix_token.test.ts +182 -0
- package/tests/apr.test.ts +71 -0
- package/tests/cetus_config.test.ts +26 -0
- package/tests/collect_fees.test.ts +11 -0
- package/tests/pool.test.ts +267 -0
- package/tests/position.test.ts +145 -0
- package/tests/remove_liquidity.test.ts +119 -0
- package/tests/rewarder.test.ts +60 -0
- package/tests/sdk_config.test.ts +49 -0
- package/tests/swap.test.ts +254 -0
- package/tests/tsconfig.json +26 -0
- package/tsconfig.json +5 -0
- package/tsup.config.ts +10 -0
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<a name="readme-top"></a>
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
<!-- PROJECT LOGO -->
|
|
8
|
+
<br />
|
|
9
|
+
<div align="center">
|
|
10
|
+
<a >
|
|
11
|
+
<img src="https://archive.cetus.zone/assets/image/logo.png" alt="Logo" width="100" height="100">
|
|
12
|
+
</a>
|
|
13
|
+
|
|
14
|
+
<h3 align="center">Cetus-CLMM-SUI-SDK</h3>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
Integrating Cetus-CLMM-SUI-SDK: A Comprehensive Guide, Please see details in document.
|
|
18
|
+
<br />
|
|
19
|
+
<a href="https://cetus-1.gitbook.io/cetus-developer-docs/developer/dev-overview"><strong>Explore the document »</strong></a>
|
|
20
|
+
<br />
|
|
21
|
+
<br />
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
## Introduction
|
|
26
|
+
|
|
27
|
+
Cetus-CLMM-SUI-SDK is the official software development kit (SDK) specifically designed for seamless integration with Cetus-CLMM. It provides developers with the necessary tools and resources to easily connect and interact with Cetus-CLMM, enabling the development of robust and efficient applications.
|
|
28
|
+
|
|
29
|
+
## Getting Started
|
|
30
|
+
|
|
31
|
+
To integrate our SDK into your local project, please follow the example steps provided below.
|
|
32
|
+
Please see details in document.
|
|
33
|
+
|
|
34
|
+
### Prerequisites
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npm i @cetusprotocol/sui-clmm-sdk
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## SDK Initialization
|
|
41
|
+
|
|
42
|
+
The SDK provides a convenient initialization method `src/config/initCetusSDK` for quick setup and configuration of the Cetus SDK.
|
|
43
|
+
|
|
44
|
+
### Network Options
|
|
45
|
+
|
|
46
|
+
- `mainnet` (Production Network)
|
|
47
|
+
- `testnet` (Test Network)
|
|
48
|
+
|
|
49
|
+
### Important Note
|
|
50
|
+
|
|
51
|
+
Before performing swaps or other asset-related operations, ensure:
|
|
52
|
+
|
|
53
|
+
- A wallet is properly configured
|
|
54
|
+
- The wallet has sufficient token balance for the intended operation
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { CetusClmmSDK } from '@cetusprotocol/sui-clmm-sdk'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
If you would like to use the mainnet network and the official Sui rpc url, you can do so as follows:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const sdk = CetusClmmSDK.createSDK()
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
If you wish to set your own full node URL or network (You have the option to select either 'mainnet' or 'testnet' for the network), you can do so as follows:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const env = 'mainnet'
|
|
70
|
+
const full_rpc_url = 'YOUR_FULL_NODE_URL'
|
|
71
|
+
const wallet = 'YOUR_WALLET_ADDRESS'
|
|
72
|
+
|
|
73
|
+
const sdk = CetusClmmSDK.createSDK({ env })
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
If you wish to set your own full node URL or SuiClient, you can do so as follows:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
const sdk = CetusClmmSDK.createSDK({ env, sui_client })
|
|
80
|
+
//or
|
|
81
|
+
const sdk = CetusClmmSDK.createSDK({ env, full_rpc_url })
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**After linking your wallet, if you need use your wallet address to do something, you should set it by `CetusClmmSDK.setSenderAddress("YOUR_SUI_ADDRESS_HERE")`**
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
const wallet = 'YOUR_WALLET_ADDRESS'
|
|
88
|
+
sdk.setSenderAddress(wallet)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Now, you can start using Cetus SDK.
|
|
92
|
+
|
|
93
|
+
### Typescript Doc
|
|
94
|
+
|
|
95
|
+
You can view this typescript sdk in
|
|
96
|
+
<a href="https://cetus-1.gitbook.io/cetus-developer-docs/developer/dev-overview"><strong> Cetus Development Documents. </strong></a>
|
|
97
|
+
<br />
|
|
98
|
+
|
|
99
|
+
## LICENSE
|
|
100
|
+
|
|
101
|
+
CETUS-SUI-SDK released under the Apache license. See the [LICENSE](./LICENSE) file for details.
|
|
102
|
+
|
|
103
|
+
## More About Cetus
|
|
104
|
+
|
|
105
|
+
Use the following links to learn more about Cetus:
|
|
106
|
+
Learn more about working with Cetus in the [Cetus Documentation](https://cetus-1.gitbook.io/cetus-docs).
|
|
107
|
+
|
|
108
|
+
Join the Cetus community on [Cetus Discord](https://discord.com/channels/1009749448022315008/1009751382783447072).
|