@cetusprotocol/sui-clmm-sdk 1.4.0 → 1.4.1
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/README.md +1 -1
- package/dist/index.d.ts +15 -62
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +15 -6
- package/dist/index.d.mts +0 -2438
- package/dist/index.mjs +0 -13
- package/dist/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ const wallet = 'YOUR_WALLET_ADDRESS'
|
|
|
73
73
|
const sdk = CetusClmmSDK.createSDK({ env })
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
If you wish to set your own full node URL or
|
|
76
|
+
If you wish to set your own full node URL or SuiJsonRpcClient, you can do so as follows:
|
|
77
77
|
|
|
78
78
|
```typescript
|
|
79
79
|
const sdk = CetusClmmSDK.createSDK({ env, sui_client })
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CoinPairType,
|
|
1
|
+
import { CoinPairType, SuiAddressType, SuiObjectIdType, NFT as NFT$1, Percentage, IModule, SuiResource, PaginationArgs, DataPage, PageQuery, CoinAsset, SdkWrapper, BaseSdkOptions, Package, BaseError } from '@cetusprotocol/common-sdk';
|
|
2
|
+
import * as _mysten_sui_transactions from '@mysten/sui/transactions';
|
|
2
3
|
import { TransactionArgument, TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
|
|
3
4
|
import BN from 'bn.js';
|
|
4
5
|
import Decimal from 'decimal.js';
|
|
5
|
-
import { DevInspectResults, SuiObjectResponse, SuiTransactionBlockResponse } from '@mysten/sui/
|
|
6
|
-
import * as _mysten_sui_dist_cjs_transactions from '@mysten/sui/dist/cjs/transactions';
|
|
6
|
+
import { DevInspectResults, SuiObjectResponse, SuiTransactionBlockResponse } from '@mysten/sui/jsonRpc';
|
|
7
7
|
|
|
8
8
|
type BasePath = {
|
|
9
9
|
direction: boolean;
|
|
@@ -1788,10 +1788,7 @@ declare class PositionModule implements IModule<CetusClmmSDK> {
|
|
|
1788
1788
|
* If this parameter is not passed, gas estimation is not performed
|
|
1789
1789
|
* @returns {Promise<TransactionBlock>}
|
|
1790
1790
|
*/
|
|
1791
|
-
createAddLiquidityFixTokenPayload(params: AddLiquidityFixTokenParams,
|
|
1792
|
-
slippage: number;
|
|
1793
|
-
cur_sqrt_price: BN;
|
|
1794
|
-
}, tx?: Transaction, input_coin_a?: TransactionObjectArgument, input_coin_b?: TransactionObjectArgument): Promise<Transaction>;
|
|
1791
|
+
createAddLiquidityFixTokenPayload(params: AddLiquidityFixTokenParams, tx?: Transaction, input_coin_a?: TransactionObjectArgument, input_coin_b?: TransactionObjectArgument): Promise<Transaction>;
|
|
1795
1792
|
/**
|
|
1796
1793
|
* create add liquidity transaction payload
|
|
1797
1794
|
* @param {AddLiquidityParams} params
|
|
@@ -1856,12 +1853,12 @@ declare class PositionModule implements IModule<CetusClmmSDK> {
|
|
|
1856
1853
|
createCollectFeeNoSendPayload(params: CollectFeeParams, tx: Transaction, primary_coin_a_input: TransactionObjectArgument, primary_coin_b_input: TransactionObjectArgument): Transaction;
|
|
1857
1854
|
createCollectFeeAndReturnCoinsPayload(params: CollectFeeParams, tx: Transaction): {
|
|
1858
1855
|
fee_a: {
|
|
1859
|
-
$kind: "NestedResult";
|
|
1860
1856
|
NestedResult: [number, number];
|
|
1857
|
+
$kind: "NestedResult";
|
|
1861
1858
|
};
|
|
1862
1859
|
fee_b: {
|
|
1863
|
-
$kind: "NestedResult";
|
|
1864
1860
|
NestedResult: [number, number];
|
|
1861
|
+
$kind: "NestedResult";
|
|
1865
1862
|
};
|
|
1866
1863
|
};
|
|
1867
1864
|
}
|
|
@@ -1946,7 +1943,7 @@ declare class RewarderModule implements IModule<CetusClmmSDK> {
|
|
|
1946
1943
|
batchCollectRewardsPayload(params: CollectRewarderParams[], tx?: Transaction, input_coin_a?: TransactionObjectArgument, input_coin_b?: TransactionObjectArgument): Promise<Transaction>;
|
|
1947
1944
|
createCollectRewarderPayload(params: CollectRewarderParams, tx: Transaction, primary_coin_inputs: TransactionArgument[]): Transaction;
|
|
1948
1945
|
createCollectRewarderNoSendPayload(params: CollectRewarderParams, tx: Transaction, primary_coin_inputs: TransactionArgument[]): Transaction;
|
|
1949
|
-
createCollectRewarderAndReturnCoinPayload(params: CollectRewarderAndReturnCoinParams, tx: Transaction):
|
|
1946
|
+
createCollectRewarderAndReturnCoinPayload(params: CollectRewarderAndReturnCoinParams, tx: Transaction): _mysten_sui_transactions.TransactionResult;
|
|
1950
1947
|
}
|
|
1951
1948
|
|
|
1952
1949
|
declare const AMM_SWAP_MODULE = "amm_swap";
|
|
@@ -2012,7 +2009,7 @@ declare class SwapModule implements IModule<CetusClmmSDK> {
|
|
|
2012
2009
|
* If this parameter is not passed, gas estimation is not performed
|
|
2013
2010
|
* @returns
|
|
2014
2011
|
*/
|
|
2015
|
-
createSwapPayload(params: SwapParams
|
|
2012
|
+
createSwapPayload(params: SwapParams): Promise<Transaction>;
|
|
2016
2013
|
/**
|
|
2017
2014
|
* create swap transaction without transfer coins payload
|
|
2018
2015
|
* @param params
|
|
@@ -2020,7 +2017,7 @@ declare class SwapModule implements IModule<CetusClmmSDK> {
|
|
|
2020
2017
|
* If this parameter is not passed, gas estimation is not performed
|
|
2021
2018
|
* @returns tx and coin ABs
|
|
2022
2019
|
*/
|
|
2023
|
-
createSwapWithoutTransferCoinsPayload(params: SwapParams
|
|
2020
|
+
createSwapWithoutTransferCoinsPayload(params: SwapParams): Promise<{
|
|
2024
2021
|
tx: Transaction;
|
|
2025
2022
|
coin_ab_s: TransactionObjectArgument[];
|
|
2026
2023
|
}>;
|
|
@@ -2188,46 +2185,14 @@ type AdjustResult = {
|
|
|
2188
2185
|
*/
|
|
2189
2186
|
declare function findAdjustCoin(coinPair: CoinPairType): AdjustResult;
|
|
2190
2187
|
declare class PositionUtils {
|
|
2191
|
-
static createCollectRewarderAndFeeParams(sdk: CetusClmmSDK, tx: Transaction, params: CollectRewarderParams
|
|
2192
|
-
/**
|
|
2193
|
-
* adjust transaction for gas
|
|
2194
|
-
* @param sdk
|
|
2195
|
-
* @param amount
|
|
2196
|
-
* @param tx
|
|
2197
|
-
* @returns
|
|
2198
|
-
*/
|
|
2199
|
-
static adjustTransactionForGas(sdk: CetusClmmSDK, all_coins: CoinAsset[], amount: bigint, tx: Transaction): Promise<{
|
|
2200
|
-
fixAmount: bigint;
|
|
2201
|
-
newTx?: Transaction;
|
|
2202
|
-
}>;
|
|
2203
|
-
/**
|
|
2204
|
-
* build add liquidity transaction
|
|
2205
|
-
* @param params
|
|
2206
|
-
* @param slippage
|
|
2207
|
-
* @param curSqrtPrice
|
|
2208
|
-
* @returns
|
|
2209
|
-
*/
|
|
2210
|
-
static buildAddLiquidityFixTokenForGas(sdk: CetusClmmSDK, all_coins: CoinAsset[], params: AddLiquidityFixTokenParams, gas_estimate_arg: {
|
|
2211
|
-
slippage: number;
|
|
2212
|
-
cur_sqrt_price: BN;
|
|
2213
|
-
}, tx?: Transaction, input_coin_a?: TransactionObjectArgument, input_coin_b?: TransactionObjectArgument): Promise<Transaction>;
|
|
2188
|
+
static createCollectRewarderAndFeeParams(sdk: CetusClmmSDK, tx: Transaction, params: CollectRewarderParams): Transaction;
|
|
2214
2189
|
/**
|
|
2215
2190
|
* build add liquidity transaction
|
|
2216
2191
|
* @param params
|
|
2217
2192
|
* @param packageId
|
|
2218
2193
|
* @returns
|
|
2219
2194
|
*/
|
|
2220
|
-
static buildAddLiquidityFixToken(sdk: CetusClmmSDK,
|
|
2221
|
-
static buildAddLiquidityFixTokenCoinInput(tx: Transaction, need_interval_amount: boolean, amount: number | string, slippage: number, coin_type: string, all_coins: CoinAsset[], build_vector?: boolean, fix_amount?: boolean): BuildCoinResult;
|
|
2222
|
-
/**
|
|
2223
|
-
* fix add liquidity fix token for coin amount
|
|
2224
|
-
* @param params
|
|
2225
|
-
* @param slippage
|
|
2226
|
-
* @param curSqrtPrice
|
|
2227
|
-
* @returns
|
|
2228
|
-
*/
|
|
2229
|
-
static fixAddLiquidityFixTokenParams(params: AddLiquidityFixTokenParams, slippage: number, curSqrtPrice: BN): AddLiquidityFixTokenParams;
|
|
2230
|
-
private static buildAddLiquidityFixTokenArgs;
|
|
2195
|
+
static buildAddLiquidityFixToken(sdk: CetusClmmSDK, params: AddLiquidityFixTokenParams, tx?: Transaction, input_coin_a?: TransactionObjectArgument, input_coin_b?: TransactionObjectArgument): Promise<Transaction>;
|
|
2231
2196
|
static checkCoinThreshold(sdk: CetusClmmSDK, by_amount_in: boolean, tx: Transaction, coin: TransactionObjectArgument, amount_limit: number, coin_type: string): void;
|
|
2232
2197
|
}
|
|
2233
2198
|
|
|
@@ -2246,21 +2211,13 @@ declare class SwapUtils {
|
|
|
2246
2211
|
* @returns The default values for the otherAmountThreshold parameter in a swap.
|
|
2247
2212
|
*/
|
|
2248
2213
|
static getDefaultOtherAmountThreshold(amount_specified_is_input: boolean): BN;
|
|
2249
|
-
/**
|
|
2250
|
-
* build add liquidity transaction
|
|
2251
|
-
* @param params
|
|
2252
|
-
* @param slippage
|
|
2253
|
-
* @param curSqrtPrice
|
|
2254
|
-
* @returns
|
|
2255
|
-
*/
|
|
2256
|
-
static buildSwapTransactionForGas(sdk: CetusClmmSDK, params: SwapParams, all_coin_asset: CoinAsset[], gas_estimate_arg: SwapGasEstimateArg): Promise<Transaction>;
|
|
2257
2214
|
/**
|
|
2258
2215
|
* build swap transaction
|
|
2259
2216
|
* @param params
|
|
2260
2217
|
* @param packageId
|
|
2261
2218
|
* @returns
|
|
2262
2219
|
*/
|
|
2263
|
-
static buildSwapTransactionArgs(tx: Transaction, params: SwapParams, sdk_options: SdkOptions, primary_coin_input_a:
|
|
2220
|
+
static buildSwapTransactionArgs(tx: Transaction, params: SwapParams, sdk_options: SdkOptions, primary_coin_input_a: TransactionObjectArgument, primary_coin_input_b: TransactionObjectArgument): Transaction;
|
|
2264
2221
|
/**
|
|
2265
2222
|
* adjust transaction for gas
|
|
2266
2223
|
* @param sdk
|
|
@@ -2278,19 +2235,15 @@ declare class SwapUtils {
|
|
|
2278
2235
|
* @param packageId
|
|
2279
2236
|
* @returns
|
|
2280
2237
|
*/
|
|
2281
|
-
static buildSwapTransaction(sdk: CetusClmmSDK, params: SwapParams
|
|
2238
|
+
static buildSwapTransaction(sdk: CetusClmmSDK, params: SwapParams): Transaction;
|
|
2282
2239
|
static fixSwapParams(sdk: CetusClmmSDK, params: SwapParams, gasEstimateArg: SwapGasEstimateArg): Promise<SwapParams>;
|
|
2283
|
-
static buildSwapTransactionWithoutTransferCoinsForGas(sdk: CetusClmmSDK, params: SwapParams, all_coin_asset: CoinAsset[], gas_estimate_arg: SwapGasEstimateArg): Promise<{
|
|
2284
|
-
tx: Transaction;
|
|
2285
|
-
coin_ab_s: TransactionObjectArgument[];
|
|
2286
|
-
}>;
|
|
2287
2240
|
/**
|
|
2288
2241
|
* build swap transaction and return swapped coin
|
|
2289
2242
|
* @param params
|
|
2290
2243
|
* @param packageId
|
|
2291
2244
|
* @returns
|
|
2292
2245
|
*/
|
|
2293
|
-
static buildSwapTransactionWithoutTransferCoins(sdk: CetusClmmSDK, params: SwapParams
|
|
2246
|
+
static buildSwapTransactionWithoutTransferCoins(sdk: CetusClmmSDK, params: SwapParams): {
|
|
2294
2247
|
tx: Transaction;
|
|
2295
2248
|
coin_ab_s: TransactionObjectArgument[];
|
|
2296
2249
|
};
|
|
@@ -2300,7 +2253,7 @@ declare class SwapUtils {
|
|
|
2300
2253
|
* @param packageId
|
|
2301
2254
|
* @returns
|
|
2302
2255
|
*/
|
|
2303
|
-
static buildSwapTransactionWithoutTransferCoinArgs(sdk: CetusClmmSDK, tx: Transaction, params: SwapParams, sdk_options: SdkOptions, primary_coin_input_a:
|
|
2256
|
+
static buildSwapTransactionWithoutTransferCoinArgs(sdk: CetusClmmSDK, tx: Transaction, params: SwapParams, sdk_options: SdkOptions, primary_coin_input_a: TransactionObjectArgument, primary_coin_input_b: TransactionObjectArgument): {
|
|
2304
2257
|
tx: Transaction;
|
|
2305
2258
|
txRes: TransactionObjectArgument[];
|
|
2306
2259
|
};
|